090c1a
--- ekiga-2.0.3/lib/gui/gmtray/eggtrayicon.h.transparent	2006-09-30 00:33:32.000000000 -0400
090c1a
+++ ekiga-2.0.3/lib/gui/gmtray/eggtrayicon.h	2006-09-30 00:33:49.000000000 -0400
090c1a
@@ -22,7 +22,9 @@
090c1a
 #define __EGG_TRAY_ICON_H__
090c1a
 
090c1a
 #include <gtk/gtkplug.h>
090c1a
+#ifdef GDK_WINDOWING_X11
090c1a
 #include <gdk/gdkx.h>
090c1a
+#endif
090c1a
 
090c1a
 G_BEGIN_DECLS
090c1a
 
090c1a
@@ -42,10 +44,14 @@
090c1a
 
090c1a
   guint stamp;
090c1a
   
090c1a
+#ifdef GDK_WINDOWING_X11
090c1a
   Atom selection_atom;
090c1a
   Atom manager_atom;
090c1a
   Atom system_tray_opcode_atom;
090c1a
+  Atom orientation_atom;
090c1a
   Window manager_window;
090c1a
+#endif
090c1a
+  GtkOrientation orientation;
090c1a
 };
090c1a
 
090c1a
 struct _EggTrayIconClass
090c1a
@@ -55,10 +61,8 @@
090c1a
 
090c1a
 GType        egg_tray_icon_get_type       (void);
090c1a
 
090c1a
-#if EGG_TRAY_ENABLE_MULTIHEAD
090c1a
 EggTrayIcon *egg_tray_icon_new_for_screen (GdkScreen   *screen,
090c1a
 					   const gchar *name);
090c1a
-#endif
090c1a
 
090c1a
 EggTrayIcon *egg_tray_icon_new            (const gchar *name);
090c1a
 
090c1a
@@ -69,7 +73,7 @@
090c1a
 void         egg_tray_icon_cancel_message (EggTrayIcon *icon,
090c1a
 					   guint        id);
090c1a
 
090c1a
-
090c1a
+GtkOrientation egg_tray_icon_get_orientation (EggTrayIcon *icon);
090c1a
 					    
090c1a
 G_END_DECLS
090c1a
 
090c1a
--- ekiga-2.0.3/lib/gui/gmtray/eggtrayicon.c.transparent	2006-09-30 00:33:26.000000000 -0400
090c1a
+++ ekiga-2.0.3/lib/gui/gmtray/eggtrayicon.c	2006-09-30 00:34:05.000000000 -0400
090c1a
@@ -18,22 +18,56 @@
090c1a
  * Boston, MA 02111-1307, USA.
090c1a
  */
090c1a
 
090c1a
+#include <config.h>
090c1a
 #include <string.h>
090c1a
-#ifndef WIN32
090c1a
+#include <libintl.h>
090c1a
+
090c1a
+#include "eggtrayicon.h"
090c1a
+
090c1a
+#include <gdkconfig.h>
090c1a
+#if defined (GDK_WINDOWING_X11)
090c1a
 #include <gdk/gdkx.h>
090c1a
+#include <X11/Xatom.h>
090c1a
+#elif defined (GDK_WINDOWING_WIN32)
090c1a
+#include <gdk/gdkwin32.h>
090c1a
 #endif
090c1a
-#include "eggtrayicon.h"
090c1a
+
090c1a
+#define _(x) x
090c1a
+#define N_(x) x
090c1a
 
090c1a
 #define SYSTEM_TRAY_REQUEST_DOCK    0
090c1a
 #define SYSTEM_TRAY_BEGIN_MESSAGE   1
090c1a
 #define SYSTEM_TRAY_CANCEL_MESSAGE  2
090c1a
+
090c1a
+#define SYSTEM_TRAY_ORIENTATION_HORZ 0
090c1a
+#define SYSTEM_TRAY_ORIENTATION_VERT 1
090c1a
+
090c1a
+enum {
090c1a
+  PROP_0,
090c1a
+  PROP_ORIENTATION
090c1a
+};
090c1a
          
090c1a
 static GtkPlugClass *parent_class = NULL;
090c1a
 
090c1a
 static void egg_tray_icon_init (EggTrayIcon *icon);
090c1a
 static void egg_tray_icon_class_init (EggTrayIconClass *klass);
090c1a
 
090c1a
-static void egg_tray_icon_update_manager_window (EggTrayIcon *icon);
090c1a
+static void egg_tray_icon_get_property (GObject    *object,
090c1a
+					guint       prop_id,
090c1a
+					GValue     *value,
090c1a
+					GParamSpec *pspec);
090c1a
+
090c1a
+static void egg_tray_icon_realize   (GtkWidget *widget);
090c1a
+static void egg_tray_icon_unrealize (GtkWidget *widget);
090c1a
+
090c1a
+static void egg_tray_icon_add (GtkContainer *container,
090c1a
+			       GtkWidget    *widget);
090c1a
+
090c1a
+#ifdef GDK_WINDOWING_X11
090c1a
+static void egg_tray_icon_update_manager_window    (EggTrayIcon *icon,
090c1a
+						    gboolean     dock_if_realized);
090c1a
+static void egg_tray_icon_manager_window_destroyed (EggTrayIcon *icon);
090c1a
+#endif
090c1a
 
090c1a
 GType
090c1a
 egg_tray_icon_get_type (void)
090c1a
@@ -65,6 +99,7 @@
090c1a
 egg_tray_icon_init (EggTrayIcon *icon)
090c1a
 {
090c1a
   icon->stamp = 1;
090c1a
+  icon->orientation = GTK_ORIENTATION_HORIZONTAL;
090c1a
   
090c1a
   gtk_widget_add_events (GTK_WIDGET (icon), GDK_PROPERTY_CHANGE_MASK);
090c1a
 }
090c1a
@@ -72,7 +107,108 @@
090c1a
 static void
090c1a
 egg_tray_icon_class_init (EggTrayIconClass *klass)
090c1a
 {
090c1a
+  GObjectClass *gobject_class = (GObjectClass *)klass;
090c1a
+  GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
090c1a
+  GtkContainerClass *container_class = (GtkContainerClass *)klass;
090c1a
+
090c1a
   parent_class = g_type_class_peek_parent (klass);
090c1a
+
090c1a
+  gobject_class->get_property = egg_tray_icon_get_property;
090c1a
+
090c1a
+  widget_class->realize   = egg_tray_icon_realize;
090c1a
+  widget_class->unrealize = egg_tray_icon_unrealize;
090c1a
+
090c1a
+  container_class->add = egg_tray_icon_add;
090c1a
+
090c1a
+  g_object_class_install_property (gobject_class,
090c1a
+				   PROP_ORIENTATION,
090c1a
+				   g_param_spec_enum ("orientation",
090c1a
+						      _("Orientation"),
090c1a
+						      _("The orientation of the tray."),
090c1a
+						      GTK_TYPE_ORIENTATION,
090c1a
+						      GTK_ORIENTATION_HORIZONTAL,
090c1a
+						      G_PARAM_READABLE));
090c1a
+
090c1a
+#if defined (GDK_WINDOWING_X11)
090c1a
+  /* Nothing */
090c1a
+#elif defined (GDK_WINDOWING_WIN32)
090c1a
+  g_warning ("Port eggtrayicon to Win32");
090c1a
+#else
090c1a
+  g_warning ("Port eggtrayicon to this GTK+ backend");
090c1a
+#endif
090c1a
+}
090c1a
+
090c1a
+static void
090c1a
+egg_tray_icon_get_property (GObject    *object,
090c1a
+			    guint       prop_id,
090c1a
+			    GValue     *value,
090c1a
+			    GParamSpec *pspec)
090c1a
+{
090c1a
+  EggTrayIcon *icon = EGG_TRAY_ICON (object);
090c1a
+
090c1a
+  switch (prop_id)
090c1a
+    {
090c1a
+    case PROP_ORIENTATION:
090c1a
+      g_value_set_enum (value, icon->orientation);
090c1a
+      break;
090c1a
+    default:
090c1a
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
090c1a
+      break;
090c1a
+    }
090c1a
+}
090c1a
+
090c1a
+#ifdef GDK_WINDOWING_X11
090c1a
+
090c1a
+static void
090c1a
+egg_tray_icon_get_orientation_property (EggTrayIcon *icon)
090c1a
+{
090c1a
+  Display *xdisplay;
090c1a
+  Atom type;
090c1a
+  int format;
090c1a
+  union {
090c1a
+	gulong *prop;
090c1a
+	guchar *prop_ch;
090c1a
+  } prop = { NULL };
090c1a
+  gulong nitems;
090c1a
+  gulong bytes_after;
090c1a
+  int error, result;
090c1a
+
090c1a
+  g_assert (icon->manager_window != None);
090c1a
+  
090c1a
+  xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
090c1a
+
090c1a
+  gdk_error_trap_push ();
090c1a
+  type = None;
090c1a
+  result = XGetWindowProperty (xdisplay,
090c1a
+			       icon->manager_window,
090c1a
+			       icon->orientation_atom,
090c1a
+			       0, G_MAXLONG, FALSE,
090c1a
+			       XA_CARDINAL,
090c1a
+			       &type, &format, &nitems,
090c1a
+			       &bytes_after, &(prop.prop_ch));
090c1a
+  error = gdk_error_trap_pop ();
090c1a
+
090c1a
+  if (error || result != Success)
090c1a
+    return;
090c1a
+
090c1a
+  if (type == XA_CARDINAL)
090c1a
+    {
090c1a
+      GtkOrientation orientation;
090c1a
+
090c1a
+      orientation = (prop.prop [0] == SYSTEM_TRAY_ORIENTATION_HORZ) ?
090c1a
+					GTK_ORIENTATION_HORIZONTAL :
090c1a
+					GTK_ORIENTATION_VERTICAL;
090c1a
+
090c1a
+      if (icon->orientation != orientation)
090c1a
+	{
090c1a
+	  icon->orientation = orientation;
090c1a
+
090c1a
+	  g_object_notify (G_OBJECT (icon), "orientation");
090c1a
+	}
090c1a
+    }
090c1a
+
090c1a
+  if (prop.prop)
090c1a
+    XFree (prop.prop);
090c1a
 }
090c1a
 
090c1a
 static GdkFilterReturn
090c1a
@@ -85,19 +221,53 @@
090c1a
       xev->xclient.message_type == icon->manager_atom &&
090c1a
       xev->xclient.data.l[1] == icon->selection_atom)
090c1a
     {
090c1a
-      egg_tray_icon_update_manager_window (icon);
090c1a
+      egg_tray_icon_update_manager_window (icon, TRUE);
090c1a
     }
090c1a
   else if (xev->xany.window == icon->manager_window)
090c1a
     {
090c1a
+      if (xev->xany.type == PropertyNotify &&
090c1a
+	  xev->xproperty.atom == icon->orientation_atom)
090c1a
+	{
090c1a
+	  egg_tray_icon_get_orientation_property (icon);
090c1a
+	}
090c1a
       if (xev->xany.type == DestroyNotify)
090c1a
 	{
090c1a
-	  egg_tray_icon_update_manager_window (icon);
090c1a
+	  egg_tray_icon_manager_window_destroyed (icon);
090c1a
 	}
090c1a
     }
090c1a
-  
090c1a
   return GDK_FILTER_CONTINUE;
090c1a
 }
090c1a
 
090c1a
+#endif  
090c1a
+
090c1a
+static void
090c1a
+egg_tray_icon_unrealize (GtkWidget *widget)
090c1a
+{
090c1a
+#ifdef GDK_WINDOWING_X11
090c1a
+  EggTrayIcon *icon = EGG_TRAY_ICON (widget);
090c1a
+  GdkWindow *root_window;
090c1a
+
090c1a
+  if (icon->manager_window != None)
090c1a
+    {
090c1a
+      GdkWindow *gdkwin;
090c1a
+
090c1a
+      gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (widget),
090c1a
+                                              icon->manager_window);
090c1a
+
090c1a
+      gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
090c1a
+    }
090c1a
+
090c1a
+  root_window = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
090c1a
+
090c1a
+  gdk_window_remove_filter (root_window, egg_tray_icon_manager_filter, icon);
090c1a
+
090c1a
+  if (GTK_WIDGET_CLASS (parent_class)->unrealize)
090c1a
+    (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
090c1a
+#endif
090c1a
+}
090c1a
+
090c1a
+#ifdef GDK_WINDOWING_X11
090c1a
+
090c1a
 static void
090c1a
 egg_tray_icon_send_manager_message (EggTrayIcon *icon,
090c1a
 				    long         message,
090c1a
@@ -119,11 +289,7 @@
090c1a
   ev.data.l[3] = data2;
090c1a
   ev.data.l[4] = data3;
090c1a
 
090c1a
-#if HAVE_GTK_MULTIHEAD
090c1a
   display = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
090c1a
-#else
090c1a
-  display = gdk_display;
090c1a
-#endif
090c1a
   
090c1a
   gdk_error_trap_push ();
090c1a
   XSendEvent (display,
090c1a
@@ -143,29 +309,15 @@
090c1a
 }
090c1a
 
090c1a
 static void
090c1a
-egg_tray_icon_update_manager_window (EggTrayIcon *icon)
090c1a
+egg_tray_icon_update_manager_window (EggTrayIcon *icon,
090c1a
+				     gboolean     dock_if_realized)
090c1a
 {
090c1a
   Display *xdisplay;
090c1a
   
090c1a
-#if HAVE_GTK_MULTIHEAD
090c1a
-  xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
090c1a
-#else
090c1a
-  xdisplay = gdk_display;
090c1a
-#endif
090c1a
-  
090c1a
   if (icon->manager_window != None)
090c1a
-    {
090c1a
-      GdkWindow *gdkwin;
090c1a
+    return;
090c1a
 
090c1a
-#if HAVE_GTK_MULTIHEAD
090c1a
-      gdkwin = gdk_window_lookup_for_display (display,
090c1a
-					      icon->manager_window);
090c1a
-#else
090c1a
-      gdkwin = gdk_window_lookup (icon->manager_window);
090c1a
-#endif
090c1a
-      
090c1a
-      gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
090c1a
-    }
090c1a
+  xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
090c1a
   
090c1a
   XGrabServer (xdisplay);
090c1a
   
090c1a
@@ -174,7 +326,7 @@
090c1a
 
090c1a
   if (icon->manager_window != None)
090c1a
     XSelectInput (xdisplay,
090c1a
-		  icon->manager_window, StructureNotifyMask);
090c1a
+		  icon->manager_window, StructureNotifyMask|PropertyChangeMask);
090c1a
 
090c1a
   XUngrabServer (xdisplay);
090c1a
   XFlush (xdisplay);
090c1a
@@ -183,87 +335,135 @@
090c1a
     {
090c1a
       GdkWindow *gdkwin;
090c1a
 
090c1a
-#if HAVE_GTK_MULTIHEAD
090c1a
       gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)),
090c1a
 					      icon->manager_window);
090c1a
-#else
090c1a
-      gdkwin = gdk_window_lookup (icon->manager_window);
090c1a
-#endif
090c1a
       
090c1a
       gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon);
090c1a
 
090c1a
-      /* Send a request that we'd like to dock */
090c1a
-      egg_tray_icon_send_dock_request (icon);
090c1a
+      if (dock_if_realized && GTK_WIDGET_REALIZED (icon))
090c1a
+	egg_tray_icon_send_dock_request (icon);
090c1a
+
090c1a
+      egg_tray_icon_get_orientation_property (icon);
090c1a
     }
090c1a
 }
090c1a
 
090c1a
-EggTrayIcon *
090c1a
-egg_tray_icon_new_for_xscreen (Screen *xscreen, const char *name)
090c1a
+static void
090c1a
+egg_tray_icon_manager_window_destroyed (EggTrayIcon *icon)
090c1a
 {
090c1a
-  EggTrayIcon *icon;
090c1a
+  GdkWindow *gdkwin;
090c1a
+  
090c1a
+  g_return_if_fail (icon->manager_window != None);
090c1a
+
090c1a
+  gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)),
090c1a
+					  icon->manager_window);
090c1a
+      
090c1a
+  gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
090c1a
+
090c1a
+  icon->manager_window = None;
090c1a
+
090c1a
+  egg_tray_icon_update_manager_window (icon, TRUE);
090c1a
+}
090c1a
+
090c1a
+#endif
090c1a
+
090c1a
+static gboolean
090c1a
+transparent_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
090c1a
+{
090c1a
+  gdk_window_clear_area (widget->window, event->area.x, event->area.y,
090c1a
+			 event->area.width, event->area.height);
090c1a
+  return FALSE;
090c1a
+}
090c1a
+
090c1a
+static void
090c1a
+make_transparent_again (GtkWidget *widget, GtkStyle *previous_style,
090c1a
+			gpointer user_data)
090c1a
+{
090c1a
+  gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
090c1a
+}
090c1a
+
090c1a
+static void
090c1a
+make_transparent (GtkWidget *widget, gpointer user_data)
090c1a
+{
090c1a
+  if (GTK_WIDGET_NO_WINDOW (widget) || GTK_WIDGET_APP_PAINTABLE (widget))
090c1a
+    return;
090c1a
+
090c1a
+  gtk_widget_set_app_paintable (widget, TRUE);
090c1a
+  gtk_widget_set_double_buffered (widget, FALSE);
090c1a
+  gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
090c1a
+  g_signal_connect (widget, "expose_event",
090c1a
+		    G_CALLBACK (transparent_expose_event), NULL);
090c1a
+  g_signal_connect_after (widget, "style_set",
090c1a
+			  G_CALLBACK (make_transparent_again), NULL);
090c1a
+}	
090c1a
+
090c1a
+static void
090c1a
+egg_tray_icon_realize (GtkWidget *widget)
090c1a
+{
090c1a
+#ifdef GDK_WINDOWING_X11
090c1a
+  EggTrayIcon *icon = EGG_TRAY_ICON (widget);
090c1a
+  GdkScreen *screen;
090c1a
+  GdkDisplay *display;
090c1a
+  Display *xdisplay;
090c1a
   char buffer[256];
090c1a
   GdkWindow *root_window;
090c1a
 
090c1a
-  g_return_val_if_fail (xscreen != NULL, NULL);
090c1a
-  
090c1a
-  icon = g_object_new (EGG_TYPE_TRAY_ICON, NULL);
090c1a
-  gtk_window_set_title (GTK_WINDOW (icon), name);
090c1a
+  if (GTK_WIDGET_CLASS (parent_class)->realize)
090c1a
+    GTK_WIDGET_CLASS (parent_class)->realize (widget);
090c1a
 
090c1a
-#if HAVE_GTK_MULTIHEAD
090c1a
-  gtk_plug_construct_for_display (GTK_PLUG (icon),
090c1a
-				  gdk_screen_get_display (screen), 0);
090c1a
-#else
090c1a
-  gtk_plug_construct (GTK_PLUG (icon), 0);
090c1a
-#endif
090c1a
-  
090c1a
-  gtk_widget_realize (GTK_WIDGET (icon));
090c1a
+  make_transparent (widget, NULL);
090c1a
+
090c1a
+  screen = gtk_widget_get_screen (widget);
090c1a
+  display = gdk_screen_get_display (screen);
090c1a
+  xdisplay = gdk_x11_display_get_xdisplay (display);
090c1a
 
090c1a
   /* Now see if there's a manager window around */
090c1a
   g_snprintf (buffer, sizeof (buffer),
090c1a
 	      "_NET_SYSTEM_TRAY_S%d",
090c1a
-	      XScreenNumberOfScreen (xscreen));
090c1a
-  
090c1a
-  icon->selection_atom = XInternAtom (DisplayOfScreen (xscreen),
090c1a
-				      buffer, False);
090c1a
+	      gdk_screen_get_number (screen));
090c1a
+
090c1a
+  icon->selection_atom = XInternAtom (xdisplay, buffer, False);
090c1a
   
090c1a
-  icon->manager_atom = XInternAtom (DisplayOfScreen (xscreen),
090c1a
-				    "MANAGER", False);
090c1a
+  icon->manager_atom = XInternAtom (xdisplay, "MANAGER", False);
090c1a
   
090c1a
-  icon->system_tray_opcode_atom = XInternAtom (DisplayOfScreen (xscreen),
090c1a
-					       "_NET_SYSTEM_TRAY_OPCODE", False);
090c1a
+  icon->system_tray_opcode_atom = XInternAtom (xdisplay,
090c1a
+						   "_NET_SYSTEM_TRAY_OPCODE",
090c1a
+						   False);
090c1a
 
090c1a
-  egg_tray_icon_update_manager_window (icon);
090c1a
+  icon->orientation_atom = XInternAtom (xdisplay,
090c1a
+					"_NET_SYSTEM_TRAY_ORIENTATION",
090c1a
+					False);
090c1a
+
090c1a
+  egg_tray_icon_update_manager_window (icon, FALSE);
090c1a
+  egg_tray_icon_send_dock_request (icon);
090c1a
 
090c1a
-#if HAVE_GTK_MULTIHEAD
090c1a
   root_window = gdk_screen_get_root_window (screen);
090c1a
-#else
090c1a
-  root_window = gdk_window_lookup (gdk_x11_get_default_root_xwindow ());
090c1a
-#endif
090c1a
   
090c1a
   /* Add a root window filter so that we get changes on MANAGER */
090c1a
   gdk_window_add_filter (root_window,
090c1a
 			 egg_tray_icon_manager_filter, icon);
090c1a
-		      
090c1a
-  return icon;
090c1a
+#endif
090c1a
+}
090c1a
+
090c1a
+static void
090c1a
+egg_tray_icon_add (GtkContainer *container, GtkWidget *widget)
090c1a
+{
090c1a
+  g_signal_connect (widget, "realize",
090c1a
+		    G_CALLBACK (make_transparent), NULL);
090c1a
+  GTK_CONTAINER_CLASS (parent_class)->add (container, widget);
090c1a
 }
090c1a
 
090c1a
-#if HAVE_GTK_MULTIHEAD
090c1a
 EggTrayIcon *
090c1a
 egg_tray_icon_new_for_screen (GdkScreen *screen, const char *name)
090c1a
 {
090c1a
-  EggTrayIcon *icon;
090c1a
-  char buffer[256];
090c1a
-
090c1a
   g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
090c1a
 
090c1a
-  return egg_tray_icon_new_for_xscreen (GDK_SCREEN_XSCREEN (screen), name);
090c1a
+  return g_object_new (EGG_TYPE_TRAY_ICON, "screen", screen, "title", name, NULL);
090c1a
 }
090c1a
-#endif
090c1a
 
090c1a
 EggTrayIcon*
090c1a
 egg_tray_icon_new (const gchar *name)
090c1a
 {
090c1a
-  return egg_tray_icon_new_for_xscreen (DefaultScreenOfDisplay (gdk_display), name);
090c1a
+  return g_object_new (EGG_TYPE_TRAY_ICON, "title", name, NULL);
090c1a
 }
090c1a
 
090c1a
 guint
090c1a
@@ -278,17 +478,20 @@
090c1a
   g_return_val_if_fail (timeout >= 0, 0);
090c1a
   g_return_val_if_fail (message != NULL, 0);
090c1a
 		     
090c1a
+#ifdef GDK_WINDOWING_X11
090c1a
   if (icon->manager_window == None)
090c1a
     return 0;
090c1a
+#endif
090c1a
 
090c1a
   if (len < 0)
090c1a
     len = strlen (message);
090c1a
 
090c1a
   stamp = icon->stamp++;
090c1a
   
090c1a
+#ifdef GDK_WINDOWING_X11
090c1a
   /* Get ready to send the message */
090c1a
   egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_BEGIN_MESSAGE,
090c1a
-				      (Window)gtk_plug_get_id (GTK_PLUG (icon)),
090c1a
+				      icon->manager_window,
090c1a
 				      timeout, len, stamp);
090c1a
 
090c1a
   /* Now to send the actual message */
090c1a
@@ -298,14 +501,10 @@
090c1a
       XClientMessageEvent ev;
090c1a
       Display *xdisplay;
090c1a
 
090c1a
-#if HAVE_GTK_MULTIHEAD
090c1a
       xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
090c1a
-#else
090c1a
-      xdisplay = gdk_display;
090c1a
-#endif
090c1a
       
090c1a
       ev.type = ClientMessage;
090c1a
-      ev.window = (Window)gtk_plug_get_id (GTK_PLUG (icon));
090c1a
+      ev.window = icon->manager_window;
090c1a
       ev.format = 8;
090c1a
       ev.message_type = XInternAtom (xdisplay,
090c1a
 				     "_NET_SYSTEM_TRAY_MESSAGE_DATA", False);
090c1a
@@ -326,6 +525,7 @@
090c1a
       XSync (xdisplay, False);
090c1a
     }
090c1a
   gdk_error_trap_pop ();
090c1a
+#endif
090c1a
 
090c1a
   return stamp;
090c1a
 }
090c1a
@@ -336,8 +536,17 @@
090c1a
 {
090c1a
   g_return_if_fail (EGG_IS_TRAY_ICON (icon));
090c1a
   g_return_if_fail (id > 0);
090c1a
-  
090c1a
+#ifdef GDK_WINDOWING_X11  
090c1a
   egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_CANCEL_MESSAGE,
090c1a
 				      (Window)gtk_plug_get_id (GTK_PLUG (icon)),
090c1a
 				      id, 0, 0);
090c1a
+#endif
090c1a
+}
090c1a
+
090c1a
+GtkOrientation
090c1a
+egg_tray_icon_get_orientation (EggTrayIcon *icon)
090c1a
+{
090c1a
+  g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), GTK_ORIENTATION_HORIZONTAL);
090c1a
+
090c1a
+  return icon->orientation;
090c1a
 }