+ if (!panel1) return;
+
+ task_active = 0;
+ task_drag = 0;
+ task_urgent = 0;
+ cleanup_systray();
+ cleanup_taskbar();
+
+ // font allocated once
+ if (panel1[0].g_task.font_desc) {
+ pango_font_description_free(panel1[0].g_task.font_desc);
+ panel1[0].g_task.font_desc = 0;
+ }
+
+ int i;
+ Panel *p;
+ for (i=0 ; i < nb_panel ; i++) {
+ p = &panel1[i];
+
+ free_area(&p->area);
+ free_area(&p->g_task.area);
+ free_area(&p->g_taskbar);
+
+ if (p->temp_pmap) {
+ XFreePixmap(server.dsp, p->temp_pmap);
+ p->temp_pmap = 0;
+ }
+ if (p->main_win) {
+ XDestroyWindow(server.dsp, p->main_win);
+ p->main_win = 0;
+ }
+ }
+
+ if (panel1) free(panel1);
+ panel1 = 0;
+}
+
+
+void resize_panel(void *obj)
+{
+ Panel *panel = (Panel*)obj;
+
+ if (panel_horizontal) {
+ int taskbar_width, modulo_width = 0;
+
+ taskbar_width = panel->area.width - (2 * panel->area.paddingxlr) - (2 * panel->area.pix.border.width);
+ if (panel->clock.area.on_screen && panel->clock.area.width)
+ taskbar_width -= (panel->clock.area.width + panel->area.paddingx);
+ #ifdef ENABLE_BATTERY
+ if (panel->battery.area.on_screen && panel->battery.area.width)
+ taskbar_width -= (panel->battery.area.width + panel->area.paddingx);
+ #endif
+ // TODO : systray only on first panel. search better implementation !
+ if (systray.area.on_screen && systray.area.width && panel == &panel1[0])
+ taskbar_width -= (systray.area.width + panel->area.paddingx);
+
+ if (panel_mode == MULTI_DESKTOP) {
+ int width = taskbar_width - ((panel->nb_desktop-1) * panel->area.paddingx);
+ taskbar_width = width / panel->nb_desktop;
+ modulo_width = width % panel->nb_desktop;
+ }
+
+ // change posx and width for all taskbar
+ int i, posx;
+ posx = panel->area.pix.border.width + panel->area.paddingxlr;
+ for (i=0 ; i < panel->nb_desktop ; i++) {
+ panel->taskbar[i].area.posx = posx;
+ panel->taskbar[i].area.width = taskbar_width;
+ panel->taskbar[i].area.resize = 1;
+ if (modulo_width) {
+ panel->taskbar[i].area.width++;
+ modulo_width--;
+ }
+ //printf("taskbar %d : posx %d, width, %d, posy %d\n", i, posx, panel->taskbar[i].area.width, posx + panel->taskbar[i].area.width);
+ if (panel_mode == MULTI_DESKTOP)
+ posx += panel->taskbar[i].area.width + panel->area.paddingx;
+ }
+ }
+ else {
+ int taskbar_height, modulo_height = 0;
+ int i, posy;
+
+ taskbar_height = panel->area.height - (2 * panel->area.paddingxlr) - (2 * panel->area.pix.border.width);
+ if (panel->clock.area.on_screen && panel->clock.area.height)
+ taskbar_height -= (panel->clock.area.height + panel->area.paddingx);
+ #ifdef ENABLE_BATTERY
+ if (panel->battery.area.on_screen && panel->battery.area.height)
+ taskbar_height -= (panel->battery.area.height + panel->area.paddingx);
+ #endif
+ // TODO : systray only on first panel. search better implementation !
+ if (systray.area.on_screen && systray.area.height && panel == &panel1[0])
+ taskbar_height -= (systray.area.height + panel->area.paddingx);
+
+ posy = panel->area.height - panel->area.pix.border.width - panel->area.paddingxlr - taskbar_height;
+ if (panel_mode == MULTI_DESKTOP) {
+ int height = taskbar_height - ((panel->nb_desktop-1) * panel->area.paddingx);
+ taskbar_height = height / panel->nb_desktop;
+ modulo_height = height % panel->nb_desktop;
+ }
+
+ // change posy and height for all taskbar
+ for (i=0 ; i < panel->nb_desktop ; i++) {
+ panel->taskbar[i].area.posy = posy;
+ panel->taskbar[i].area.height = taskbar_height;
+ panel->taskbar[i].area.resize = 1;
+ if (modulo_height) {
+ panel->taskbar[i].area.height++;
+ modulo_height--;
+ }
+ if (panel_mode == MULTI_DESKTOP)
+ posy += panel->taskbar[i].area.height + panel->area.paddingx;
+ }
+ }
+}
+
+
+void visible_object()
+{
+ Panel *panel;
+ int i, j;
+
+ for (i=0 ; i < nb_panel ; i++) {
+ panel = &panel1[i];
+
+ Taskbar *taskbar;
+ for (j=0 ; j < panel->nb_desktop ; j++) {
+ taskbar = &panel->taskbar[j];
+ if (panel_mode != MULTI_DESKTOP && taskbar->desktop != server.desktop) {
+ // SINGLE_DESKTOP and not current desktop
+ taskbar->area.on_screen = 0;
+ }
+ else {
+ taskbar->area.on_screen = 1;
+ }
+ }
+ }
+ panel_refresh = 1;
+}
+
+
+void set_panel_properties(Panel *p)
+{
+ XStoreName (server.dsp, p->main_win, "tint2");