[mutter/wayland] window: Move urgency to a setter



commit 6efcf2526dac10b589d9c9edca59dc1dfe8cc0b7
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Mar 18 13:51:36 2014 -0400

    window: Move urgency to a setter

 src/core/window-private.h |    3 +++
 src/core/window.c         |   17 ++++++++++++++---
 src/x11/window-props.c    |   22 ++++------------------
 3 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index e7c0d4d..f463360 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -726,4 +726,7 @@ gboolean meta_window_is_client_decorated (MetaWindow *window);
 
 void meta_window_update_monitor (MetaWindow *window);
 
+void meta_window_set_urgent (MetaWindow *window,
+                             gboolean    urgent);
+
 #endif
diff --git a/src/core/window.c b/src/core/window.c
index 7f507f1..4962265 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1269,9 +1269,6 @@ _meta_window_shared_new (MetaDisplay         *display,
   if (window->wm_state_demands_attention)
     g_signal_emit_by_name (window->display, "window-demands-attention", window);
 
-  if (window->wm_hints_urgent)
-    g_signal_emit_by_name (window->display, "window-marked-urgent", window);
-
   return window;
 }
 
@@ -10376,3 +10373,17 @@ meta_window_allows_resize (MetaWindow *window)
 {
   return META_WINDOW_ALLOWS_RESIZE (window);
 }
+
+void
+meta_window_set_urgent (MetaWindow *window,
+                        gboolean    urgent)
+{
+  if (window->wm_hints_urgent == urgent)
+    return;
+
+  window->wm_hints_urgent = urgent;
+  g_object_notify_by_pspec (window, props[PROP_URGENT]);
+
+  if (urgent)
+    g_signal_emit_by_name (window->display, "window-marked-urgent", window);
+}
diff --git a/src/x11/window-props.c b/src/x11/window-props.c
index 3d54765..b1bd6e1 100644
--- a/src/x11/window-props.c
+++ b/src/x11/window-props.c
@@ -1460,10 +1460,9 @@ reload_wm_hints (MetaWindow    *window,
                  gboolean       initial)
 {
   Window old_group_leader;
-  gboolean old_urgent;
+  gboolean urgent;
 
   old_group_leader = window->xgroup_leader;
-  old_urgent = window->wm_hints_urgent;
   
   /* Fill in defaults */
   window->input = TRUE;
@@ -1471,7 +1470,7 @@ reload_wm_hints (MetaWindow    *window,
   window->xgroup_leader = None;
   window->wm_hints_pixmap = None;
   window->wm_hints_mask = None;
-  window->wm_hints_urgent = FALSE;
+  urgent = FALSE;
 
   if (value->type != META_PROP_VALUE_INVALID)
     {
@@ -1493,7 +1492,7 @@ reload_wm_hints (MetaWindow    *window,
         window->wm_hints_mask = hints->icon_mask;
 
       if (hints->flags & XUrgencyHint)
-        window->wm_hints_urgent = TRUE;
+        urgent = TRUE;
 
       meta_verbose ("Read WM_HINTS input: %d iconic: %d group leader: 0x%lx pixmap: 0x%lx mask: 0x%lx\n",
                     window->input, window->initially_iconic,
@@ -1510,20 +1509,7 @@ reload_wm_hints (MetaWindow    *window,
       meta_window_group_leader_changed (window);
     }
 
-  /*
-   * Do not emit urgency notification on the inital property load
-   */
-  if (!initial && (window->wm_hints_urgent != old_urgent))
-    g_object_notify (G_OBJECT (window), "urgent");
-
-  /*
-   * Do not emit signal for the initial property load, let the constructor to
-   * take care of it once the MetaWindow is fully constructed.
-   *
-   * Only emit if the property is both changed and set.
-   */
-  if (!initial && window->wm_hints_urgent && !old_urgent)
-    g_signal_emit_by_name (window->display, "window-marked-urgent", window);
+  meta_window_set_urgent (window, urgent);
 
   meta_icon_cache_property_changed (&window->icon_cache,
                                     window->display,


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