wayland: fix popup positioning when CSD is active. fix CSD stride
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
parent
1a75d6cea1
commit
a4d095cabf
5 changed files with 28 additions and 13 deletions
|
|
@ -428,6 +428,8 @@ struct _MwLLWayland {
|
||||||
|
|
||||||
MwBool dispatching_resize;
|
MwBool dispatching_resize;
|
||||||
|
|
||||||
|
MwBool is_toplevel_menu;
|
||||||
|
|
||||||
struct _MwLLWaylandShmBuffer framebuffer;
|
struct _MwLLWaylandShmBuffer framebuffer;
|
||||||
struct _MwLLWaylandShmBuffer backbuffer;
|
struct _MwLLWaylandShmBuffer backbuffer;
|
||||||
struct _MwLLWaylandShmBuffer cursor;
|
struct _MwLLWaylandShmBuffer cursor;
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,8 @@ struct _MwWidget {
|
||||||
|
|
||||||
int berserk;
|
int berserk;
|
||||||
long last_tick;
|
long last_tick;
|
||||||
|
|
||||||
|
MwBool is_menu;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ void MwLLWaylandBackbufferSetup(struct _MwLLWayland* wayland) {
|
||||||
}
|
}
|
||||||
MwLLWaylandBufferSetup(&wayland->backbuffer, w, h);
|
MwLLWaylandBufferSetup(&wayland->backbuffer, w, h);
|
||||||
|
|
||||||
MwLLCairoBackSetup(&wayland->cairo, wayland->backbuffer.buf_back, wayland->ww, wayland->wh);
|
MwLLCairoBackSetup(&wayland->cairo, wayland->backbuffer.buf_back, w, h);
|
||||||
|
|
||||||
memset(wayland->backbuffer.buf_back, 255, wayland->backbuffer.buf_size);
|
memset(wayland->backbuffer.buf_back, 255, wayland->backbuffer.buf_size);
|
||||||
if(wayland->configured)
|
if(wayland->configured)
|
||||||
|
|
|
||||||
|
|
@ -451,7 +451,6 @@ static void popup_configure(void* data,
|
||||||
int32_t height) {
|
int32_t height) {
|
||||||
MwLL self = data;
|
MwLL self = data;
|
||||||
(void)xdg_popup;
|
(void)xdg_popup;
|
||||||
|
|
||||||
self->wayland.x = x;
|
self->wayland.x = x;
|
||||||
self->wayland.y = y;
|
self->wayland.y = y;
|
||||||
self->wayland.ww = width;
|
self->wayland.ww = width;
|
||||||
|
|
@ -483,18 +482,23 @@ struct xdg_popup_listener popup_listener = {
|
||||||
/* Popup setup function */
|
/* Popup setup function */
|
||||||
static void setup_popup(MwLL r, int x, int y, MwLL parent) {
|
static void setup_popup(MwLL r, int x, int y, MwLL parent) {
|
||||||
MwLL topmost_parent = r->wayland.parent;
|
MwLL topmost_parent = r->wayland.parent;
|
||||||
|
r->wayland.type = MwLL_WAYLAND_POPUP;
|
||||||
|
r->wayland.x = x;
|
||||||
|
r->wayland.y = y;
|
||||||
|
r->wayland.popup = malloc(sizeof(struct _MwLLWaylandPopup));
|
||||||
|
|
||||||
r->wayland.type = MwLL_WAYLAND_POPUP;
|
if(parent) {
|
||||||
r->wayland.x = x;
|
MwWidget p = parent->common.user;
|
||||||
r->wayland.y = y;
|
while(topmost_parent->wayland.parent) {
|
||||||
r->wayland.popup = malloc(sizeof(struct _MwLLWaylandPopup));
|
topmost_parent = topmost_parent->wayland.parent;
|
||||||
|
}
|
||||||
|
|
||||||
while(topmost_parent->wayland.type != MwLL_WAYLAND_TOPLEVEL && topmost_parent->wayland.type != MwLL_WAYLAND_LAYER_SURFACE) {
|
if(!topmost_parent->wayland.has_decorations && topmost_parent->wayland.do_csd) {
|
||||||
topmost_parent = topmost_parent->wayland.parent;
|
if(p->is_menu) {
|
||||||
}
|
r->wayland.x += round((float)CSD_BORDER_FRAME_LEFT / 2.);
|
||||||
if(!topmost_parent->wayland.has_decorations && topmost_parent->wayland.do_csd) {
|
r->wayland.y += ceil((float)CSD_BORDER_FRAME_TOP / 2.);
|
||||||
r->wayland.x += ceil((float)CSD_BORDER_FRAME_LEFT / 2.);
|
}
|
||||||
r->wayland.y += ceil((float)CSD_BORDER_FRAME_TOP / 2.);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MwLLWaylandSetupCallbacks(&r->wayland);
|
MwLLWaylandSetupCallbacks(&r->wayland);
|
||||||
|
|
@ -525,7 +529,13 @@ static void setup_popup(MwLL r, int x, int y, MwLL parent) {
|
||||||
xdg_positioner_set_size(r->wayland.popup->xdg_positioner, r->wayland.ww, r->wayland.wh);
|
xdg_positioner_set_size(r->wayland.popup->xdg_positioner, r->wayland.ww, r->wayland.wh);
|
||||||
xdg_positioner_set_anchor_rect(
|
xdg_positioner_set_anchor_rect(
|
||||||
r->wayland.popup->xdg_positioner,
|
r->wayland.popup->xdg_positioner,
|
||||||
r->wayland.x, r->wayland.y, r->wayland.ww, r->wayland.wh);
|
topmost_parent->wayland.x, topmost_parent->wayland.y, r->wayland.ww, r->wayland.wh);
|
||||||
|
xdg_positioner_set_offset(
|
||||||
|
r->wayland.popup->xdg_positioner,
|
||||||
|
r->wayland.x, r->wayland.y);
|
||||||
|
|
||||||
|
xdg_positioner_set_anchor(r->wayland.popup->xdg_positioner, XDG_POSITIONER_ANCHOR_NONE);
|
||||||
|
xdg_positioner_set_gravity(r->wayland.popup->xdg_positioner, XDG_POSITIONER_GRAVITY_NONE);
|
||||||
|
|
||||||
r->wayland.xkb_keymap = topmost_parent->wayland.xkb_keymap;
|
r->wayland.xkb_keymap = topmost_parent->wayland.xkb_keymap;
|
||||||
r->wayland.xkb_state = topmost_parent->wayland.xkb_state;
|
r->wayland.xkb_state = topmost_parent->wayland.xkb_state;
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ static int wcreate(MwWidget handle) {
|
||||||
m->wsub = NULL;
|
m->wsub = NULL;
|
||||||
m->sub = NULL;
|
m->sub = NULL;
|
||||||
handle->internal = m;
|
handle->internal = m;
|
||||||
|
handle->is_menu = MwTRUE;
|
||||||
|
|
||||||
MwSetDefault(handle);
|
MwSetDefault(handle);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue