add option for under-mouse placement
authorDana Jansens <danakj@orodu.net>
Sun, 28 Sep 2003 09:01:04 +0000 (09:01 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 28 Sep 2003 09:01:04 +0000 (09:01 +0000)
openbox/config.c
openbox/config.h
openbox/place.c
openbox/place.h

index aebf433..2c787e4 100644 (file)
@@ -29,6 +29,8 @@ gboolean config_focus_follow;
 guint    config_focus_delay;
 guint    config_focus_raise;
 
+ObPlacePolicy config_place_policy;
+
 char *config_theme;
 
 gchar *config_title_layout;
@@ -207,6 +209,18 @@ static void parse_focus(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
         config_focus_raise = parse_bool(doc, n);
 }
 
+static void parse_placement(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
+                            void *d)
+{
+    xmlNodePtr n;
+
+    node = node->children;
+    
+    if ((n = parse_find_node("policy", node)))
+        if (parse_contains("UnderMouse", doc, n))
+            config_place_policy = OB_PLACE_POLICY_MOUSE;
+}
+
 static void parse_theme(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
                         void *d)
 {
@@ -478,6 +492,10 @@ void config_startup(ObParseInst *i)
 
     parse_register(i, "focus", parse_focus, NULL);
 
+    config_place_policy = OB_PLACE_POLICY_SMART;
+
+    parse_register(i, "placement", parse_placement, NULL);
+
     config_theme = NULL;
 
     config_title_layout = g_strdup("NLIMC");
index 465bff4..a2cfce3 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "misc.h"
 #include "stacking.h"
+#include "place.h"
 
 #include <glib.h>
 
@@ -36,6 +37,8 @@ extern guint    config_focus_delay;
  focus follows mouse */
 extern guint    config_focus_raise;
 
+extern ObPlacePolicy config_place_policy;
+
 /*! When true windows' contents are refreshed while they are resized; otherwise
   they are not updated until the resize is complete */
 extern gboolean config_redraw_resize;
index 044743b..19fa597 100644 (file)
@@ -374,7 +374,7 @@ void place_client(ObClient *client, gint *x, gint *y)
         return;
     if (place_transient(client, x, y)             ||
         place_dialog(client, x, y)                ||
-        ((config_focus_follow && config_focus_new) ?
+        ((config_place_policy == OB_PLACE_POLICY_MOUSE) ?
          place_under_mouse(client, x, y) :
          place_smart(client, x, y, SMART_FULL)    ||
          place_smart(client, x, y, SMART_GROUP)   ||
index 0237232..1d35888 100644 (file)
 
 struct _ObClient;
 
-void place_client(ObClient *client, gint *x, gint *y);
+typedef enum
+{
+    OB_PLACE_POLICY_SMART,
+    OB_PLACE_POLICY_MOUSE
+} ObPlacePolicy;
+
+void place_client(struct _ObClient *client, gint *x, gint *y);
 
 #endif