From: Dana Jansens Date: Mon, 14 Apr 2003 23:38:54 +0000 (+0000) Subject: fixes for handling char**s X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=e6d1ab217f53fcafe418a75ce184463c6e36e31b;p=chaz%2Fopenbox fixes for handling char**s --- diff --git a/openbox/client.c b/openbox/client.c index b061b8f6..d2e75dc2 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -1134,10 +1134,9 @@ void client_update_class(Client *self) if (data[1]) self->class = g_strdup(data[1]); } + g_strfreev(data); } - g_strfreev(data); - if (PROP_GETS(self->window, wm_window_role, locale, &s)) self->role = g_strdup(s); @@ -1587,7 +1586,7 @@ void client_fullscreen(Client *self, gboolean fs, gboolean savearea) x = y = w = h = 0; } else { guint num; - guint32 *dimensions; + gint32 *dimensions; /* pick some fallbacks... */ x = screen_area(self->desktop)->x + @@ -1598,7 +1597,7 @@ void client_fullscreen(Client *self, gboolean fs, gboolean savearea) h = screen_area(self->desktop)->height / 2; if (PROP_GETA32(self->window, openbox_premax, cardinal, - &dimensions, &num)) { + (guint32**)&dimensions, &num)) { if (num == 4) { x = dimensions[0]; y = dimensions[1]; diff --git a/openbox/prop.c b/openbox/prop.c index a97b66dc..bce0426b 100644 --- a/openbox/prop.c +++ b/openbox/prop.c @@ -352,11 +352,11 @@ void prop_set_string_utf8(Window win, Atom prop, char *val) void prop_set_strings_utf8(Window win, Atom prop, char **strs) { GString *str; - guint i; + char **s; str = g_string_sized_new(0); - for (i = 0; strs[i]; ++i) { - str = g_string_append(str, strs[i]); + for (s = strs; *s; ++s) { + str = g_string_append(str, *s); str = g_string_append_c(str, '\0'); } XChangeProperty(ob_display, win, prop, prop_atoms.utf8, 8, diff --git a/openbox/screen.c b/openbox/screen.c index 2b4ece3e..4db99246 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -25,7 +25,7 @@ guint screen_desktop = 0; Size screen_physical_size; gboolean screen_showing_desktop; DesktopLayout screen_desktop_layout; -char **screen_desktop_names; +char **screen_desktop_names = NULL; static Rect *area = NULL; static Strut *strut = NULL; @@ -155,10 +155,11 @@ void screen_startup() screen_resize(); /* set the names */ - screen_desktop_names = g_new0(char*, - g_slist_length(config_desktops_names) + 1); + screen_desktop_names = g_new(char*, + g_slist_length(config_desktops_names) + 1); for (i = 0, it = config_desktops_names; it; ++i, it = it->next) screen_desktop_names[i] = it->data; /* dont strdup */ + screen_desktop_names[i] = NULL; PROP_SETSS(ob_root, net_desktop_names, screen_desktop_names); g_free(screen_desktop_names); /* dont free the individual strings */ screen_desktop_names = NULL; @@ -377,11 +378,13 @@ void screen_update_desktop_names() /* empty the array */ g_strfreev(screen_desktop_names); + screen_desktop_names = NULL; if (PROP_GETSS(ob_root, net_desktop_names, utf8, &screen_desktop_names)) for (i = 0; screen_desktop_names[i] && i <= screen_num_desktops; ++i); else i = 0; + g_message("I %d", i); if (i <= screen_num_desktops) { screen_desktop_names = g_renew(char*, screen_desktop_names, screen_num_desktops + 1);