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