X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fscreen.c;h=1faf521eced56e9edebc131a2f02be0b74babf72;hb=82b2f0aa7a1723632e8d3cf7dc772e4bdb66868a;hp=34943fa6049a291954fc12cd34d6d4b1cee4551c;hpb=8d81088eb9c9a23e5458d797d8bf1ec0f110dd68;p=chaz%2Fopenbox diff --git a/openbox/screen.c b/openbox/screen.c index 34943fa6..1faf521e 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -299,36 +299,29 @@ gboolean screen_annex(const gchar *program_name) void screen_startup(gboolean reconfig) { - GSList *it; - guint i; + if (!reconfig) { + guint i, numnames; + gchar **names; + GSList *it; - if (!reconfig) /* get the initial size */ screen_resize(); - desktop_cycle_popup = pager_popup_new(FALSE); - pager_popup_height(desktop_cycle_popup, POPUP_HEIGHT); + /* get the desktop names */ + numnames = g_slist_length(config_desktops_names); + names = g_new(gchar*, numnames + 1); + names[numnames] = NULL; + for (i = 0, it = config_desktops_names; it; ++i, it = g_slist_next(it)) + names[i] = g_strdup(it->data); -#if 0 - /* get the names */ - if (PROP_GETSS(RootWindow(ob_display, ob_screen), - net_desktop_names, utf8, &screen_desktop_names)) - for (i = 0; screen_desktop_names[i]; ++i); - 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; + /* set the root window property */ + PROP_SETSS(RootWindow(ob_display, ob_screen), net_desktop_names,names); + + g_strfreev(names); } - /* then set the names */ - PROP_SETSS(RootWindow(ob_display, ob_screen), - net_desktop_names, screen_desktop_names); - g_strfreev(screen_desktop_names); - screen_desktop_names = NULL; + + desktop_cycle_popup = pager_popup_new(FALSE); + pager_popup_height(desktop_cycle_popup, POPUP_HEIGHT); if (!reconfig) screen_num_desktops = 0; @@ -883,11 +876,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); }