1 #include "openbox/actions.h"
2 #include "openbox/event.h"
3 #include "openbox/client.h"
4 #include "openbox/focus.h"
12 static gpointer
setup_func(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
);
13 static void free_func(gpointer options
);
14 static gboolean
run_func(ObActionsData
*data
, gpointer options
);
16 void action_activate_startup()
18 actions_register("Activate",
25 static gpointer
setup_func(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
)
30 o
= g_new0(Options
, 1);
34 if ((n
= parse_find_node("here", node
)))
35 o
->here
= parse_bool(doc
, n
);
36 if ((n
= parse_find_node("raise", node
)))
37 o
->raise
= parse_bool(doc
, n
);
38 if ((n
= parse_find_node("unshade", node
)))
39 o
->unshade
= parse_bool(doc
, n
);
43 static void free_func(gpointer options
)
50 /* Always return FALSE because its not interactive */
51 static gboolean
run_func(ObActionsData
*data
, gpointer options
)
56 gboolean mouse
= (data
->uact
== OB_USER_ACTION_MOUSE_PRESS
||
57 data
->uact
== OB_USER_ACTION_MOUSE_RELEASE
||
58 data
->uact
== OB_USER_ACTION_MOUSE_CLICK
||
59 data
->uact
== OB_USER_ACTION_MOUSE_DOUBLE_CLICK
||
60 data
->uact
== OB_USER_ACTION_MOUSE_MOTION
);
61 if (!mouse
|| client_mouse_focusable(data
->client
) ||
62 data
->context
!= OB_FRAME_CONTEXT_CLIENT
||
63 data
->context
!= OB_FRAME_CONTEXT_FRAME
)
65 client_activate(data
->client
, o
->here
, o
->raise
, o
->unshade
, TRUE
);
68 /* focus action on something other than a client, make keybindings
69 work for this openbox instance, but don't focus any specific client