1 #include "openbox/actions.h"
2 #include "openbox/misc.h"
3 #include "openbox/client.h"
4 #include "openbox/frame.h"
5 #include "openbox/screen.h"
12 static gpointer setup_north_func(ObParseInst *i,
13 xmlDocPtr doc, xmlNodePtr node);
14 static gpointer setup_south_func(ObParseInst *i,
15 xmlDocPtr doc, xmlNodePtr node);
16 static gpointer setup_east_func(ObParseInst *i,
17 xmlDocPtr doc, xmlNodePtr node);
18 static gpointer setup_west_func(ObParseInst *i,
19 xmlDocPtr doc, xmlNodePtr node);
20 static gboolean run_func(ObActionsData *data, gpointer options);
22 void action_growtoedge_startup()
24 actions_register("GrowToEdgeNorth", setup_north_func, g_free, run_func,
26 actions_register("GrowToEdgeSouth", setup_south_func, g_free, run_func,
28 actions_register("GrowToEdgeEast", setup_east_func, g_free, run_func,
30 actions_register("GrowToEdgeWest", setup_west_func, g_free, run_func,
34 static gpointer setup_north_func(ObParseInst *i,
35 xmlDocPtr doc, xmlNodePtr node)
37 Options *o = g_new0(Options, 1);
38 o->dir = OB_DIRECTION_NORTH;
42 static gpointer setup_south_func(ObParseInst *i,
43 xmlDocPtr doc, xmlNodePtr node)
45 Options *o = g_new0(Options, 1);
46 o->dir = OB_DIRECTION_SOUTH;
50 static gpointer setup_east_func(ObParseInst *i,
51 xmlDocPtr doc, xmlNodePtr node)
53 Options *o = g_new0(Options, 1);
54 o->dir = OB_DIRECTION_EAST;
58 static gpointer setup_west_func(ObParseInst *i,
59 xmlDocPtr doc, xmlNodePtr node)
61 Options *o = g_new0(Options, 1);
62 o->dir = OB_DIRECTION_WEST;
66 /* Always return FALSE because its not interactive */
67 static gboolean run_func(ObActionsData *data, gpointer options)
72 gint x, y, w, h, realw, realh, lw, lh;
74 /* don't allow vertical resize if shaded */
75 if (o->dir != OB_DIRECTION_NORTH || o->dir != OB_DIRECTION_SOUTH ||
76 !data->client->shaded)
78 client_find_resize_directional(data->client, o->dir, TRUE,
82 client_try_configure(data->client, &x, &y, &realw, &realh,
84 /* if it's going to be resized smaller than it intended, don't
85 move the window over */
86 if (x != data->client->area.x) x += w - realw;
87 if (y != data->client->area.y) y += h - realh;
89 if (x != data->client->area.x || y != data->client->area.y ||
90 w != data->client->area.width ||
91 h != data->client->area.height)
93 actions_client_move(data, TRUE);
94 client_move_resize(data->client, x, y, realw, realh);
95 actions_client_move(data, FALSE);