]>
Dogcows Code - chaz/openbox/blob - openbox/actions/directionaldesktop.c
1 #include "openbox/actions.h"
2 #include "openbox/screen.h"
3 #include "openbox/client.h"
14 static gpointer
setup_func(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
);
15 static void free_func(gpointer options
);
16 static gboolean
run_func(ObActionsData
*data
, gpointer options
);
18 void action_directionaldesktop_startup()
20 actions_register("DirectionalDesktop",
27 static gpointer
setup_func(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
)
32 o
= g_new0(Options
, 1);
34 o
->dir
= OB_DIRECTION_EAST
;
37 if ((n
= parse_find_node("wrap", node
)))
38 o
->wrap
= parse_bool(doc
, n
);
39 if ((n
= parse_find_node("direction", node
))) {
40 gchar
*s
= parse_string(doc
, n
);
41 if (!g_ascii_strcasecmp(s
, "next")) {
43 o
->dir
= OB_DIRECTION_EAST
;
45 else if (!g_ascii_strcasecmp(s
, "previous")) {
47 o
->dir
= OB_DIRECTION_WEST
;
49 else if (!g_ascii_strcasecmp(s
, "north") ||
50 !g_ascii_strcasecmp(s
, "up"))
51 o
->dir
= OB_DIRECTION_NORTH
;
52 else if (!g_ascii_strcasecmp(s
, "south") ||
53 !g_ascii_strcasecmp(s
, "down"))
54 o
->dir
= OB_DIRECTION_SOUTH
;
55 else if (!g_ascii_strcasecmp(s
, "west") ||
56 !g_ascii_strcasecmp(s
, "left"))
57 o
->dir
= OB_DIRECTION_WEST
;
58 else if (!g_ascii_strcasecmp(s
, "east") ||
59 !g_ascii_strcasecmp(s
, "right"))
60 o
->dir
= OB_DIRECTION_EAST
;
63 if ((n
= parse_find_node("send", node
)))
64 o
->send
= parse_bool(doc
, n
);
65 if ((n
= parse_find_node("follow", node
)))
66 o
->follow
= parse_bool(doc
, n
);
71 static void free_func(gpointer options
)
78 /* Always return FALSE because its not interactive */
79 static gboolean
run_func(ObActionsData
*data
, gpointer options
)
84 d
= screen_cycle_desktop(o
->dir
,
88 if (d
< screen_num_desktops
&& d
!= screen_desktop
) {
89 gboolean go
= !o
->send
;
91 if (data
->client
&& client_normal(data
->client
)) {
92 client_set_desktop(data
->client
, d
, o
->follow
, FALSE
);
97 screen_set_desktop(d
, TRUE
);
This page took 0.042267 seconds and 5 git commands to generate.