window: Move urgency to a setter

This commit is contained in:
Jasper St. Pierre 2014-03-18 13:51:36 -04:00
parent d6a27195d3
commit 6efcf2526d
3 changed files with 21 additions and 21 deletions

View File

@ -726,4 +726,7 @@ gboolean meta_window_is_client_decorated (MetaWindow *window);
void meta_window_update_monitor (MetaWindow *window);
void meta_window_set_urgent (MetaWindow *window,
gboolean urgent);
#endif

View File

@ -1269,9 +1269,6 @@ _meta_window_shared_new (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;
}
@ -10376,3 +10373,17 @@ meta_window_allows_resize (MetaWindow *window)
{
return META_WINDOW_ALLOWS_RESIZE (window);
}
void
meta_window_set_urgent (MetaWindow *window,
gboolean urgent)
{
if (window->wm_hints_urgent == urgent)
return;
window->wm_hints_urgent = urgent;
g_object_notify_by_pspec (window, props[PROP_URGENT]);
if (urgent)
g_signal_emit_by_name (window->display, "window-marked-urgent", window);
}

View File

@ -1460,10 +1460,9 @@ reload_wm_hints (MetaWindow *window,
gboolean initial)
{
Window old_group_leader;
gboolean old_urgent;
gboolean urgent;
old_group_leader = window->xgroup_leader;
old_urgent = window->wm_hints_urgent;
/* Fill in defaults */
window->input = TRUE;
@ -1471,7 +1470,7 @@ reload_wm_hints (MetaWindow *window,
window->xgroup_leader = None;
window->wm_hints_pixmap = None;
window->wm_hints_mask = None;
window->wm_hints_urgent = FALSE;
urgent = FALSE;
if (value->type != META_PROP_VALUE_INVALID)
{
@ -1493,7 +1492,7 @@ reload_wm_hints (MetaWindow *window,
window->wm_hints_mask = hints->icon_mask;
if (hints->flags & XUrgencyHint)
window->wm_hints_urgent = TRUE;
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,
@ -1510,20 +1509,7 @@ 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");
/*
* 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_window_set_urgent (window, urgent);
meta_icon_cache_property_changed (&window->icon_cache,
window->display,