all repos — tint2 @ b4fb372f5222e087b21b0faaba774f56119723d2

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

panel_items : fixed hide/unhide of baterry and systray

git-svn-id: http://tint2.googlecode.com/svn/trunk@560 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
thilor77 thilor77@121b4492-b84c-0410-8b4c-0d4edfb3f3cc
commit

b4fb372f5222e087b21b0faaba774f56119723d2

parent

f8e31774b61c06e417d88fb4a4291709618c07be

5 files changed, 37 insertions(+), 18 deletions(-)

jump to
M src/battery/battery.csrc/battery/battery.c

@@ -79,14 +79,14 @@ int i;

for (i=0 ; i < nb_panel ; i++) { if (battery_state.percentage >= percentage_hide) { if (panel1[i].battery.area.on_screen == 1) { - panel1[i].battery.area.on_screen = 0; - panel1[i].area.resize = 1; + hide(&panel1[i].battery.area); panel_refresh = 1; } } else { if (panel1[i].battery.area.on_screen == 0) { - panel1[i].battery.area.on_screen = 1; + show(&panel1[i].battery.area); + panel_refresh = 1; } } if (panel1[i].battery.area.on_screen == 1) {

@@ -237,9 +237,6 @@ battery->area.panel = p;

battery->area._draw_foreground = draw_battery; battery->area.size_mode = SIZE_BY_CONTENT; battery->area._resize = resize_battery; - battery->area.resize = 1; - battery->area.redraw = 1; - battery->area.on_screen = 1; }

@@ -462,14 +459,13 @@ }

} else { int new_size = bat_percentage_height + bat_time_height + (2 * (battery->area.paddingxlr + battery->area.bg->border.width)); - if (new_size != battery->area.height) { + if (new_size > battery->area.height || new_size < (battery->area.height-2)) { battery->area.height = new_size; battery->bat1_posy = ((battery->area.height - bat_percentage_height) / 2) - ((bat_time_height_ink + 2) / 2); battery->bat2_posy = battery->bat1_posy + bat_percentage_height + 2 - (bat_percentage_height - bat_percentage_height_ink)/2 - (bat_time_height - bat_time_height_ink)/2; ret = 1; } } - return ret; }
M src/clock/clock.csrc/clock/clock.c

@@ -148,12 +148,11 @@ clock->area.panel = p;

clock->area._draw_foreground = draw_clock; clock->area.size_mode = SIZE_BY_CONTENT; clock->area._resize = resize_clock; - clock->area.resize = 1; - clock->area.redraw = 1; // check consistency if (time1_format == 0) return; + clock->area.resize = 1; clock->area.on_screen = 1; if (time_tooltip_format) {

@@ -205,6 +204,7 @@ int time_height_ink, time_height, time_width, date_height_ink, date_height, date_width, ret = 0;

clock->area.redraw = 1; + date_height = date_width = 0; strftime(buf_time, sizeof(buf_time), time1_format, clock_gettime_for_tz(time1_timezone)); get_text_size2(time1_font_desc, &time_height_ink, &time_height, &time_width, panel->area.height, panel->area.width, buf_time, strlen(buf_time)); if (time2_format) {
M src/systray/systraybar.csrc/systray/systraybar.c

@@ -107,9 +107,9 @@ if (!((TrayWindow*)l->data)->hide)

count++; } if (count == 0) - systray.area.on_screen = 0; + hide(&systray.area); else - systray.area.on_screen = 1; + show(&systray.area); refresh_systray = 0; }

@@ -426,7 +426,7 @@ traywin->depth = attr.depth;

traywin->damage = 0; if (systray.area.on_screen == 0) - systray.area.on_screen = 1; + show(&systray.area); if (systray.sort == 3) systray.list_icons = g_slist_prepend(systray.list_icons, traywin);

@@ -488,10 +488,9 @@ for (l = systray.list_icons; l ; l = l->next) {

if (!((TrayWindow*)l->data)->hide) count++; } - if (count == 0) { - systray.area.on_screen = 0; - systray.area.width = 0; - } + if (count == 0) + hide(&systray.area); + // changed in systray systray.area.resize = 1; panel_refresh = 1;
M src/util/area.csrc/util/area.c

@@ -123,8 +123,8 @@ if (a->_resize) {

if (a->_resize(a)) { // 'size' changed => 'resize = 1' on the parent and redraw object ((Area*)a->parent)->resize = 1; - a->redraw = 1; } + a->redraw = 1; } } }

@@ -317,6 +317,26 @@ for (l = a->list ; l ; l = l->next)

set_redraw(l->data); } +void hide(Area *a) +{ + Area *parent = (Area*)a->parent; + + a->on_screen = 0; + parent->resize = 1; + if (panel_horizontal) + a->width = 0; + else + a->height = 0; +} + +void show(Area *a) +{ + Area *parent = (Area*)a->parent; + + a->on_screen = 1; + parent->resize = 1; + a->resize = 1; +} void draw (Area *a) {
M src/util/area.hsrc/util/area.h

@@ -104,6 +104,10 @@

// set 'redraw' on an area and childs void set_redraw (Area *a); +// hide/unhide area +void hide(Area *a); +void show(Area *a); + // draw pixmap void draw (Area *a); void draw_background (Area *a, cairo_t *c);