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(xmlNodePtr node);
13 static gboolean run_func(ObActionsData *data, gpointer options);
15 void action_focus_startup(void)
17 actions_register("Focus", setup_func, g_free, run_func);
20 static gpointer setup_func(xmlNodePtr node)
25 o = g_new0(Options, 1);
28 if ((n = obt_xml_find_node(node, "here")))
29 o->here = obt_xml_node_bool(n);
30 if ((n = obt_xml_find_node(node, "stopInteractive")))
31 o->stop_int = obt_xml_node_bool(n);
35 /* Always return FALSE because its not interactive */
36 static gboolean run_func(ObActionsData *data, gpointer options)
42 ob_debug("button %d focusable %d context %d %d %d\n",
43 data->button, client_mouse_focusable(data->client),
45 OB_FRAME_CONTEXT_CLIENT, OB_FRAME_CONTEXT_FRAME);
47 if (data->button == 0 || client_mouse_focusable(data->client) ||
48 (data->context != OB_FRAME_CONTEXT_CLIENT &&
49 data->context != OB_FRAME_CONTEXT_FRAME))
52 actions_interactive_cancel_act();
54 actions_client_move(data, TRUE);
55 client_activate(data->client, TRUE, o->here, FALSE, FALSE, TRUE);
56 actions_client_move(data, FALSE);
58 } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) {
60 actions_interactive_cancel_act();
62 /* focus action on the root window. make keybindings work for this
63 openbox instance, but don't focus any specific client */