[gnome-panel/wip/muktupavels/work-areas: 116/116] struts: add support for _NET_WM_STRUT_AREA



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

    struts: add support for _NET_WM_STRUT_AREA

 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..9e2ccc841 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 net_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 (net_wm_strut_area == None)
+               net_wm_strut_area = XInternAtom (xdisplay, "_NET_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, net_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]