X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Factions%2Fmoveresizeto.c;h=29780c495323389ca2d555df36258707d7b552fe;hb=d3a01a40f35cb3ae6c5ad8329291e86e2e599691;hp=cdd772ad735e8d96cb1ad436b85c769bdfaaa4b7;hpb=c1257fb4f9c5a17ee8140c8a49c78604604bccc0;p=chaz%2Fopenbox diff --git a/openbox/actions/moveresizeto.c b/openbox/actions/moveresizeto.c index cdd772ad..29780c49 100644 --- a/openbox/actions/moveresizeto.c +++ b/openbox/actions/moveresizeto.c @@ -6,7 +6,9 @@ enum { CURRENT_MONITOR = -1, - ALL_MONITORS = -2 + ALL_MONITORS = -2, + NEXT_MONITOR = -3, + PREV_MONITOR = -4 }; typedef struct { @@ -89,6 +91,10 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node) if (g_ascii_strcasecmp(s, "current") != 0) { if (!g_ascii_strcasecmp(s, "all")) o->monitor = ALL_MONITORS; + else if(!g_ascii_strcasecmp(s, "next")) + o->monitor = NEXT_MONITOR; + else if(!g_ascii_strcasecmp(s, "prev")) + o->monitor = PREV_MONITOR; else o->monitor = parse_int(doc, n) - 1; } @@ -113,14 +119,25 @@ static gboolean run_func(ObActionsData *data, gpointer options) if (data->client) { Rect *area, *carea; ObClient *c; - gint mon, cmon; + guint mon, cmon; gint x, y, lw, lh, w, h; c = data->client; mon = o->monitor; cmon = client_monitor(c); - if (mon == CURRENT_MONITOR) mon = cmon; - else if (mon == ALL_MONITORS) mon = SCREEN_AREA_ALL_MONITORS; + switch (mon) { + case CURRENT_MONITOR: + mon = cmon; break; + case ALL_MONITORS: + mon = SCREEN_AREA_ALL_MONITORS; break; + case NEXT_MONITOR: + mon = (cmon + 1 > screen_num_monitors - 1) ? 0 : (cmon + 1); break; + case PREV_MONITOR: + mon = (cmon == 0) ? (screen_num_monitors - 1) : (cmon - 1); break; + default: + g_assert_not_reached(); + } + area = screen_area(c->desktop, mon, NULL); carea = screen_area(c->desktop, cmon, NULL);