]> Dogcows Code - chaz/openbox/blobdiff - plugins/placement/placement.c
make key grabbing per window instead of always root
[chaz/openbox] / plugins / placement / placement.c
index 730a4f76647b2218bbab4dc60d3d738c5eddb547..889168b941f49e68aff6c8b33c865fff10b4af34 100644 (file)
@@ -1,19 +1,37 @@
-#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;
 
-void place_random(Client *c)
+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)
 {
     int l, r, t, b;
     int x, y;
     Rect *area;
 
+    if (ob_state == State_Starting) return;
+
     area = screen_area(c->desktop);
 
     l = area->x;
@@ -31,13 +49,14 @@ void place_random(Client *c)
                      TRUE, TRUE);
 }
 
-void event(ObEvent *e, void *foo)
+static void event(ObEvent *e, void *foo)
 {
     g_assert(e->type == Event_Client_New);
 
-    if (ob_state == State_Starting) return;
+    /* 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.027064 seconds and 4 git commands to generate.