[gnome-panel/wip/muktupavels/work-areas: 2/2] struts: add support for _GNOME_WM_STRUT_AREA



commit b505fdecc9081fd4658a52a2911b402391b7a148
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Jun 16 22:46:16 2018 +0300

    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

 gnome-panel/panel-struts.c |  3 ++-
 gnome-panel/panel-xutils.c | 20 +++++++++++++++++++-
 gnome-panel/panel-xutils.h |  3 ++-
 3 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/gnome-panel/panel-struts.c b/gnome-panel/panel-struts.c
index c00179943..c3c898e43 100644
--- a/gnome-panel/panel-struts.c
+++ b/gnome-panel/panel-struts.c
@@ -313,7 +313,8 @@ panel_struts_set_window_hint (PanelToplevel *toplevel)
                                strut->orientation,
                                strut_size,
                                strut->allocated_strut_start,
-                               strut->allocated_strut_end);
+                               strut->allocated_strut_end,
+                               &strut->allocated_geometry);
 }
 
 void
diff --git a/gnome-panel/panel-xutils.c b/gnome-panel/panel-xutils.c
index cdf661f9a..c1257a18b 100644
--- a/gnome-panel/panel-xutils.c
+++ b/gnome-panel/panel-xutils.c
@@ -32,6 +32,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,
@@ -53,12 +54,14 @@ panel_xutils_set_strut (GdkWindow        *gdk_window,
                        PanelOrientation  orientation,
                        guint32           strut,
                        guint32           strut_start,
-                       guint32           strut_end)
+                       guint32           strut_end,
+                       GdkRectangle     *rect)
 {
        GdkDisplay *display;
        Display *xdisplay;
        Window xwindow;
        gulong struts [12] = { 0, };
+       gulong area[4] = { 0, };
 
        g_return_if_fail (GDK_IS_WINDOW (gdk_window));
 
@@ -70,6 +73,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:
@@ -97,13 +102,23 @@ panel_xutils_set_strut (GdkWindow        *gdk_window,
                break;
        }
 
+       area[0] = rect->x;
+       area[1] = rect->y;
+       area[2] = rect->width;
+       area[3] = rect->height;
+
        gdk_x11_display_error_trap_push (display);
+
        XChangeProperty (xdisplay, xwindow, net_wm_strut,
                         XA_CARDINAL, 32, PropModeReplace,
                         (guchar *) &struts, 4);
        XChangeProperty (xdisplay, xwindow, net_wm_strut_partial,
                         XA_CARDINAL, 32, PropModeReplace,
                         (guchar *) &struts, 12);
+       XChangeProperty (xdisplay, xwindow, gnome_wm_strut_area,
+                        XA_CARDINAL, 32, PropModeReplace,
+                        (guchar *) &area, 4);
+
        gdk_x11_display_error_trap_pop_ignored (display);
 }
 
@@ -122,11 +137,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/gnome-panel/panel-xutils.h b/gnome-panel/panel-xutils.h
index 79fdce5d9..8859eb449 100644
--- a/gnome-panel/panel-xutils.h
+++ b/gnome-panel/panel-xutils.h
@@ -34,7 +34,8 @@ void panel_xutils_set_strut       (GdkWindow             *gdk_window,
                                   PanelOrientation       orientation,
                                   guint32                strut,
                                   guint32                strut_start,
-                                  guint32                strut_end);
+                                  guint32                strut_end,
+                                  GdkRectangle          *rect);
 
 void panel_xutils_unset_strut     (GdkWindow             *gdk_window);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]