[mutter] [MetaDisplay] Added window-demands-attention signal



commit 7579b691dfb7ce4f9e86325210de00dbdbd295eb
Author: Tomas Frydrych <tf linux intel com>
Date:   Wed Oct 28 17:19:24 2009 +0000

    [MetaDisplay] Added window-demands-attention signal
    
    Having a MetaDisplay::window-demands-attention signal allows to deal with
    windows demanding attention in a cetralized fashion.
    
    The signal is emitted when a window is created with initial demands-attention
    state and/or when the state changes later on.
    
    Based on original patch by Jon Nettleton.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=597052

 src/core/display.c |    9 +++++++++
 src/core/window.c  |   11 ++++++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 2001faa..5b08eac 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -130,6 +130,7 @@ enum
   OVERLAY_KEY,
   FOCUS_WINDOW,
   WINDOW_CREATED,
+  WINDOW_DEMANDS_ATTENTION,
   LAST_SIGNAL
 };
 
@@ -236,6 +237,14 @@ meta_display_class_init (MetaDisplayClass *klass)
                   g_cclosure_marshal_VOID__OBJECT,
                   G_TYPE_NONE, 1, META_TYPE_WINDOW);
 
+  display_signals[WINDOW_DEMANDS_ATTENTION] =
+    g_signal_new ("window-demands-attention",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  0,
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__OBJECT,
+                  G_TYPE_NONE, 1, META_TYPE_WINDOW);
 
   g_object_class_install_property (object_class,
                                    PROP_FOCUS_WINDOW,
diff --git a/src/core/window.c b/src/core/window.c
index 3faab01..0175e6e 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1109,6 +1109,9 @@ meta_window_new_with_attrs (MetaDisplay       *display,
 
   meta_display_notify_window_created (display, window);
 
+  if (window->wm_state_demands_attention)
+    g_signal_emit_by_name (window->display, "window-demands-attention", window);
+
   return window;
 }
 
@@ -2672,7 +2675,11 @@ meta_window_show (MetaWindow *window)
   window->initial_timestamp_set = FALSE;
 
   if (notify_demands_attention)
-    g_object_notify (G_OBJECT (window), "demands-attention");
+    {
+      g_object_notify (G_OBJECT (window), "demands-attention");
+      g_signal_emit_by_name (window->display, "window-demands-attention",
+                             window);
+    }
 }
 
 static void
@@ -8664,6 +8671,8 @@ meta_window_set_demands_attention (MetaWindow *window)
       window->wm_state_demands_attention = TRUE;
       set_net_wm_state (window);
       g_object_notify (G_OBJECT (window), "demands-attention");
+      g_signal_emit_by_name (window->display, "window-demands-attention",
+                             window);
     }
   else
     {



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