From d64c5bfc1178583b9f5cf23952b82d0ae1e7c087 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Tue, 6 Dec 2011 15:41:27 +0000 Subject: [PATCH] screen: signal workspace creation from client applications Using an external application using libwnck an external application can create a new workspace by moving a window into it. In this case we are currently missing a "workspace-added" signal emission. Signed-off-by: Lionel Landwerlin https://bugzilla.gnome.org/show_bug.cgi?id=666015 --- src/core/screen.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/core/screen.c b/src/core/screen.c index 0fb7f08cb..14d40b1ee 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -1554,7 +1554,7 @@ static void update_num_workspaces (MetaScreen *screen, guint32 timestamp) { - int new_num; + int new_num, old_num; GList *tmp; int i; GList *extras; @@ -1584,6 +1584,7 @@ update_num_workspaces (MetaScreen *screen, ++i; tmp = tmp->next; } + old_num = i; g_assert (last_remaining); @@ -1618,22 +1619,22 @@ update_num_workspaces (MetaScreen *screen, g_assert (w->windows == NULL); meta_workspace_remove (w); - + tmp = tmp->next; } - + g_list_free (extras); - - while (i < new_num) - { - meta_workspace_new (screen); - ++i; - } + + for (i = old_num; i < new_num; i++) + meta_workspace_new (screen); set_number_of_spaces_hint (screen, new_num); meta_screen_queue_workarea_recalc (screen); + for (i = old_num; i < new_num; i++) + g_signal_emit (screen, screen_signals[WORKSPACE_ADDED], 0, i); + g_object_notify (G_OBJECT (screen), "n-workspaces"); }