mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
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:
parent
cb46a1163e
commit
8a63c589a6
1 changed files with 11 additions and 15 deletions
26
event.c
26
event.c
|
@ -771,22 +771,18 @@ event_handle_unmapnotify(xcb_unmap_notify_event_t *ev)
|
|||
static void
|
||||
event_handle_randr_screen_change_notify(xcb_randr_screen_change_notify_event_t *ev)
|
||||
{
|
||||
/* Code of XRRUpdateConfiguration Xlib function ported to XCB
|
||||
* (only the code relevant to RRScreenChangeNotify) as the latter
|
||||
* doesn't provide this kind of function */
|
||||
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);
|
||||
/* Ignore events for other roots (do we get them at all?) */
|
||||
if (ev->root != globalconf.screen->root)
|
||||
return;
|
||||
|
||||
/* XRRUpdateConfiguration also executes the following instruction
|
||||
* but it's not useful because SubpixelOrder is not used at all at
|
||||
* the moment
|
||||
*
|
||||
* XRenderSetSubpixelOrder(dpy, snum, scevent->subpixel_order);
|
||||
*/
|
||||
/* Do (part of) what XRRUpdateConfiguration() would do (update our state) */
|
||||
if (ev->rotation & (XCB_RANDR_ROTATION_ROTATE_90 | XCB_RANDR_ROTATION_ROTATE_270)) {
|
||||
globalconf.screen->width_in_pixels = ev->height;
|
||||
globalconf.screen->height_in_pixels = ev->width;
|
||||
} else {
|
||||
globalconf.screen->width_in_pixels = ev->width;
|
||||
globalconf.screen->height_in_pixels = ev->height;
|
||||
}
|
||||
|
||||
awesome_restart();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue