From c8bfbf5a3b2cf21308dff113d609f3a753bf771c Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 26 Jan 2017 18:46:14 +0100 Subject: [PATCH] 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. --- event.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/event.c b/event.c index 40e33d740..8e64c28db 100644 --- a/event.c +++ b/event.c @@ -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;