[gtk/gtk-3-24: 3/4] GdkWin32: Initialize _gdk_offset_x / _gdk_offset_x to unscaled values
- From: Luca Bacci <lbacci src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 3/4] GdkWin32: Initialize _gdk_offset_x / _gdk_offset_x to unscaled values
- Date: Mon, 18 Oct 2021 11:36:48 +0000 (UTC)
commit 378ed797a466fd3df5097d6393ca83afc7634d8b
Author: Luca Bacci <luca bacci982 gmail com>
Date: Thu Sep 23 15:21:32 2021 +0200
GdkWin32: Initialize _gdk_offset_x / _gdk_offset_x to unscaled values
Note that gdk_monitor_get_geometry () returns DPI-scaled values,
while the screen offset should be unscaled, as scales are properties
of indivdual monitors.
gdk/win32/gdkmonitor-win32.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gdk/win32/gdkmonitor-win32.c b/gdk/win32/gdkmonitor-win32.c
index e5bd520e81..ebd0c75fb8 100644
--- a/gdk/win32/gdkmonitor-win32.c
+++ b/gdk/win32/gdkmonitor-win32.c
@@ -888,13 +888,15 @@ _gdk_win32_display_get_monitor_list (GdkWin32Display *win32_display)
{
GdkWin32Monitor *m;
GdkRectangle rect;
+ int scale;
m = g_ptr_array_index (data.monitors, i);
+ gdk_monitor_get_geometry (GDK_MONITOR (m), &rect);
+ scale = gdk_monitor_get_scale_factor (GDK_MONITOR (m));
/* Calculate offset */
- gdk_monitor_get_geometry (GDK_MONITOR (m), &rect);
- _gdk_offset_x = MAX (_gdk_offset_x, -rect.x);
- _gdk_offset_y = MAX (_gdk_offset_y, -rect.y);
+ _gdk_offset_x = MAX (_gdk_offset_x, -rect.x * scale);
+ _gdk_offset_y = MAX (_gdk_offset_y, -rect.y * scale);
}
GDK_NOTE (MISC, g_print ("Multi-monitor offset: (%d,%d)\n",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]