[MetaWindow] added urgent property

Property tracking ICCCM urgency hint

https://bugzilla.gnome.org/show_bug.cgi?id=600068
This commit is contained in:
Tomas Frydrych 2009-11-20 08:51:19 +00:00
parent 01ce961c00
commit 0ccfb0d781
3 changed files with 32 additions and 4 deletions

View File

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

View File

@ -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);

View File

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