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