From 5e2c66e241ce6f9a6e4fe28290ae63b8b1520dce Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Tue, 17 Nov 2009 10:24:18 +0000 Subject: [PATCH] [MetaDisplay] added "window-marked-urgent" signal Having a MetaDisplay window-marked-urgent signal when a window sets its urgent hint allows for centralized processing https://bugzilla.gnome.org/show_bug.cgi?id=600068 --- src/core/display.c | 11 +++++++++++ src/core/window-props.c | 9 +++++++++ src/core/window.c | 3 +++ 3 files changed, 23 insertions(+) diff --git a/src/core/display.c b/src/core/display.c index 5b08eac9b..6995f95d1 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -131,6 +131,7 @@ enum FOCUS_WINDOW, WINDOW_CREATED, WINDOW_DEMANDS_ATTENTION, + WINDOW_MARKED_URGENT, LAST_SIGNAL }; @@ -246,6 +247,16 @@ meta_display_class_init (MetaDisplayClass *klass) g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, META_TYPE_WINDOW); + display_signals[WINDOW_MARKED_URGENT] = + g_signal_new ("window-marked-urgent", + 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, g_param_spec_object ("focus-window", diff --git a/src/core/window-props.c b/src/core/window-props.c index 4e145022f..4d951194f 100644 --- a/src/core/window-props.c +++ b/src/core/window-props.c @@ -1406,6 +1406,15 @@ reload_wm_hints (MetaWindow *window, 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_icon_cache_property_changed (&window->icon_cache, window->display, XA_WM_HINTS); diff --git a/src/core/window.c b/src/core/window.c index 4b8397711..be4cfbc1b 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -1125,6 +1125,9 @@ meta_window_new_with_attrs (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; }