diff --git a/ChangeLog b/ChangeLog index 7f305fd82..82b2ff1ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-08-14 Mark McLoughlin + + * src/screen.c: (set_number_of_spaces_hint), move from + workspace.c. + (update_num_workspaces): set the hint here. Fixes #90123. + + * src/workspace.c: + (meta_workspace_new), (meta_workspace_free): don't set + the hint here. + (update_num_workspaces): move to screen.c + 2002-08-12 Havoc Pennington * src/stack.c (compute_layer): window is in fullscreen layer if diff --git a/src/screen.c b/src/screen.c index 9319f7f4f..90f728b62 100644 --- a/src/screen.c +++ b/src/screen.c @@ -744,6 +744,27 @@ meta_screen_get_n_workspaces (MetaScreen *screen) return i; } +static int +set_number_of_spaces_hint (MetaScreen *screen, + int n_spaces) +{ + unsigned long data[1]; + + if (screen->closing > 0) + return 0; + + data[0] = n_spaces; + + meta_verbose ("Setting _NET_NUMBER_OF_DESKTOPS to %ld\n", data[0]); + + meta_error_trap_push (screen->display); + XChangeProperty (screen->display->xdisplay, screen->xroot, + screen->display->atom_net_number_of_desktops, + XA_CARDINAL, + 32, PropModeReplace, (guchar*) data, 1); + return meta_error_trap_pop (screen->display); +} + static void update_num_workspaces (MetaScreen *screen) { @@ -818,16 +839,14 @@ update_num_workspaces (MetaScreen *screen) g_list_free (extras); - /* Add missing workspaces. FIXME This will keep setting the - * number-of-workspaces root window property on each workspace - * creation, kind of a lame thing - */ while (i < new_num) { meta_workspace_new (screen); ++i; } + set_number_of_spaces_hint (screen, new_num); + meta_screen_queue_workarea_recalc (screen); } diff --git a/src/workspace.c b/src/workspace.c index 1e9e5b6a3..dedde22fa 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -27,7 +27,6 @@ void meta_workspace_queue_calc_showing (MetaWorkspace *workspace); -static int set_number_of_spaces_hint (MetaScreen *screen); static int set_active_space_hint (MetaScreen *screen); MetaWorkspace* @@ -51,9 +50,6 @@ meta_workspace_new (MetaScreen *screen) workspace->name = g_strdup_printf (_("Workspace %d"), meta_workspace_index (workspace) + 1); - /* Update hint for current number of workspaces */ - set_number_of_spaces_hint (screen); - return workspace; } @@ -94,8 +90,6 @@ meta_workspace_free (MetaWorkspace *workspace) g_free (workspace); - /* Update hint for current number of workspaces */ - set_number_of_spaces_hint (screen); /* don't bother to reset names, pagers can just ignore * extra ones */ @@ -308,26 +302,6 @@ meta_workspace_list_windows (MetaWorkspace *workspace) return workspace_windows; } -static int -set_number_of_spaces_hint (MetaScreen *screen) -{ - unsigned long data[1]; - - if (screen->closing > 0) - return 0; - - data[0] = meta_screen_get_n_workspaces (screen); - - meta_verbose ("Setting _NET_NUMBER_OF_DESKTOPS to %ld\n", data[0]); - - meta_error_trap_push (screen->display); - XChangeProperty (screen->display->xdisplay, screen->xroot, - screen->display->atom_net_number_of_desktops, - XA_CARDINAL, - 32, PropModeReplace, (guchar*) data, 1); - return meta_error_trap_pop (screen->display); -} - static int set_active_space_hint (MetaScreen *screen) {