[Xfce4-commits] <xfce4-panel:devel> Add (hidden) xfconf property to disable struts for a panel.

Nick Schermer noreply at xfce.org
Sat Nov 28 21:02:07 CET 2009


Updating branch refs/heads/devel
         to d2011b8929ec539170a88041afe787b2ac6d2979 (commit)
       from aad85f6160c71652a38ddd09c7233c02e2890c86 (commit)

commit d2011b8929ec539170a88041afe787b2ac6d2979
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Nov 28 19:08:53 2009 +0100

    Add (hidden) xfconf property to disable struts for a panel.

 panel/panel-application.c |    1 +
 panel/panel-window.c      |   29 ++++++++++++++++++++++++++---
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/panel/panel-application.c b/panel/panel-application.c
index 7cfc081..6a096d6 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -266,6 +266,7 @@ panel_application_xfconf_window_bindings (PanelApplication *application,
     { "background-alpha", G_TYPE_UINT },
     { "output-name", G_TYPE_STRING },
     { "position", G_TYPE_STRING },
+    { "disable-struts", G_TYPE_BOOLEAN },
     { NULL }
   };
 
diff --git a/panel/panel-window.c b/panel/panel-window.c
index 5d52813..60558c6 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -137,7 +137,8 @@ enum
   PROP_AUTOHIDE,
   PROP_SPAN_MONITORS,
   PROP_OUTPUT_NAME,
-  PROP_POSITION
+  PROP_POSITION,
+  PROP_DISABLE_STRUTS
 };
 
 enum _AutohideState
@@ -225,6 +226,7 @@ struct _PanelWindow
   /* struts information */
   StrutsEgde           struts_edge;
   gulong               struts[N_STRUTS];
+  guint                struts_disabled : 1;
 
   /* window positioning */
   guint                size;
@@ -343,6 +345,12 @@ panel_window_class_init (PanelWindowClass *klass)
                                                         NULL,
                                                         EXO_PARAM_READWRITE));
 
+  g_object_class_install_property (gobject_class,
+                                   PROP_DISABLE_STRUTS,
+                                   g_param_spec_boolean ("disable-struts", NULL, NULL,
+                                                         FALSE,
+                                                         EXO_PARAM_READWRITE));
+
   /* initialize the atoms */
   cardinal_atom = gdk_atom_intern_static_string ("CARDINAL");
   net_wm_strut_partial_atom = gdk_atom_intern_static_string ("_NET_WM_STRUT_PARTIAL");
@@ -368,6 +376,7 @@ panel_window_init (PanelWindow *window)
   /* init vars */
   window->screen = NULL;
   window->struts_edge = STRUTS_EDGE_NONE;
+  window->struts_disabled = FALSE;
 
   window->horizontal = TRUE;
   window->size = 30;
@@ -445,6 +454,10 @@ panel_window_get_property (GObject    *object,
         g_value_take_string (value, position);
         break;
 
+      case PROP_DISABLE_STRUTS:
+        g_value_set_boolean (value, window->struts_disabled);
+        break;
+
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -572,6 +585,15 @@ panel_window_set_property (GObject      *object,
           }
         break;
 
+      case PROP_DISABLE_STRUTS:
+        val_bool = g_value_get_boolean (value);
+        if (val_bool != window->struts_disabled)
+          {
+            window->struts_disabled = val_bool;
+            panel_window_screen_layout_changed (window->screen, window);
+          }
+        break;
+
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -1211,8 +1233,9 @@ panel_window_screen_struts_edge (PanelWindow *window)
 {
   panel_return_val_if_fail (PANEL_IS_WINDOW (window), STRUTS_EDGE_NONE);
 
-  /* no struts when autohide is active */
-  if (window->autohide_state != AUTOHIDE_DISABLED)
+  /* no struts when autohide is active or they are disabled by the user */
+  if (window->autohide_state != AUTOHIDE_DISABLED
+      || window->struts_disabled)
     return STRUTS_EDGE_NONE;
 
   /* return the screen edge on which the window is



More information about the Xfce4-commits mailing list