cd5141
diff -up gtk+-2.19.7/gtk/gtkstatusicon.c.icon-padding gtk+-2.19.7/gtk/gtkstatusicon.c
cd5141
--- gtk+-2.19.7/gtk/gtkstatusicon.c.icon-padding	2010-03-08 08:42:22.000000000 -0500
cd5141
+++ gtk+-2.19.7/gtk/gtkstatusicon.c	2010-03-10 00:40:11.165527903 -0500
cd5141
@@ -170,6 +170,7 @@ static void     gtk_status_icon_screen_c
cd5141
 						  GdkScreen      *old_screen);
cd5141
 static void     gtk_status_icon_embedded_changed (GtkStatusIcon *status_icon);
cd5141
 static void     gtk_status_icon_orientation_changed (GtkStatusIcon *status_icon);
cd5141
+static void     gtk_status_icon_padding_changed  (GtkStatusIcon *status_icon);
cd5141
 static gboolean gtk_status_icon_scroll           (GtkStatusIcon  *status_icon,
cd5141
 						  GdkEventScroll *event);
cd5141
 static gboolean gtk_status_icon_query_tooltip    (GtkStatusIcon *status_icon,
cd5141
@@ -850,6 +851,8 @@ gtk_status_icon_init (GtkStatusIcon *sta
cd5141
 			    G_CALLBACK (gtk_status_icon_embedded_changed), status_icon);
cd5141
   g_signal_connect_swapped (priv->tray_icon, "notify::orientation",
cd5141
 			    G_CALLBACK (gtk_status_icon_orientation_changed), status_icon);
cd5141
+  g_signal_connect_swapped (priv->tray_icon, "notify::padding",
cd5141
+			    G_CALLBACK (gtk_status_icon_padding_changed), status_icon);
cd5141
   g_signal_connect_swapped (priv->tray_icon, "button-press-event",
cd5141
 			    G_CALLBACK (gtk_status_icon_button_press), status_icon);
cd5141
   g_signal_connect_swapped (priv->tray_icon, "button-release-event",
cd5141
@@ -975,6 +978,8 @@ gtk_status_icon_finalize (GObject *objec
cd5141
   g_signal_handlers_disconnect_by_func (priv->tray_icon,
cd5141
 			                gtk_status_icon_orientation_changed, status_icon);
cd5141
   g_signal_handlers_disconnect_by_func (priv->tray_icon,
cd5141
+			                gtk_status_icon_padding_changed, status_icon);
cd5141
+  g_signal_handlers_disconnect_by_func (priv->tray_icon,
cd5141
 			                gtk_status_icon_button_press, status_icon);
cd5141
   g_signal_handlers_disconnect_by_func (priv->tray_icon,
cd5141
 			                gtk_status_icon_button_release, status_icon);
cd5141
@@ -1679,14 +1684,32 @@ gtk_status_icon_screen_changed (GtkStatu
cd5141
 #ifdef GDK_WINDOWING_X11
cd5141
 
cd5141
 static void
cd5141
+gtk_status_icon_padding_changed (GtkStatusIcon *status_icon)
cd5141
+{
cd5141
+  GtkStatusIconPrivate *priv = status_icon->priv;
cd5141
+  GtkOrientation orientation;
cd5141
+  gint padding;
cd5141
+
cd5141
+  orientation = _gtk_tray_icon_get_orientation (GTK_TRAY_ICON (priv->tray_icon));
cd5141
+  padding = _gtk_tray_icon_get_padding (GTK_TRAY_ICON (priv->tray_icon));
cd5141
+
cd5141
+  if (orientation == GTK_ORIENTATION_HORIZONTAL)
cd5141
+    gtk_misc_set_padding (GTK_MISC (priv->image), padding, 0);
cd5141
+  else
cd5141
+    gtk_misc_set_padding (GTK_MISC (priv->image), 0, padding);
cd5141
+}
cd5141
+
cd5141
+static void
cd5141
 gtk_status_icon_embedded_changed (GtkStatusIcon *status_icon)
cd5141
 {
cd5141
+  gtk_status_icon_padding_changed (status_icon);
cd5141
   g_object_notify (G_OBJECT (status_icon), "embedded");
cd5141
 }
cd5141
 
cd5141
 static void
cd5141
 gtk_status_icon_orientation_changed (GtkStatusIcon *status_icon)
cd5141
 {
cd5141
+  gtk_status_icon_padding_changed (status_icon);
cd5141
   g_object_notify (G_OBJECT (status_icon), "orientation");
cd5141
 }
cd5141
 
cd5141
@@ -1804,7 +1827,7 @@ gtk_status_icon_reset_image_data (GtkSta
cd5141
 
cd5141
       g_object_notify (G_OBJECT (status_icon), "stock");
cd5141
       break;
cd5141
-      
cd5141
+
cd5141
     case GTK_IMAGE_ICON_NAME:
cd5141
       g_free (priv->image_data.icon_name);
cd5141
       priv->image_data.icon_name = NULL;
cd5141
diff -up gtk+-2.19.7/gtk/gtktrayicon.h.icon-padding gtk+-2.19.7/gtk/gtktrayicon.h
cd5141
--- gtk+-2.19.7/gtk/gtktrayicon.h.icon-padding	2009-10-18 01:35:45.000000000 -0400
cd5141
+++ gtk+-2.19.7/gtk/gtktrayicon.h	2010-03-10 00:40:11.169528392 -0500
cd5141
@@ -69,7 +69,8 @@ void           _gtk_tray_icon_cancel_mes
cd5141
 					       guint        id);
cd5141
 
cd5141
 GtkOrientation _gtk_tray_icon_get_orientation (GtkTrayIcon *icon);
cd5141
-					    
cd5141
+gint           _gtk_tray_icon_get_padding     (GtkTrayIcon *icon);
cd5141
+
cd5141
 G_END_DECLS
cd5141
 
cd5141
 #endif /* __GTK_TRAY_ICON_H__ */
cd5141
diff -up gtk+-2.19.7/gtk/gtktrayicon-x11.c.icon-padding gtk+-2.19.7/gtk/gtktrayicon-x11.c
cd5141
--- gtk+-2.19.7/gtk/gtktrayicon-x11.c.icon-padding	2010-03-08 21:01:28.000000000 -0500
cd5141
+++ gtk+-2.19.7/gtk/gtktrayicon-x11.c	2010-03-10 00:49:48.229509604 -0500
cd5141
@@ -43,23 +43,26 @@
cd5141
 
cd5141
 enum {
cd5141
   PROP_0,
cd5141
-  PROP_ORIENTATION
cd5141
+  PROP_ORIENTATION,
cd5141
+  PROP_PADDING
cd5141
 };
cd5141
 
cd5141
 struct _GtkTrayIconPrivate
cd5141
 {
cd5141
   guint stamp;
cd5141
-  
cd5141
+
cd5141
   Atom selection_atom;
cd5141
   Atom manager_atom;
cd5141
   Atom system_tray_opcode_atom;
cd5141
   Atom orientation_atom;
cd5141
   Atom visual_atom;
cd5141
+  Atom padding_atom;
cd5141
   Window manager_window;
cd5141
   GdkVisual *manager_visual;
cd5141
   gboolean manager_visual_rgba;
cd5141
 
cd5141
   GtkOrientation orientation;
cd5141
+  gint padding;
cd5141
 };
cd5141
 
cd5141
 static void gtk_tray_icon_constructed   (GObject     *object);
cd5141
@@ -113,6 +116,16 @@ gtk_tray_icon_class_init (GtkTrayIconCla
cd5141
 						      GTK_ORIENTATION_HORIZONTAL,
cd5141
 						      GTK_PARAM_READABLE));
cd5141
 
cd5141
+  g_object_class_install_property (gobject_class,
cd5141
+				   PROP_PADDING,
cd5141
+				   g_param_spec_int ("padding",
cd5141
+						     P_("Padding"),
cd5141
+						     P_("Padding that should be put around icons in the tray"),
cd5141
+						     0,
cd5141
+                                                     G_MAXINT,
cd5141
+                                                     0,
cd5141
+						     GTK_PARAM_READABLE));
cd5141
+
cd5141
   g_type_class_add_private (class, sizeof (GtkTrayIconPrivate));
cd5141
 }
cd5141
 
cd5141
@@ -124,6 +137,7 @@ gtk_tray_icon_init (GtkTrayIcon *icon)
cd5141
   
cd5141
   icon->priv->stamp = 1;
cd5141
   icon->priv->orientation = GTK_ORIENTATION_HORIZONTAL;
cd5141
+  icon->priv->padding = 0;
cd5141
 
cd5141
   gtk_widget_set_app_paintable (GTK_WIDGET (icon), TRUE);
cd5141
   gtk_widget_add_events (GTK_WIDGET (icon), GDK_PROPERTY_CHANGE_MASK);
cd5141
@@ -161,6 +175,10 @@ gtk_tray_icon_constructed (GObject *obje
cd5141
 					 "_NET_SYSTEM_TRAY_VISUAL",
cd5141
 					 False);
cd5141
 
cd5141
+  icon->priv->padding_atom = XInternAtom (xdisplay,
cd5141
+					 "_NET_SYSTEM_TRAY_PADDING",
cd5141
+					 False);
cd5141
+
cd5141
   /* Add a root window filter so that we get changes on MANAGER */
cd5141
   gdk_window_add_filter (root_window,
cd5141
 			 gtk_tray_icon_manager_filter, icon);
cd5141
@@ -212,6 +230,9 @@ gtk_tray_icon_get_property (GObject    *
cd5141
     case PROP_ORIENTATION:
cd5141
       g_value_set_enum (value, icon->priv->orientation);
cd5141
       break;
cd5141
+    case PROP_PADDING:
cd5141
+      g_value_set_int (value, icon->priv->padding);
cd5141
+      break;
cd5141
     default:
cd5141
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
cd5141
       break;
cd5141
@@ -372,9 +393,58 @@ gtk_tray_icon_get_visual_property (GtkTr
cd5141
     XFree (prop.prop);
cd5141
 }
cd5141
 
cd5141
+static void
cd5141
+gtk_tray_icon_get_padding_property (GtkTrayIcon *icon)
cd5141
+{
cd5141
+  GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (icon));
cd5141
+  GdkDisplay *display = gdk_screen_get_display (screen);
cd5141
+  Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
cd5141
+
cd5141
+  Atom type;
cd5141
+  int format;
cd5141
+  union {
cd5141
+	gulong *prop;
cd5141
+	guchar *prop_ch;
cd5141
+  } prop = { NULL };
cd5141
+  gulong nitems;
cd5141
+  gulong bytes_after;
cd5141
+  int error, result;
cd5141
+
cd5141
+  g_assert (icon->priv->manager_window != None);
cd5141
+
cd5141
+  gdk_error_trap_push ();
cd5141
+  type = None;
cd5141
+  result = XGetWindowProperty (xdisplay,
cd5141
+			       icon->priv->manager_window,
cd5141
+			       icon->priv->padding_atom,
cd5141
+			       0, G_MAXLONG, FALSE,
cd5141
+			       XA_CARDINAL,
cd5141
+			       &type, &format, &nitems,
cd5141
+			       &bytes_after, &(prop.prop_ch));
cd5141
+  error = gdk_error_trap_pop ();
cd5141
+
cd5141
+  if (!error && result == Success &&
cd5141
+      type == XA_CARDINAL && nitems == 1 && format == 32)
cd5141
+    {
cd5141
+      gint padding;
cd5141
+
cd5141
+      padding = prop.prop[0];
cd5141
+
cd5141
+      if (icon->priv->padding != padding)
cd5141
+	{
cd5141
+	  icon->priv->padding = padding;
cd5141
+
cd5141
+	  g_object_notify (G_OBJECT (icon), "padding");
cd5141
+	}
cd5141
+    }
cd5141
+
cd5141
+  if (type != None)
cd5141
+    XFree (prop.prop);
cd5141
+}
cd5141
+
cd5141
 static GdkFilterReturn
cd5141
-gtk_tray_icon_manager_filter (GdkXEvent *xevent, 
cd5141
-			      GdkEvent  *event, 
cd5141
+gtk_tray_icon_manager_filter (GdkXEvent *xevent,
cd5141
+			      GdkEvent  *event,
cd5141
 			      gpointer   user_data)
cd5141
 {
cd5141
   GtkTrayIcon *icon = user_data;
cd5141
@@ -399,6 +469,11 @@ gtk_tray_icon_manager_filter (GdkXEvent 
cd5141
 
cd5141
 	  gtk_tray_icon_get_orientation_property (icon);
cd5141
 	}
cd5141
+      else if (xev->xany.type == PropertyNotify &&
cd5141
+               xev->xproperty.atom == icon->priv->padding_atom)
cd5141
+        {
cd5141
+          gtk_tray_icon_get_padding_property (icon);
cd5141
+        }
cd5141
       else if (xev->xany.type == DestroyNotify)
cd5141
 	{
cd5141
           GTK_NOTE (PLUGSOCKET,
cd5141
@@ -504,6 +579,7 @@ gtk_tray_icon_update_manager_window (Gtk
cd5141
 
cd5141
       gtk_tray_icon_get_orientation_property (icon);
cd5141
       gtk_tray_icon_get_visual_property (icon);
cd5141
+      gtk_tray_icon_get_padding_property (icon);
cd5141
 
cd5141
       if (gtk_widget_get_realized (GTK_WIDGET (icon)))
cd5141
 	{
cd5141
@@ -740,6 +816,14 @@ _gtk_tray_icon_get_orientation (GtkTrayI
cd5141
   return icon->priv->orientation;
cd5141
 }
cd5141
 
cd5141
+gint
cd5141
+_gtk_tray_icon_get_padding (GtkTrayIcon *icon)
cd5141
+{
cd5141
+  g_return_val_if_fail (GTK_IS_TRAY_ICON (icon), 0);
cd5141
+
cd5141
+  return icon->priv->padding;
cd5141
+}
cd5141
+
cd5141
 
cd5141
 #define __GTK_TRAY_ICON_X11_C__
cd5141
 #include "gtkaliasdef.c"