From beaa11be9843963190490bc239aa4adc83600d3f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 13 Dec 2010 20:46:00 -0500 Subject: [PATCH] Add a vfunc for gdk_notify_startup_complete At the same time, add a display api for this, since it really is per-display. --- gdk/gdk.symbols | 1 + gdk/gdkdisplay.c | 53 ++++++++++++++++++++++++++++++ gdk/gdkdisplay.h | 3 +- gdk/gdkdisplayprivate.h | 3 ++ gdk/x11/gdkdisplay-x11.c | 70 ++++++++-------------------------------- 5 files changed, 72 insertions(+), 58 deletions(-) diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index d47c4e25dd..6093cc44b6 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -109,6 +109,7 @@ gdk_display_manager_get_default_display gdk_display_manager_get_type G_GNUC_CONST gdk_display_manager_list_displays gdk_display_manager_set_default_display +gdk_display_notify_startup_complete gdk_display_open gdk_display_open_default_libgtk_only gdk_display_peek_event diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index d78e7c9387..321c6cb17e 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -2449,3 +2449,56 @@ _gdk_display_get_next_serial (GdkDisplay *display) { return GDK_DISPLAY_GET_CLASS (display)->get_next_serial (display); } + + +/** + * gdk_notify_startup_complete: + * + * Indicates to the GUI environment that the application has finished + * loading. If the applications opens windows, this function is + * normally called after opening the application's initial set of + * windows. + * + * GTK+ will call this function automatically after opening the first + * #GtkWindow unless gtk_window_set_auto_startup_notification() is called + * to disable that feature. + * + * Since: 2.2 + **/ +void +gdk_notify_startup_complete (void) +{ + gdk_notify_startup_complete_with_id (NULL); +} + +/** + * 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; + + display = gdk_display_get_default (); + if (display) + gdk_display_notify_startup_complete (display, startup_id); +} + +void +gdk_display_notify_startup_complete (GdkDisplay *display, + const gchar *startup_id) +{ + GDK_DISPLAY_GET_CLASS (display)->notify_startup_complete (display, startup_id); +} diff --git a/gdk/gdkdisplay.h b/gdk/gdkdisplay.h index 0b9f688b6a..9bb1ba962d 100644 --- a/gdk/gdkdisplay.h +++ b/gdk/gdkdisplay.h @@ -235,12 +235,13 @@ void gdk_display_store_clipboard (GdkDisplay *display, gboolean gdk_display_supports_shapes (GdkDisplay *display); gboolean gdk_display_supports_input_shapes (GdkDisplay *display); gboolean gdk_display_supports_composite (GdkDisplay *display); +void gdk_display_notify_startup_complete (GdkDisplay *display, + const gchar *startup_id); GdkDeviceManager * gdk_display_get_device_manager (GdkDisplay *display); GdkAppLaunchContext *gdk_display_get_app_launch_context (GdkDisplay *display); - G_END_DECLS #endif /* __GDK_DISPLAY_H__ */ diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h index 4772041e05..9e8cb4c7c4 100644 --- a/gdk/gdkdisplayprivate.h +++ b/gdk/gdkdisplayprivate.h @@ -175,6 +175,9 @@ struct _GdkDisplayClass gulong (*get_next_serial) (GdkDisplay *display); + void (*notify_startup_complete) (GdkDisplay *display, + const gchar *startup_id); + /* Signals */ void (*closed) (GdkDisplay *display, gboolean is_error); diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 194b25fe73..126d0288d0 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -2062,72 +2062,27 @@ gdk_x11_display_broadcast_startup_message (GdkDisplay *display, va_end (ap); broadcast_xmessage (display, - "_NET_STARTUP_INFO", + "_NET_STARTUP_INFO", "_NET_STARTUP_INFO_BEGIN", message->str); g_string_free (message, TRUE); } -/** - * gdk_notify_startup_complete: - * - * Indicates to the GUI environment that the application has finished - * loading. If the applications opens windows, this function is - * normally called after opening the application's initial set of - * windows. - * - * GTK+ will call this function automatically after opening the first - * #GtkWindow unless gtk_window_set_auto_startup_notification() is called - * to disable that feature. - * - * Since: 2.2 - **/ -void -gdk_notify_startup_complete (void) +static void +gdk_x11_display_notify_startup_complete (GdkDisplay *display, + const gchar *startup_id) { - GdkDisplay *display; - GdkDisplayX11 *display_x11; - - display = gdk_display_get_default (); - if (!display) - return; - - display_x11 = GDK_DISPLAY_X11 (display); - - if (display_x11->startup_notification_id == NULL) - return; - - 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; - - display = gdk_display_get_default (); - if (!display) - return; + if (startup_id == NULL) + { + startup_id = GDK_DISPLAY_X11 (display)->startup_notification_id; + if (startup_id == NULL) + return; + } gdk_x11_display_broadcast_startup_message (display, "remove", - "ID", startup_id, - NULL); + "ID", startup_id, + NULL); } static gboolean @@ -2754,5 +2709,6 @@ _gdk_display_x11_class_init (GdkDisplayX11Class * class) display_class->before_process_all_updates = _gdk_x11_display_before_process_all_updates; display_class->after_process_all_updates = _gdk_x11_display_after_process_all_updates; display_class->get_next_serial = gdk_x11_display_get_next_serial; + display_class->notify_startup_complete = gdk_x11_display_notify_startup_complete; }