Merge branches 'wip/edges', 'mikabox/crap', 'mikabox/lock', 'mikabox/maybe' and ...
[mikachu/openbox.git] / openbox / config.c
index 76f4856..e5e9269 100644 (file)
@@ -64,6 +64,7 @@ guint   config_desktops_num;
 GSList *config_desktops_names;
 guint   config_screen_firstdesk;
 guint   config_desktop_popup_time;
+gint    config_emulate_xinerama;
 
 gboolean         config_resize_redraw;
 gint             config_resize_popup_show;
@@ -447,11 +448,13 @@ static void parse_key(xmlNodePtr node, GList *keylist)
     gchar *keystring, **keys, **key;
     xmlNodePtr n;
     gboolean is_chroot = FALSE;
+    gboolean grab = TRUE;
 
     if (!obt_xml_attr_string(node, "key", &keystring))
         return;
 
     obt_xml_attr_bool(node, "chroot", &is_chroot);
+    obt_xml_attr_bool(node, "grab", &grab);
 
     keys = g_strsplit(keystring, " ", 0);
     for (key = keys; *key; ++key) {
@@ -469,7 +472,7 @@ static void parse_key(xmlNodePtr node, GList *keylist)
 
                 action = actions_parse(n);
                 if (action)
-                    keyboard_bind(keylist, action);
+                    keyboard_bind(keylist, action, grab);
                 n = obt_xml_find_node(n->next, "action");
             }
         }
@@ -582,8 +585,23 @@ static void parse_mouse(xmlNodePtr node, gpointer d)
                 while (nact) {
                     ObActionsAct *action;
 
-                    if ((action = actions_parse(nact)))
-                        mouse_bind(buttonstr, cx, mact, action);
+                    if ((action = actions_parse(nact))) {
+                        gchar *p = buttonstr;
+                        while (*p) {
+                            gchar *s = strchr(p, ' ');
+                            if (s) {
+                                *s = '\0';
+                            } else {
+                                s = p;
+                                while (*++s);
+                                s--;
+                            }
+                            mouse_bind(p, cx, mact, action);
+                            actions_act_ref(action); /* ref the action for each binding */
+                            p = s+1;
+                        }
+                        actions_act_unref(action); /* remove the extra ref */
+                    }
                     nact = obt_xml_find_node(nact->next, "action");
                 }
             g_free(buttonstr);
@@ -629,6 +647,8 @@ static void parse_placement(xmlNodePtr node, gpointer d)
     if ((n = obt_xml_find_node(node, "policy"))) {
         if (obt_xml_node_contains(n, "UnderMouse"))
             config_place_policy = OB_PLACE_POLICY_MOUSE;
+        if (obt_xml_node_contains(n, "Random"))
+            config_place_policy = OB_PLACE_POLICY_RANDOM;
     }
     if ((n = obt_xml_find_node(node, "center"))) {
         config_place_center = obt_xml_node_bool(n);
@@ -754,6 +774,13 @@ static void parse_theme(xmlNodePtr node, gpointer d)
 
         *font = RrFontOpen(ob_rr_inst, name, size, weight, slant);
         g_free(name);
+
+        if ((fnode = obt_xml_find_node(n->children, "description"))) {
+            gchar *s = obt_xml_node_string(fnode);
+            RrFontDescriptionFromString(*font, s);
+            g_free(s);
+        }
+
     next_font:
         n = obt_xml_find_node(n->next, "font");
     }
@@ -775,6 +802,8 @@ static void parse_desktops(xmlNodePtr node, gpointer d)
         if (d > 0)
             config_screen_firstdesk = (unsigned) d;
     }
+    if ((n = obt_xml_find_node(node, "emulatexinerama")))
+        config_emulate_xinerama = obt_xml_node_bool(n);
     if ((n = obt_xml_find_node(node, "names"))) {
         GSList *it;
         xmlNodePtr nname;
@@ -976,7 +1005,7 @@ static void bind_default_keyboard(void)
     };
     for (it = binds; it->key; ++it) {
         GList *l = g_list_append(NULL, g_strdup(it->key));
-        keyboard_bind(l, actions_parse_string(it->actname));
+        keyboard_bind(l, actions_parse_string(it->actname), TRUE);
     }
 }
 
@@ -1090,6 +1119,7 @@ void config_startup(ObtXmlInst *i)
 
     config_desktops_num = 4;
     config_screen_firstdesk = 1;
+    config_emulate_xinerama = FALSE;
     config_desktops_names = NULL;
     config_desktop_popup_time = 875;