]> Dogcows Code - chaz/openbox/commitdiff
we werent dropping it in screen, we were dropping it in prop
authorDana Jansens <danakj@orodu.net>
Mon, 7 May 2007 05:58:02 +0000 (05:58 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 7 May 2007 05:58:02 +0000 (05:58 +0000)
openbox/prop.c
openbox/screen.c

index 6bd05cc6a4fe0163653c40a3adb3a86e303a1c3a..0485045e344459938fb4f92d5fa132fe038f2c39 100644 (file)
@@ -328,7 +328,7 @@ gboolean prop_get_strings_locale(Window win, Atom prop, gchar ***ret)
     if (get_all(win, prop, prop_atoms.string, 8, (guchar**)&raw, &num)) {
 
         p = raw;
-        while (p < raw + num - 1) {
+        while (p < raw + num) {
             ++count;
             strs = g_slist_append(strs, p);
             p += strlen(p) + 1; /* next string */
@@ -377,7 +377,7 @@ gboolean prop_get_strings_utf8(Window win, Atom prop, gchar ***ret)
     if (get_all(win, prop, prop_atoms.utf8, 8, (guchar**)&raw, &num)) {
 
         p = raw;
-        while (p < raw + num - 1) {
+        while (p < raw + num) {
             ++count;
             strs = g_slist_append(strs, p);
             p += strlen(p) + 1; /* next string */
index 34943fa6049a291954fc12cd34d6d4b1cee4551c..da68d2dc572ed97a3cf8e472656e29f60235b328 100644 (file)
@@ -299,8 +299,7 @@ gboolean screen_annex(const gchar *program_name)
 
 void screen_startup(gboolean reconfig)
 {
-    GSList *it;
-    guint i;
+    guint i, numnames;
 
     if (!reconfig)
         /* get the initial size */
@@ -317,12 +316,18 @@ void screen_startup(gboolean reconfig)
     else
 #endif
         i = 0;
-    for (it = g_slist_nth(config_desktops_names, i); it;
-         it = g_slist_next(it), ++i)
-    {
-        screen_desktop_names = g_renew(gchar*, screen_desktop_names, i + 2);
-        screen_desktop_names[i] = g_strdup(it->data);
-        screen_desktop_names[i+1] = NULL;
+    numnames = g_slist_length(config_desktops_names);
+    if (numnames > i) {
+        GSList *it;
+
+        screen_desktop_names = g_renew(gchar*,screen_desktop_names,numnames+1);
+        screen_desktop_names[numnames] = NULL;
+
+        for (it = g_slist_nth(config_desktops_names, i); it;
+             it = g_slist_next(it), ++i)
+        {
+            screen_desktop_names[i] = g_strdup(it->data);
+        }
     }
     /* then set the names */
     PROP_SETSS(RootWindow(ob_display, ob_screen),
@@ -883,11 +888,11 @@ void screen_update_desktop_names()
         for (i = 0; screen_desktop_names[i] && i < screen_num_desktops; ++i);
     else
         i = 0;
-    if (i < screen_num_desktops - 1) {
+    if (i < screen_num_desktops) {
         screen_desktop_names = g_renew(gchar*, screen_desktop_names,
                                        screen_num_desktops + 1);
         screen_desktop_names[screen_num_desktops] = NULL;
-        for (; i < screen_num_desktops - 1; ++i)
+        for (; i < screen_num_desktops; ++i)
             screen_desktop_names[i] = g_strdup_printf("desktop %i", i + 1);
     }
 
This page took 0.036459 seconds and 4 git commands to generate.