diff --git a/src/core/window-private.h b/src/core/window-private.h index c08880696..b2694a9e3 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -130,6 +130,9 @@ struct _MetaWindow /* Whether we're fullscreen */ guint fullscreen : 1; + /* Whether the urgent flag of WM_HINTS is set */ + guint wm_hints_urgent : 1; + /* Area to cover when in fullscreen mode. If _NET_WM_FULLSCREEN_MONITORS has * been overridden (via a client message), the window will cover the union of * these monitors. If not, this is the single monitor which the window's diff --git a/src/core/window-props.c b/src/core/window-props.c index 7047b467b..4e145022f 100644 --- a/src/core/window-props.c +++ b/src/core/window-props.c @@ -1350,8 +1350,10 @@ reload_wm_hints (MetaWindow *window, gboolean initial) { Window old_group_leader; - + gboolean old_urgent; + old_group_leader = window->xgroup_leader; + old_urgent = window->wm_hints_urgent; /* Fill in defaults */ window->input = TRUE; @@ -1359,7 +1361,8 @@ reload_wm_hints (MetaWindow *window, window->xgroup_leader = None; window->wm_hints_pixmap = None; window->wm_hints_mask = None; - + window->wm_hints_urgent = FALSE; + if (value->type != META_PROP_VALUE_INVALID) { const XWMHints *hints = value->v.wm_hints; @@ -1378,7 +1381,10 @@ reload_wm_hints (MetaWindow *window, if (hints->flags & IconMaskHint) window->wm_hints_mask = hints->icon_mask; - + + if (hints->flags & XUrgencyHint) + window->wm_hints_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, window->xgroup_leader, @@ -1394,6 +1400,12 @@ 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"); + 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 0175e6eb2..4b8397711 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -139,7 +139,8 @@ enum { PROP_FULLSCREEN, PROP_WINDOW_TYPE, PROP_USER_TIME, - PROP_DEMANDS_ATTENTION + PROP_DEMANDS_ATTENTION, + PROP_URGENT }; enum @@ -212,6 +213,9 @@ meta_window_get_property(GObject *object, case PROP_DEMANDS_ATTENTION: g_value_set_boolean (value, win->wm_state_demands_attention); break; + case PROP_URGENT: + g_value_set_boolean (value, win->wm_hints_urgent); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -308,6 +312,14 @@ meta_window_class_init (MetaWindowClass *klass) FALSE, G_PARAM_READABLE)); + g_object_class_install_property (object_class, + PROP_URGENT, + g_param_spec_boolean ("urgent", + "Urgent", + "Whether the urgent flag of WM_HINTS is set", + FALSE, + G_PARAM_READABLE)); + window_signals[WORKSPACE_CHANGED] = g_signal_new ("workspace-changed", G_TYPE_FROM_CLASS (object_class), @@ -700,6 +712,7 @@ meta_window_new_with_attrs (MetaDisplay *display, meta_icon_cache_init (&window->icon_cache); window->wm_hints_pixmap = None; window->wm_hints_mask = None; + window->wm_hints_urgent = FALSE; window->frame = NULL; window->has_focus = FALSE;