[Xfce4-commits] <xfce4-panel:devel> Get rid of the mask and make the code easier to undestand.

Nick Schermer noreply at xfce.org
Mon Feb 1 16:32:02 CET 2010


Updating branch refs/heads/devel
         to 7454bf4a581747de00493290c68024c824f0e1a1 (commit)
       from 603575a50a732c3507f20fc1278928b6b7bd21de (commit)

commit 7454bf4a581747de00493290c68024c824f0e1a1
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Feb 1 16:06:11 2010 +0100

    Get rid of the mask and make the code easier to undestand.

 panel/panel-base-window.c |    5 +++--
 panel/panel-base-window.h |    3 +--
 panel/panel-window.c      |   30 ++++++++++++++++--------------
 3 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/panel/panel-base-window.c b/panel/panel-base-window.c
index ec2936f..8d4e6c5 100644
--- a/panel/panel-base-window.c
+++ b/panel/panel-base-window.c
@@ -168,7 +168,7 @@ panel_base_window_init (PanelBaseWindow *window)
 
   window->priv->enter_opacity = 1.00;
   window->priv->leave_opacity = 1.00;
-  window->priv->borders = PANEL_BORDER_MASK;
+  window->priv->borders = PANEL_BORDER_NONE;
   window->priv->active_timeout_id = 0;
 
   /* set colormap */
@@ -597,7 +597,8 @@ panel_base_window_get_borders (PanelBaseWindow *window)
 
   /* show all borders for the marching ants */
   if (priv->active_timeout_id != 0)
-    return PANEL_BORDER_MASK;
+    return PANEL_BORDER_TOP | PANEL_BORDER_BOTTOM
+           | PANEL_BORDER_LEFT | PANEL_BORDER_RIGHT;
 
   return priv->borders;
 }
diff --git a/panel/panel-base-window.h b/panel/panel-base-window.h
index f8640e6..78333e4 100644
--- a/panel/panel-base-window.h
+++ b/panel/panel-base-window.h
@@ -41,8 +41,7 @@ enum _PanelBorders
   PANEL_BORDER_LEFT   = 1 << 0,
   PANEL_BORDER_RIGHT  = 1 << 1,
   PANEL_BORDER_TOP    = 1 << 2,
-  PANEL_BORDER_BOTTOM = 1 << 3,
-  PANEL_BORDER_MASK   = 0x0f
+  PANEL_BORDER_BOTTOM = 1 << 3
 };
 
 struct _PanelBaseWindowClass
diff --git a/panel/panel-window.c b/panel/panel-window.c
index a8a56d1..6b6920a 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -1461,57 +1461,59 @@ panel_window_screen_force_update (PanelWindow *window)
 static void
 panel_window_screen_update_borders (PanelWindow *window)
 {
-  PanelBorders borders = PANEL_BORDER_MASK;
-  PanelBorders unset_borders = 0;
+  PanelBorders borders;
 
   panel_return_if_fail (PANEL_IS_WINDOW (window));
 
-  /* the border we want to hide */
   switch (window->snap_position)
     {
     case SNAP_POSITION_NONE:
+      borders = PANEL_BORDER_TOP | PANEL_BORDER_BOTTOM
+                | PANEL_BORDER_LEFT | PANEL_BORDER_RIGHT;
       break;
 
     case SNAP_POSITION_E:
     case SNAP_POSITION_EC:
-      unset_borders = PANEL_BORDER_RIGHT;
+      borders = PANEL_BORDER_TOP | PANEL_BORDER_BOTTOM
+                | PANEL_BORDER_LEFT;
       break;
 
     case SNAP_POSITION_W:
     case SNAP_POSITION_WC:
-      unset_borders = PANEL_BORDER_LEFT;
+      borders = PANEL_BORDER_TOP | PANEL_BORDER_BOTTOM
+                | PANEL_BORDER_RIGHT;
       break;
 
     case SNAP_POSITION_N:
     case SNAP_POSITION_NC:
-      unset_borders = PANEL_BORDER_TOP;
+      borders = PANEL_BORDER_BOTTOM | PANEL_BORDER_LEFT
+                | PANEL_BORDER_RIGHT;
       break;
 
     case SNAP_POSITION_S:
     case SNAP_POSITION_SC:
-      unset_borders = PANEL_BORDER_BOTTOM;
+      borders = PANEL_BORDER_TOP | PANEL_BORDER_LEFT
+                | PANEL_BORDER_RIGHT;
       break;
 
     case SNAP_POSITION_NE:
-      unset_borders = PANEL_BORDER_RIGHT | PANEL_BORDER_TOP;
+
+      borders = PANEL_BORDER_BOTTOM | PANEL_BORDER_LEFT;
       break;
 
     case SNAP_POSITION_SE:
-      unset_borders = PANEL_BORDER_RIGHT | PANEL_BORDER_BOTTOM;
+      borders = PANEL_BORDER_LEFT | PANEL_BORDER_TOP;
       break;
 
     case SNAP_POSITION_NW:
-      unset_borders = PANEL_BORDER_LEFT | PANEL_BORDER_TOP;
+      borders = PANEL_BORDER_RIGHT | PANEL_BORDER_BOTTOM;
       break;
 
     case SNAP_POSITION_SW:
-      unset_borders = PANEL_BORDER_LEFT | PANEL_BORDER_BOTTOM;
+      borders = PANEL_BORDER_RIGHT | PANEL_BORDER_TOP;
       break;
     }
 
-  /* the visible borders */
-  PANEL_UNSET_FLAG (borders, unset_borders);
-
   /* don't show the side borders if the length is 100% */
   if (window->length == 1.00)
     {



More information about the Xfce4-commits mailing list