From a42762493ae4aeb7e892166d76c8bd5843b2be67 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 14 May 2016 14:20:08 +0200 Subject: [PATCH] xembed: Handle reparents correctly The Xembed specification states that the protocol ends by reparenting the embedded window elsewhere while unmapping the window can be done without ending the protocol. This commit makes us follow this part of the spec. Signed-off-by: Uli Schlachter --- event.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/event.c b/event.c index e4ca8fe55..6e2ea836c 100644 --- a/event.c +++ b/event.c @@ -770,14 +770,6 @@ event_handle_unmapnotify(xcb_unmap_notify_event_t *ev) if((c = client_getbywin(ev->window))) client_unmanage(c, true); - else - for(int i = 0; i < globalconf.embedded.len; i++) - if(globalconf.embedded.tab[i].win == ev->window) - { - xembed_window_array_take(&globalconf.embedded, i); - xcb_change_save_set(globalconf.connection, XCB_SET_MODE_DELETE, ev->window); - luaA_systray_invalidate(); - } } /** The randr screen change notify event handler. @@ -918,6 +910,16 @@ event_handle_reparentnotify(xcb_reparent_notify_event_t *ev) if (ev->parent != globalconf.screen->root) client_unmanage(c, true); } + else if (ev->parent != globalconf.systray.window) { + /* Embedded window moved elsewhere, end of embedding */ + for(int i = 0; i < globalconf.embedded.len; i++) + if(globalconf.embedded.tab[i].win == ev->window) + { + xembed_window_array_take(&globalconf.embedded, i); + xcb_change_save_set(globalconf.connection, XCB_SET_MODE_DELETE, ev->window); + luaA_systray_invalidate(); + } + } } static void