]> Dogcows Code - chaz/openbox/blob - openbox/actions/focus.c
remove the highlight action. its not useful without event bindings
[chaz/openbox] / openbox / actions / focus.c
1 #include "openbox/actions.h"
2 #include "openbox/event.h"
3 #include "openbox/client.h"
4 #include "openbox/focus.h"
5
6 typedef struct {
7 gboolean here;
8 } Options;
9
10 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
11 static void free_func(gpointer options);
12 static gboolean run_func(ObActionsData *data, gpointer options);
13
14 void action_focus_startup()
15 {
16 actions_register("Focus",
17 setup_func,
18 free_func,
19 run_func,
20 NULL, NULL);
21 }
22
23 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
24 {
25 xmlNodePtr n;
26 Options *o;
27
28 o = g_new0(Options, 1);
29
30 if ((n = parse_find_node("here", node)))
31 o->here = parse_bool(doc, n);
32 return o;
33 }
34
35 static void free_func(gpointer options)
36 {
37 Options *o = options;
38
39 g_free(o);
40 }
41
42 /* Always return FALSE because its not interactive */
43 static gboolean run_func(ObActionsData *data, gpointer options)
44 {
45 Options *o = options;
46
47 if (data->client) {
48 ob_debug("button %d focusable %d context %d %d %d\n",
49 data->button, client_mouse_focusable(data->client),
50 data->context,
51 OB_FRAME_CONTEXT_CLIENT, OB_FRAME_CONTEXT_FRAME);
52 if (data->button == 0 || client_mouse_focusable(data->client) ||
53 (data->context != OB_FRAME_CONTEXT_CLIENT &&
54 data->context != OB_FRAME_CONTEXT_FRAME))
55 {
56 client_activate(data->client, o->here, FALSE, FALSE, TRUE);
57 }
58 } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) {
59 /* focus action on the root window. make keybindings work for this
60 openbox instance, but don't focus any specific client */
61 focus_nothing();
62 }
63
64 return FALSE;
65 }
This page took 0.036002 seconds and 5 git commands to generate.