Add a vfunc for gdk_notify_startup_complete

At the same time, add a display api for this, since it really
is per-display.
This commit is contained in:
Matthias Clasen 2010-12-13 20:46:00 -05:00
parent a251d3786b
commit beaa11be98
5 changed files with 72 additions and 58 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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__ */

View File

@ -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);

View File

@ -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;
}