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 void free_func(gpointer o);
14 static gboolean run_func(ObActionsData *data, gpointer options);
16 void action_focus_startup(void)
18 actions_register("Focus", setup_func, free_func, run_func);
21 static gpointer setup_func(xmlNodePtr node)
26 o = g_slice_new0(Options);
29 if ((n = obt_xml_find_node(node, "here")))
30 o->here = obt_xml_node_bool(n);
31 if ((n = obt_xml_find_node(node, "stopInteractive")))
32 o->stop_int = obt_xml_node_bool(n);
36 static void free_func(gpointer o)
38 g_slice_free(Options, o);
41 /* Always return FALSE because its not interactive */
42 static gboolean run_func(ObActionsData *data, gpointer options)
48 ob_debug("button %d focusable %d context %d %d %d\n",
49 data->button, client_mouse_focusable(data->client),
51 OB_FRAME_CONTEXT_CLIENT, OB_FRAME_CONTEXT_FRAME);
53 if (data->button == 0 || client_mouse_focusable(data->client) ||
54 (data->context != OB_FRAME_CONTEXT_CLIENT &&
55 data->context != OB_FRAME_CONTEXT_FRAME))
58 actions_interactive_cancel_act();
60 actions_client_move(data, TRUE);
61 client_activate(data->client, TRUE, o->here, FALSE, FALSE, TRUE);
62 actions_client_move(data, FALSE);
64 } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) {
66 actions_interactive_cancel_act();
68 /* focus action on the root window. make keybindings work for this
69 openbox instance, but don't focus any specific client */