diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2007-03-13 17:03:54 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@src.gnome.org> | 2007-03-13 17:03:54 +0000 |
commit | 87c28d778aeb173bede7a88029c76ccf5da04c09 (patch) | |
tree | a22bce1482aa547f6d66e06797987c5f4cf097d4 /gdk | |
parent | 500435f2f95c0fcc5fa3e49fa8c7814e5046aaf5 (diff) | |
download | gtk+-87c28d778aeb173bede7a88029c76ccf5da04c09.tar.gz |
Apply patch by Vytautas Liuolia for changing the startup notification id
2007-03-13 Emmanuele Bassi <ebassi@gnome.org>
Apply patch by Vytautas Liuolia for changing the startup
notification id on a window in the X11 backend. (#347375)
* gdk/gdk.h:
* gdk/gdkx.h:
* gdk/x11/gdkdisplay-x11.c: Add gdk_notify_startup_complete_wit_id()
and gdk_x11_display_get_startup_notification_id().
* gdk/gdkwindow.h:
* gdk/x11/gdkwindow-x11.c: Add gdk_window_set_startup_id().
* gtk/gtkwindow.h:
* gtk/gtkwindow.c: Add gtk_window_set_startup_id(), used to
change the startup notification id.
(gtk_window_class_init), (gtk_window_init),
(gtk_window_set_property): Add write-only "startup-id" property
to GtkWindow.
(gtk_window_realize): Set the startup notification id
on a GtkWindow if it's valid.
(gtk_window_map): If we have another valid startup notification
id then finish the notification process.
svn path=/trunk/; revision=17508
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdk.h | 2 | ||||
-rw-r--r-- | gdk/gdkwindow.h | 2 | ||||
-rw-r--r-- | gdk/x11/gdkdisplay-x11.c | 47 | ||||
-rw-r--r-- | gdk/x11/gdkwindow-x11.c | 34 | ||||
-rw-r--r-- | gdk/x11/gdkx.h | 2 |
5 files changed, 85 insertions, 2 deletions
@@ -177,6 +177,8 @@ gboolean gdk_event_send_client_message_for_display (GdkDisplay *display, void gdk_notify_startup_complete (void); +void gdk_notify_startup_complete_with_id (const gchar* startup_id); + /* Threading */ diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h index 8380aa56e3..be1fc2b1e3 100644 --- a/gdk/gdkwindow.h +++ b/gdk/gdkwindow.h @@ -482,6 +482,8 @@ void gdk_window_set_title (GdkWindow *window, const gchar *title); void gdk_window_set_role (GdkWindow *window, const gchar *role); +void gdk_window_set_startup_id (GdkWindow *window, + const gchar *startup_id); void gdk_window_set_transient_for (GdkWindow *window, GdkWindow *parent); void gdk_window_set_background (GdkWindow *window, diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index fa1524e0ad..ace29b2cfc 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -1079,7 +1079,36 @@ gdk_notify_startup_complete (void) if (!G_LIKELY (display_x11->trusted_client)) return; - escaped_id = escape_for_xmessage (display_x11->startup_notification_id); + gdk_notify_startup_complete_with_id (display_x11->startup_notification_id); +} + +/** + * gdk_notify_startup_complete_with_id: + * @startup_id: a startup-notification identifier, for which notification + * process should be completed + * + * Indicates to the GUI environment that the application has finished + * loading, using a given identifier. + * + * GTK+ will call this function automatically for #GtkWindow with custom + * startup-notification identifier unless + * gtk_window_set_auto_startup_notification() is called to disable + * that feature. + * + * Since: 2.12 + **/ +void +gdk_notify_startup_complete_with_id (const gchar* startup_id) +{ + GdkDisplay *display; + gchar *escaped_id; + gchar *message; + + display = gdk_display_get_default (); + if (!display) + return; + + escaped_id = escape_for_xmessage (startup_id); message = g_strdup_printf ("remove: ID=%s", escaped_id); g_free (escaped_id); @@ -1091,7 +1120,6 @@ gdk_notify_startup_complete (void) g_free (message); } - /** * gdk_display_supports_selection_notification: * @display: a #GdkDisplay @@ -1291,5 +1319,20 @@ gdk_display_supports_input_shapes (GdkDisplay *display) } +/** + * gdk_x11_display_get_startup_notification_id: + * @display: a #GdkDisplay + * + * Returns: the startup notification ID for + * @display. + * + * Since: 2.12 + */ +G_CONST_RETURN gchar * +gdk_x11_display_get_startup_notification_id (GdkDisplay *display) +{ + return GDK_DISPLAY_X11 (display)->startup_notification_id; +} + #define __GDK_DISPLAY_X11_C__ #include "gdkaliasdef.c" diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index dc46434775..c0226a6815 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -2897,6 +2897,40 @@ gdk_window_set_role (GdkWindow *window, } /** + * gdk_window_set_startup_id: + * @window: a toplevel #GdkWindow + * @startup_id: a string with startup-notification identifier + * + * When using GTK+, typically you should use gtk_window_set_startup_id() + * instead of this low-level function. + * + * Since: 2.12 + * + **/ +void +gdk_window_set_startup_id (GdkWindow *window, + const gchar *startup_id) +{ + GdkDisplay *display; + + g_return_if_fail (GDK_IS_WINDOW (window)); + + display = gdk_drawable_get_display (window); + + if (!GDK_WINDOW_DESTROYED (window)) + { + if (startup_id) + XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), + gdk_x11_get_xatom_by_name_for_display (display, "_NET_STARTUP_ID"), + gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8, + PropModeReplace, startup_id, strlen (startup_id)); + else + XDeleteProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), + gdk_x11_get_xatom_by_name_for_display (display, "_NET_STARTUP_ID")); + } +} + +/** * gdk_window_set_transient_for: * @window: a toplevel #GdkWindow * @parent: another toplevel #GdkWindow diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h index f07a5883e7..9563e1b814 100644 --- a/gdk/x11/gdkx.h +++ b/gdk/x11/gdkx.h @@ -142,6 +142,8 @@ gpointer gdk_xid_table_lookup_for_display (GdkDisplay *display, guint32 gdk_x11_get_server_time (GdkWindow *window); guint32 gdk_x11_display_get_user_time (GdkDisplay *display); +G_CONST_RETURN gchar *gdk_x11_display_get_startup_notification_id (GdkDisplay *display); + void gdk_x11_display_set_cursor_theme (GdkDisplay *display, const gchar *theme, const gint size); |