Update root window size on RandR notify

The code that claims to do what XRRUpdateConfiguration() would do was actually
wrong. That function does not send any requests to the X11 server, but it just
updates the local, in-memory state.

This commit makes us do the same: We update the size of the root window if it
changed. The code is directly inspired from the code in libXrandr.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-04-09 16:06:21 +02:00
parent cb46a1163e
commit 8a63c589a6

26
event.c
View file

@ -771,22 +771,18 @@ event_handle_unmapnotify(xcb_unmap_notify_event_t *ev)
static void static void
event_handle_randr_screen_change_notify(xcb_randr_screen_change_notify_event_t *ev) event_handle_randr_screen_change_notify(xcb_randr_screen_change_notify_event_t *ev)
{ {
/* Code of XRRUpdateConfiguration Xlib function ported to XCB /* Ignore events for other roots (do we get them at all?) */
* (only the code relevant to RRScreenChangeNotify) as the latter if (ev->root != globalconf.screen->root)
* doesn't provide this kind of function */ return;
if(ev->rotation & (XCB_RANDR_ROTATION_ROTATE_90 | XCB_RANDR_ROTATION_ROTATE_270))
xcb_randr_set_screen_size(globalconf.connection, ev->root, ev->height, ev->width,
ev->mheight, ev->mwidth);
else
xcb_randr_set_screen_size(globalconf.connection, ev->root, ev->width, ev->height,
ev->mwidth, ev->mheight);
/* XRRUpdateConfiguration also executes the following instruction /* Do (part of) what XRRUpdateConfiguration() would do (update our state) */
* but it's not useful because SubpixelOrder is not used at all at if (ev->rotation & (XCB_RANDR_ROTATION_ROTATE_90 | XCB_RANDR_ROTATION_ROTATE_270)) {
* the moment globalconf.screen->width_in_pixels = ev->height;
* globalconf.screen->height_in_pixels = ev->width;
* XRenderSetSubpixelOrder(dpy, snum, scevent->subpixel_order); } else {
*/ globalconf.screen->width_in_pixels = ev->width;
globalconf.screen->height_in_pixels = ev->height;
}
awesome_restart(); awesome_restart();
} }