diff options
author | Vincent Untz <vuntz@gnome.org> | 2007-06-18 10:59:45 +0000 |
---|---|---|
committer | Vincent Untz <vuntz@src.gnome.org> | 2007-06-18 10:59:45 +0000 |
commit | 75996ad08a684ca9923fd7bd72bbc11c3545e608 (patch) | |
tree | bf8974d6fe8c4abcdb3914ef7bc1f3a47126f301 | |
parent | 89893eeecfe8320aaa45cef63a996916884266c3 (diff) | |
download | libwnck-75996ad08a684ca9923fd7bd72bbc11c3545e608.tar.gz |
initializes data to some good values before fetching information from
2007-06-18 Vincent Untz <vuntz@gnome.org>
* libwnck/screen.c: (update_client_list), (update_workspace_list),
(update_viewport_settings), (update_workspace_layout):
* libwnck/window.c: (_wnck_window_create), (update_actions),
(update_wintype), (update_transient_for), (update_wmclass),
(update_frame_extents): initializes data to some good values before
fetching information from hints, since the fetches might fail.
* libwnck/screen.c: (update_workspace_list): be more solid against
invalid values of _NET_NUMBER_OF_DESKTOPS
svn path=/trunk/; revision=1319
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | libwnck/screen.c | 34 | ||||
-rw-r--r-- | libwnck/window.c | 14 |
3 files changed, 50 insertions, 10 deletions
@@ -1,5 +1,17 @@ 2007-06-18 Vincent Untz <vuntz@gnome.org> + * libwnck/screen.c: (update_client_list), (update_workspace_list), + (update_viewport_settings), (update_workspace_layout): + * libwnck/window.c: (_wnck_window_create), (update_actions), + (update_wintype), (update_transient_for), (update_wmclass), + (update_frame_extents): initializes data to some good values before + fetching information from hints, since the fetches might fail. + + * libwnck/screen.c: (update_workspace_list): be more solid against + invalid values of _NET_NUMBER_OF_DESKTOPS + +2007-06-18 Vincent Untz <vuntz@gnome.org> + * libwnck/tasklist.c: (wnck_tasklist_disconnect_screen): disconnect signal handlers for all windows (wnck_tasklist_disconnect_window): new diff --git a/libwnck/screen.c b/libwnck/screen.c index 29f1e68..8b22c37 100644 --- a/libwnck/screen.c +++ b/libwnck/screen.c @@ -1354,11 +1354,11 @@ static void update_client_list (WnckScreen *screen) { /* stacking order */ - Window *stack = NULL; - int stack_length = 0; + Window *stack; + int stack_length; /* mapping order */ - Window *mapping = NULL; - int mapping_length = 0; + Window *mapping; + int mapping_length; GList *new_stack_list; GList *new_list; GList *created; @@ -1382,11 +1382,15 @@ update_client_list (WnckScreen *screen) screen->priv->need_update_stack_list = FALSE; + stack = NULL; + stack_length = 0; _wnck_get_window_list (screen->priv->xroot, _wnck_atom_get ("_NET_CLIENT_LIST_STACKING"), &stack, &stack_length); + mapping = NULL; + mapping_length = 0; _wnck_get_window_list (screen->priv->xroot, _wnck_atom_get ("_NET_CLIENT_LIST"), &mapping, @@ -1657,9 +1661,16 @@ update_workspace_list (WnckScreen *screen) ++reentrancy_guard; n_spaces = 0; - _wnck_get_cardinal (screen->priv->xroot, - _wnck_atom_get ("_NET_NUMBER_OF_DESKTOPS"), - &n_spaces); + if (!_wnck_get_cardinal (screen->priv->xroot, + _wnck_atom_get ("_NET_NUMBER_OF_DESKTOPS"), + &n_spaces)) + n_spaces = 1; + + if (n_spaces <= 0) + { + g_warning ("Someone set a weird number of desktops in _NET_NUMBER_OF_DESKTOPS, assuming the value is 1\n"); + n_spaces = 1; + } old_n_spaces = g_list_length (screen->priv->workspaces); @@ -1780,6 +1791,8 @@ update_viewport_settings (WnckScreen *screen) space_width = wnck_screen_get_width (screen); space_height = wnck_screen_get_height (screen); + p_coord = NULL; + n_coord = 0; if (_wnck_get_cardinal_list (screen->priv->xroot, _wnck_atom_get ("_NET_DESKTOP_GEOMETRY"), &p_coord, &n_coord) && @@ -1811,6 +1824,8 @@ update_viewport_settings (WnckScreen *screen) got_viewport_prop = FALSE; + p_coord = NULL; + n_coord = 0; if (_wnck_get_cardinal_list (screen->priv->xroot, _wnck_atom_get ("_NET_DESKTOP_VIEWPORT"), &p_coord, &n_coord) && @@ -1930,14 +1945,13 @@ update_workspace_layout (WnckScreen *screen) gulong *list; int n_items; - list = NULL; - n_items = 0; - if (!screen->priv->need_update_workspace_layout) return; screen->priv->need_update_workspace_layout = FALSE; + list = NULL; + n_items = 0; if (_wnck_get_cardinal_list (screen->priv->xroot, _wnck_atom_get ("_NET_DESKTOP_LAYOUT"), &list, diff --git a/libwnck/window.c b/libwnck/window.c index 57fc7a8..abcda1c 100644 --- a/libwnck/window.c +++ b/libwnck/window.c @@ -435,6 +435,10 @@ _wnck_window_create (Window xwindow, window->priv->pid = _wnck_get_pid (window->priv->xwindow); + window->priv->x = 0; + window->priv->y = 0; + window->priv->width = 0; + window->priv->height = 0; _wnck_get_window_geometry (WNCK_SCREEN_XSCREEN (window->priv->screen), xwindow, &window->priv->x, @@ -2544,6 +2548,8 @@ update_actions (WnckWindow *window) window->priv->actions = 0; + atoms = NULL; + n_atoms = 0; if (!_wnck_get_atom_list (window->priv->xwindow, _wnck_atom_get ("_NET_WM_ALLOWED_ACTIONS"), &atoms, @@ -2650,6 +2656,8 @@ update_wintype (WnckWindow *window) found_type = FALSE; type = WNCK_WINDOW_NORMAL; + atoms = NULL; + n_atoms = 0; if (_wnck_get_atom_list (window->priv->xwindow, _wnck_atom_get ("_NET_WM_WINDOW_TYPE"), &atoms, @@ -2715,6 +2723,7 @@ update_transient_for (WnckWindow *window) window->priv->need_update_transient_for = FALSE; + parent = None; if (_wnck_get_window (window->priv->xwindow, _wnck_atom_get ("WM_TRANSIENT_FOR"), &parent) && @@ -2759,6 +2768,9 @@ update_wmclass (WnckWindow *window) g_free (window->priv->res_class); g_free (window->priv->res_name); + window->priv->res_class = NULL; + window->priv->res_name = NULL; + _wnck_get_wmclass (window->priv->xwindow, &window->priv->res_class, &window->priv->res_name); @@ -2807,6 +2819,8 @@ update_frame_extents (WnckWindow *window) window->priv->need_update_frame_extents = FALSE; + left = right = top = bottom = 0; + if (!_wnck_get_frame_extents (window->priv->xwindow, &left, &right, &top, &bottom)) return; |