From b33fb2a03a2a49b71820e337fc548663203537df Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Thu, 7 Jul 2016 21:38:34 +0200 Subject: [PATCH] Correctly deny ConfigureRequests for embedded windows (#990) Since commit 4daa6e8, we are denying resizes and moves for embedded windows (=tray icons). However, the Xembed spec says that the embedding client acts like a WM (as specified by ICCCM) to the embedded window. Thus, when denying a configure request, we have to inform the window by sending it a synthetic configure notify. Otherwise, GTK seems to sometimes not draw its tray icon. Fixes: https://github.com/awesomeWM/awesome/issues/986 Signed-off-by: Uli Schlachter --- event.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/event.c b/event.c index c4e2ea3d..ee1411f1 100644 --- a/event.c +++ b/event.c @@ -403,7 +403,31 @@ event_handle_configurerequest(xcb_configure_request_event_t *ev) { /* Ignore this so that systray icons cannot resize themselves. * We decide their size! + * However, Xembed says that we act like a WM to the embedded window and + * thus we have to send a synthetic configure notify informing the + * window that its configure request was denied. */ + xcb_get_geometry_cookie_t geom_cookie = + xcb_get_geometry_unchecked(globalconf.connection, ev->window); + xcb_translate_coordinates_cookie_t coords_cookie = + xcb_translate_coordinates_unchecked(globalconf.connection, + ev->window, globalconf.screen->root, 0, 0); + xcb_get_geometry_reply_t *geom = + xcb_get_geometry_reply(globalconf.connection, geom_cookie, NULL); + xcb_translate_coordinates_reply_t *coords = + xcb_translate_coordinates_reply(globalconf.connection, coords_cookie, NULL); + + if (geom && coords) + { + xwindow_configure(ev->window, + (area_t) { .x = coords->dst_x, + .y = coords->dst_y, + .width = geom->width, + .height = geom->height }, + 0); + } + p_delete(&geom); + p_delete(&coords); } else event_handle_configurerequest_configure_window(ev);