Browse Source

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

upstream/xfce4-panel-4.10.1
Nick Schermer 13 years ago
parent
commit
b92708f11e
  1. 5
      panel/panel-base-window.c
  2. 3
      panel/panel-base-window.h
  3. 30
      panel/panel-window.c

5
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;
}

3
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

30
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)
{

Loading…
Cancel
Save