X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fsystray%2Fsystraybar.c;h=8a92a0452ff8d083596ff8632986bc4ebf3ef0b6;hb=31738a0686966a561b8578d5daf1366dd0a8c1ac;hp=23d2ab3821d1b58883ed1a0a380dd36a1bea2626;hpb=c75069e03de761de15a6d74a4df0d7dbe6672b6e;p=chaz%2Ftint2 diff --git a/src/systray/systraybar.c b/src/systray/systraybar.c index 23d2ab3..8a92a04 100644 --- a/src/systray/systraybar.c +++ b/src/systray/systraybar.c @@ -1,7 +1,7 @@ /************************************************************************** * Tint2 : systraybar * -* Copyright (C) 2009 thierry lorthiois (lorthiois@bbsoft.fr) +* Copyright (C) 2009 thierry lorthiois (lorthiois@bbsoft.fr) from Omega distribution * based on 'docker-1.5' from Ben Jansens. * * This program is free software; you can redistribute it and/or @@ -98,7 +98,9 @@ void init_systray_panel(void *p) { systray.area.parent = p; systray.area.panel = p; - + if (systray.area.bg == 0) + systray.area.bg = &g_array_index(backgrounds, Background, 0); + GSList *l; int count = 0; for (l = systray.list_icons; l ; l = l->next) { @@ -167,11 +169,11 @@ int resize_systray(void *obj) void on_change_systray (void *obj) { - // here, sysbar's position is defined. so we can calculate position of tray icon. + // here, systray.area.posx/posy are defined by rendering engine. so we can calculate position of tray icon. Systraybar *sysbar = obj; Panel *panel = sysbar->area.panel; int i, posx, posy; - int start = panel->area.bg->border.width + panel->area.paddingy + systray.area.bg->border.width + systray.area.paddingy +sysbar->marging/2; + int start = panel->area.bg->border.width + panel->area.paddingy + systray.area.bg->border.width + systray.area.paddingy + sysbar->marging/2; if (panel_horizontal) { posy = start; posx = systray.area.posx + systray.area.bg->border.width + systray.area.paddingxlr; @@ -189,6 +191,7 @@ void on_change_systray (void *obj) traywin->y = posy; traywin->x = posx; + //printf("systray %d : %d,%d\n", i, posx, posy); traywin->width = sysbar->icon_size; traywin->height = sysbar->icon_size; if (panel_horizontal) { @@ -351,6 +354,9 @@ gboolean add_icon(Window id) Panel *panel = systray.area.panel; int hide = 0; + // watch for the icon trying to resize itself / closing again! + XSelectInput(server.dsp, id, StructureNotifyMask); + error = FALSE; XWindowAttributes attr; if ( XGetWindowAttributes(server.dsp, id, &attr) == False ) return FALSE; @@ -439,8 +445,6 @@ gboolean add_icon(Window id) systray.list_icons = g_slist_insert_sorted(systray.list_icons, traywin, compare_traywindows); //printf("add_icon id %lx, %d\n", id, g_slist_length(systray.list_icons)); - // watch for the icon trying to resize itself! - XSelectInput(server.dsp, traywin->tray_id, StructureNotifyMask); if (server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) { traywin->damage = XDamageCreate(server.dsp, traywin->id, XDamageReportRawRectangles); XCompositeRedirectWindow(server.dsp, traywin->id, CompositeRedirectManual); @@ -532,6 +536,11 @@ void systray_render_icon_now(void* t) // we made also sure, that we always have a 32 bit visual, i.e. we can safely create 32 bit pixmaps here TrayWindow* traywin = t; traywin->render_timeout = 0; + if ( traywin->width == 0 || traywin->height == 0 ) { + // reschedule rendering since the geometry information has not yet been processed (can happen on slow cpu) + systray_render_icon(traywin); + return; + } // good systray icons support 32 bit depth, but some icons are still 24 bit. // We create a heuristic mask for these icons, i.e. we get the rgb value in the top left corner, and