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(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
13 static gpointer setup_activate_func(ObParseInst *i,
14 xmlDocPtr doc, xmlNodePtr node);
15 static void free_func(gpointer options);
16 static gboolean run_func(ObActionsData *data, gpointer options);
18 void action_focus_startup(void)
20 actions_register("Focus",
25 actions_register("Activate",
32 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
37 o = g_new0(Options, 1);
39 if ((n = parse_find_node("here", node)))
40 o->here = parse_bool(doc, n);
44 static gpointer setup_activate_func(ObParseInst *i,
45 xmlDocPtr doc, xmlNodePtr node)
47 Options *o = setup_func(i, doc, node);
52 static void free_func(gpointer options)
59 /* Always return FALSE because its not interactive */
60 static gboolean run_func(ObActionsData *data, gpointer options)
66 ob_debug("button %d focusable %d context %d %d %d\n",
67 data->button, client_mouse_focusable(data->client),
69 OB_FRAME_CONTEXT_CLIENT, OB_FRAME_CONTEXT_FRAME);
71 if (data->button == 0 || client_mouse_focusable(data->client) ||
72 (data->context != OB_FRAME_CONTEXT_CLIENT &&
73 data->context != OB_FRAME_CONTEXT_FRAME))
75 actions_client_move(data, TRUE);
76 client_activate(data->client, TRUE, o->here,
77 o->activate, o->activate, TRUE);
78 actions_client_move(data, FALSE);
80 } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) {
81 /* focus action on the root window. make keybindings work for this
82 openbox instance, but don't focus any specific client */