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(xmlNodePtr node);
12 static gboolean run_func(ObActionsData *data, gpointer options);
14 void action_focus_startup(void)
16 actions_register("Focus", setup_func, g_free, run_func);
19 static gpointer setup_func(xmlNodePtr node)
24 o = g_new0(Options, 1);
26 if ((n = obt_xml_find_node(node, "here")))
27 o->here = obt_xml_node_bool(n);
31 /* Always return FALSE because its not interactive */
32 static gboolean run_func(ObActionsData *data, gpointer options)
38 ob_debug("button %d focusable %d context %d %d %d\n",
39 data->button, client_mouse_focusable(data->client),
41 OB_FRAME_CONTEXT_CLIENT, OB_FRAME_CONTEXT_FRAME);
43 if (data->button == 0 || client_mouse_focusable(data->client) ||
44 (data->context != OB_FRAME_CONTEXT_CLIENT &&
45 data->context != OB_FRAME_CONTEXT_FRAME))
47 actions_client_move(data, TRUE);
48 client_activate(data->client, TRUE, o->here, FALSE, FALSE, TRUE);
49 actions_client_move(data, FALSE);
51 } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) {
52 /* focus action on the root window. make keybindings work for this
53 openbox instance, but don't focus any specific client */