]> Dogcows Code - chaz/openbox/blobdiff - openbox/config.c
make the dock's hiding always have at least 1px on screen
[chaz/openbox] / openbox / config.c
index 25e30fff4c6e4b7a19a4c3cff2a80804cb80434d..c094732ecb30924600d989f83efba4692f747049 100644 (file)
@@ -60,10 +60,11 @@ GSList *config_desktops_names;
 guint   config_screen_firstdesk;
 guint   config_desktop_popup_time;
 
-gboolean config_resize_redraw;
-gboolean config_resize_four_corners;
-gint     config_resize_popup_show;
-gint     config_resize_popup_pos;
+gboolean         config_resize_redraw;
+gboolean         config_resize_four_corners;
+gint             config_resize_popup_show;
+ObResizePopupPos config_resize_popup_pos;
+GravityPoint     config_resize_popup_fixed;
 
 ObStackingLayer config_dock_layer;
 gboolean        config_dock_floating;
@@ -137,16 +138,28 @@ void config_app_settings_copy_non_defaults(const ObAppSettings *src,
 
     if (src->pos_given) {
         dst->pos_given = TRUE;
-        dst->center_x = src->center_x;
-        dst->center_y = src->center_y;
-        dst->opposite_x = src->opposite_x;
-        dst->opposite_y = src->opposite_y;
-        dst->position.x = src->position.x;
-        dst->position.y = src->position.y;
+        dst->position = src->position;
         dst->monitor = src->monitor;
     }
 }
 
+static void config_parse_gravity_coord(xmlDocPtr doc, xmlNodePtr node,
+                                       GravityCoord *c)
+{
+    gchar *s = parse_string(doc, node);
+    if (!g_ascii_strcasecmp(s, "center"))
+        c->center = TRUE;
+    else {
+        if (s[0] == '-')
+            c->opposite = TRUE;
+        if (s[0] == '-' || s[0] == '+')
+            c->pos = atoi(s+1);
+        else
+            c->pos = atoi(s);
+    }
+    g_free(s);
+}
+
 /*
   <applications>
     <application name="aterm">
@@ -212,38 +225,16 @@ static void parse_per_app_settings(ObParseInst *inst, xmlDocPtr doc,
             if ((n = parse_find_node("position", app->children))) {
                 if ((c = parse_find_node("x", n->children)))
                     if (!parse_contains("default", doc, c)) {
-                        gchar *s = parse_string(doc, c);
-                        if (!g_ascii_strcasecmp(s, "center")) {
-                            settings->center_x = TRUE;
-                            x_pos_given = TRUE;
-                        } else {
-                            if (s[0] == '-')
-                                settings->opposite_x = TRUE;
-                            if (s[0] == '-' || s[0] == '+')
-                                settings->position.x = atoi(s+1);
-                            else
-                                settings->position.x = atoi(s);
-                            x_pos_given = TRUE;
-                        }
-                        g_free(s);
+                        config_parse_gravity_coord(doc, c,
+                                                   &settings->position.x);
+                        x_pos_given = TRUE;
                     }
 
                 if (x_pos_given && (c = parse_find_node("y", n->children)))
                     if (!parse_contains("default", doc, c)) {
-                        gchar *s = parse_string(doc, c);
-                        if (!g_ascii_strcasecmp(s, "center")) {
-                            settings->center_y = TRUE;
-                            settings->pos_given = TRUE;
-                        } else {
-                            if (s[0] == '-')
-                                settings->opposite_y = TRUE;
-                            if (s[0] == '-' || s[0] == '+')
-                                settings->position.y = atoi(s+1);
-                            else
-                                settings->position.y = atoi(s);
-                            settings->pos_given = TRUE;
-                        }
-                        g_free(s);
+                        config_parse_gravity_coord(doc, c,
+                                                   &settings->position.y);
+                        settings->pos_given = TRUE;
                     }
 
                 if (settings->pos_given &&
@@ -661,11 +652,24 @@ static void parse_resize(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
             config_resize_popup_show = 1;
     }
     if ((n = parse_find_node("popupPosition", node))) {
-        config_resize_popup_pos = parse_int(doc, n);
         if (parse_contains("Top", doc, n))
-            config_resize_popup_pos = 1;
+            config_resize_popup_pos = OB_RESIZE_POS_TOP;
         else if (parse_contains("Center", doc, n))
-            config_resize_popup_pos = 0;
+            config_resize_popup_pos = OB_RESIZE_POS_CENTER;
+        else if (parse_contains("Fixed", doc, n)) {
+            config_resize_popup_pos = OB_RESIZE_POS_FIXED;
+
+            if ((n = parse_find_node("popupFixedPosition", node))) {
+                xmlNodePtr n2;
+
+                if ((n2 = parse_find_node("x", n->children)))
+                    config_parse_gravity_coord(doc, n2,
+                                               &config_resize_popup_fixed.x);
+                if ((n2 = parse_find_node("y", n->children)))
+                    config_parse_gravity_coord(doc, n2,
+                                               &config_resize_popup_fixed.y);
+            }
+        }
     }
 }
 
@@ -914,7 +918,9 @@ void config_startup(ObParseInst *i)
     config_resize_redraw = TRUE;
     config_resize_four_corners = FALSE;
     config_resize_popup_show = 1; /* nonpixel increments */
-    config_resize_popup_pos = 0;  /* center of client */
+    config_resize_popup_pos = OB_RESIZE_POS_CENTER;
+    GRAVITY_COORD_SET(config_resize_popup_fixed.x, 0, FALSE, FALSE);
+    GRAVITY_COORD_SET(config_resize_popup_fixed.y, 0, FALSE, FALSE);
 
     parse_register(i, "resize", parse_resize, NULL);
 
This page took 0.025511 seconds and 4 git commands to generate.