+void draw_systray(void *obj, cairo_t *c, int active)
+{
+ Systraybar *sysbar = obj;
+ Panel *panel = sysbar->area.panel;
+ TrayWindow *traywin;
+ GSList *l;
+ int icon_size;
+
+ icon_size = sysbar->area.height - (2 * sysbar->area.pix.border.width) - (2 * sysbar->area.paddingy);
+ for (l = systray.list_icons; l ; l = l->next) {
+ traywin = (TrayWindow*)l->data;
+
+ printf("draw_systray %d %d\n", systray.area.posx, systray.area.width);
+ // watch for the icon trying to resize itself!
+ XSelectInput(server.dsp, traywin->id, StructureNotifyMask);
+
+ // position and size the icon window
+ XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, icon_size, icon_size);
+
+ // resize our window so that the new window can fit in it
+ //fix_geometry();
+
+ // flush before clearing, otherwise the clear isn't effective.
+ XFlush(server.dsp);
+ // make sure the new child will get the right stuff in its background
+ // for ParentRelative.
+ XClearWindow(server.dsp, panel->main_win);
+
+ // show the window
+ XMapRaised(server.dsp, traywin->id);
+ }
+}
+
+
+void resize_systray(void *obj)
+{
+ Systraybar *sysbar = obj;
+ Panel *panel = sysbar->area.panel;
+ TrayWindow *traywin;
+ GSList *l;
+ int count, posx, posy;
+ int icon_size;
+
+ icon_size = sysbar->area.height - (2 * sysbar->area.pix.border.width) - (2 * sysbar->area.paddingy);
+ count = g_slist_length(systray.list_icons);
+
+ if (!count) systray.area.width = 0;
+ else systray.area.width = (2 * systray.area.pix.border.width) + (2 * systray.area.paddingxlr) + (icon_size * count) + ((count-1) * systray.area.paddingx);
+
+ systray.area.posx = panel->area.width - panel->area.pix.border.width - panel->area.paddingxlr - systray.area.width;
+ if (panel->clock.area.on_screen)
+ systray.area.posx -= (panel->clock.area.width + panel->area.paddingx);
+
+ systray.area.redraw = 1;
+
+ posy = panel->area.pix.border.width + panel->area.paddingy + systray.area.pix.border.width + systray.area.paddingy;
+ posx = systray.area.posx + systray.area.pix.border.width + systray.area.paddingxlr;
+ for (l = systray.list_icons; l ; l = l->next) {
+ traywin = (TrayWindow*)l->data;
+
+ traywin->y = posy;
+ traywin->x = posx;
+ posx += (icon_size + systray.area.paddingx);
+ }
+
+ // resize other objects on panel
+ printf("resize_systray %d %d\n", systray.area.posx, systray.area.width);
+}
+
+