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



commit 672d130c9a39be889f53a20226cb7d9a13643b96
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 |  5 +++--
 gnome-panel/panel-xutils.c | 17 ++++++++++++++++-
 gnome-panel/panel-xutils.h |  3 ++-
 3 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/gnome-panel/panel-struts.c b/gnome-panel/panel-struts.c
index 2bc4bda1a..c7343f0d8 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
@@ -322,7 +323,7 @@ panel_struts_unset_window_hint (PanelToplevel *toplevel)
        if (!gtk_widget_get_realized (GTK_WIDGET (toplevel)))
                return;
 
-       panel_xutils_set_strut (gtk_widget_get_window (GTK_WIDGET (toplevel)), 0, 0, 0, 0);
+       panel_xutils_set_strut (gtk_widget_get_window (GTK_WIDGET (toplevel)), 0, 0, 0, 0, NULL);
 }
 
 static inline int
diff --git a/gnome-panel/panel-xutils.c b/gnome-panel/panel-xutils.c
index 52ed9494f..a8fd86d5e 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,6 +102,13 @@ panel_xutils_set_strut (GdkWindow        *gdk_window,
                break;
        }
 
+       if (rect != NULL) {
+               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,
@@ -104,6 +116,9 @@ panel_xutils_set_strut (GdkWindow        *gdk_window,
        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);
 }
 
diff --git a/gnome-panel/panel-xutils.h b/gnome-panel/panel-xutils.h
index 08c9147f8..22fe397ae 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_warp_pointer           (GdkWindow             *gdk_window,
                                   int                    x,


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