diff options
author | Jonas Zetterberg <jozz@jozz.se> | 2018-12-01 12:53:46 +0100 |
---|---|---|
committer | Olivier Fourdan <fourdan@xfce.org> | 2018-12-09 17:11:50 +0100 |
commit | 07773e608413a370932c5f2d59ed0b656240970a (patch) | |
tree | b867a1a8c72a26bd69995e81428df287b58564e2 /common | |
parent | 7d8ad718466e59865755578bdf4192cd21abc221 (diff) | |
download | xfwm4-07773e608413a370932c5f2d59ed0b656240970a.tar.gz |
tabwin: Place tabwin in center when display is scaled
Bug: 14931
On scaled display the tabwin is using unscaled window coordinates to calculate
its position. Let the callert choose scaled or unscaled display size and use
scaled in tabwin.
fixes: 9d5ac6a4 Introduce xfwm-common static library
Signed-off-by: Jonas Zetterberg <jozz@jozz.se>
Diffstat (limited to 'common')
-rw-r--r-- | common/xfwm-common.c | 17 | ||||
-rw-r--r-- | common/xfwm-common.h | 3 |
2 files changed, 12 insertions, 8 deletions
diff --git a/common/xfwm-common.c b/common/xfwm-common.c index a991b3551..04f45e0dc 100644 --- a/common/xfwm-common.c +++ b/common/xfwm-common.c @@ -78,23 +78,26 @@ xfwm_get_screen_dimensions (gint *width, gint *height) void xfwm_get_monitor_geometry (GdkScreen *screen, gint monitor_num, - GdkRectangle *geometry) + GdkRectangle *geometry, + gboolean scaled) { #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; + if (scaled) + { + 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, monitor_num, geometry); #endif diff --git a/common/xfwm-common.h b/common/xfwm-common.h index e2e8c97b4..3cd2b6279 100644 --- a/common/xfwm-common.h +++ b/common/xfwm-common.h @@ -31,7 +31,8 @@ void xfwm_get_screen_dimensions (gint *width, void xfwm_get_monitor_geometry (GdkScreen *screen, gint monitor_num, - GdkRectangle *geometry); + GdkRectangle *geometry, + gboolean scaled); void xfwm_get_primary_monitor_geometry (GdkScreen *screen, GdkRectangle *geometry); |