[gnome-panel/wip/muktupavels/hidpi: 5/6] xutils: make sure struts are in device pixels
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/wip/muktupavels/hidpi: 5/6] xutils: make sure struts are in device pixels
- Date: Thu, 22 Apr 2021 18:19:56 +0000 (UTC)
commit e85b2d2138976ba2c315ab438a50644e795a3fb6
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Apr 22 20:16:03 2021 +0300
xutils: make sure struts are in device pixels
gnome-panel/panel-xutils.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/gnome-panel/panel-xutils.c b/gnome-panel/panel-xutils.c
index c1257a18b..5a185df3d 100644
--- a/gnome-panel/panel-xutils.c
+++ b/gnome-panel/panel-xutils.c
@@ -23,6 +23,7 @@
#include "config.h"
#include "panel-xutils.h"
+#include "panel-util.h"
#include <glib.h>
#include <gdk/gdk.h>
@@ -60,6 +61,7 @@ panel_xutils_set_strut (GdkWindow *gdk_window,
GdkDisplay *display;
Display *xdisplay;
Window xwindow;
+ int window_scale;
gulong struts [12] = { 0, };
gulong area[4] = { 0, };
@@ -76,6 +78,12 @@ panel_xutils_set_strut (GdkWindow *gdk_window,
if (gnome_wm_strut_area == None)
gnome_wm_strut_area = XInternAtom (xdisplay, "_GNOME_WM_STRUT_AREA", False);
+ window_scale = panel_util_get_window_scaling_factor ();
+
+ strut *= window_scale;
+ strut_start *= window_scale;
+ strut_end *= window_scale;
+
switch (orientation) {
case PANEL_ORIENTATION_LEFT:
struts [STRUT_LEFT] = strut;
@@ -102,10 +110,10 @@ panel_xutils_set_strut (GdkWindow *gdk_window,
break;
}
- area[0] = rect->x;
- area[1] = rect->y;
- area[2] = rect->width;
- area[3] = rect->height;
+ area[0] = rect->x * window_scale;
+ area[1] = rect->y * window_scale;
+ area[2] = rect->width * window_scale;
+ area[3] = rect->height * window_scale;
gdk_x11_display_error_trap_push (display);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]