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 */
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_moverelative_startup()
18 actions_register("MoveRelative",
25 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
30 o = g_new0(Options, 1);
32 if ((n = parse_find_node("x", node)))
33 o->x = parse_int(doc, n);
34 if ((n = parse_find_node("y", node)))
35 o->y = parse_int(doc, n);
40 static void free_func(gpointer options)
47 /* Always return FALSE because its not interactive */
48 static gboolean run_func(ObActionsData *data, gpointer options)
54 gint x, y, lw, lh, w, h;
57 x = data->client->area.x + o->x;
58 y = data->client->area.y + o->y;
59 w = data->client->area.width;
60 h = data->client->area.height;
61 client_try_configure(data->client, &x, &y, &w, &h, &lw, &lh, TRUE);
62 client_find_onscreen(data->client, &x, &y, w, h, FALSE);
64 actions_client_move(data, TRUE);
65 client_configure(data->client, x, y, w, h, TRUE, TRUE, FALSE);
66 actions_client_move(data, FALSE);