[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
This commit is contained in:
Tomas Frydrych 2009-10-28 17:19:24 +00:00
parent 2a14deab0c
commit 7579b691df
2 changed files with 19 additions and 1 deletions

View File

@ -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,

View File

@ -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
{