Make the dock a context and add actions LowerDock and RaiseDock
This commit is contained in:
parent
48d36cd587
commit
1ffc002132
10 changed files with 67 additions and 8 deletions
|
@ -188,6 +188,7 @@ openbox_openbox_SOURCES = \
|
||||||
openbox/actions/debug.c \
|
openbox/actions/debug.c \
|
||||||
openbox/actions/decorations.c \
|
openbox/actions/decorations.c \
|
||||||
openbox/actions/desktop.c \
|
openbox/actions/desktop.c \
|
||||||
|
openbox/actions/dock.c \
|
||||||
openbox/actions/dockautohide.c \
|
openbox/actions/dockautohide.c \
|
||||||
openbox/actions/directionalwindows.c \
|
openbox/actions/directionalwindows.c \
|
||||||
openbox/actions/execute.c \
|
openbox/actions/execute.c \
|
||||||
|
|
|
@ -30,6 +30,7 @@ void action_all_startup(void)
|
||||||
action_resize_startup();
|
action_resize_startup();
|
||||||
action_decorations_startup();
|
action_decorations_startup();
|
||||||
action_desktop_startup();
|
action_desktop_startup();
|
||||||
|
action_dock_startup();
|
||||||
action_resizerelative_startup();
|
action_resizerelative_startup();
|
||||||
action_addremovedesktop_startup();
|
action_addremovedesktop_startup();
|
||||||
action_dockautohide_startup();
|
action_dockautohide_startup();
|
||||||
|
|
|
@ -31,6 +31,7 @@ void action_directionalwindows_startup(void);
|
||||||
void action_resize_startup(void);
|
void action_resize_startup(void);
|
||||||
void action_decorations_startup(void);
|
void action_decorations_startup(void);
|
||||||
void action_desktop_startup(void);
|
void action_desktop_startup(void);
|
||||||
|
void action_dock_startup(void);
|
||||||
void action_resizerelative_startup(void);
|
void action_resizerelative_startup(void);
|
||||||
void action_addremovedesktop_startup(void);
|
void action_addremovedesktop_startup(void);
|
||||||
void action_dockautohide_startup(void);
|
void action_dockautohide_startup(void);
|
||||||
|
|
38
openbox/actions/dock.c
Normal file
38
openbox/actions/dock.c
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
|
|
@ -677,6 +677,16 @@ void dock_get_area(Rect *a)
|
||||||
dock->area.width, dock->area.height);
|
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)
|
ObDockApp* dock_find_dockapp(Window xwin)
|
||||||
{
|
{
|
||||||
return g_hash_table_lookup(dock->dock_map, &xwin);
|
return g_hash_table_lookup(dock->dock_map, &xwin);
|
||||||
|
|
|
@ -80,6 +80,9 @@ void dock_app_configure(ObDockApp *app, gint w, gint h);
|
||||||
|
|
||||||
void dock_get_area(Rect *a);
|
void dock_get_area(Rect *a);
|
||||||
|
|
||||||
|
void dock_raise_dock(void);
|
||||||
|
void dock_lower_dock(void);
|
||||||
|
|
||||||
ObDockApp* dock_find_dockapp(Window xwin);
|
ObDockApp* dock_find_dockapp(Window xwin);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -709,7 +709,7 @@ static void event_process(const XEvent *ec, gpointer data)
|
||||||
/* ...or it if it was physically on an openbox
|
/* ...or it if it was physically on an openbox
|
||||||
internal window... */
|
internal window... */
|
||||||
((w = window_find(e->xbutton.subwindow)) &&
|
((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 */
|
/* ...then process the event, otherwise ignore it */
|
||||||
{
|
{
|
||||||
used = event_handle_user_input(client, e);
|
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)
|
static void event_handle_dock(ObDock *s, XEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->type) {
|
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:
|
case EnterNotify:
|
||||||
dock_hide(FALSE);
|
dock_hide(FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1368,18 +1368,27 @@ ObFrameContext frame_context_from_string(const gchar *name)
|
||||||
return OB_FRAME_CONTEXT_CLOSE;
|
return OB_FRAME_CONTEXT_CLOSE;
|
||||||
else if (!g_ascii_strcasecmp("MoveResize", name))
|
else if (!g_ascii_strcasecmp("MoveResize", name))
|
||||||
return OB_FRAME_CONTEXT_MOVE_RESIZE;
|
return OB_FRAME_CONTEXT_MOVE_RESIZE;
|
||||||
|
else if (!g_ascii_strcasecmp("Dock", name))
|
||||||
|
return OB_FRAME_CONTEXT_DOCK;
|
||||||
|
|
||||||
return OB_FRAME_CONTEXT_NONE;
|
return OB_FRAME_CONTEXT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y)
|
ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y)
|
||||||
{
|
{
|
||||||
ObFrame *self;
|
ObFrame *self;
|
||||||
|
ObWindow *obwin;
|
||||||
|
|
||||||
if (moveresize_in_progress)
|
if (moveresize_in_progress)
|
||||||
return OB_FRAME_CONTEXT_MOVE_RESIZE;
|
return OB_FRAME_CONTEXT_MOVE_RESIZE;
|
||||||
|
|
||||||
if (win == obt_root(ob_screen))
|
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 (client == NULL) return OB_FRAME_CONTEXT_NONE;
|
||||||
if (win == client->window) {
|
if (win == client->window) {
|
||||||
/* conceptually, this is the desktop, as far as users are
|
/* conceptually, this is the desktop, as far as users are
|
||||||
|
|
|
@ -53,6 +53,7 @@ typedef enum {
|
||||||
/*! This is a special context, which occurs while dragging a window in
|
/*! This is a special context, which occurs while dragging a window in
|
||||||
a move/resize */
|
a move/resize */
|
||||||
OB_FRAME_CONTEXT_MOVE_RESIZE,
|
OB_FRAME_CONTEXT_MOVE_RESIZE,
|
||||||
|
OB_FRAME_CONTEXT_DOCK,
|
||||||
OB_FRAME_NUM_CONTEXTS
|
OB_FRAME_NUM_CONTEXTS
|
||||||
} ObFrameContext;
|
} ObFrameContext;
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ ObFrameContext mouse_button_frame_context(ObFrameContext context,
|
||||||
case OB_FRAME_CONTEXT_MOVE_RESIZE:
|
case OB_FRAME_CONTEXT_MOVE_RESIZE:
|
||||||
case OB_FRAME_CONTEXT_LEFT:
|
case OB_FRAME_CONTEXT_LEFT:
|
||||||
case OB_FRAME_CONTEXT_RIGHT:
|
case OB_FRAME_CONTEXT_RIGHT:
|
||||||
|
case OB_FRAME_CONTEXT_DOCK:
|
||||||
break;
|
break;
|
||||||
case OB_FRAME_CONTEXT_ROOT:
|
case OB_FRAME_CONTEXT_ROOT:
|
||||||
x = OB_FRAME_CONTEXT_DESKTOP;
|
x = OB_FRAME_CONTEXT_DESKTOP;
|
||||||
|
|
Loading…
Reference in a new issue