]> Dogcows Code - chaz/openbox/commitdiff
prefixing for the dock. use ObDirection instead of dupliacting it in another enum...
authorDana Jansens <danakj@orodu.net>
Thu, 10 Jul 2003 16:29:40 +0000 (16:29 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 10 Jul 2003 16:29:40 +0000 (16:29 +0000)
openbox/config.c
openbox/config.h
openbox/dock.c
openbox/dock.h
openbox/event.c
openbox/window.c
openbox/window.h

index 491097e444f1ff663305a328eae03d83d92d51b5..b8ffa9a6c488d2ff36833ec9ad7dcce8303ba914 100644 (file)
@@ -16,7 +16,8 @@ gboolean config_opaque_move;
 gboolean config_opaque_resize;
 
 StackLayer   config_dock_layer;
-DockPosition config_dock_pos;
+gboolean     config_dock_floating;
+ObDirection  config_dock_pos;
 int          config_dock_x;
 int          config_dock_y;
 gboolean     config_dock_horz;
@@ -89,25 +90,33 @@ static void parse_dock(xmlDocPtr doc, xmlNodePtr node, void *d)
 
     if ((n = parse_find_node("position", node))) {
         if (parse_contains("TopLeft", doc, n))
-            config_dock_pos = DockPos_TopLeft;
+            config_dock_floating = FALSE,
+            config_dock_pos = OB_DIRECTION_NORTHWEST;
         else if (parse_contains("Top", doc, n))
-            config_dock_pos = DockPos_Top;
+            config_dock_floating = FALSE,
+            config_dock_pos = OB_DIRECTION_NORTH;
         else if (parse_contains("TopRight", doc, n))
-            config_dock_pos = DockPos_TopRight;
+            config_dock_floating = FALSE,
+            config_dock_pos = OB_DIRECTION_NORTHEAST;
         else if (parse_contains("Right", doc, n))
-            config_dock_pos = DockPos_Right;
+            config_dock_floating = FALSE,
+            config_dock_pos = OB_DIRECTION_EAST;
         else if (parse_contains("BottomRight", doc, n))
-            config_dock_pos = DockPos_BottomRight;
+            config_dock_floating = FALSE,
+            config_dock_pos = OB_DIRECTION_SOUTHEAST;
         else if (parse_contains("Bottom", doc, n))
-            config_dock_pos = DockPos_Bottom;
+            config_dock_floating = FALSE,
+            config_dock_pos = OB_DIRECTION_SOUTH;
         else if (parse_contains("BottomLeft", doc, n))
-            config_dock_pos = DockPos_BottomLeft;
+            config_dock_floating = FALSE,
+            config_dock_pos = OB_DIRECTION_SOUTHWEST;
         else if (parse_contains("Left", doc, n))
-            config_dock_pos = DockPos_Left;
+            config_dock_floating = FALSE,
+            config_dock_pos = OB_DIRECTION_WEST;
         else if (parse_contains("Floating", doc, n))
-            config_dock_pos = DockPos_Floating;
+            config_dock_floating = TRUE;
     }
-    if (config_dock_pos == DockPos_Floating) {
+    if (config_dock_floating) {
         if ((n = parse_find_node("floatingX", node)))
             config_dock_x = parse_int(doc, n);
         if ((n = parse_find_node("floatingY", node)))
@@ -158,7 +167,8 @@ void config_startup()
     parse_register("moveresize", parse_moveresize, NULL);
 
     config_dock_layer = Layer_Top;
-    config_dock_pos = DockPos_TopRight;
+    config_dock_pos = OB_DIRECTION_NORTHEAST;
+    config_dock_floating = FALSE;
     config_dock_x = 0;
     config_dock_y = 0;
     config_dock_horz = FALSE;
index 71aa4e1d90108fe7e94eb9f4a60f14515b9760b5..6b0f3be5ed7588e22e1a0b69a41666ce6a6c4726 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __config_h
 #define __config_h
 
+#include "misc.h"
 #include "dock.h"
 #include "stacking.h"
 
@@ -27,8 +28,10 @@ extern gboolean config_opaque_resize;
 
 /*! The stacking layer the dock will reside in */
 extern StackLayer config_dock_layer;
-/*! The position at which to place the dock */
-extern DockPosition config_dock_pos;
+/*! Is the dock floating */
+extern gboolean config_dock_floating;
+/*! Where to place the dock if not floating */
+extern ObDirection config_dock_pos;
 /*! If config_dock_pos is DockPos_Floating, this is the top-left corner's
   position */
 extern int config_dock_x;
index 08f651390da225d0064c627a268d2a1394ec0806..5a9e02ec7be0364955661889242e9fdb06e4e0af 100644 (file)
@@ -10,7 +10,7 @@
                          EnterWindowMask | LeaveWindowMask)
 #define DOCKAPP_EVENT_MASK (StructureNotifyMask)
 
-static Dock *dock;
+static ObDock *dock;
 
 Strut dock_strut;
 
@@ -20,7 +20,7 @@ void dock_startup()
 
     STRUT_SET(dock_strut, 0, 0, 0, 0);
 
-    dock = g_new0(struct Dock, 1);
+    dock = g_new0(ObDock, 1);
     dock->obwin.type = Window_Dock;
 
     dock->hidden = TRUE;
@@ -51,11 +51,11 @@ void dock_shutdown()
 
 void dock_add(Window win, XWMHints *wmhints)
 {
-    DockApp *app;
+    ObDockApp *app;
     XWindowAttributes attrib;
-    char **data;
+    gchar **data;
 
-    app = g_new0(DockApp, 1);
+    app = g_new0(ObDockApp, 1);
     app->obwin.type = Window_DockApp;
     app->win = win;
     app->icon_win = (wmhints->flags & IconWindowHint) ?
@@ -122,7 +122,7 @@ void dock_remove_all()
         dock_remove(dock->dock_apps->data, TRUE);
 }
 
-void dock_remove(DockApp *app, gboolean reparent)
+void dock_remove(ObDockApp *app, gboolean reparent)
 {
     ungrab_button(2, 0, app->icon_win);
     XSelectInput(ob_display, app->icon_win, NoEventMask);
@@ -148,10 +148,10 @@ void dock_remove(DockApp *app, gboolean reparent)
 void dock_configure()
 {
     GList *it;
-    int spot;
-    int gravity;
-    int minw, minh;
-    int strw, strh;
+    gint spot;
+    gint gravity;
+    gint minw, minh;
+    gint strw, strh;
     Rect *a;
 
     RrMinsize(dock->a_frame, &minw, &minh);
@@ -160,7 +160,7 @@ void dock_configure()
 
     /* get the size */
     for (it = dock->dock_apps; it; it = it->next) {
-        struct DockApp *app = it->data;
+        ObDockApp *app = it->data;
         if (config_dock_horz) {
             dock->w += app->w;
             dock->h = MAX(dock->h, app->h);
@@ -174,7 +174,7 @@ void dock_configure()
 
     /* position the apps */
     for (it = dock->dock_apps; it; it = it->next) {
-        struct DockApp *app = it->data;
+        ObDockApp *app = it->data;
         if (config_dock_horz) {
             app->x = spot;
             app->y = (dock->h - app->h) / 2;
@@ -195,52 +195,53 @@ void dock_configure()
     a = screen_physical_area();
 
     /* calculate position */
-    switch (config_dock_pos) {
-    case DockPos_Floating:
+    if (config_dock_floating) {
         dock->x = config_dock_x;
         dock->y = config_dock_y;
         gravity = NorthWestGravity;
-        break;
-    case DockPos_TopLeft:
-        dock->x = 0;
-        dock->y = 0;
-        gravity = NorthWestGravity;
-        break;
-    case DockPos_Top:
-        dock->x = a->width / 2;
-        dock->y = 0;
-        gravity = NorthGravity;
-        break;
-    case DockPos_TopRight:
-        dock->x = a->width;
-        dock->y = 0;
-        gravity = NorthEastGravity;
-        break;
-    case DockPos_Left:
-        dock->x = 0;
-        dock->y = a->height / 2;
-        gravity = WestGravity;
-        break;
-    case DockPos_Right:
-        dock->x = a->width;
-        dock->y = a->height / 2;
-        gravity = EastGravity;
-        break;
-    case DockPos_BottomLeft:
-        dock->x = 0;
-        dock->y = a->height;
-        gravity = SouthWestGravity;
-        break;
-    case DockPos_Bottom:
-        dock->x = a->width / 2;
-        dock->y = a->height;
-        gravity = SouthGravity;
-        break;
-    case DockPos_BottomRight:
-        dock->x = a->width;
-        dock->y = a->height;
-        gravity = SouthEastGravity;
-        break;
+    } else {
+        switch (config_dock_pos) {
+        case OB_DIRECTION_NORTHWEST:
+            dock->x = 0;
+            dock->y = 0;
+            gravity = NorthWestGravity;
+            break;
+        case OB_DIRECTION_NORTH:
+            dock->x = a->width / 2;
+            dock->y = 0;
+            gravity = NorthGravity;
+            break;
+        case OB_DIRECTION_NORTHEAST:
+            dock->x = a->width;
+            dock->y = 0;
+            gravity = NorthEastGravity;
+            break;
+        case OB_DIRECTION_WEST:
+            dock->x = 0;
+            dock->y = a->height / 2;
+            gravity = WestGravity;
+            break;
+        case OB_DIRECTION_EAST:
+            dock->x = a->width;
+            dock->y = a->height / 2;
+            gravity = EastGravity;
+            break;
+        case OB_DIRECTION_SOUTHWEST:
+            dock->x = 0;
+            dock->y = a->height;
+            gravity = SouthWestGravity;
+            break;
+        case OB_DIRECTION_SOUTH:
+            dock->x = a->width / 2;
+            dock->y = a->height;
+            gravity = SouthGravity;
+            break;
+        case OB_DIRECTION_SOUTHEAST:
+            dock->x = a->width;
+            dock->y = a->height;
+            gravity = SouthEastGravity;
+            break;
+        }
     }
 
     switch(gravity) {
@@ -269,49 +270,49 @@ void dock_configure()
     }
 
     if (config_dock_hide && dock->hidden) {
-        switch (config_dock_pos) {
-        case DockPos_Floating:
-            break;
-        case DockPos_TopLeft:
-            if (config_dock_horz)
+        if (!config_dock_floating) {
+            switch (config_dock_pos) {
+            case OB_DIRECTION_NORTHWEST:
+                if (config_dock_horz)
+                    dock->y -= dock->h - ob_rr_theme->bwidth;
+                else
+                    dock->x -= dock->w - ob_rr_theme->bwidth;
+                break;
+            case OB_DIRECTION_NORTH:
                 dock->y -= dock->h - ob_rr_theme->bwidth;
-            else
+                break;
+            case OB_DIRECTION_NORTHEAST:
+                if (config_dock_horz)
+                    dock->y -= dock->h - ob_rr_theme->bwidth;
+                else
+                    dock->x += dock->w - ob_rr_theme->bwidth;
+                break;
+            case OB_DIRECTION_WEST:
                 dock->x -= dock->w - ob_rr_theme->bwidth;
-            break;
-        case DockPos_Top:
-            dock->y -= dock->h - ob_rr_theme->bwidth;
-            break;
-        case DockPos_TopRight:
-            if (config_dock_horz)
-                dock->y -= dock->h - ob_rr_theme->bwidth;
-            else
+                break;
+            case OB_DIRECTION_EAST:
                 dock->x += dock->w - ob_rr_theme->bwidth;
-            break;
-        case DockPos_Left:
-            dock->x -= dock->w - ob_rr_theme->bwidth;
-            break;
-        case DockPos_Right:
-            dock->x += dock->w - ob_rr_theme->bwidth;
-            break;
-        case DockPos_BottomLeft:
-            if (config_dock_horz)
-                dock->y += dock->h - ob_rr_theme->bwidth;
-            else
-                dock->x -= dock->w - ob_rr_theme->bwidth;
-            break;
-        case DockPos_Bottom:
-            dock->y += dock->h - ob_rr_theme->bwidth;
-            break;
-        case DockPos_BottomRight:
-            if (config_dock_horz)
+                break;
+            case OB_DIRECTION_SOUTHWEST:
+                if (config_dock_horz)
+                    dock->y += dock->h - ob_rr_theme->bwidth;
+                else
+                    dock->x -= dock->w - ob_rr_theme->bwidth;
+                break;
+            case OB_DIRECTION_SOUTH:
                 dock->y += dock->h - ob_rr_theme->bwidth;
-            else
-                dock->x += dock->w - ob_rr_theme->bwidth;
-            break;
-        }    
+                break;
+            case OB_DIRECTION_SOUTHEAST:
+                if (config_dock_horz)
+                    dock->y += dock->h - ob_rr_theme->bwidth;
+                else
+                    dock->x += dock->w - ob_rr_theme->bwidth;
+                break;
+            }    
+        }
     }
 
-    if (config_dock_pos != DockPos_Floating && config_dock_hide) {
+    if (!config_dock_floating && config_dock_hide) {
         strw = strh = ob_rr_theme->bwidth;
     } else {
         strw = dock->w;
@@ -319,46 +320,47 @@ void dock_configure()
     }
 
     /* set the strut */
-    switch (config_dock_pos) {
-    case DockPos_Floating:
+    if (config_dock_floating) {
         STRUT_SET(dock_strut, 0, 0, 0, 0);
-        break;
-    case DockPos_TopLeft:
-        if (config_dock_horz)
+    } else {
+        switch (config_dock_pos) {
+        case OB_DIRECTION_NORTHWEST:
+            if (config_dock_horz)
+                STRUT_SET(dock_strut, 0, strh, 0, 0);
+            else
+                STRUT_SET(dock_strut, strw, 0, 0, 0);
+            break;
+        case OB_DIRECTION_NORTH:
             STRUT_SET(dock_strut, 0, strh, 0, 0);
-        else
+            break;
+        case OB_DIRECTION_NORTHEAST:
+            if (config_dock_horz)
+                STRUT_SET(dock_strut, 0, strh, 0, 0);
+            else
+                STRUT_SET(dock_strut, 0, 0, strw, 0);
+            break;
+        case OB_DIRECTION_WEST:
             STRUT_SET(dock_strut, strw, 0, 0, 0);
-        break;
-    case DockPos_Top:
-        STRUT_SET(dock_strut, 0, strh, 0, 0);
-        break;
-    case DockPos_TopRight:
-        if (config_dock_horz)
-            STRUT_SET(dock_strut, 0, strh, 0, 0);
-        else
+            break;
+        case OB_DIRECTION_EAST:
             STRUT_SET(dock_strut, 0, 0, strw, 0);
-        break;
-    case DockPos_Left:
-        STRUT_SET(dock_strut, strw, 0, 0, 0);
-        break;
-    case DockPos_Right:
-        STRUT_SET(dock_strut, 0, 0, strw, 0);
-        break;
-    case DockPos_BottomLeft:
-        if (config_dock_horz)
-            STRUT_SET(dock_strut, 0, 0, 0, strh);
-        else
-            STRUT_SET(dock_strut, strw, 0, 0, 0);
-        break;
-    case DockPos_Bottom:
-        STRUT_SET(dock_strut, 0, 0, 0, strh);
-        break;
-    case DockPos_BottomRight:
-        if (config_dock_horz)
+            break;
+        case OB_DIRECTION_SOUTHWEST:
+            if (config_dock_horz)
+                STRUT_SET(dock_strut, 0, 0, 0, strh);
+            else
+                STRUT_SET(dock_strut, strw, 0, 0, 0);
+            break;
+        case OB_DIRECTION_SOUTH:
             STRUT_SET(dock_strut, 0, 0, 0, strh);
-        else
-            STRUT_SET(dock_strut, 0, 0, strw, 0);
-        break;
+            break;
+        case OB_DIRECTION_SOUTHEAST:
+            if (config_dock_horz)
+                STRUT_SET(dock_strut, 0, 0, 0, strh);
+            else
+                STRUT_SET(dock_strut, 0, 0, strw, 0);
+            break;
+        }
     }
 
     dock->w += minw;
@@ -384,18 +386,18 @@ void dock_configure()
     screen_update_areas();
 }
 
-void dock_app_configure(DockApp *app, int w, int h)
+void dock_app_configure(ObDockApp *app, gint w, gint h)
 {
     app->w = w;
     app->h = h;
     dock_configure();
 }
 
-void dock_app_drag(DockApp *app, XMotionEvent *e)
+void dock_app_drag(ObDockApp *app, XMotionEvent *e)
 {
-    DockApp *over = NULL;
+    ObDockApp *over = NULL;
     GList *it;
-    int x, y;
+    gint x, y;
     gboolean after;
 
     x = e->x_root;
index d70519a3e3a837a304aa9c2c993246d0c2dec64a..aa18da8426c9b17f6c1f58aecfcf7154f0b90724 100644 (file)
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 
-typedef enum {
-    DockPos_Floating,
-    DockPos_TopLeft,
-    DockPos_Top,
-    DockPos_TopRight,
-    DockPos_Right,
-    DockPos_BottomRight,
-    DockPos_Bottom,
-    DockPos_BottomLeft,
-    DockPos_Left
-} DockPosition;
-
-typedef struct Dock {
+typedef struct _ObDock    ObDock;
+typedef struct _ObDockApp ObDockApp;
+
+struct _ObDock
+{
     ObWindow obwin;
 
     Window frame;
     RrAppearance *a_frame;
 
     /* actual position (when not auto-hidden) */
-    int x, y;
-    int w, h;
+    gint x;
+    gint y;
+    gint w;
+    gint h;
 
     gboolean hidden;
     Timer *hide_timer;
 
     GList *dock_apps;
-} Dock;
+};
 
-typedef struct DockApp {
+struct _ObDockApp {
     ObWindow obwin;
 
-    int ignore_unmaps;
+    gint ignore_unmaps;
 
     Window icon_win;
     Window win;
 
-    char *name;
-    char *class;
+    gchar *name;
+    gchar *class;
 
-    int x;
-    int y;
-    int w;
-    int h;
-} DockApp;
+    gint x;
+    gint y;
+    gint w;
+    gint h;
+};
 
 extern Strut dock_strut;
 
@@ -67,9 +61,9 @@ void dock_hide(gboolean hide);
 void dock_add(Window win, XWMHints *wmhints);
 
 void dock_remove_all();
-void dock_remove(DockApp *app, gboolean reparent);
+void dock_remove(ObDockApp *app, gboolean reparent);
 
-void dock_app_drag(DockApp *app, XMotionEvent *e);
-void dock_app_configure(DockApp *app, int w, int h);
+void dock_app_drag(ObDockApp *app, XMotionEvent *e);
+void dock_app_configure(ObDockApp *app, gint w, gint h);
 
 #endif
index 7c5ab11fee2652427c12e6415f377ac38d7b7557..8acca386af828c78d4cb0f8d75a9276dff33c8c9 100644 (file)
@@ -38,8 +38,8 @@
 
 static void event_process(XEvent *e);
 static void event_handle_root(XEvent *e);
-static void event_handle_dock(Dock *s, XEvent *e);
-static void event_handle_dockapp(DockApp *app, XEvent *e);
+static void event_handle_dock(ObDock *s, XEvent *e);
+static void event_handle_dockapp(ObDockApp *app, XEvent *e);
 static void event_handle_client(ObClient *c, XEvent *e);
 static void event_handle_menu(ObClient *c, XEvent *e);
 static void fd_event_handle();
@@ -468,8 +468,8 @@ static void event_process(XEvent *e)
 {
     Window window;
     ObClient *client = NULL;
-    Dock *dock = NULL;
-    DockApp *dockapp = NULL;
+    ObDock *dock = NULL;
+    ObDockApp *dockapp = NULL;
     Menu *menu = NULL;
     ObWindow *obwin = NULL;
 
@@ -1145,7 +1145,7 @@ static void fd_event_handle()
     g_datalist_foreach(&fd_handler_list, fd_event_handle_foreach, NULL);
 }
 
-static void event_handle_dock(Dock *s, XEvent *e)
+static void event_handle_dock(ObDock *s, XEvent *e)
 {
     switch (e->type) {
     case ButtonPress:
@@ -1160,7 +1160,7 @@ static void event_handle_dock(Dock *s, XEvent *e)
     }
 }
 
-static void event_handle_dockapp(DockApp *app, XEvent *e)
+static void event_handle_dockapp(ObDockApp *app, XEvent *e)
 {
     switch (e->type) {
     case MotionNotify:
index 15cebcd746e430e3721e2f546af50d2a0aeed86d..781aa5db8655f8f6295f363c1c2df2e8e6eac754 100644 (file)
@@ -23,7 +23,7 @@ Window window_top(ObWindow *self)
     case Window_Menu:
         return ((Menu*)self)->frame;
     case Window_Dock:
-        return ((Dock*)self)->frame;
+        return ((ObDock*)self)->frame;
     case Window_DockApp:
         /* not to be used for stacking */
         g_assert_not_reached();
index edb54e17951ce89e73c3534151ec4e1da640433e..7e7e4d34a3bf3111e107e9a8fe91df162c01472a 100644 (file)
@@ -30,13 +30,13 @@ typedef struct InternalWindow {
 #define WINDOW_IS_INTERNAL(win) (((ObWindow*)win)->type == Window_Internal)
 
 struct Menu;
-struct Dock;
-struct DockApp;
+struct _ObDock;
+struct _ObDockApp;
 struct _ObClient;
 
 #define WINDOW_AS_MENU(win) ((struct Menu*)win)
-#define WINDOW_AS_DOCK(win) ((struct Dock*)win)
-#define WINDOW_AS_DOCKAPP(win) ((struct DockApp*)win)
+#define WINDOW_AS_DOCK(win) ((struct _ObDock*)win)
+#define WINDOW_AS_DOCKAPP(win) ((struct _ObDockApp*)win)
 #define WINDOW_AS_CLIENT(win) ((struct _ObClient*)win)
 #define WINDOW_AS_INTERNAL(win) ((struct InternalWindow*)win)
 
This page took 0.048255 seconds and 4 git commands to generate.