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
This commit is contained in:
Emmanuele Bassi
2007-03-13 17:03:54 +00:00
committed by Emmanuele Bassi
parent 500435f2f9
commit 87c28d778a
8 changed files with 249 additions and 7 deletions

View File

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

View File

@ -2896,6 +2896,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

View File

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