[gnome-battery-bench] SystemInfo: workaround for gdk monitor api bug



commit c0ad7bb89ae2bd4272851e8b5df170704bb15c76
Author: Christian Kellner <gicmo gnome org>
Date:   Thu Jun 29 18:25:37 2017 +0200

    SystemInfo: workaround for gdk monitor api bug
    
    Gtk+3 reports physical pixels on Wayland but application pixel on
    X11. See https://bugzilla.gnome.org/show_bug.cgi?id=783995

 src/system-info.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/system-info.c b/src/system-info.c
index 23121ab..02bff26 100644
--- a/src/system-info.c
+++ b/src/system-info.c
@@ -815,6 +815,17 @@ load_monitor_info(GbbSystemInfo *info,
     gdk_monitor_get_geometry(builtin, &geo);
     info->monitor_x = geo.width * info->monitor_scale;
     info->monitor_y = geo.height * info->monitor_scale;
+
+    /* Workaround for a gtk bug where on wayland the reported geo
+     * is actually device pixels (bgo 783995).
+     */
+#ifdef GDK_WINDOWING_WAYLAND
+    if (GDK_IS_WAYLAND_DISPLAY(display)) {
+        info->monitor_x /= info->monitor_scale;
+        info->monitor_y /= info->monitor_scale;
+    }
+#endif
+
 #else /* GDK version check */
     info->monitor_valid = FALSE;
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]