]> Dogcows Code - chaz/openbox/blobdiff - plugins/placement/placement.c
xinerama support
[chaz/openbox] / plugins / placement / placement.c
index 2307db2ff4cf36d74c3e2d28789bf326d06cd92e..5f962e47c2bf74823994a9799f5217d16aa5c587 100644 (file)
@@ -1,15 +1,27 @@
-#include "../../kernel/dispatch.h"
-#include "../../kernel/client.h"
-#include "../../kernel/frame.h"
-#include "../../kernel/screen.h"
-#include "../../kernel/openbox.h"
+#include "kernel/dispatch.h"
+#include "kernel/client.h"
+#include "kernel/frame.h"
+#include "kernel/screen.h"
+#include "kernel/openbox.h"
+#include "parser/parse.h"
 #include "history.h"
 #include <glib.h>
 
-gboolean history = TRUE;
+static gboolean history;
+
+static void parse_xml(xmlDocPtr doc, xmlNodePtr node, void *d)
+{
+    xmlNodePtr n;
+
+    if ((n = parse_find_node("remember", node)))
+        history = parse_bool(doc, n);
+}
 
 void plugin_setup_config()
 {
+    history = TRUE;
+
+    parse_register("placement", parse_xml, NULL);
 }
 
 static void place_random(Client *c)
@@ -20,7 +32,8 @@ static void place_random(Client *c)
 
     if (ob_state == State_Starting) return;
 
-    area = screen_area(c->desktop);
+    area = screen_area_xinerama(c->desktop,
+                                g_random_int_range(0, screen_num_xin_areas));
 
     l = area->x;
     t = area->y;
@@ -44,7 +57,7 @@ static void event(ObEvent *e, void *foo)
     /* requested a position */
     if (e->data.c.client->positioned) return;
 
-    if (!place_history(e->data.c.client))
+    if (!history || !place_history(e->data.c.client))
         place_random(e->data.c.client);
 }
 
This page took 0.028062 seconds and 4 git commands to generate.