1 #include "openbox/actions.h"
2 #include "openbox/event.h"
3 #include "openbox/client.h"
4 #include "openbox/focus.h"
11 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
12 static gpointer setup_activate_func(ObParseInst *i,
13 xmlDocPtr doc, xmlNodePtr node);
14 static void free_func(gpointer options);
15 static gboolean run_func(ObActionsData *data, gpointer options);
17 void action_focus_startup()
19 actions_register("Focus",
24 actions_register("Activate",
31 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
36 o = g_new0(Options, 1);
38 if ((n = parse_find_node("here", node)))
39 o->here = parse_bool(doc, n);
43 static gpointer setup_activate_func(ObParseInst *i,
44 xmlDocPtr doc, xmlNodePtr node)
46 Options *o = setup_func(i, doc, node);
51 static void free_func(gpointer options)
58 /* Always return FALSE because its not interactive */
59 static gboolean run_func(ObActionsData *data, gpointer options)
65 ob_debug("button %d focusable %d context %d %d %d\n",
66 data->button, client_mouse_focusable(data->client),
68 OB_FRAME_CONTEXT_CLIENT, OB_FRAME_CONTEXT_FRAME);
70 if (data->button == 0 || client_mouse_focusable(data->client) ||
71 (data->context != OB_FRAME_CONTEXT_CLIENT &&
72 data->context != OB_FRAME_CONTEXT_FRAME))
74 client_activate(data->client, o->here,
75 o->activate, o->activate, TRUE);
77 } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) {
78 /* focus action on the root window. make keybindings work for this
79 openbox instance, but don't focus any specific client */