This is an automated email from the git hooks/post-receive script. o l i v i e r p u s h e d a c o m m i t t o b r a n c h m a s t e r in repository xfce/xfwm4.
commit 0a82935b7bb3bfc9525bf6b38a20abba857f4dde Author: Viktor Odintsev <nine...@xfce.org> Date: Thu May 30 20:59:26 2019 +0300 Use device geometry for primary monitor `xfwm_get_primary_monitor_geometry` returns logical dimensions instead of device dimensions, which leads to incorrect `_NET_WORKAREA` calculation. --- common/xfwm-common.c | 47 +++++++++++++++++++++++++++++++++-------------- common/xfwm-common.h | 3 ++- src/placement.c | 2 +- src/workspaces.c | 2 +- 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/common/xfwm-common.c b/common/xfwm-common.c index 740451a..f187e42 100644 --- a/common/xfwm-common.c +++ b/common/xfwm-common.c @@ -75,52 +75,71 @@ xfwm_get_screen_dimensions (gint *width, gint *height) +static void +xfwm_geometry_convert_to_device_pixels (GdkRectangle *geometry, + gint scale) +{ + if (geometry != NULL) + { + geometry->x *= scale; + geometry->y *= scale; + geometry->width *= scale; + geometry->height *= scale; + } +} + + + void xfwm_get_monitor_geometry (GdkScreen *screen, gint monitor_num, GdkRectangle *geometry, gboolean scaled) { + gint scale; #if GTK_CHECK_VERSION(3, 22, 0) GdkDisplay *display; GdkMonitor *monitor; display = gdk_screen_get_display (screen); monitor = gdk_display_get_monitor (display, monitor_num); + scale = gdk_monitor_get_scale_factor (monitor); gdk_monitor_get_geometry (monitor, geometry); - - /* Convert to device pixels */ - if (scaled) - { - int scale = gdk_monitor_get_scale_factor (monitor); - geometry->x *= scale; - geometry->y *= scale; - geometry->width *= scale; - geometry->height *= scale; - } #else + scale = gdk_screen_get_monitor_scale_factor (screen, monitor_num); gdk_screen_get_monitor_geometry (screen, monitor_num, geometry); #endif + + if (scaled && scale != 1) + xfwm_geometry_convert_to_device_pixels (geometry, scale); } void xfwm_get_primary_monitor_geometry (GdkScreen *screen, - GdkRectangle *geometry) + GdkRectangle *geometry, + gboolean scaled) { + gint scale; #if GTK_CHECK_VERSION(3, 22, 0) GdkDisplay *display; GdkMonitor *monitor; display = gdk_screen_get_display (screen); monitor = gdk_display_get_primary_monitor (display); + scale = gdk_monitor_get_scale_factor (monitor); gdk_monitor_get_geometry (monitor, geometry); #else - gdk_screen_get_monitor_geometry (screen, - gdk_screen_get_primary_monitor (screen), - geometry); + gint monitor_num; + + monitor_num = gdk_screen_get_primary_monitor (screen); + scale = gdk_screen_get_monitor_scale_factor (screen, monitor_num); + gdk_screen_get_monitor_geometry (screen, monitor_num, geometry); #endif + + if (scaled && scale != 1) + xfwm_geometry_convert_to_device_pixels (geometry, scale); } diff --git a/common/xfwm-common.h b/common/xfwm-common.h index 667caff..693ad84 100644 --- a/common/xfwm-common.h +++ b/common/xfwm-common.h @@ -35,7 +35,8 @@ void xfwm_get_monitor_geometry (GdkScreen *screen, gboolean scaled); void xfwm_get_primary_monitor_geometry (GdkScreen *screen, - GdkRectangle *geometry); + GdkRectangle *geometry, + gboolean scaled); gint xfwm_get_primary_refresh_rate (GdkScreen *screen); diff --git a/src/placement.c b/src/placement.c index 3fb1294..c947597 100644 --- a/src/placement.c +++ b/src/placement.c @@ -773,7 +773,7 @@ clientInitPosition (Client * c) position = (c->size->flags & (PPosition | USPosition)); n_monitors = myScreenGetNumMonitors (c->screen_info); - xfwm_get_primary_monitor_geometry (screen_info->gscr, &rect); + xfwm_get_primary_monitor_geometry (screen_info->gscr, &rect, TRUE); is_transient = clientIsTransient (c); if (position || is_transient || (c->type & (WINDOW_TYPE_DONT_PLACE | WINDOW_TYPE_DIALOG))) diff --git a/src/workspaces.c b/src/workspaces.c index d8aa4ed..6981845 100644 --- a/src/workspaces.c +++ b/src/workspaces.c @@ -548,7 +548,7 @@ workspaceUpdateArea (ScreenInfo *screen_info) screen_info->margins[i] = screen_info->gnome_margins[i]; } - xfwm_get_primary_monitor_geometry (screen_info->gscr, &workarea); + xfwm_get_primary_monitor_geometry (screen_info->gscr, &workarea, TRUE); for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, i++) { -- To stop receiving notification emails like this one, please contact the administrator of this repository. _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits