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

@ -14,6 +14,25 @@
GDK_ACTION_COPY. Otherwise apps that check the suggested_action
field, like eog, won't accept dropped files.
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.
2005-06-17 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkcursor.h: Define GDK_IS_CURSOR() and GDK_CURSOR().

View File

@ -14,6 +14,25 @@
GDK_ACTION_COPY. Otherwise apps that check the suggested_action
field, like eog, won't accept dropped files.
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.
2005-06-17 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkcursor.h: Define GDK_IS_CURSOR() and GDK_CURSOR().

View File

@ -14,6 +14,25 @@
GDK_ACTION_COPY. Otherwise apps that check the suggested_action
field, like eog, won't accept dropped files.
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.
2005-06-17 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkcursor.h: Define GDK_IS_CURSOR() and GDK_CURSOR().

View File

@ -1,3 +1,8 @@
2005-06-17 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk-sections.txt:
* gdk/gdk-sections.txt: Add urgency hint API.
2005-06-14 Matthias Clasen <mclasen@redhat.com>
* gdk/gdk-sections.txt: Add new functions.

View File

@ -705,6 +705,7 @@ gdk_window_set_modal_hint
gdk_window_set_type_hint
gdk_window_set_skip_taskbar_hint
gdk_window_set_skip_pager_hint
gdk_window_set_urgency_hint
gdk_window_get_position
gdk_window_get_root_origin
gdk_window_get_frame_extents

View File

@ -4730,6 +4730,7 @@ gtk_window_set_role
gtk_window_set_type_hint
gtk_window_set_skip_taskbar_hint
gtk_window_set_skip_pager_hint
gtk_window_set_urgency_hint
gtk_window_set_accept_focus
gtk_window_set_focus_on_map
gtk_window_get_decorated
@ -4751,6 +4752,7 @@ gtk_window_get_transient_for
gtk_window_get_type_hint
gtk_window_get_skip_taskbar_hint
gtk_window_get_skip_pager_hint
gtk_window_get_urgency_hint
gtk_window_get_accept_focus
gtk_window_get_focus_on_map
gtk_window_move

View File

@ -708,6 +708,7 @@ gdk_window_set_type_hint
gdk_window_set_modal_hint
gdk_window_set_skip_taskbar_hint
gdk_window_set_skip_pager_hint
gdk_window_set_urgency_hint
gdk_window_set_geometry_hints
gdk_window_set_title
gdk_window_set_role

View File

@ -414,6 +414,8 @@ void gdk_window_set_skip_taskbar_hint (GdkWindow *window,
gboolean skips_taskbar);
void gdk_window_set_skip_pager_hint (GdkWindow *window,
gboolean skips_pager);
void gdk_window_set_urgency_hint (GdkWindow *window,
gboolean urgent);
void gdk_window_set_geometry_hints (GdkWindow *window,
GdkGeometry *geometry,

View File

@ -1270,6 +1270,9 @@ update_wm_hints (GdkWindow *window,
}
else
wm_hints.window_group = GDK_DISPLAY_X11 (display)->leader_window;
if (toplevel->urgency_hint)
wm_hints.flags |= XUrgencyHint;
XSetWMHints (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
@ -2342,6 +2345,34 @@ gdk_window_set_skip_pager_hint (GdkWindow *window,
NULL);
}
/**
* gdk_window_set_urgency_hint:
* @window: a toplevel #GdkWindow
* @urgent: %TRUE if the window is urgent
*
* Toggles whether a window needs the user's
* urgent attention.
*
* Since: 2.8
**/
void
gdk_window_set_urgency_hint (GdkWindow *window,
gboolean urgent)
{
GdkToplevelX11 *toplevel;
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD);
if (GDK_WINDOW_DESTROYED (window))
return;
toplevel = _gdk_x11_window_get_toplevel (window);
toplevel->urgency_hint = urgent;
update_wm_hints (window, FALSE);
}
/**
* gdk_window_set_geometry_hints:
* @window: a toplevel #GdkWindow

View File

@ -111,6 +111,7 @@ struct _GdkToplevelX11
/* Set if we are requesting these hints */
guint skip_taskbar_hint : 1;
guint skip_pager_hint : 1;
guint urgency_hint : 1;
guint on_all_desktops : 1; /* _NET_WM_STICKY == 0xFFFFFFFF */

View File

@ -3912,6 +3912,7 @@ gtk_window_get_screen
gtk_window_get_size
gtk_window_get_skip_pager_hint
gtk_window_get_skip_taskbar_hint
gtk_window_get_urgency_hint
gtk_window_get_title
gtk_window_get_transient_for
gtk_window_get_type G_GNUC_CONST
@ -3975,6 +3976,7 @@ gtk_window_set_role
gtk_window_set_screen
gtk_window_set_skip_pager_hint
gtk_window_set_skip_taskbar_hint
gtk_window_set_urgency_hint
gtk_window_set_title
gtk_window_set_transient_for
gtk_window_set_type_hint

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

View File

@ -204,6 +204,9 @@ gboolean gtk_window_get_skip_taskbar_hint (GtkWindow *window);
void gtk_window_set_skip_pager_hint (GtkWindow *window,
gboolean setting);
gboolean gtk_window_get_skip_pager_hint (GtkWindow *window);
void gtk_window_set_urgency_hint (GtkWindow *window,
gboolean setting);
gboolean gtk_window_get_urgency_hint (GtkWindow *window);
void gtk_window_set_accept_focus (GtkWindow *window,
gboolean setting);
gboolean gtk_window_get_accept_focus (GtkWindow *window);