From 5e8dfcfe5409f0eb628642a173e4f69487942e8b Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 7 May 2007 05:58:02 +0000 Subject: [PATCH] we werent dropping it in screen, we were dropping it in prop --- openbox/prop.c | 4 ++-- openbox/screen.c | 25 +++++++++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/openbox/prop.c b/openbox/prop.c index 6bd05cc6..0485045e 100644 --- a/openbox/prop.c +++ b/openbox/prop.c @@ -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 */ diff --git a/openbox/screen.c b/openbox/screen.c index 34943fa6..da68d2dc 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -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); } -- 2.39.2