]> Dogcows Code - chaz/tint2/blobdiff - src/panel.c
reverted my last checkin, because I forgot that XCopyArea only works if src.depth...
[chaz/tint2] / src / panel.c
index 9d803d95489b002f33df430ea14858ae23313887..0c5c3837b4825003dc2b71666cc086e017872dc6 100644 (file)
@@ -81,6 +81,12 @@ void init_panel()
        int i, old_nb_panel;
        Panel *new_panel, *p;
 
+       if (panel_config.monitor > (server.nb_monitor-1)) {
+               // server.nb_monitor minimum value is 1 (see get_monitors())
+               fprintf(stderr, "warning : monitor not found. tint2 default to all monitors.\n");
+               panel_config.monitor = 0;
+       }
+
        init_tooltip();
        init_systray();
        init_clock();
@@ -312,6 +318,11 @@ void cleanup_panel()
                pango_font_description_free(panel_config.g_task.font_desc);
                panel_config.g_task.font_desc = 0;
        }
+
+       if (backgrounds) {
+               g_array_free(backgrounds, 1);
+               backgrounds = 0;
+       }
 }
 
 
@@ -540,6 +551,12 @@ void set_panel_background(Panel *p)
        if (p->area.pix) XFreePixmap (server.dsp, p->area.pix);
        p->area.pix = XCreatePixmap (server.dsp, server.root_win, p->area.width, p->area.height, server.depth);
 
+       int xoff=0, yoff=0;
+       if (panel_horizontal && panel_position & BOTTOM)
+               yoff = p->area.height-p->hidden_height;
+       else if (!panel_horizontal && panel_position & RIGHT)
+               xoff = p->area.width-p->hidden_width;
+
        if (real_transparency) {
                clear_pixmap(p->area.pix, 0, 0, p->area.width, p->area.height);
        }
@@ -549,7 +566,11 @@ void set_panel_background(Panel *p)
                Window dummy;
                int  x, y;
                XTranslateCoordinates(server.dsp, p->main_win, server.root_win, 0, 0, &x, &y, &dummy);
-               XSetTSOrigin(server.dsp, server.gc, -x, -y) ;
+               if (panel_autohide && p->is_hidden) {
+                       x -= xoff;
+                       y -= yoff;
+               }
+               XSetTSOrigin(server.dsp, server.gc, -x, -y);
                XFillRectangle(server.dsp, p->area.pix, server.gc, 0, 0, p->area.width, p->area.height);
        }
 
@@ -565,11 +586,6 @@ void set_panel_background(Panel *p)
        if (panel_autohide) {
                if (p->hidden_pixmap) XFreePixmap(server.dsp, p->hidden_pixmap);
                p->hidden_pixmap = XCreatePixmap(server.dsp, server.root_win, p->hidden_width, p->hidden_height, server.depth);
-               int xoff=0, yoff=0;
-               if (panel_horizontal && panel_position & BOTTOM)
-                       yoff = p->area.height-p->hidden_height;
-               else if (!panel_horizontal && panel_position & RIGHT)
-                       xoff = p->area.width-p->hidden_width;
                XCopyArea(server.dsp, p->area.pix, p->hidden_pixmap, server.gc, xoff, yoff, p->hidden_width, p->hidden_height, 0, 0);
        }
 
@@ -719,7 +735,7 @@ void autohide_show(void* p)
        if (panel_strut_policy == STRUT_FOLLOW_SIZE)
                update_strut(p);
 
-       XMapSubwindows(server.dsp, panel->main_win);
+       XMapSubwindows(server.dsp, panel->main_win);  // systray windows
        if (panel_horizontal) {
                if (panel_position & TOP)
                        XResizeWindow(server.dsp, panel->main_win, panel->area.width, panel->area.height);
@@ -732,6 +748,7 @@ void autohide_show(void* p)
                else
                        XMoveResizeWindow(server.dsp, panel->main_win, panel->posx, panel->posy, panel->area.width, panel->area.height);
        }
+       refresh_systray = 1;   // ugly hack, because we actually only need to call XSetBackgroundPixmap
        panel_refresh = 1;
 }
 
@@ -744,7 +761,7 @@ void autohide_hide(void* p)
        if (panel_strut_policy == STRUT_FOLLOW_SIZE)
                update_strut(p);
 
-       XUnmapSubwindows(server.dsp, panel->main_win);
+       XUnmapSubwindows(server.dsp, panel->main_win);  // systray windows
        int diff = (panel_horizontal ? panel->area.height : panel->area.width) - panel_autohide_height;
        if (panel_horizontal) {
                if (panel_position & TOP)
This page took 0.02186 seconds and 4 git commands to generate.