From: Mikael Magnusson Date: Wed, 2 Aug 2006 16:36:40 +0000 (+0000) Subject: add moverelative and resizerelative X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=8cb6e95eb6afb7204052b07748ffe265700f5d2c;p=chaz%2Fopenbox add moverelative and resizerelative --- diff --git a/data/rc.xsd b/data/rc.xsd index 2fc8f340..9f548313 100644 --- a/data/rc.xsd +++ b/data/rc.xsd @@ -151,6 +151,12 @@ + + + + + + @@ -272,6 +278,7 @@ + @@ -285,6 +292,7 @@ + diff --git a/openbox/action.c b/openbox/action.c index fa41e788..e98677b9 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -556,6 +556,16 @@ ActionString actionstrings[] = action_resize_relative_vert, setup_client_action }, + { + "moverelative", + action_move_relative, + setup_client_action + }, + { + "resizerelative", + action_resize_relative, + setup_client_action + }, { "maximizefull", action_maximize_full, @@ -872,7 +882,21 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, act->func == action_resize_relative_horz || act->func == action_resize_relative_vert) { if ((n = parse_find_node("delta", node->xmlChildrenNode))) - act->data.relative.delta = parse_int(doc, n); + act->data.relative.deltax = parse_int(doc, n); + } else if (act->func == action_move_relative) { + if ((n = parse_find_node("x", node->xmlChildrenNode))) + act->data.relative.deltax = parse_int(doc, n); + if ((n = parse_find_node("y", node->xmlChildrenNode))) + act->data.relative.deltay = parse_int(doc, n); + } else if (act->func == action_resize_relative) { + if ((n = parse_find_node("left", node->xmlChildrenNode))) + act->data.relative.deltaxl = parse_int(doc, n); + if ((n = parse_find_node("up", node->xmlChildrenNode))) + act->data.relative.deltayu = parse_int(doc, n); + if ((n = parse_find_node("right", node->xmlChildrenNode))) + act->data.relative.deltax = parse_int(doc, n); + if ((n = parse_find_node("down", node->xmlChildrenNode))) + act->data.relative.deltay = parse_int(doc, n); } else if (act->func == action_desktop) { if ((n = parse_find_node("desktop", node->xmlChildrenNode))) act->data.desktop.desk = parse_int(doc, n); @@ -1162,7 +1186,7 @@ void action_move_relative_horz(union ActionData *data) { ObClient *c = data->relative.any.c; client_action_start(data); - client_move(c, c->area.x + data->relative.delta, c->area.y); + client_move(c, c->area.x + data->relative.deltax, c->area.y); client_action_end(data); } @@ -1170,7 +1194,7 @@ void action_move_relative_vert(union ActionData *data) { ObClient *c = data->relative.any.c; client_action_start(data); - client_move(c, c->area.x, c->area.y + data->relative.delta); + client_move(c, c->area.x, c->area.y + data->relative.deltax); client_action_end(data); } @@ -1190,7 +1214,7 @@ void action_resize_relative_horz(union ActionData *data) ObClient *c = data->relative.any.c; client_action_start(data); client_resize(c, - c->area.width + data->relative.delta * c->size_inc.width, + c->area.width + data->relative.deltax * c->size_inc.width, c->area.height); client_action_end(data); } @@ -1201,11 +1225,34 @@ void action_resize_relative_vert(union ActionData *data) if (!c->shaded) { client_action_start(data); client_resize(c, c->area.width, c->area.height + - data->relative.delta * c->size_inc.height); + data->relative.deltax * c->size_inc.height); client_action_end(data); } } +void action_move_relative(union ActionData *data) +{ + ObClient *c = data->relative.any.c; + client_action_start(data); + client_move(c, c->area.x + data->relative.deltax, c->area.y + + data->relative.deltay); + client_action_end(data); +} + +void action_resize_relative(union ActionData *data) +{ + ObClient *c = data->relative.any.c; + client_action_start(data); + client_move_resize(c, + c->area.x - data->relative.deltaxl * c->size_inc.width, + c->area.y - data->relative.deltayu * c->size_inc.height, + c->area.width + data->relative.deltax * c->size_inc.width + + data->relative.deltaxl * c->size_inc.width, + c->area.height + data->relative.deltay * c->size_inc.height + + data->relative.deltayu * c->size_inc.height); + client_action_end(data); +} + void action_maximize_full(union ActionData *data) { client_action_start(data); diff --git a/openbox/action.h b/openbox/action.h index 3ef5aa73..b98a6ece 100644 --- a/openbox/action.h +++ b/openbox/action.h @@ -82,7 +82,10 @@ struct Activate { struct MoveResizeRelative { struct AnyAction any; - gint delta; + gint deltax; + gint deltay; + gint deltaxl; + gint deltayu; }; struct SendToDesktop {