- Wrap-around workspaces (ie. when on the last workspace, "switch_to_workspace_right" goes back to the first one)

This commit is contained in:
Bastien Nocera 2002-05-05 00:11:29 +00:00
parent 011a7f77a6
commit cf4ef8cab2
2 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2002-05-05 Bastien Nocera <hadess@hadess.net>
* 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 <andersca@gnu.org> 2002-05-05 Anders Carlsson <andersca@gnu.org>
* src/metacity.schemas: Fix a spelling error and change * src/metacity.schemas: Fix a spelling error and change

View File

@ -487,17 +487,24 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace,
/* FIXME this isn't using any sane layout, just assuming /* FIXME this isn't using any sane layout, just assuming
* the spaces are in a big row * the spaces are in a big row
*/ */
int i; int i, num_workspaces;
i = meta_workspace_index (workspace); 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) switch (direction)
{ {
case META_MOTION_LEFT: case META_MOTION_LEFT:
--i; --i;
if (i == -1)
i = num_workspaces - 1;
break; break;
case META_MOTION_RIGHT: case META_MOTION_RIGHT:
++i; ++i;
if (i == num_workspaces)
i = 0;
break; break;
case META_MOTION_UP: case META_MOTION_UP:
case META_MOTION_DOWN: case META_MOTION_DOWN: