From 82b064ed7d1b58ccedbf955e62eb6bdae1ef260e Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Fri, 17 May 2002 01:48:57 +0000 Subject: [PATCH] fix it, maybe 2002-05-16 Havoc Pennington * src/workspace.c (meta_workspace_get_neighbor): fix it, maybe --- ChangeLog | 4 ++++ src/workspace.c | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7bf95c41d..1f05ccaf7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-05-16 Havoc Pennington + + * src/workspace.c (meta_workspace_get_neighbor): fix it, maybe + 2002-05-16 Havoc Pennington * src/window.c (constrain_position): lock desktop to position 0,0 diff --git a/src/workspace.c b/src/workspace.c index fa2a0bc0c..548e422e6 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -521,8 +521,6 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace, i = meta_workspace_index (workspace); num_workspaces = meta_screen_get_n_workspaces (workspace->screen); - - /* FIXME this code is entirely broken */ /* * 3 rows, 4 columns, horizontal layout: @@ -568,6 +566,10 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace, rows, cols, workspace->screen->vertical_workspaces, i, num_workspaces, direction); + + /* FIXME someone who's better or more patient at math puzzles + * should clean this up. ;-) + */ if (workspace->screen->vertical_workspaces) { switch (direction) @@ -584,7 +586,7 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace, break; case META_MOTION_RIGHT: if ((i + rows) >= num_workspaces) - i = i + rows - num_workspaces; + i = (i % rows + 1) % rows; else i += rows; break; @@ -626,7 +628,7 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace, break; case META_MOTION_DOWN: if ((i + cols) >= num_workspaces) - i = i + cols - num_workspaces; + i = (i % cols + 1) % cols; else i += cols; break;