Support the ICCCM urgency hint. (#61858, Havoc Pennington)

2005-06-17  Matthias Clasen  <mclasen@redhat.com>

	Support the ICCCM urgency hint.  (#61858, Havoc Pennington)

	* gtk/gtk.symbols:
	* gtk/gtkwindow.[hc]: Add a GtkWindow::urgency-hint property
	with getter and setter.

	* gdk/gdk.symbols:
	* gdk/gdkwindow.h:
	* gdk/x11/gdkwindow-x11.c (gdk_window_set_urgency_hint):
	Add a setter for the urgency hint.

	* gdk/x11/gdkwindow-x11.h (struct _GdkToplevelX11): Store
	urgency hint here.

	* gdk/x11/gdkwindow-x11.c (update_wm_hints): Set the urgency
	hint in the WM_HINTS property when appropriate.
This commit is contained in:
Matthias Clasen
2005-06-17 20:19:32 +00:00
committed by Matthias Clasen
parent 015b3c5671
commit 23fabedc9d
13 changed files with 177 additions and 0 deletions

View File

@ -82,6 +82,7 @@ enum {
PROP_TYPE_HINT,
PROP_SKIP_TASKBAR_HINT,
PROP_SKIP_PAGER_HINT,
PROP_URGENCY_HINT,
PROP_ACCEPT_FOCUS,
PROP_FOCUS_ON_MAP,
PROP_DECORATED,
@ -165,6 +166,7 @@ struct _GtkWindowPrivate
guint fullscreen_initially : 1;
guint skips_taskbar : 1;
guint skips_pager : 1;
guint urgent : 1;
guint accept_focus : 1;
guint focus_on_map : 1;
};
@ -580,6 +582,14 @@ gtk_window_class_init (GtkWindowClass *klass)
FALSE,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_URGENCY_HINT,
g_param_spec_boolean ("urgency-hint",
P_("Urgent"),
P_("TRUE if the window should be brought to the user's attention."),
FALSE,
GTK_PARAM_READWRITE));
/**
* GtkWindow:accept-focus-hint:
*
@ -868,6 +878,10 @@ gtk_window_set_property (GObject *object,
gtk_window_set_skip_pager_hint (window,
g_value_get_boolean (value));
break;
case PROP_URGENCY_HINT:
gtk_window_set_urgency_hint (window,
g_value_get_boolean (value));
break;
case PROP_ACCEPT_FOCUS:
gtk_window_set_accept_focus (window,
g_value_get_boolean (value));
@ -968,6 +982,10 @@ gtk_window_get_property (GObject *object,
g_value_set_boolean (value,
gtk_window_get_skip_pager_hint (window));
break;
case PROP_URGENCY_HINT:
g_value_set_boolean (value,
gtk_window_get_urgency_hint (window));
break;
case PROP_ACCEPT_FOCUS:
g_value_set_boolean (value,
gtk_window_get_accept_focus (window));
@ -2057,6 +2075,60 @@ gtk_window_get_skip_pager_hint (GtkWindow *window)
return priv->skips_pager;
}
/**
* gtk_window_set_urgency_hint:
* @window: a #GtkWindow
* @setting: %TRUE to mark this window as urgent
*
* Windows may set a hint asking the desktop environment to draw
* the users attention to the window. This function sets this hint.
*
* Since: 2.8
**/
void
gtk_window_set_urgency_hint (GtkWindow *window,
gboolean setting)
{
GtkWindowPrivate *priv;
g_return_if_fail (GTK_IS_WINDOW (window));
priv = GTK_WINDOW_GET_PRIVATE (window);
setting = setting != FALSE;
if (priv->urgent != setting)
{
priv->urgent = setting;
if (GTK_WIDGET_REALIZED (window))
gdk_window_set_urgency_hint (GTK_WIDGET (window)->window,
priv->urgent);
g_object_notify (G_OBJECT (window), "urgency-hint");
}
}
/**
* gtk_window_get_urgency_hint:
* @window: a #GtkWindow
*
* Gets the value set by gtk_window_set_urgency_hint()
*
* Return value: %TRUE if window is urgent
*
* Since: 2.8
**/
gboolean
gtk_window_get_urgency_hint (GtkWindow *window)
{
GtkWindowPrivate *priv;
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
priv = GTK_WINDOW_GET_PRIVATE (window);
return priv->urgent;
}
/**
* gtk_window_set_accept_focus:
* @window: a #GtkWindow