Add all the action names used in 3.4 so configs don't break
[mikachu/openbox.git] / openbox / actions / movetoedge.c
index 8a4044b..51215fd 100644 (file)
@@ -9,20 +9,29 @@ typedef struct {
     ObDirection dir;
 } Options;
 
-static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
-static void     free_func(gpointer options);
+static gpointer setup_func(xmlNodePtr node);
 static gboolean run_func(ObActionsData *data, gpointer options);
+/* 3.4-compatibility */
+static gpointer setup_north_func(xmlNodePtr node);
+static gpointer setup_south_func(xmlNodePtr node);
+static gpointer setup_east_func(xmlNodePtr node);
+static gpointer setup_west_func(xmlNodePtr node);
 
-void action_movetofromedge_startup()
+void action_movetoedge_startup(void)
 {
-    actions_register("MoveToEdge",
-                     setup_func,
-                     free_func,
-                     run_func,
+    actions_register("MoveToEdge", setup_func, g_free, run_func, NULL, NULL);
+    /* 3.4-compatibility */
+    actions_register("MoveToEdgeNorth", setup_north_func, g_free, run_func,
+                     NULL, NULL);
+    actions_register("MoveToEdgeSouth", setup_south_func, g_free, run_func,
+                     NULL, NULL);
+    actions_register("MoveToEdgeEast", setup_east_func, g_free, run_func,
+                     NULL, NULL);
+    actions_register("MoveToEdgeWest", setup_west_func, g_free, run_func,
                      NULL, NULL);
 }
 
-static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
+static gpointer setup_func(xmlNodePtr node)
 {
     xmlNodePtr n;
     Options *o;
@@ -30,8 +39,8 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
     o = g_new0(Options, 1);
     o->dir = OB_DIRECTION_NORTH;
 
-    if ((n = parse_find_node("direction", node))) {
-        gchar *s = parse_string(doc, n);
+    if ((n = obt_parse_find_node(node, "direction"))) {
+        gchar *s = obt_parse_node_string(n);
         if (!g_ascii_strcasecmp(s, "north") ||
             !g_ascii_strcasecmp(s, "up"))
             o->dir = OB_DIRECTION_NORTH;
@@ -50,13 +59,6 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
     return o;
 }
 
-static void free_func(gpointer options)
-{
-    Options *o = options;
-
-    g_free(o);
-}
-
 /* Always return FALSE because its not interactive */
 static gboolean run_func(ObActionsData *data, gpointer options)
 {
@@ -67,11 +69,41 @@ static gboolean run_func(ObActionsData *data, gpointer options)
 
         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);
+            client_move(data->client, x, y);
+            actions_client_move(data, FALSE);
         }
     }
 
     return FALSE;
 }
+
+/* 3.4-compatibility */
+static gpointer setup_north_func(xmlNodePtr node)
+{
+    Options *o = g_new0(Options, 1);
+    o->dir = OB_DIRECTION_NORTH;
+    return o;
+}
+
+static gpointer setup_south_func(xmlNodePtr node)
+{
+    Options *o = g_new0(Options, 1);
+    o->dir = OB_DIRECTION_SOUTH;
+    return o;
+}
+
+static gpointer setup_east_func(xmlNodePtr node)
+{
+    Options *o = g_new0(Options, 1);
+    o->dir = OB_DIRECTION_EAST;
+    return o;
+}
+
+static gpointer setup_west_func(xmlNodePtr node)
+{
+    Options *o = g_new0(Options, 1);
+    o->dir = OB_DIRECTION_WEST;
+    return o;
+}
+