From 42c7798ccd4d488a4a927af62f1b8b4e404e9dd4 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Tue, 6 Aug 2019 09:59:59 -0400 Subject: [PATCH 1/5] Expose window scaling factor --- libwnck/private.h | 2 ++ libwnck/util.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/libwnck/private.h b/libwnck/private.h index f1a4af2..199d2b4 100644 --- a/libwnck/private.h +++ b/libwnck/private.h @@ -43,6 +43,8 @@ WnckHandle *_wnck_get_handle (void); WnckClientType _wnck_get_client_type (void); +int _wnck_get_window_scaling_factor (void); + gsize _wnck_get_default_icon_size (void); gsize _wnck_get_default_mini_icon_size (void); diff --git a/libwnck/util.c b/libwnck/util.c index b3d8750..d51ee05 100644 --- a/libwnck/util.c +++ b/libwnck/util.c @@ -680,6 +680,27 @@ _wnck_get_client_type (void) return _wnck_handle_get_client_type (_wnck_get_handle ()); } +/** + * _wnck_get_window_scaling_factor: + * + * Retrieves the internal scale factor that maps from window coordinates to the + * actual device pixels. On traditional systems this is 1, on high density + * outputs, it can be a higher value (typically 2). + */ +int +_wnck_get_window_scaling_factor (void) +{ + GdkScreen *screen; + GValue value = G_VALUE_INIT; + + g_value_init (&value, G_TYPE_INT); + + screen = gdk_screen_get_default (); + if (gdk_screen_get_setting (screen, "gdk-window-scaling-factor", &value)) + return g_value_get_int (&value); + return 1; +} + static gsize default_icon_size = WNCK_DEFAULT_ICON_SIZE; /** -- 2.31.1