Update _NET_CURRENT_DESKTOP on workspace removal

When we delete a workspace before the active workspace, we need
to upate the _NET_CURRENT_DESKTOP since the active workspace index
changes. To do this workspace.c:set_active_space_hint() is moved
to screen.c:meta_screen_set_active_workspace_hint() so that it
can be shared.

https://bugzilla.gnome.org/show_bug.cgi?id=640581
This commit is contained in:
Owen W. Taylor
2011-01-25 16:27:31 -05:00
parent ad707be01e
commit 4c4c720dc1
3 changed files with 37 additions and 28 deletions

View File

@ -24,6 +24,7 @@
*/
#include <config.h>
#include "screen-private.h"
#include "workspace.h"
#include "workspace-private.h"
#include "boxes-private.h"
@ -45,7 +46,6 @@ enum {
};
void meta_workspace_queue_calc_showing (MetaWorkspace *workspace);
static void set_active_space_hint (MetaScreen *screen);
static void focus_ancestor_or_mru_window (MetaWorkspace *workspace,
MetaWindow *not_this_one,
guint32 timestamp);
@ -557,7 +557,7 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
workspace->screen->active_workspace = workspace;
set_active_space_hint (workspace->screen);
meta_screen_set_active_workspace_hint (workspace->screen);
/* If the "show desktop" mode is active for either the old workspace
* or the new one *but not both*, then update the
@ -752,32 +752,6 @@ meta_workspace_list_windows (MetaWorkspace *workspace)
return workspace_windows;
}
static void
set_active_space_hint (MetaScreen *screen)
{
unsigned long data[1];
/* this is because we destroy the spaces in order,
* so we always end up setting a current desktop of
* 0 when closing a screen, so lose the current desktop
* on restart. By doing this we keep the current
* desktop on restart.
*/
if (screen->closing > 0)
return;
data[0] = meta_workspace_index (screen->active_workspace);
meta_verbose ("Setting _NET_CURRENT_DESKTOP to %lu\n", data[0]);
meta_error_trap_push (screen->display);
XChangeProperty (screen->display->xdisplay, screen->xroot,
screen->display->atom__NET_CURRENT_DESKTOP,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (screen->display);
}
void
meta_workspace_invalidate_work_area (MetaWorkspace *workspace)
{