summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <[email protected]>2021-12-16 13:18:12 +0100
committerraveit65 <[email protected]>2021-12-19 19:37:38 +0100
commit8a380c3e9af91a726b8ed45ccf9ef64911540595 (patch)
tree1b5818dc36a6fe9e030e3479eb243f05af9ce25a
parentede1f04954c5b64dbdaea7a75aecc1153cc6e9b3 (diff)
downloadmate-panel-8a380c3e9af91a726b8ed45ccf9ef64911540595.tar.bz2
mate-panel-8a380c3e9af91a726b8ed45ccf9ef64911540595.tar.xz
struts: add support for _GNOME_WM_STRUT_AREA
In addition to existing properties set also new _GNOME_WM_STRUT_AREA property that allows creating struts between monitors. https://mail.gnome.org/archives/wm-spec-list/2018-December/msg00000.html https://gitlab.freedesktop.org/xdg/xdg-specs/merge_requests/22 https://gitlab.gnome.org/GNOME/gnome-panel/merge_requests/3 Upscale area strut because of 73e025b0eab94fe06cdafee61c347fb5fe6f7545
-rw-r--r--mate-panel/panel-struts.c4
-rw-r--r--mate-panel/panel-xutils.c33
-rw-r--r--mate-panel/panel-xutils.h4
3 files changed, 35 insertions, 6 deletions
diff --git a/mate-panel/panel-struts.c b/mate-panel/panel-struts.c
index b24707ca..00968ab7 100644
--- a/mate-panel/panel-struts.c
+++ b/mate-panel/panel-struts.c
@@ -320,7 +320,9 @@ panel_struts_set_window_hint (PanelToplevel *toplevel)
strut->orientation,
strut_size,
strut->allocated_strut_start * scale,
- strut->allocated_strut_end * scale);
+ strut->allocated_strut_end * scale,
+ &strut->allocated_geometry,
+ scale);
}
void
diff --git a/mate-panel/panel-xutils.c b/mate-panel/panel-xutils.c
index 4d8b32a2..eb887e71 100644
--- a/mate-panel/panel-xutils.c
+++ b/mate-panel/panel-xutils.c
@@ -39,6 +39,7 @@
static Atom net_wm_strut = None;
static Atom net_wm_strut_partial = None;
+static Atom gnome_wm_strut_area = None;
enum {
STRUT_LEFT = 0,
@@ -55,16 +56,27 @@ enum {
STRUT_BOTTOM_END = 11
};
+enum {
+ STRUT_AREA_X = 0,
+ STRUT_AREA_Y,
+ STRUT_AREA_WIDTH,
+ STRUT_AREA_HEIGHT,
+ STRUT_AREA_LAST
+};
+
void
panel_xutils_set_strut (GdkWindow *gdk_window,
PanelOrientation orientation,
guint32 strut,
guint32 strut_start,
- guint32 strut_end)
+ guint32 strut_end,
+ GdkRectangle *rect,
+ int scale)
{
- Display *xdisplay;
- Window window;
- gulong struts [12] = { 0, };
+ Display *xdisplay;
+ Window window;
+ gulong struts [12] = { 0, };
+ gulong area [STRUT_AREA_LAST];
GdkDisplay *display;
g_return_if_fail (GDK_IS_WINDOW (gdk_window));
@@ -77,6 +89,8 @@ panel_xutils_set_strut (GdkWindow *gdk_window,
net_wm_strut = XInternAtom (xdisplay, "_NET_WM_STRUT", False);
if (net_wm_strut_partial == None)
net_wm_strut_partial = XInternAtom (xdisplay, "_NET_WM_STRUT_PARTIAL", False);
+ if (gnome_wm_strut_area == None)
+ gnome_wm_strut_area = XInternAtom (xdisplay, "_GNOME_WM_STRUT_AREA", False);
switch (orientation) {
case PANEL_ORIENTATION_LEFT:
@@ -101,6 +115,11 @@ panel_xutils_set_strut (GdkWindow *gdk_window,
break;
}
+ area [STRUT_AREA_X] = rect->x * scale;
+ area [STRUT_AREA_Y] = rect->y * scale;
+ area [STRUT_AREA_WIDTH] = rect->width * scale;
+ area [STRUT_AREA_HEIGHT] = rect->height * scale;
+
display = gdk_window_get_display (gdk_window);
gdk_x11_display_error_trap_push (display);
XChangeProperty (xdisplay, window, net_wm_strut,
@@ -109,6 +128,9 @@ panel_xutils_set_strut (GdkWindow *gdk_window,
XChangeProperty (xdisplay, window, net_wm_strut_partial,
XA_CARDINAL, 32, PropModeReplace,
(guchar *) &struts, 12);
+ XChangeProperty (xdisplay, window, gnome_wm_strut_area,
+ XA_CARDINAL, 32, PropModeReplace,
+ (guchar *) &area, 4);
gdk_x11_display_error_trap_pop_ignored (display);
}
@@ -127,11 +149,14 @@ panel_xutils_unset_strut (GdkWindow *gdk_window)
net_wm_strut = XInternAtom (xdisplay, "_NET_WM_STRUT", False);
if (net_wm_strut_partial == None)
net_wm_strut_partial = XInternAtom (xdisplay, "_NET_WM_STRUT_PARTIAL", False);
+ if (gnome_wm_strut_area == None)
+ gnome_wm_strut_area = XInternAtom (xdisplay, "_GNOME_WM_STRUT_AREA", False);
gdk_x11_display_error_trap_push (display);
XDeleteProperty (xdisplay, xwindow, net_wm_strut);
XDeleteProperty (xdisplay, xwindow, net_wm_strut_partial);
+ XDeleteProperty (xdisplay, xwindow, gnome_wm_strut_area);
gdk_x11_display_error_trap_pop_ignored (display);
}
diff --git a/mate-panel/panel-xutils.h b/mate-panel/panel-xutils.h
index 8310c052..988153d3 100644
--- a/mate-panel/panel-xutils.h
+++ b/mate-panel/panel-xutils.h
@@ -48,7 +48,9 @@ void panel_xutils_set_strut (GdkWindow *gdk_window,
PanelOrientation orientation,
guint32 strut,
guint32 strut_start,
- guint32 strut_end);
+ guint32 strut_end,
+ GdkRectangle *rect,
+ int scale);
void panel_xutils_unset_strut (GdkWindow *gdk_window);