]>
Dogcows Code - chaz/openbox/blob - openbox/actions/movetoedge.c
1 #include "openbox/actions.h"
2 #include "openbox/misc.h"
3 #include "openbox/client.h"
4 #include "openbox/frame.h"
5 #include "openbox/geom.h"
12 static gpointer
setup_func(xmlNodePtr node
);
13 static gboolean
run_func(ObActionsData
*data
, gpointer options
);
15 void action_movetoedge_startup(void)
17 actions_register("MoveToEdge", setup_func
, g_free
, run_func
, NULL
, NULL
);
20 static gpointer
setup_func(xmlNodePtr node
)
25 o
= g_new0(Options
, 1);
26 o
->dir
= OB_DIRECTION_NORTH
;
28 if ((n
= obt_parse_find_node(node
, "direction"))) {
29 gchar
*s
= obt_parse_node_string(n
);
30 if (!g_ascii_strcasecmp(s
, "north") ||
31 !g_ascii_strcasecmp(s
, "up"))
32 o
->dir
= OB_DIRECTION_NORTH
;
33 else if (!g_ascii_strcasecmp(s
, "south") ||
34 !g_ascii_strcasecmp(s
, "down"))
35 o
->dir
= OB_DIRECTION_SOUTH
;
36 else if (!g_ascii_strcasecmp(s
, "west") ||
37 !g_ascii_strcasecmp(s
, "left"))
38 o
->dir
= OB_DIRECTION_WEST
;
39 else if (!g_ascii_strcasecmp(s
, "east") ||
40 !g_ascii_strcasecmp(s
, "right"))
41 o
->dir
= OB_DIRECTION_EAST
;
48 /* Always return FALSE because its not interactive */
49 static gboolean
run_func(ObActionsData
*data
, gpointer options
)
56 client_find_move_directional(data
->client
, o
->dir
, &x
, &y
);
57 if (x
!= data
->client
->area
.x
|| y
!= data
->client
->area
.y
) {
58 actions_client_move(data
, TRUE
);
59 client_move(data
->client
, x
, y
);
60 actions_client_move(data
, FALSE
);
This page took 0.034602 seconds and 4 git commands to generate.