]> Dogcows Code - chaz/openbox/blobdiff - openbox/config.c
let you specify the resize popup to be in a fixed place
[chaz/openbox] / openbox / config.c
index cd38d7b9067901375a951a9103168ecf0ac0eed9..058536665b20b90f22002266efdf008c47f0357d 100644 (file)
@@ -38,6 +38,7 @@ gboolean config_focus_under_mouse;
 
 ObPlacePolicy config_place_policy;
 gboolean      config_place_center;
+gboolean      config_place_active;
 
 StrutPartial config_margins;
 
@@ -59,10 +60,16 @@ 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;
+gboolean         config_resize_popup_x_center;
+gboolean         config_resize_popup_y_center;
+gboolean         config_resize_popup_x_opposite;
+gboolean         config_resize_popup_y_opposite;
+gint             config_resize_popup_x;
+gint             config_resize_popup_y;
 
 ObStackingLayer config_dock_layer;
 gboolean        config_dock_floating;
@@ -96,7 +103,7 @@ gint     config_resist_edge;
 
 GSList *config_per_app_settings;
 
-ObAppSettings* config_create_app_settings()
+ObAppSettings* config_create_app_settings(void)
 {
     ObAppSettings *settings = g_new0(ObAppSettings, 1);
     settings->decor = -1;
@@ -500,6 +507,8 @@ static void parse_placement(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
             config_place_policy = OB_PLACE_POLICY_MOUSE;
     if ((n = parse_find_node("center", node)))
         config_place_center = parse_bool(doc, n);
+    if ((n = parse_find_node("active", node)))
+        config_place_active = parse_bool(doc, n);
 }
 
 static void parse_margins(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
@@ -658,11 +667,46 @@ 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))) {
+                    gchar *s = parse_string(doc, n2);
+                    if (!g_ascii_strcasecmp(s, "center"))
+                        config_resize_popup_x_center = TRUE;
+                    else {
+                        if (s[0] == '-')
+                            config_resize_popup_x_opposite = TRUE;
+                        if (s[0] == '-' || s[0] == '+')
+                            config_resize_popup_x = atoi(s+1);
+                        else
+                            config_resize_popup_x = atoi(s);
+                    }
+                }
+                if ((n2 = parse_find_node("y", n->children))) {
+                    gchar *s = parse_string(doc, n2);
+                    if (!g_ascii_strcasecmp(s, "center"))
+                        config_resize_popup_y_center = TRUE;
+                    else {
+                        if (s[0] == '-')
+                            config_resize_popup_y_opposite = TRUE;
+                        if (s[0] == '-' || s[0] == '+')
+                            config_resize_popup_y = atoi(s+1);
+                        else
+                            config_resize_popup_y = atoi(s);
+                    }
+                }
+                g_print("X %d %d %d\n", config_resize_popup_x_center, config_resize_popup_x_opposite, config_resize_popup_x);
+                g_print("Y %d %d %d\n", config_resize_popup_y_center, config_resize_popup_y_opposite, config_resize_popup_y);
+            }
+        }
     }
 }
 
@@ -785,7 +829,7 @@ typedef struct
     const gchar *actname;
 } ObDefKeyBind;
 
-static void bind_default_keyboard()
+static void bind_default_keyboard(void)
 {
     ObDefKeyBind *it;
     ObDefKeyBind binds[] = {
@@ -808,7 +852,7 @@ typedef struct
     const gchar *actname;
 } ObDefMouseBind;
 
-static void bind_default_mouse()
+static void bind_default_mouse(void)
 {
     ObDefMouseBind *it;
     ObDefMouseBind binds[] = {
@@ -880,6 +924,7 @@ void config_startup(ObParseInst *i)
 
     config_place_policy = OB_PLACE_POLICY_SMART;
     config_place_center = TRUE;
+    config_place_active = FALSE;
 
     parse_register(i, "placement", parse_placement, NULL);
 
@@ -910,7 +955,13 @@ 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;
+    config_resize_popup_x_center = FALSE;
+    config_resize_popup_x_opposite = FALSE;
+    config_resize_popup_x = 0;
+    config_resize_popup_y_center = FALSE;
+    config_resize_popup_y_opposite = FALSE;
+    config_resize_popup_y = 0;
 
     parse_register(i, "resize", parse_resize, NULL);
 
@@ -962,7 +1013,7 @@ void config_startup(ObParseInst *i)
     parse_register(i, "applications", parse_per_app_settings, NULL);
 }
 
-void config_shutdown()
+void config_shutdown(void)
 {
     GSList *it;
 
This page took 0.027838 seconds and 4 git commands to generate.