diff --git a/include/Mw/LowLevel/Wayland.h b/include/Mw/LowLevel/Wayland.h index e9643230..8d47b510 100644 --- a/include/Mw/LowLevel/Wayland.h +++ b/include/Mw/LowLevel/Wayland.h @@ -329,7 +329,7 @@ struct _MwLLWaylandSublevel { MwLL parent; - struct xdg_surface* xdg_surface; + struct xdg_surface* parent_xdg_surface; }; struct _MwLLWaylandPopup { diff --git a/src/backend/wayland.c b/src/backend/wayland.c index c626900b..31d83e4b 100644 --- a/src/backend/wayland.c +++ b/src/backend/wayland.c @@ -1512,6 +1512,12 @@ static void setup_sublevel(MwLL parent, MwLL r, int x, int y) { r->wayland.sublevel = malloc(sizeof(struct _MwLLWaylandSublevel)); r->wayland.sublevel->parent = parent; + if(parent->wayland.type == MWLL_WAYLAND_TOPLEVEL) { + r->wayland.sublevel->parent_xdg_surface = parent->wayland.toplevel->xdg_surface; + } else { + r->wayland.sublevel->parent_xdg_surface = parent->wayland.sublevel->parent_xdg_surface; + } + r->wayland.type = MWLL_WAYLAND_SUBLEVEL; r->wayland.display = parent->wayland.display; @@ -1530,10 +1536,6 @@ static void setup_sublevel(MwLL parent, MwLL r, int x, int y) { r->wayland.framebuffer.surface = wl_compositor_create_surface(compositor); - if(WAYLAND_GET_INTERFACE(r->wayland, xdg_wm_base)) - r->wayland.sublevel->xdg_surface = - xdg_wm_base_get_xdg_surface(WAYLAND_GET_INTERFACE(r->wayland, xdg_wm_base)->context, r->wayland.framebuffer.surface); - r->wayland.sublevel->subsurface = wl_subcompositor_get_subsurface(r->wayland.sublevel->subcompositor, r->wayland.framebuffer.surface, parent_surface); wl_subsurface_set_desync(r->wayland.sublevel->subsurface); @@ -2307,14 +2309,15 @@ static void MwLLDetachImpl(MwLL handle, MwPoint* point) { } static void MwLLShowImpl(MwLL handle, int show) { - /* Some guy on a mailing list said that "abusing" wl_surface_attach for this purpose is bad? This is documented behavior so please I beg of you let me know if there's a compositor that actually has a problem with this. */ - if(handle->wayland.framebuffer.surface) { - wl_surface_attach(handle->wayland.framebuffer.surface, show ? handle->wayland.framebuffer.shm_buffer : NULL, 0, 0); - wl_surface_commit(handle->wayland.framebuffer.surface); - } - if(handle->wayland.backbuffer.surface) { - wl_surface_attach(handle->wayland.backbuffer.surface, show ? handle->wayland.backbuffer.shm_buffer : NULL, 0, 0); - wl_surface_commit(handle->wayland.backbuffer.surface); + (void)show; + switch(handle->wayland.type) { + case MWLL_WAYLAND_UNKNOWN: + case MWLL_WAYLAND_TOPLEVEL: + break; + case MWLL_WAYLAND_SUBLEVEL: + break; + case MWLL_WAYLAND_POPUP: + break; } } @@ -2439,9 +2442,8 @@ static void MwLLEndStateChangeImpl(MwLL handle) { int i; for(i = 0; i < arrlen(w->children); i++) { if(w->children[i]->lowlevel->wayland.type == MWLL_WAYLAND_SUBLEVEL) { - MwLL child = w->children[i]->lowlevel; - child->wayland.sublevel->xdg_surface = - xdg_wm_base_get_xdg_surface(WAYLAND_GET_INTERFACE(handle->wayland, xdg_wm_base)->context, handle->wayland.framebuffer.surface); + MwLL child = w->children[i]->lowlevel; + child->wayland.sublevel->parent_xdg_surface = handle->wayland.popup->xdg_surface; wl_subsurface_destroy(child->wayland.sublevel->subsurface); wl_flush(handle);