]> Dogcows Code - chaz/openbox/blobdiff - openbox/dock.c
give different border colors to active and inactive windows. adjust the xml theme...
[chaz/openbox] / openbox / dock.c
index 592446a2ff22e193966dfb23bb3eecca0ff018e7..0cc42285a3e7a8c2de406956d9000cf976712ef8 100644 (file)
@@ -1,7 +1,8 @@
 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
 
    dock.c for the Openbox window manager
-   Copyright (c) 2003        Ben Jansens
+   Copyright (c) 2006        Mikael Magnusson
+   Copyright (c) 2003-2007   Dana Jansens
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -56,11 +57,12 @@ void dock_startup(gboolean reconfig)
         GList *it;
 
         XSetWindowBorder(ob_display, dock->frame,
-                         RrColorPixel(ob_rr_theme->b_color));
-        XSetWindowBorderWidth(ob_display, dock->frame, ob_rr_theme->bwidth);
+                         RrColorPixel(ob_rr_theme->
+                                      frame_focused_border_color));
+        XSetWindowBorderWidth(ob_display, dock->frame, ob_rr_theme->fbwidth);
 
         RrAppearanceFree(dock->a_frame);
-        dock->a_frame = RrAppearanceCopy(ob_rr_theme->a_unfocused_title);
+        dock->a_frame = RrAppearanceCopy(ob_rr_theme->a_focused_title);
 
         stacking_add(DOCK_AS_WINDOW(dock));
 
@@ -88,10 +90,10 @@ void dock_startup(gboolean reconfig)
                                 RrVisual(ob_rr_inst),
                                 CWOverrideRedirect | CWEventMask,
                                 &attrib);
-    dock->a_frame = RrAppearanceCopy(ob_rr_theme->a_unfocused_title);
+    dock->a_frame = RrAppearanceCopy(ob_rr_theme->a_focused_title);
     XSetWindowBorder(ob_display, dock->frame,
-                     RrColorPixel(ob_rr_theme->b_color));
-    XSetWindowBorderWidth(ob_display, dock->frame, ob_rr_theme->bwidth);
+                     RrColorPixel(ob_rr_theme->frame_focused_border_color));
+    XSetWindowBorderWidth(ob_display, dock->frame, ob_rr_theme->fbwidth);
 
     g_hash_table_insert(window_map, &dock->frame, dock);
     stacking_add(DOCK_AS_WINDOW(dock));
@@ -129,7 +131,7 @@ void dock_add(Window win, XWMHints *wmhints)
 
     if (PROP_GETSS(app->win, wm_class, locale, &data)) {
         if (data[0]) {
-           app->name = g_strdup(data[0]);
+            app->name = g_strdup(data[0]);
             if (data[1])
                 app->class = g_strdup(data[1]);
         }
@@ -158,7 +160,7 @@ void dock_add(Window win, XWMHints *wmhints)
       handled and need to be ignored.
     */
     if (ob_state() == OB_STATE_STARTING)
-       app->ignore_unmaps += 2;
+        app->ignore_unmaps += 2;
 
     if (app->win != app->icon_win) {
         /* have to map it so that it can be re-managed on a restart */
@@ -197,7 +199,7 @@ void dock_remove(ObDockApp *app, gboolean reparent)
     g_hash_table_remove(window_map, &app->icon_win);
 
     if (reparent)
-       XReparentWindow(ob_display, app->icon_win,
+        XReparentWindow(ob_display, app->icon_win,
                         RootWindow(ob_display, ob_screen), app->x, app->y);
 
     dock->dock_apps = g_list_remove(dock->dock_apps, app);
@@ -219,7 +221,7 @@ void dock_configure()
     gint strw, strh;
     Rect *a;
 
-    RrMinsize(dock->a_frame, &minw, &minh);
+    RrMinSize(dock->a_frame, &minw, &minh);
 
     dock->w = dock->h = 0;
 
@@ -260,8 +262,8 @@ void dock_configure()
     }
 
     /* used for calculating offsets */
-    dock->w += ob_rr_theme->bwidth * 2;
-    dock->h += ob_rr_theme->bwidth * 2;
+    dock->w += ob_rr_theme->fbwidth * 2;
+    dock->h += ob_rr_theme->fbwidth * 2;
 
     a = screen_physical_area();
 
@@ -312,6 +314,8 @@ void dock_configure()
             dock->y = a->height;
             gravity = SouthEastGravity;
             break;
+        default:
+            g_assert_not_reached();
         }
     }
 
@@ -346,51 +350,51 @@ void dock_configure()
             case OB_DIRECTION_NORTHWEST:
                 switch (config_dock_orient) {
                 case OB_ORIENTATION_HORZ:
-                    dock->y -= dock->h - ob_rr_theme->bwidth;
+                    dock->y -= dock->h - ob_rr_theme->fbwidth;
                     break;
                 case OB_ORIENTATION_VERT:
-                    dock->x -= dock->w - ob_rr_theme->bwidth;
+                    dock->x -= dock->w - ob_rr_theme->fbwidth;
                     break;
                 }
                 break;
             case OB_DIRECTION_NORTH:
-                dock->y -= dock->h - ob_rr_theme->bwidth;
+                dock->y -= dock->h - ob_rr_theme->fbwidth;
                 break;
             case OB_DIRECTION_NORTHEAST:
                 switch (config_dock_orient) {
                 case OB_ORIENTATION_HORZ:
-                    dock->y -= dock->h - ob_rr_theme->bwidth;
+                    dock->y -= dock->h - ob_rr_theme->fbwidth;
                     break;
                 case OB_ORIENTATION_VERT:
-                    dock->x += dock->w - ob_rr_theme->bwidth;
+                    dock->x += dock->w - ob_rr_theme->fbwidth;
                     break;
                 }
                 break;
             case OB_DIRECTION_WEST:
-                dock->x -= dock->w - ob_rr_theme->bwidth;
+                dock->x -= dock->w - ob_rr_theme->fbwidth;
                 break;
             case OB_DIRECTION_EAST:
-                dock->x += dock->w - ob_rr_theme->bwidth;
+                dock->x += dock->w - ob_rr_theme->fbwidth;
                 break;
             case OB_DIRECTION_SOUTHWEST:
                 switch (config_dock_orient) {
                 case OB_ORIENTATION_HORZ:
-                    dock->y += dock->h - ob_rr_theme->bwidth;
+                    dock->y += dock->h - ob_rr_theme->fbwidth;
                     break;
                 case OB_ORIENTATION_VERT:
-                    dock->x -= dock->w - ob_rr_theme->bwidth;
+                    dock->x -= dock->w - ob_rr_theme->fbwidth;
                     break;
                 } break;
             case OB_DIRECTION_SOUTH:
-                dock->y += dock->h - ob_rr_theme->bwidth;
+                dock->y += dock->h - ob_rr_theme->fbwidth;
                 break;
             case OB_DIRECTION_SOUTHEAST:
                 switch (config_dock_orient) {
                 case OB_ORIENTATION_HORZ:
-                    dock->y += dock->h - ob_rr_theme->bwidth;
+                    dock->y += dock->h - ob_rr_theme->fbwidth;
                     break;
                 case OB_ORIENTATION_VERT:
-                    dock->x += dock->w - ob_rr_theme->bwidth;
+                    dock->x += dock->w - ob_rr_theme->fbwidth;
                     break;
                 }
                 break;
@@ -399,8 +403,8 @@ void dock_configure()
     }
 
     if (!config_dock_floating && config_dock_hide) {
-        strw = ob_rr_theme->bwidth;
-        strh = ob_rr_theme->bwidth;
+        strw = ob_rr_theme->fbwidth;
+        strh = ob_rr_theme->fbwidth;
     } else {
         strw = dock->w;
         strh = dock->h;
@@ -410,7 +414,7 @@ void dock_configure()
     if (!dock->dock_apps) {
         STRUT_PARTIAL_SET(dock_strut, 0, 0, 0, 0,
                           0, 0, 0, 0, 0, 0, 0, 0);
-    } else if (config_dock_floating) {
+    } else if (config_dock_floating || config_dock_nostrut) {
         STRUT_PARTIAL_SET(dock_strut, 0, 0, 0, 0,
                           0, 0, 0, 0, 0, 0, 0, 0);
     } else {
@@ -498,8 +502,8 @@ void dock_configure()
     dock->h += minh;
 
     /* not used for actually sizing shit */
-    dock->w -= ob_rr_theme->bwidth * 2;
-    dock->h -= ob_rr_theme->bwidth * 2;
+    dock->w -= ob_rr_theme->fbwidth * 2;
+    dock->h -= ob_rr_theme->fbwidth * 2;
 
     if (dock->dock_apps) {
         g_assert(dock->w > 0);
@@ -514,8 +518,8 @@ void dock_configure()
         XUnmapWindow(ob_display, dock->frame);
 
     /* but they are useful outside of this function! */
-    dock->w += ob_rr_theme->bwidth * 2;
-    dock->h += ob_rr_theme->bwidth * 2;
+    dock->w += ob_rr_theme->fbwidth * 2;
+    dock->h += ob_rr_theme->fbwidth * 2;
 
     screen_update_areas();
 }
@@ -577,6 +581,8 @@ void dock_app_drag(ObDockApp *app, XMotionEvent *e)
     case OB_ORIENTATION_VERT:
         after = (y > over->h / 2);
         break;
+    default:
+        g_assert_not_reached();
     }
 
     /* remove before doing the it->next! */
@@ -597,17 +603,30 @@ static gboolean hide_timeout(gpointer data)
     return FALSE; /* don't repeat */
 }
 
+static gboolean show_timeout(gpointer data)
+{
+    /* hide */
+    dock->hidden = FALSE;
+    dock_configure();
+
+    return FALSE; /* don't repeat */
+}
+
 void dock_hide(gboolean hide)
 {
     if (!hide) {
-        /* show */
-        dock->hidden = FALSE;
-        dock_configure();
-
-        /* if was hiding, stop it */
-        ob_main_loop_timeout_remove(ob_main_loop, hide_timeout);
-    } else if (!dock->hidden && config_dock_hide) {
-        ob_main_loop_timeout_add(ob_main_loop, config_dock_hide_delay,
-                                 hide_timeout, NULL, NULL);
+        if (dock->hidden && config_dock_hide) {
+            ob_main_loop_timeout_add(ob_main_loop, config_dock_show_delay,
+                                 show_timeout, NULL, g_direct_equal, NULL);
+        } else if (!dock->hidden && config_dock_hide) {
+            ob_main_loop_timeout_remove(ob_main_loop, hide_timeout);
+        }
+    } else {
+        if (!dock->hidden && config_dock_hide) {
+            ob_main_loop_timeout_add(ob_main_loop, config_dock_hide_delay,
+                                 hide_timeout, NULL, g_direct_equal, NULL);
+        } else if (dock->hidden && config_dock_hide) {
+            ob_main_loop_timeout_remove(ob_main_loop, show_timeout);
+        }
     }
 }
This page took 0.02702 seconds and 4 git commands to generate.