]> Dogcows Code - chaz/openbox/commitdiff
add moverelative and resizerelative
authorMikael Magnusson <mikachu@comhem.se>
Wed, 2 Aug 2006 16:36:40 +0000 (16:36 +0000)
committerMikael Magnusson <mikachu@comhem.se>
Wed, 2 Aug 2006 16:36:40 +0000 (16:36 +0000)
data/rc.xsd
openbox/action.c
openbox/action.h

index 2fc8f340877d71a09e77b73b231fcd1c3e3369de..9f548313ae8df3a96a7cb010346c547bc149f0e8 100644 (file)
             <xs:element minOccurs="0" name="execute" type="xs:string"/>
             <xs:element minOccurs="0" name="menu" type="xs:string"/>
             <xs:element minOccurs="0" name="delta" type="xs:integer"/>
+            <xs:element minOccurs="0" name="x" type="xs:integer"/>
+            <xs:element minOccurs="0" name="y" type="xs:integer"/>
+            <xs:element minOccurs="0" name="left" type="xs:integer"/>
+            <xs:element minOccurs="0" name="right" type="xs:integer"/>
+            <xs:element minOccurs="0" name="up" type="xs:integer"/>
+            <xs:element minOccurs="0" name="down" type="xs:integer"/>
             <xs:element minOccurs="0" name="desktop" type="xs:integer"/>
             <xs:element minOccurs="0" name="wrap" type="ob:bool"/>
             <xs:element minOccurs="0" name="follow" type="ob:bool"/>
             <xs:enumeration value="MaximizeHorz"/>
             <xs:enumeration value="MaximizeVert"/>
             <xs:enumeration value="Move"/>
+            <xs:enumeration value="MoveRelative"/>
             <xs:enumeration value="MoveRelativeHorz"/>
             <xs:enumeration value="MoveRelativeVert"/>
             <xs:enumeration value="MoveToCenter"/>
             <xs:enumeration value="RaiseLower"/>
             <xs:enumeration value="Reconfigure"/>
             <xs:enumeration value="Resize"/>
+            <xs:enumeration value="ResizeRelative"/>
             <xs:enumeration value="ResizeRelativeHorz"/>
             <xs:enumeration value="ResizeRelativeVert"/>
             <xs:enumeration value="Restart"/>
index fa41e788670af3f2608854408ec9679393ca6e04..e98677b9ad44ef8fe0cf4a199d091642745f3b1c 100644 (file)
@@ -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);
index 3ef5aa734a3cc8a5fb83c5ceb02b5669187f1265..b98a6ece3c8513edac00d1908c4be35b8fd97dfa 100644 (file)
@@ -82,7 +82,10 @@ struct Activate {
 
 struct MoveResizeRelative {
     struct AnyAction any;
-    gint delta;
+    gint deltax;
+    gint deltay;
+    gint deltaxl;
+    gint deltayu;
 };
 
 struct SendToDesktop {
This page took 0.034445 seconds and 4 git commands to generate.