]> Dogcows Code - chaz/openbox/commitdiff
add center option to placement section
authorMikael Magnusson <mikachu@comhem.se>
Wed, 13 Jun 2007 17:08:32 +0000 (17:08 +0000)
committerMikael Magnusson <mikachu@comhem.se>
Wed, 13 Jun 2007 17:08:32 +0000 (17:08 +0000)
data/rc.xml
data/rc.xsd
openbox/config.c
openbox/config.h
openbox/place.c

index a5e9bd117ee2c53ce3e32cbad1cf937eca583ac1..1a4230c7efa07c87c5a5580de083ff209e886528 100644 (file)
@@ -32,6 +32,9 @@
 <placement>
   <policy>Smart</policy>
   <!-- 'Smart' or 'UnderMouse' -->
+  <center>yes</center>
+  <!-- whether to place windows in the center of the free area found or
+       the top left corner -->
 </placement>
 
 <theme>
index 151541918dc894165c7548d236372cbfbdac5114..3e6b312b647ffbc1a1facc3f91e7bba8982aed73 100644 (file)
@@ -53,6 +53,7 @@
             <xsd:documentation>defines how new windows are placed</xsd:documentation>
         </xsd:annotation>
         <xsd:element name="policy" type="ob:placementpolicy"/>
+        <xsd:element name="center" type="ob:bool"/>
     </xsd:complexType>
     <xsd:complexType name="theme">
         <xsd:element minOccurs="0" name="name" type="xsd:string"/>
index 10a60fb4b35743380113f065483c5b4875b81f22..2eb8e13c4fe5623ae2459511f44453b92bc751af 100644 (file)
@@ -36,6 +36,7 @@ gboolean config_focus_last;
 gboolean config_focus_under_mouse;
 
 ObPlacePolicy config_place_policy;
+gboolean      config_place_center;
 
 gchar   *config_theme;
 gboolean config_theme_keepborder;
@@ -495,6 +496,8 @@ static void parse_placement(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
     if ((n = parse_find_node("policy", node)))
         if (parse_contains("UnderMouse", doc, n))
             config_place_policy = OB_PLACE_POLICY_MOUSE;
+    if ((n = parse_find_node("center", node)))
+        config_place_center = parse_bool(doc, n);
 }
 
 static void parse_theme(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
@@ -869,6 +872,7 @@ void config_startup(ObParseInst *i)
     parse_register(i, "focus", parse_focus, NULL);
 
     config_place_policy = OB_PLACE_POLICY_SMART;
+    config_place_center = TRUE;
 
     parse_register(i, "placement", parse_placement, NULL);
 
index f45196e29d8b59c054d6ff02cd82203768f21121..e8c70eb2489dc980beab81ee5b7e9eaf95cfdb4d 100644 (file)
@@ -76,6 +76,8 @@ extern gboolean config_focus_last;
 extern gboolean config_focus_under_mouse;
 
 extern ObPlacePolicy config_place_policy;
+/*! Place windows in the center of the free area */
+extern gboolean config_place_center;
 
 /*! When true windows' contents are refreshed while they are resized; otherwise
   they are not updated until the resize is complete */
index adbb1f4b7a54dfc3c2e99a1859588c293418dc3a..845becdb93d67fe74036f37757aa28de7c664458 100644 (file)
@@ -326,8 +326,12 @@ static gboolean place_nooverlap(ObClient *c, gint *x, gint *y)
                 Rect *r = maxit->data;
 
                 /* center it in the area */
-                *x = r->x + (r->width - c->frame->area.width) / 2;
-                *y = r->y + (r->height - c->frame->area.height) / 2;
+                *x = r->x;
+                *y = r->y;
+                if (config_place_center) {
+                    *x += (r->width - c->frame->area.width) / 2;
+                    *y += (r->height - c->frame->area.height) / 2;
+                }
                 ret = TRUE;
             }
 
This page took 0.037788 seconds and 4 git commands to generate.