From 6fc7c30adf9df52689d8e7a4bd64f74bebbf707f Mon Sep 17 00:00:00 2001 From: Alexander Sosedkin Date: Tue, 5 Feb 2019 12:52:31 +0700 Subject: [PATCH] common: Scale gdk_monitor_get_geometry results Bug: 15117 Window scaling limits menus and maximized windows to top-left quadrant. This patch applies a scaling multiplier to the remaining gdk_monitor_get_geometry invocation results. Signed-off-by: Alexander Sosedkin --- common/xfwm-common.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/common/xfwm-common.c b/common/xfwm-common.c index 04f45e0d..f2c8267f 100644 --- a/common/xfwm-common.c +++ b/common/xfwm-common.c @@ -65,11 +65,17 @@ xfwm_get_screen_dimensions (gint *width, gint *height) *width = geometry.width; if (height != NULL) *height = geometry.height; + + /* Convert to device pixels */ + int scale = gdk_monitor_get_scale_factor (monitor); + *width *= scale; + *width *= scale; #else if (width != NULL) *width = gdk_screen_width (); if (height != NULL) *height = gdk_screen_height (); + #endif } @@ -116,6 +122,13 @@ xfwm_get_primary_monitor_geometry (GdkScreen *screen, display = gdk_screen_get_display (screen); monitor = gdk_display_get_primary_monitor (display); gdk_monitor_get_geometry (monitor, geometry); + + /* Convert to device pixels */ + int 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, gdk_screen_get_primary_monitor (screen), -- 2.20.1