From cb46a1163e904d37deee0e069cc81320ff34ea37 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 9 Apr 2016 15:56:44 +0200 Subject: [PATCH] Update root window size on ConfigureNotify This commit copies part of what XRRUpdateConfiguration() would do. When the root window is resized, we update the information that the X11 server sent to us when we connected to it to contain the new size of the root window. This is 50% ugly, but having our own copy of the root window size would be 51% ugly, so it's better to write to the XCB-owned structure. Right now this is all dead code anyway, because we restart anyway, but since the goal is to get rid of that restart, this is a step in the right direction (e.g. root.size() will automatically return the new size). Signed-off-by: Uli Schlachter --- event.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/event.c b/event.c index f7cdb0af..2809916f 100644 --- a/event.c +++ b/event.c @@ -397,13 +397,19 @@ event_handle_configurerequest(xcb_configure_request_event_t *ev) static void event_handle_configurenotify(xcb_configure_notify_event_t *ev) { - const xcb_screen_t *screen = globalconf.screen; + xcb_screen_t *screen = globalconf.screen; if(ev->window == screen->root && (ev->width != screen->width_in_pixels || ev->height != screen->height_in_pixels)) /* it's not that we panic, but restart */ awesome_restart(); + + /* Copy what XRRUpdateConfiguration() would do: Update the configuration */ + if(ev->window == screen->root) { + screen->width_in_pixels = ev->width; + screen->height_in_pixels = ev->height; + } } /** The destroy notify event handler.