Commit 23fabedc authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

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.
parent 015b3c56
......@@ -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().
......
......@@ -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().
......
......@@ -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().
......
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.
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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,
......
......@@ -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
......
......@@ -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 */
......
......@@ -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
......
......@@ -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
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment