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"
11 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
12 static void free_func(gpointer options);
13 static gboolean run_func(ObActionsData *data, gpointer options);
15 void action_focus_startup(void)
17 actions_register("Focus",
24 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
29 o = g_new0(Options, 1);
31 if ((n = parse_find_node("here", node)))
32 o->here = parse_bool(doc, n);
36 static void free_func(gpointer options)
43 /* Always return FALSE because its not interactive */
44 static gboolean run_func(ObActionsData *data, gpointer options)
50 ob_debug("button %d focusable %d context %d %d %d\n",
51 data->button, client_mouse_focusable(data->client),
53 OB_FRAME_CONTEXT_CLIENT, OB_FRAME_CONTEXT_FRAME);
55 if (data->button == 0 || client_mouse_focusable(data->client) ||
56 (data->context != OB_FRAME_CONTEXT_CLIENT &&
57 data->context != OB_FRAME_CONTEXT_FRAME))
59 actions_client_move(data, TRUE);
60 client_activate(data->client, TRUE, o->here, FALSE, FALSE, TRUE);
61 actions_client_move(data, FALSE);
63 } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) {
64 /* focus action on the root window. make keybindings work for this
65 openbox instance, but don't focus any specific client */