fixes for handling char**s
Dana Jansens danakj@orodu.net
3 files changed,
12 insertions(+),
10 deletions(-)
M
openbox/client.c
→
openbox/client.c
@@ -1134,9 +1134,8 @@ self->name = g_strdup(data[0]);
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 @@ as appropriate when the window is fullscreened */
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 @@ w = screen_area(self->desktop)->width / 2;
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];
M
openbox/prop.c
→
openbox/prop.c
@@ -352,11 +352,11 @@
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,
M
openbox/screen.c
→
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 @@ /* get the initial size */
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 @@ guint i;
/* 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);