From 6c5f6ed1f5d501c79977a55c0f2430ebdd32ef6c Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 22 Jun 2007 14:09:57 +0000 Subject: remove the activate action, make the focus action "activate" but not raise or unshade --- Makefile.am | 2 +- openbox/actions/activate.c | 70 ---------------------------------------------- openbox/actions/all.c | 2 +- openbox/actions/all.h | 2 +- openbox/actions/focus.c | 62 ++++++++++++++++++++++++++++++++++++++++ openbox/focus_cycle.c | 4 +-- 6 files changed, 67 insertions(+), 75 deletions(-) delete mode 100644 openbox/actions/activate.c create mode 100644 openbox/actions/focus.c diff --git a/Makefile.am b/Makefile.am index 61bc0b3d..a1bc2645 100644 --- a/Makefile.am +++ b/Makefile.am @@ -156,13 +156,13 @@ openbox_openbox_SOURCES = \ gettext.h \ openbox/actions/all.c \ openbox/actions/all.h \ - openbox/actions/activate.c \ openbox/actions/breakchroot.c \ openbox/actions/close.c \ openbox/actions/cyclewindows.c \ openbox/actions/debug.c \ openbox/actions/execute.c \ openbox/actions/exit.c \ + openbox/actions/focus.c \ openbox/actions/move.c \ openbox/actions/reconfigure.c \ openbox/actions/restart.c \ diff --git a/openbox/actions/activate.c b/openbox/actions/activate.c deleted file mode 100644 index c3f3f98e..00000000 --- a/openbox/actions/activate.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "openbox/actions.h" -#include "openbox/event.h" -#include "openbox/client.h" -#include "openbox/focus.h" - -typedef struct { - gboolean here; - gboolean raise; - gboolean unshade; -} Options; - -static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node); -static void free_func(gpointer options); -static gboolean run_func(ObActionsData *data, gpointer options); - -void action_activate_startup() -{ - actions_register("Activate", - setup_func, - free_func, - run_func, - NULL, NULL); -} - -static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node) -{ - xmlNodePtr n; - Options *o; - - o = g_new0(Options, 1); - o->raise = TRUE; - o->unshade = TRUE; - - if ((n = parse_find_node("here", node))) - o->here = parse_bool(doc, n); - if ((n = parse_find_node("raise", node))) - o->raise = parse_bool(doc, n); - if ((n = parse_find_node("unshade", node))) - o->unshade = parse_bool(doc, n); - return o; -} - -static void free_func(gpointer options) -{ - Options *o = options; - - g_free(o); -} - -/* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) -{ - Options *o = options; - - if (data->client) { - if (data->button == 0 || client_mouse_focusable(data->client) || - data->context != OB_FRAME_CONTEXT_CLIENT || - data->context != OB_FRAME_CONTEXT_FRAME) - { - client_activate(data->client, o->here, o->raise, o->unshade, TRUE); - } - } else { - /* focus action on something other than a client, make keybindings - work for this openbox instance, but don't focus any specific client - */ - focus_nothing(); - } - - return FALSE; -} diff --git a/openbox/actions/all.c b/openbox/actions/all.c index a65d76b5..71e439e6 100644 --- a/openbox/actions/all.c +++ b/openbox/actions/all.c @@ -10,8 +10,8 @@ void action_all_startup() action_exit_startup(); action_restart_startup(); action_cyclewindows_startup(); - action_activate_startup(); action_breakchroot_startup(); action_close_startup(); action_move_startup(); + action_focus_startup(); } diff --git a/openbox/actions/all.h b/openbox/actions/all.h index fa252492..2f2cf18a 100644 --- a/openbox/actions/all.h +++ b/openbox/actions/all.h @@ -11,9 +11,9 @@ void action_reconfigure_startup(); void action_exit_startup(); void action_restart_startup(); void action_cyclewindows_startup(); -void action_activate_startup(); void action_breakchroot_startup(); void action_close_startup(); void action_move_startup(); +void action_focus_startup(); #endif diff --git a/openbox/actions/focus.c b/openbox/actions/focus.c new file mode 100644 index 00000000..9be6741c --- /dev/null +++ b/openbox/actions/focus.c @@ -0,0 +1,62 @@ +#include "openbox/actions.h" +#include "openbox/event.h" +#include "openbox/client.h" +#include "openbox/focus.h" + +typedef struct { + gboolean here; +} Options; + +static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node); +static void free_func(gpointer options); +static gboolean run_func(ObActionsData *data, gpointer options); + +void action_focus_startup() +{ + actions_register("Focus", + setup_func, + free_func, + run_func, + NULL, NULL); +} + +static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node) +{ + xmlNodePtr n; + Options *o; + + o = g_new0(Options, 1); + + if ((n = parse_find_node("here", node))) + o->here = parse_bool(doc, n); + return o; +} + +static void free_func(gpointer options) +{ + Options *o = options; + + g_free(o); +} + +/* Always return FALSE because its not interactive */ +static gboolean run_func(ObActionsData *data, gpointer options) +{ + Options *o = options; + + if (data->client) { + if (data->button == 0 || client_mouse_focusable(data->client) || + data->context != OB_FRAME_CONTEXT_CLIENT || + data->context != OB_FRAME_CONTEXT_FRAME) + { + client_activate(data->client, o->here, FALSE, FALSE, TRUE); + } + } else { + /* focus action on something other than a client, make keybindings + work for this openbox instance, but don't focus any specific client + */ + focus_nothing(); + } + + return FALSE; +} diff --git a/openbox/focus_cycle.c b/openbox/focus_cycle.c index 22398851..0396dd86 100644 --- a/openbox/focus_cycle.c +++ b/openbox/focus_cycle.c @@ -137,7 +137,7 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops, focus_cycle_all_desktops, focus_cycle_dock_windows, focus_cycle_desktop_windows); - return NULL; + return focus_cycle_target; } else if (ft != focus_cycle_target) { focus_cycle_target = ft; done = TRUE; @@ -316,7 +316,7 @@ ObClient* focus_directional_cycle(ObDirection dir, gboolean dock_windows, focus_cycle_all_desktops, focus_cycle_dock_windows, focus_cycle_desktop_windows); - return NULL; + return focus_cycle_target; done_cycle: if (done && !cancel) ret = focus_cycle_target; -- cgit v1.2.3