Update physical size on RRChangeNotifyEvent

Xrandr provides new physical sizes in millimeters when sending a
RRChangeNotifyEvent, either to preserve DPI when monitors are added, or
to change DPI when a DPI change was requested. Keep track of the changes
so that our DPI information is always fresh.
This commit is contained in:
Giuseppe Bilotta 2017-01-26 18:46:14 +01:00
parent 5a914b3496
commit c8bfbf5a3b
1 changed files with 4 additions and 0 deletions

View File

@ -816,10 +816,14 @@ event_handle_randr_screen_change_notify(xcb_randr_screen_change_notify_event_t *
/* 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->width_in_millimeters = ev->mheight;
globalconf.screen->height_in_pixels = ev->width;
globalconf.screen->height_in_millimeters = ev->mwidth;
} else {
globalconf.screen->width_in_pixels = ev->width;
globalconf.screen->width_in_millimeters = ev->mwidth;
globalconf.screen->height_in_pixels = ev->height;
globalconf.screen->height_in_millimeters = ev->mheight;;
}
globalconf.screen_need_refresh = true;