summaryrefslogtreecommitdiff
path: root/plugins/systray/systray.c
diff options
context:
space:
mode:
authorNick Schermer <nick@xfce.org>2010-12-25 12:13:06 +0100
committerNick Schermer <nick@xfce.org>2010-12-28 17:01:45 +0100
commitc8bdf2b20efc0447ca7074e969ea1bc11582e72e (patch)
tree5aa8d178de47dbb45b37fb899af401b4ed69352e /plugins/systray/systray.c
parentbdc17ee8fc838690a408054c2a48a4cb9e1d67eb (diff)
downloadxfce4-panel-c8bdf2b20efc0447ca7074e969ea1bc11582e72e.tar.gz
Move composited child function to plugin.
This makes it more obvious this is something special we need to do after Gtk's expose event to draw composited icons.
Diffstat (limited to 'plugins/systray/systray.c')
-rw-r--r--plugins/systray/systray.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/plugins/systray/systray.c b/plugins/systray/systray.c
index 16f20188..7629f472 100644
--- a/plugins/systray/systray.c
+++ b/plugins/systray/systray.c
@@ -54,6 +54,8 @@ static void systray_plugin_orientation_changed (XfcePanelPlugin
static gboolean systray_plugin_size_changed (XfcePanelPlugin *panel_plugin,
gint size);
static void systray_plugin_configure_plugin (XfcePanelPlugin *panel_plugin);
+static void systray_plugin_box_expose_event (GtkWidget *box,
+ GdkEventExpose *event);
static void systray_plugin_button_toggled (GtkWidget *button,
SystrayPlugin *plugin);
static void systray_plugin_button_set_arrow (SystrayPlugin *plugin);
@@ -217,6 +219,8 @@ systray_plugin_init (SystrayPlugin *plugin)
plugin->box = systray_box_new ();
gtk_box_pack_start (GTK_BOX (plugin->hvbox), plugin->box, TRUE, TRUE, 0);
+ g_signal_connect (G_OBJECT (plugin->box), "expose-event",
+ G_CALLBACK (systray_plugin_box_expose_event), NULL);
gtk_widget_show (plugin->box);
plugin->button = xfce_arrow_button_new (GTK_ARROW_RIGHT);
@@ -546,6 +550,55 @@ systray_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
static void
+systray_plugin_box_expose_event_icon (GtkWidget *child,
+ gpointer user_data)
+{
+ cairo_t *cr = user_data;
+ GtkAllocation *alloc;
+
+ if (systray_socket_is_composited (XFCE_SYSTRAY_SOCKET (child)))
+ {
+ alloc = &child->allocation;
+
+ /* skip hidden (see offscreen in box widget) icons */
+ if (alloc->x > 0 && alloc->y > 0)
+ {
+ gdk_cairo_set_source_pixmap (cr, gtk_widget_get_window (child),
+ alloc->x, alloc->y);
+ cairo_paint (cr);
+ }
+ }
+}
+
+
+
+static void
+systray_plugin_box_expose_event (GtkWidget *box,
+ GdkEventExpose *event)
+{
+ cairo_t *cr;
+
+ if (!gtk_widget_is_composited (box))
+ return;
+
+ cr = gdk_cairo_create (gtk_widget_get_window (box));
+ if (G_LIKELY (cr != NULL))
+ {
+ gdk_cairo_rectangle (cr, &event->area);
+ cairo_clip (cr);
+
+ /* separately draw all the composed tray icons after gtk
+ * handled the expose event */
+ gtk_container_foreach (GTK_CONTAINER (box),
+ systray_plugin_box_expose_event_icon, cr);
+
+ cairo_destroy (cr);
+ }
+}
+
+
+
+static void
systray_plugin_button_toggled (GtkWidget *button,
SystrayPlugin *plugin)
{