1 #include "openbox/actions.h"
2 #include "openbox/event.h"
3 #include "openbox/client.h"
4 #include "openbox/focus.h"
5 #include "openbox/screen.h"
12 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
13 static void free_func(gpointer options);
14 static gboolean run_func(ObActionsData *data, gpointer options);
16 void action_focus_startup(void)
18 actions_register("Focus",
25 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
30 o = g_new0(Options, 1);
33 if ((n = parse_find_node("here", node)))
34 o->here = parse_bool(doc, n);
35 if ((n = parse_find_node("stopInteractive", node)))
36 o->stop_int = parse_bool(doc, n);
40 static void free_func(gpointer options)
47 /* Always return FALSE because its not interactive */
48 static gboolean run_func(ObActionsData *data, gpointer options)
54 ob_debug("button %d focusable %d context %d %d %d\n",
55 data->button, client_mouse_focusable(data->client),
57 OB_FRAME_CONTEXT_CLIENT, OB_FRAME_CONTEXT_FRAME);
59 if (data->button == 0 || client_mouse_focusable(data->client) ||
60 (data->context != OB_FRAME_CONTEXT_CLIENT &&
61 data->context != OB_FRAME_CONTEXT_FRAME))
64 actions_interactive_cancel_act();
66 actions_client_move(data, TRUE);
67 client_activate(data->client, TRUE, o->here, FALSE, FALSE, TRUE);
68 actions_client_move(data, FALSE);
70 } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) {
72 actions_interactive_cancel_act();
74 /* focus action on the root window. make keybindings work for this
75 openbox instance, but don't focus any specific client */