[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
This commit is contained in:
Tomas Frydrych 2009-11-17 10:24:18 +00:00
parent 0ccfb0d781
commit 5e2c66e241
3 changed files with 23 additions and 0 deletions

View File

@ -131,6 +131,7 @@ enum
FOCUS_WINDOW, FOCUS_WINDOW,
WINDOW_CREATED, WINDOW_CREATED,
WINDOW_DEMANDS_ATTENTION, WINDOW_DEMANDS_ATTENTION,
WINDOW_MARKED_URGENT,
LAST_SIGNAL LAST_SIGNAL
}; };
@ -246,6 +247,16 @@ meta_display_class_init (MetaDisplayClass *klass)
g_cclosure_marshal_VOID__OBJECT, g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, META_TYPE_WINDOW); 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, g_object_class_install_property (object_class,
PROP_FOCUS_WINDOW, PROP_FOCUS_WINDOW,
g_param_spec_object ("focus-window", g_param_spec_object ("focus-window",

View File

@ -1406,6 +1406,15 @@ reload_wm_hints (MetaWindow *window,
if (!initial && (window->wm_hints_urgent != old_urgent)) if (!initial && (window->wm_hints_urgent != old_urgent))
g_object_notify (G_OBJECT (window), "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, meta_icon_cache_property_changed (&window->icon_cache,
window->display, window->display,
XA_WM_HINTS); XA_WM_HINTS);

View File

@ -1125,6 +1125,9 @@ meta_window_new_with_attrs (MetaDisplay *display,
if (window->wm_state_demands_attention) if (window->wm_state_demands_attention)
g_signal_emit_by_name (window->display, "window-demands-attention", window); 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; return window;
} }