diff --git a/event.c b/event.c index e4ca8fe5..6e2ea836 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