summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorOlivier Fourdan <fourdan@xfce.org>2018-07-31 11:29:05 +0200
committerOlivier Fourdan <fourdan@xfce.org>2018-07-31 11:29:05 +0200
commitbe929b2ad13a9a8ccd94ca3041b1af9d287b4a8f (patch)
tree1dc5890d38584b7159f56ecc45f3766670956e22 /common
parent85c8a57a1fcdc3510e38c93071319ebe3cfcdbeb (diff)
downloadxfwm4-be929b2ad13a9a8ccd94ca3041b1af9d287b4a8f.tar.gz
common: Convert monitor geometry to device geometry
Bug: 14566 `xfwm_get_monitor_geometry()` uses `gdk_monitor_get_geometry()` which returns the monitor geometry ion logical coordinates, not device coordinates. Apply the scale back to the geometry to get the device pixels. Signed-off-by: Olivier Fourdan <fourdan@xfce.org>
Diffstat (limited to 'common')
-rw-r--r--common/xfwm-common.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/xfwm-common.c b/common/xfwm-common.c
index fd698465e..a991b3551 100644
--- a/common/xfwm-common.c
+++ b/common/xfwm-common.c
@@ -83,10 +83,18 @@ xfwm_get_monitor_geometry (GdkScreen *screen,
#if GTK_CHECK_VERSION(3, 22, 0)
GdkDisplay *display;
GdkMonitor *monitor;
+ int scale;
display = gdk_screen_get_display (screen);
monitor = gdk_display_get_monitor (display, monitor_num);
gdk_monitor_get_geometry (monitor, geometry);
+
+ /* Convert to device pixels */
+ scale = gdk_monitor_get_scale_factor (monitor);
+ geometry->x *= scale;
+ geometry->y *= scale;
+ geometry->width *= scale;
+ geometry->height *= scale;
#else
gdk_screen_get_monitor_geometry (screen, monitor_num, geometry);
#endif