diff --git a/ChangeLog b/ChangeLog index d2d048e09..e89b290c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-05-05 Bastien Nocera + + * src/workspace.c: (meta_workspace_get_neighbor): + Wrap-around workspaces (ie. when on the last workspace, + "switch_to_workspace_right" goes back to the + first one) + 2002-05-05 Anders Carlsson * src/metacity.schemas: Fix a spelling error and change diff --git a/src/workspace.c b/src/workspace.c index 5e45375dd..44ba51b3d 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -487,17 +487,24 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace, /* FIXME this isn't using any sane layout, just assuming * the spaces are in a big row */ - int i; + int i, num_workspaces; i = meta_workspace_index (workspace); + /* Wrap from the last workspace to the first one, and vice-versa */ + num_workspaces = g_list_length (workspace->screen->display->workspaces); + switch (direction) { case META_MOTION_LEFT: --i; + if (i == -1) + i = num_workspaces - 1; break; case META_MOTION_RIGHT: ++i; + if (i == num_workspaces) + i = 0; break; case META_MOTION_UP: case META_MOTION_DOWN: