]> Dogcows Code - chaz/openbox/commitdiff
Make the dock a context and add actions LowerDock and RaiseDock
authorMikael Magnusson <mikachu@gmail.com>
Sat, 26 Jun 2010 13:55:40 +0000 (15:55 +0200)
committerMikael Magnusson <mikachu@gmail.com>
Thu, 16 Sep 2010 15:24:11 +0000 (17:24 +0200)
Makefile.am
openbox/actions/all.c
openbox/actions/all.h
openbox/actions/dock.c [new file with mode: 0644]
openbox/dock.c
openbox/dock.h
openbox/event.c
openbox/frame.c
openbox/frame.h
openbox/mouse.c

index 12176d67e959cd9529c31314445483115f9e6ff9..765ffaa9cb2897a9fa9ba5034d980a15a3ef8a03 100644 (file)
@@ -188,6 +188,7 @@ openbox_openbox_SOURCES = \
        openbox/actions/debug.c \
        openbox/actions/decorations.c \
        openbox/actions/desktop.c \
+       openbox/actions/dock.c \
        openbox/actions/dockautohide.c \
        openbox/actions/directionalwindows.c \
        openbox/actions/execute.c \
index 4563e65f7970678843a76870d2f5e8c5f1e59424..332e79ca6c92911949ddb269f113751adb755858 100644 (file)
@@ -30,6 +30,7 @@ void action_all_startup(void)
     action_resize_startup();
     action_decorations_startup();
     action_desktop_startup();
+    action_dock_startup();
     action_resizerelative_startup();
     action_addremovedesktop_startup();
     action_dockautohide_startup();
index 6acbc9cae5a0cc8693ae6d6546c0ea40e2cb318a..54d63195de6d24480d6256719f439464a4ca3753 100644 (file)
@@ -31,6 +31,7 @@ void action_directionalwindows_startup(void);
 void action_resize_startup(void);
 void action_decorations_startup(void);
 void action_desktop_startup(void);
+void action_dock_startup(void);
 void action_resizerelative_startup(void);
 void action_addremovedesktop_startup(void);
 void action_dockautohide_startup(void);
diff --git a/openbox/actions/dock.c b/openbox/actions/dock.c
new file mode 100644 (file)
index 0000000..a1f6837
--- /dev/null
@@ -0,0 +1,38 @@
+#include "openbox/actions.h"
+#include "openbox/stacking.h"
+#include "openbox/window.h"
+#include "openbox/dock.h"
+
+static gboolean raise_func(ObActionsData *data, gpointer options);
+static gboolean lower_func(ObActionsData *data, gpointer options);
+
+void action_dock_startup(void)
+{
+    actions_register("RaiseDock",
+                     NULL, NULL,
+                     raise_func);
+    actions_register("LowerDock",
+                     NULL, NULL,
+                     lower_func);
+}
+
+/* Always return FALSE because its not interactive */
+static gboolean raise_func(ObActionsData *data, gpointer options)
+{
+    actions_client_move(data, TRUE);
+    dock_raise_dock();
+    actions_client_move(data, FALSE);
+
+    return FALSE;
+}
+
+/* Always return FALSE because its not interactive */
+static gboolean lower_func(ObActionsData *data, gpointer options)
+{
+    actions_client_move(data, TRUE);
+    dock_lower_dock();
+    actions_client_move(data, FALSE);
+
+    return FALSE;
+}
+
index 64406d9eae055bf2f9a281fa2db084f4d027346d..b8a5ff5668d42f39b9b05dca00142582436ba95a 100644 (file)
@@ -677,6 +677,16 @@ void dock_get_area(Rect *a)
              dock->area.width, dock->area.height);
 }
 
+void dock_raise_dock(void)
+{
+    stacking_raise(DOCK_AS_WINDOW(dock));
+}
+
+void dock_lower_dock(void)
+{
+    stacking_lower(DOCK_AS_WINDOW(dock));
+}
+
 ObDockApp* dock_find_dockapp(Window xwin)
 {
     return g_hash_table_lookup(dock->dock_map, &xwin);
index 8bc735ee279c8c09461e7b2d29e4358609b1a4e7..cb4fd6cada01524b9f368b9e1d4951004aff8b4b 100644 (file)
@@ -80,6 +80,9 @@ void dock_app_configure(ObDockApp *app, gint w, gint h);
 
 void dock_get_area(Rect *a);
 
+void dock_raise_dock(void);
+void dock_lower_dock(void);
+
 ObDockApp* dock_find_dockapp(Window xwin);
 
 #endif
index 46baa6dd41e7c41cee0f6f9effc776a0c8e12e17..eb69d090827b0e524c2cf4ebc8593a4a3a292f12 100644 (file)
@@ -709,7 +709,7 @@ static void event_process(const XEvent *ec, gpointer data)
             /* ...or it if it was physically on an openbox
                internal window... */
             ((w = window_find(e->xbutton.subwindow)) &&
-             WINDOW_IS_INTERNAL(w)))
+             (WINDOW_IS_INTERNAL(w) || WINDOW_IS_DOCK(w))))
             /* ...then process the event, otherwise ignore it */
         {
             used = event_handle_user_input(client, e);
@@ -1712,12 +1712,6 @@ static void event_handle_client(ObClient *client, XEvent *e)
 static void event_handle_dock(ObDock *s, XEvent *e)
 {
     switch (e->type) {
-    case ButtonPress:
-        if (e->xbutton.button == 1)
-            stacking_raise(DOCK_AS_WINDOW(s));
-        else if (e->xbutton.button == 2)
-            stacking_lower(DOCK_AS_WINDOW(s));
-        break;
     case EnterNotify:
         dock_hide(FALSE);
         break;
index 9c065c7dcdf4fbe70ce9ee9e91cd5ad154784559..bd9527b0956119adefaa38343495590e84293c47 100644 (file)
@@ -1368,18 +1368,27 @@ ObFrameContext frame_context_from_string(const gchar *name)
         return OB_FRAME_CONTEXT_CLOSE;
     else if (!g_ascii_strcasecmp("MoveResize", name))
         return OB_FRAME_CONTEXT_MOVE_RESIZE;
+    else if (!g_ascii_strcasecmp("Dock", name))
+        return OB_FRAME_CONTEXT_DOCK;
+
     return OB_FRAME_CONTEXT_NONE;
 }
 
 ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y)
 {
     ObFrame *self;
+    ObWindow *obwin;
 
     if (moveresize_in_progress)
         return OB_FRAME_CONTEXT_MOVE_RESIZE;
 
     if (win == obt_root(ob_screen))
-        return OB_FRAME_CONTEXT_ROOT ;
+        return OB_FRAME_CONTEXT_ROOT;
+    if ((obwin = window_find(win))) {
+        if (WINDOW_IS_DOCK(obwin)) {
+          return OB_FRAME_CONTEXT_DOCK;
+        }
+    }
     if (client == NULL) return OB_FRAME_CONTEXT_NONE;
     if (win == client->window) {
         /* conceptually, this is the desktop, as far as users are
index 0e28b9f1afc24f379fd06496ef8f99e494aac08f..915c08db73ffabf79f46f14ba08030b15b660296 100644 (file)
@@ -53,6 +53,7 @@ typedef enum {
     /*! This is a special context, which occurs while dragging a window in
       a move/resize */
     OB_FRAME_CONTEXT_MOVE_RESIZE,
+    OB_FRAME_CONTEXT_DOCK,
     OB_FRAME_NUM_CONTEXTS
 } ObFrameContext;
 
index 567ec4dc2817284f84b04c42937d9d0ae95d8364..ddf6851d2424d57bc0a40ee166a4b4b4d3555af2 100644 (file)
@@ -66,6 +66,7 @@ ObFrameContext mouse_button_frame_context(ObFrameContext context,
     case OB_FRAME_CONTEXT_MOVE_RESIZE:
     case OB_FRAME_CONTEXT_LEFT:
     case OB_FRAME_CONTEXT_RIGHT:
+    case OB_FRAME_CONTEXT_DOCK:
         break;
     case OB_FRAME_CONTEXT_ROOT:
         x = OB_FRAME_CONTEXT_DESKTOP;
This page took 0.041127 seconds and 4 git commands to generate.