]> Dogcows Code - chaz/openbox/blob - openbox/actions/moverelative.c
Add a focus option, unfocusOnLeave that removes focus from a window when the pointer...
[chaz/openbox] / openbox / actions / moverelative.c
1 #include "openbox/actions.h"
2 #include "openbox/client.h"
3 #include "openbox/screen.h"
4 #include "openbox/frame.h"
5 #include <stdlib.h> /* for atoi */
6
7 typedef struct {
8 gint x;
9 gint y;
10 } Options;
11
12 static gpointer setup_func(xmlNodePtr node);
13 static gboolean run_func(ObActionsData *data, gpointer options);
14
15 void action_moverelative_startup(void)
16 {
17 actions_register("MoveRelative", setup_func, g_free, run_func);
18 }
19
20 static gpointer setup_func(xmlNodePtr node)
21 {
22 xmlNodePtr n;
23 Options *o;
24
25 o = g_new0(Options, 1);
26
27 if ((n = obt_parse_find_node(node, "x")))
28 o->x = obt_parse_node_int(n);
29 if ((n = obt_parse_find_node(node, "y")))
30 o->y = obt_parse_node_int(n);
31
32 return o;
33 }
34
35 /* Always return FALSE because its not interactive */
36 static gboolean run_func(ObActionsData *data, gpointer options)
37 {
38 Options *o = options;
39
40 if (data->client) {
41 ObClient *c;
42 gint x, y, lw, lh, w, h;
43
44 c = data->client;
45 x = c->area.x + o->x;
46 y = c->area.y + o->y;
47 w = c->area.width;
48 h = c->area.height;
49 client_try_configure(c, &x, &y, &w, &h, &lw, &lh, TRUE);
50 client_find_onscreen(c, &x, &y, w, h, FALSE);
51
52 actions_client_move(data, TRUE);
53 client_configure(c, x, y, w, h, TRUE, TRUE, FALSE);
54 actions_client_move(data, FALSE);
55 }
56
57 return FALSE;
58 }
This page took 0.038148 seconds and 4 git commands to generate.