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(xmlNodePtr node);
11 static gboolean run_func(ObActionsData *data, gpointer options);
13 void action_focus_startup(void)
15 actions_register("Focus", setup_func, g_free, run_func, NULL, NULL);
18 static gpointer setup_func(xmlNodePtr node)
23 o = g_new0(Options, 1);
25 if ((n = obt_parse_find_node(node, "here")))
26 o->here = obt_parse_node_bool(n);
30 /* Always return FALSE because its not interactive */
31 static gboolean run_func(ObActionsData *data, gpointer options)
37 ob_debug("button %d focusable %d context %d %d %d\n",
38 data->button, client_mouse_focusable(data->client),
40 OB_FRAME_CONTEXT_CLIENT, OB_FRAME_CONTEXT_FRAME);
42 if (data->button == 0 || client_mouse_focusable(data->client) ||
43 (data->context != OB_FRAME_CONTEXT_CLIENT &&
44 data->context != OB_FRAME_CONTEXT_FRAME))
46 client_activate(data->client, o->here, FALSE, FALSE, TRUE);
48 } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) {
49 /* focus action on the root window. make keybindings work for this
50 openbox instance, but don't focus any specific client */