[MetaWindow] Added boolean demands-attention property

https://bugzilla.gnome.org/show_bug.cgi?id=588065
This commit is contained in:
Tomas Frydrych 2009-11-17 10:02:06 +00:00
parent fb45b8f45c
commit 2a14deab0c

View File

@ -138,7 +138,8 @@ enum {
PROP_DECORATED, PROP_DECORATED,
PROP_FULLSCREEN, PROP_FULLSCREEN,
PROP_WINDOW_TYPE, PROP_WINDOW_TYPE,
PROP_USER_TIME PROP_USER_TIME,
PROP_DEMANDS_ATTENTION
}; };
enum enum
@ -208,6 +209,9 @@ meta_window_get_property(GObject *object,
case PROP_USER_TIME: case PROP_USER_TIME:
g_value_set_uint (value, win->net_wm_user_time); g_value_set_uint (value, win->net_wm_user_time);
break; break;
case PROP_DEMANDS_ATTENTION:
g_value_set_boolean (value, win->wm_state_demands_attention);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -296,6 +300,14 @@ meta_window_class_init (MetaWindowClass *klass)
0, 0,
G_PARAM_READABLE)); G_PARAM_READABLE));
g_object_class_install_property (object_class,
PROP_DEMANDS_ATTENTION,
g_param_spec_boolean ("demands-attention",
"Demands Attention",
"Whether the window has _NET_WM_STATE_DEMANDS_ATTENTION set",
FALSE,
G_PARAM_READABLE));
window_signals[WORKSPACE_CHANGED] = window_signals[WORKSPACE_CHANGED] =
g_signal_new ("workspace-changed", g_signal_new ("workspace-changed",
G_TYPE_FROM_CLASS (object_class), G_TYPE_FROM_CLASS (object_class),
@ -2399,6 +2411,7 @@ meta_window_show (MetaWindow *window)
MetaWindow *focus_window; MetaWindow *focus_window;
gboolean toplevel_was_mapped; gboolean toplevel_was_mapped;
gboolean toplevel_now_mapped; gboolean toplevel_now_mapped;
gboolean notify_demands_attention = FALSE;
meta_topic (META_DEBUG_WINDOW_STATE, meta_topic (META_DEBUG_WINDOW_STATE,
"Showing window %s, shaded: %d iconic: %d placed: %d\n", "Showing window %s, shaded: %d iconic: %d placed: %d\n",
@ -2533,7 +2546,13 @@ meta_window_show (MetaWindow *window)
* which we are going to call ourselves here a few lines down. * which we are going to call ourselves here a few lines down.
*/ */
if (overlap) if (overlap)
{
if (!window->wm_state_demands_attention)
{
window->wm_state_demands_attention = TRUE; window->wm_state_demands_attention = TRUE;
notify_demands_attention = TRUE;
}
}
} }
/* Shaded means the frame is mapped but the window is not */ /* Shaded means the frame is mapped but the window is not */
@ -2651,6 +2670,9 @@ meta_window_show (MetaWindow *window)
* See http://bugzilla.gnome.org/show_bug.cgi?id=573922 * See http://bugzilla.gnome.org/show_bug.cgi?id=573922
*/ */
window->initial_timestamp_set = FALSE; window->initial_timestamp_set = FALSE;
if (notify_demands_attention)
g_object_notify (G_OBJECT (window), "demands-attention");
} }
static void static void
@ -8594,6 +8616,10 @@ meta_window_set_demands_attention (MetaWindow *window)
gboolean obscured = FALSE; gboolean obscured = FALSE;
MetaWorkspace *workspace = window->screen->active_workspace; MetaWorkspace *workspace = window->screen->active_workspace;
if (window->wm_state_demands_attention)
return;
if (workspace!=window->workspace) if (workspace!=window->workspace)
{ {
/* windows on other workspaces are necessarily obscured */ /* windows on other workspaces are necessarily obscured */
@ -8637,6 +8663,7 @@ meta_window_set_demands_attention (MetaWindow *window)
window->wm_state_demands_attention = TRUE; window->wm_state_demands_attention = TRUE;
set_net_wm_state (window); set_net_wm_state (window);
g_object_notify (G_OBJECT (window), "demands-attention");
} }
else else
{ {
@ -8655,8 +8682,12 @@ meta_window_unset_demands_attention (MetaWindow *window)
meta_topic (META_DEBUG_WINDOW_OPS, meta_topic (META_DEBUG_WINDOW_OPS,
"Marking %s as not needing attention\n", window->desc); "Marking %s as not needing attention\n", window->desc);
if (window->wm_state_demands_attention)
{
window->wm_state_demands_attention = FALSE; window->wm_state_demands_attention = FALSE;
set_net_wm_state (window); set_net_wm_state (window);
g_object_notify (G_OBJECT (window), "demands-attention");
}
} }
MetaFrame * MetaFrame *