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 <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-04-09 15:56:44 +02:00
parent 80a6f2f510
commit cb46a1163e

View file

@ -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.