[gnome-panel] struts: add panel_xutils_unset_strut



commit 3e96a811fcd5de1ba47ec09f6794e1c8a9253a60
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Jan 30 13:21:55 2020 +0200

    struts: add panel_xutils_unset_strut

 gnome-panel/panel-struts.c |  2 +-
 gnome-panel/panel-xutils.c | 24 ++++++++++++++++++++++++
 gnome-panel/panel-xutils.h |  2 ++
 3 files changed, 27 insertions(+), 1 deletion(-)
---
diff --git a/gnome-panel/panel-struts.c b/gnome-panel/panel-struts.c
index 2bc4bda1a..c00179943 100644
--- a/gnome-panel/panel-struts.c
+++ b/gnome-panel/panel-struts.c
@@ -322,7 +322,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_unset_strut (gtk_widget_get_window (GTK_WIDGET (toplevel)));
 }
 
 static inline int
diff --git a/gnome-panel/panel-xutils.c b/gnome-panel/panel-xutils.c
index 52ed9494f..cdf661f9a 100644
--- a/gnome-panel/panel-xutils.c
+++ b/gnome-panel/panel-xutils.c
@@ -107,6 +107,30 @@ panel_xutils_set_strut (GdkWindow        *gdk_window,
        gdk_x11_display_error_trap_pop_ignored (display);
 }
 
+void
+panel_xutils_unset_strut (GdkWindow *gdk_window)
+{
+       GdkDisplay *display;
+       Display *xdisplay;
+       Window xwindow;
+
+       display = gdk_window_get_display (gdk_window);
+       xdisplay = gdk_x11_display_get_xdisplay (display);
+       xwindow = gdk_x11_window_get_xid (gdk_window);
+
+       if (net_wm_strut == None)
+               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);
+
+       gdk_x11_display_error_trap_push (display);
+
+       XDeleteProperty (xdisplay, xwindow, net_wm_strut);
+       XDeleteProperty (xdisplay, xwindow, net_wm_strut_partial);
+
+       gdk_x11_display_error_trap_pop_ignored (display);
+}
+
 void
 panel_warp_pointer (GdkWindow *gdk_window,
                    int        x,
diff --git a/gnome-panel/panel-xutils.h b/gnome-panel/panel-xutils.h
index 08c9147f8..79fdce5d9 100644
--- a/gnome-panel/panel-xutils.h
+++ b/gnome-panel/panel-xutils.h
@@ -36,6 +36,8 @@ void panel_xutils_set_strut       (GdkWindow             *gdk_window,
                                   guint32                strut_start,
                                   guint32                strut_end);
 
+void panel_xutils_unset_strut     (GdkWindow             *gdk_window);
+
 void panel_warp_pointer           (GdkWindow             *gdk_window,
                                   int                    x,
                                   int                    y);


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