[mutter] screen: signal workspace creation from client applications



commit d64c5bfc1178583b9f5cf23952b82d0ae1e7c087
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Tue Dec 6 15:41:27 2011 +0000

    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 <lionel g landwerlin linux intel com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=666015

 src/core/screen.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/core/screen.c b/src/core/screen.c
index 0fb7f08..14d40b1 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");
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]