summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorColin Walters <walters@redhat.com>2008-06-03 17:39:20 +0000
committerColin Walters <walters@src.gnome.org>2008-06-03 17:39:20 +0000
commit8ade45013cd28181af5692d12a7dd9b8b38526f0 (patch)
treefe7454a837fde1d69acbbc6be8ffafc3b9db68e2 /gtk
parent727a9145f6f931b6ee7f2fedb9f8b55de306b6ec (diff)
downloadgtk+-8ade45013cd28181af5692d12a7dd9b8b38526f0.tar.gz
Bug 535303 – add _get_implementation to GtkStatusIcon
2008-06-03 Colin Walters <walters@redhat.com> Bug 535303 – add _get_implementation to GtkStatusIcon * gtk/gtkstatusicon.c (gtk_status_icon_get_x11_window_id): New function to retrieve internal X11 window ID, useful for libnotify. * gtk/gtkstatusicon.h: Prototype it. * docs/reference/gtk/gtk-sections.txt: Add to docs. * gtk/gtk.symbols: Export it. svn path=/trunk/; revision=20304
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtk.symbols1
-rwxr-xr-xgtk/gtkstatusicon.c34
-rwxr-xr-xgtk/gtkstatusicon.h2
3 files changed, 37 insertions, 0 deletions
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 19cb6f13c2..70d0add28f 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -1123,6 +1123,7 @@ gtk_status_icon_get_blinking
gtk_status_icon_is_embedded
gtk_status_icon_position_menu
gtk_status_icon_get_geometry
+gtk_status_icon_get_x11_window_id
#endif
#endif
diff --git a/gtk/gtkstatusicon.c b/gtk/gtkstatusicon.c
index 060d260f72..4e8a008dd3 100755
--- a/gtk/gtkstatusicon.c
+++ b/gtk/gtkstatusicon.c
@@ -41,6 +41,10 @@
#include "gtkprivate.h"
#include "gtkwidget.h"
+#ifdef GDK_WINDOWING_X11
+#include "gdk/x11/gdkx.h"
+#endif
+
#ifdef GDK_WINDOWING_WIN32
#include "gtkicontheme.h"
#include "gtklabel.h"
@@ -2095,6 +2099,36 @@ gtk_status_icon_get_geometry (GtkStatusIcon *status_icon,
#endif /* GDK_WINDOWING_X11 */
}
+/**
+ * gtk_status_icon_get_x11_window_id:
+ * @status_icon: a #GtkStatusIcon
+ *
+ * This function is only useful on the X11/freedesktop.org platform.
+ * It returns a window ID for the widget in the underlying
+ * status icon implementation. This is useful for the Galago
+ * notification service, which can send a window ID in the protocol
+ * in order for the server to position notification windows
+ * pointing to a status icon reliably.
+ *
+ * This function is not intended for other use cases which are
+ * more likely to be met by one of the non-X11 specific methods, such
+ * as gtk_status_icon_position_menu().
+ *
+ * Return value: An 32 bit unsigned integer identifier for the
+ * underlying X11 Window
+ *
+ * Since: 2.14
+ */
+guint32
+gtk_status_icon_get_x11_window_id (GtkStatusIcon *status_icon)
+{
+#ifdef GDK_WINDOWING_X11
+ gtk_widget_realize (GTK_WIDGET (status_icon->priv->tray_icon));
+ return GDK_WINDOW_XID (GTK_WIDGET (status_icon->priv->tray_icon)->window);
+#else
+ return 0;
+#endif
+}
#define __GTK_STATUS_ICON_C__
#include "gtkaliasdef.c"
diff --git a/gtk/gtkstatusicon.h b/gtk/gtkstatusicon.h
index ed51a2745c..dbb95207e0 100755
--- a/gtk/gtkstatusicon.h
+++ b/gtk/gtkstatusicon.h
@@ -122,6 +122,8 @@ gboolean gtk_status_icon_get_geometry (GtkStatusIcon *st
GdkRectangle *area,
GtkOrientation *orientation);
+guint32 gtk_status_icon_get_x11_window_id (GtkStatusIcon *status_icon);
+
G_END_DECLS
#endif /* __GTK_STATUS_ICON_H__ */