X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fscreen.c;h=ffb9894f0b14b5355c53e8201d9bf47ff8caa6c7;hb=712475a9b597a5fa0877b4d3cf3c99aa586641ff;hp=174f64526b1708406090ac47e4353a514cc9e79a;hpb=d4b20aef313238e65d176822d44ee259b72e4f95;p=chaz%2Fopenbox diff --git a/openbox/screen.c b/openbox/screen.c index 174f6452..ffb9894f 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; @@ -48,7 +48,7 @@ gboolean screen_annex() XErrorHandler old; pid_t pid; int i, num_support; - Atom *supported; + guint32 *supported; running = FALSE; old = XSetErrorHandler(another_running); @@ -80,7 +80,7 @@ gboolean screen_annex() /* set the _NET_SUPPORTED_ATOMS hint */ num_support = 48; i = 0; - supported = g_new(Atom, num_support); + supported = g_new(guint32, num_support); supported[i++] = prop_atoms.net_current_desktop; supported[i++] = prop_atoms.net_number_of_desktops; supported[i++] = prop_atoms.net_desktop_geometry; @@ -159,6 +159,7 @@ void screen_startup() 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; @@ -312,7 +313,7 @@ void screen_update_layout() screen_desktop_layout.rows = 1; screen_desktop_layout.columns = screen_num_desktops; - if (PROP_GETA32(ob_root, net_desktop_layout, cardinal, data, &num)) { + if (PROP_GETA32(ob_root, net_desktop_layout, cardinal, &data, &num)) { if (num == 3 || num == 4) { if (data[0] == prop_atoms.net_wm_orientation_vert) screen_desktop_layout.orientation = data[0]; @@ -377,13 +378,16 @@ void screen_update_desktop_names() /* empty the array */ g_strfreev(screen_desktop_names); + screen_desktop_names = NULL; - PROP_GETSS(ob_root, net_desktop_names, utf8, &screen_desktop_names); - - for (i = 0; screen_desktop_names[i] && i < screen_num_desktops; ++i); - if (i < screen_num_desktops) { + 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; + if (i <= screen_num_desktops) { screen_desktop_names = g_renew(char*, screen_desktop_names, screen_num_desktops + 1); + screen_desktop_names[screen_num_desktops] = NULL; for (; i < screen_num_desktops; ++i) screen_desktop_names[i] = g_strdup("Unnamed Desktop"); }