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(xmlNodePtr node);
13 static void free_func(gpointer o);
14 static gboolean run_func(ObActionsData *data, gpointer options);
16 void action_moverelative_startup(void)
18 actions_register("MoveRelative", setup_func, free_func, run_func);
21 static gpointer setup_func(xmlNodePtr node)
26 o = g_slice_new0(Options);
28 if ((n = obt_xml_find_node(node, "x")))
29 o->x = obt_xml_node_int(n);
30 if ((n = obt_xml_find_node(node, "y")))
31 o->y = obt_xml_node_int(n);
36 static void free_func(gpointer o)
38 g_slice_free(Options, o);
41 /* Always return FALSE because its not interactive */
42 static gboolean run_func(ObActionsData *data, gpointer options)
48 gint x, y, lw, lh, w, h;
55 client_try_configure(c, &x, &y, &w, &h, &lw, &lh, TRUE);
56 client_find_onscreen(c, &x, &y, w, h, FALSE);
58 actions_client_move(data, TRUE);
59 client_configure(c, x, y, w, h, TRUE, TRUE, FALSE);
60 actions_client_move(data, FALSE);