diff options
| author | Dana Jansens <danakj@orodu.net> | 2007-06-28 05:18:01 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2007-06-28 05:18:01 +0000 |
| commit | 01a35904fec67a7f92a0eb7f19457e79ca3d0988 (patch) | |
| tree | 6fbe5902ffe87e9046f05bb9919da1e5bedee933 /openbox/actions | |
| parent | d9699d14700da5f227f6e5ad708519b1efdd874d (diff) | |
rewrote the movetoedge code so it works with both types of edges (to edge and from edge)
Diffstat (limited to 'openbox/actions')
| -rw-r--r-- | openbox/actions/growtoedge.c | 8 | ||||
| -rw-r--r-- | openbox/actions/movetofromedge.c | 61 |
2 files changed, 10 insertions, 59 deletions
diff --git a/openbox/actions/growtoedge.c b/openbox/actions/growtoedge.c index 5d4647f7..a5b24e37 100644 --- a/openbox/actions/growtoedge.c +++ b/openbox/actions/growtoedge.c @@ -74,11 +74,13 @@ static gboolean run_func(ObActionsData *data, gpointer options) width = c->area.width + c->frame->size.left + c->frame->size.right; height = c->area.height + c->frame->size.top + c->frame->size.bottom; +#if 0 + dest = client_directional_edge_search(c, o->dir); + switch(o->dir) { case OB_DIRECTION_NORTH: if (c->shaded) break; /* don't allow vertical resize if shaded */ - dest = client_directional_edge_search(c, o->dir, FALSE); if (a->y == y) height = height / 2; else { @@ -87,7 +89,6 @@ static gboolean run_func(ObActionsData *data, gpointer options) } break; case OB_DIRECTION_WEST: - dest = client_directional_edge_search(c, o->dir, FALSE); if (a->x == x) width = width / 2; else { @@ -98,7 +99,6 @@ static gboolean run_func(ObActionsData *data, gpointer options) case OB_DIRECTION_SOUTH: if (c->shaded) break; /* don't allow vertical resize if shaded */ - dest = client_directional_edge_search(c, o->dir, FALSE); if (a->y + a->height == y + c->frame->area.height) { height = c->frame->area.height / 2; y = a->y + a->height - height; @@ -108,7 +108,6 @@ static gboolean run_func(ObActionsData *data, gpointer options) height -= (height - c->frame->area.height) % c->size_inc.height; break; case OB_DIRECTION_EAST: - dest = client_directional_edge_search(c, o->dir, FALSE); if (a->x + a->width == x + c->frame->area.width) { width = c->frame->area.width / 2; x = a->x + a->width - width; @@ -129,6 +128,7 @@ static gboolean run_func(ObActionsData *data, gpointer options) client_move_resize(c, x, y, width, height); actions_client_move(data, TRUE); +#endif g_free(a); } diff --git a/openbox/actions/movetofromedge.c b/openbox/actions/movetofromedge.c index 72a89c1c..8db45097 100644 --- a/openbox/actions/movetofromedge.c +++ b/openbox/actions/movetofromedge.c @@ -6,24 +6,16 @@ typedef struct { ObDirection dir; - gboolean hang; } Options; static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node); -static gpointer setup_to_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node); -static gpointer setup_from_func(ObParseInst *i,xmlDocPtr doc, xmlNodePtr node); static void free_func(gpointer options); static gboolean run_func(ObActionsData *data, gpointer options); void action_movetofromedge_startup() { actions_register("MoveToEdge", - setup_to_func, - free_func, - run_func, - NULL, NULL); - actions_register("MoveFromEdge", - setup_from_func, + setup_func, free_func, run_func, NULL, NULL); @@ -57,20 +49,6 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node) return o; } -static gpointer setup_to_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node) -{ - Options *o = setup_func(i, doc, node); - o->hang = FALSE; - return o; -} - -static gpointer setup_from_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node) -{ - Options *o = setup_func(i, doc, node); - o->hang = TRUE; - return o; -} - static void free_func(gpointer options) { Options *o = options; @@ -85,40 +63,13 @@ static gboolean run_func(ObActionsData *data, gpointer options) if (data->client) { gint x, y; - ObClient *c = data->client; - x = c->frame->area.x; - y = c->frame->area.y; - - switch(o->dir) { - case OB_DIRECTION_NORTH: - y = client_directional_edge_search(c, OB_DIRECTION_NORTH, - o->hang) - - (o->hang ? c->frame->area.height : 0); - break; - case OB_DIRECTION_WEST: - x = client_directional_edge_search(c, OB_DIRECTION_WEST, - o->hang) - - (o->hang ? c->frame->area.width : 0); - break; - case OB_DIRECTION_SOUTH: - y = client_directional_edge_search(c, OB_DIRECTION_SOUTH, - o->hang) - - (o->hang ? 0 : c->frame->area.height); - break; - case OB_DIRECTION_EAST: - x = client_directional_edge_search(c, OB_DIRECTION_EAST, - o->hang) - - (o->hang ? 0 : c->frame->area.width); - break; - default: - g_assert_not_reached(); + client_find_move_directional(data->client, o->dir, &x, &y); + if (x != data->client->area.x || y != data->client->area.y) { + actions_client_move(data, FALSE); + client_move(data->client, x, y); + actions_client_move(data, TRUE); } - frame_frame_gravity(c->frame, &x, &y); - - actions_client_move(data, FALSE); - client_move(c, x, y); - actions_client_move(data, TRUE); } return FALSE; |
