[mutter] screen: Fix workspace removal
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] screen: Fix workspace removal
- Date: Sat, 16 Aug 2014 18:59:45 +0000 (UTC)
commit 32cf4afb0487d39d70e3a4134266aad3a1e396fd
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sat Aug 16 14:49:18 2014 -0400
screen: Fix workspace removal
I accidentally broke this in commit a119ea9. The code was considerably
more complicated than it needs to be, so let's replace it with a
g_list_find and nothing more.
src/core/screen.c | 38 ++++++++++++++------------------------
1 files changed, 14 insertions(+), 24 deletions(-)
---
diff --git a/src/core/screen.c b/src/core/screen.c
index bae56f8..545050c 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -1073,38 +1073,28 @@ meta_screen_remove_workspace (MetaScreen *screen, MetaWorkspace *workspace,
guint32 timestamp)
{
GList *l;
+ GList *next;
MetaWorkspace *neighbour = NULL;
- GList *next = NULL;
int index;
gboolean active_index_changed;
int new_num;
- for (l = screen->workspaces; l != NULL; l = next)
- {
- MetaWorkspace *w = l->data;
-
- if (w == workspace)
- {
- if (l->next)
- next = l->next;
+ l = g_list_find (screen->workspaces, workspace);
+ if (!l)
+ return;
- if (l->prev)
- neighbour = l->prev->data;
- else if (l->next)
- neighbour = l->next->data;
- else
- {
- /* Cannot remove the only workspace! */
- return;
- }
+ next = l->next;
- break;
- }
+ if (l->prev)
+ neighbour = l->prev->data;
+ else if (l->next)
+ neighbour = l->next->data;
+ else
+ {
+ /* Cannot remove the only workspace! */
+ return;
}
- if (!neighbour)
- return;
-
meta_workspace_relocate_windows (workspace, neighbour);
if (workspace == screen->active_workspace)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]