1 #include "openbox/actions.h"
2 #include "openbox/event.h"
3 #include "openbox/client.h"
4 #include "openbox/focus.h"
10 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
11 static void free_func(gpointer options);
12 static gboolean run_func(ObActionsData *data, gpointer options);
14 void action_focus_startup(void)
16 actions_register("Focus",
23 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
28 o = g_new0(Options, 1);
30 if ((n = parse_find_node("here", node)))
31 o->here = parse_bool(doc, n);
35 static void free_func(gpointer options)
42 /* Always return FALSE because its not interactive */
43 static gboolean run_func(ObActionsData *data, gpointer options)
49 ob_debug("button %d focusable %d context %d %d %d\n",
50 data->button, client_mouse_focusable(data->client),
52 OB_FRAME_CONTEXT_CLIENT, OB_FRAME_CONTEXT_FRAME);
54 if (data->button == 0 || client_mouse_focusable(data->client) ||
55 (data->context != OB_FRAME_CONTEXT_CLIENT &&
56 data->context != OB_FRAME_CONTEXT_FRAME))
58 actions_client_move(data, TRUE);
59 client_activate(data->client, o->here, FALSE, FALSE, TRUE);
60 actions_client_move(data, FALSE);
62 } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) {
63 /* focus action on the root window. make keybindings work for this
64 openbox instance, but don't focus any specific client */