]>
Dogcows Code - chaz/openbox/blob - openbox/actions/movetofromedge.c
1 #include "openbox/actions.h"
2 #include "openbox/misc.h"
3 #include "openbox/client.h"
4 #include "openbox/frame.h"
11 static gpointer
setup_func(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
);
12 static void free_func(gpointer options
);
13 static gboolean
run_func(ObActionsData
*data
, gpointer options
);
15 void action_movetofromedge_startup()
17 actions_register("MoveToEdge",
24 static gpointer
setup_func(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
)
29 o
= g_new0(Options
, 1);
30 o
->dir
= OB_DIRECTION_NORTH
;
32 if ((n
= parse_find_node("direction", node
))) {
33 gchar
*s
= parse_string(doc
, n
);
34 if (!g_ascii_strcasecmp(s
, "north") ||
35 !g_ascii_strcasecmp(s
, "up"))
36 o
->dir
= OB_DIRECTION_NORTH
;
37 else if (!g_ascii_strcasecmp(s
, "south") ||
38 !g_ascii_strcasecmp(s
, "down"))
39 o
->dir
= OB_DIRECTION_SOUTH
;
40 else if (!g_ascii_strcasecmp(s
, "west") ||
41 !g_ascii_strcasecmp(s
, "left"))
42 o
->dir
= OB_DIRECTION_WEST
;
43 else if (!g_ascii_strcasecmp(s
, "east") ||
44 !g_ascii_strcasecmp(s
, "right"))
45 o
->dir
= OB_DIRECTION_EAST
;
52 static void free_func(gpointer options
)
59 /* Always return FALSE because its not interactive */
60 static gboolean
run_func(ObActionsData
*data
, gpointer options
)
67 client_find_move_directional(data
->client
, o
->dir
, &x
, &y
);
68 if (x
!= data
->client
->area
.x
|| y
!= data
->client
->area
.y
) {
69 actions_client_move(data
, FALSE
);
70 client_move(data
->client
, x
, y
);
71 actions_client_move(data
, TRUE
);
This page took 0.039087 seconds and 4 git commands to generate.