panel_items : fixed some segfault.

git-svn-id: http://tint2.googlecode.com/svn/trunk@549 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
thilor77 2010-09-18 14:58:00 +00:00
parent 3791486704
commit 500981b052
4 changed files with 21 additions and 22 deletions

View file

@ -73,17 +73,20 @@ void update_batterys(void* arg)
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;
panel_refresh = 1;
}
continue;
}
else {
if (panel1[i].battery.area.on_screen == 0) {
panel1[i].battery.area.on_screen = 1;
panel_refresh = 1;
panel1[i].area.resize = 1;
}
}
panel1[i].battery.area.resize = 1;
if (panel1[i].battery.area.on_screen == 1) {
panel1[i].battery.area.resize = 1;
panel_refresh = 1;
}
}
}
@ -448,7 +451,6 @@ int resize_battery(void *obj)
percentage_width = time_width = 0;
battery->area.redraw = 1;
snprintf(buf_bat_percentage, sizeof(buf_bat_percentage), "%d%%", battery_state.percentage);
if(battery_state.state == BATTERY_FULL) {
strcpy(buf_bat_time, "Full");

View file

@ -151,8 +151,11 @@ void init_clock_panel(void *p)
clock->area._resize = resize_clock;
clock->area.resize = 1;
clock->area.redraw = 1;
clock->area.on_screen = 1;
// check consistency
if (time1_format == 0)
return;
clock->area.on_screen = 1;
strftime(buf_time, sizeof(buf_time), time1_format, clock_gettime_for_tz(time1_timezone));
get_text_size(time1_font_desc, &time_height_ink, &time_height, panel->area.height, buf_time, strlen(buf_time));
if (time2_format) {
@ -167,8 +170,6 @@ void init_clock_panel(void *p)
}
else {
// panel vertical => fixed width, height, posy and posx
// clock->area.posy = panel->area.bg->border.width + panel->area.paddingxlr;
// clock->area.height = (2 * clock->area.paddingxlr) + (time_height + date_height);
clock->area.posx = panel->area.bg->border.width + panel->area.paddingy;
clock->area.width = panel->area.width - (2 * panel->area.bg->border.width) - (2 * panel->area.paddingy);
}
@ -236,7 +237,11 @@ int resize_clock (void *obj)
strftime(buf_date, sizeof(buf_date), time2_format, clock_gettime_for_tz(time2_timezone));
// vertical panel doen't adjust width
if (!panel_horizontal) return ret;
if (!panel_horizontal) {
// clock->area.posy = panel->area.bg->border.width + panel->area.paddingxlr;
// clock->area.height = (2 * clock->area.paddingxlr) + (time_height + date_height);
return ret;
}
//printf(" resize_clock\n");
cairo_surface_t *cs;

View file

@ -70,8 +70,12 @@ void init_launcher_panel(void *p)
launcher->area._resize = resize_launcher;
launcher->area.resize = 1;
launcher->area.redraw = 1;
launcher->area.on_screen = 1;
// check consistency
if (launcher->list_apps == NULL)
return;
launcher->area.on_screen = 1;
if (panel_horizontal) {
// panel horizonal => fixed height and posy
launcher->area.posy = panel->area.bg->border.width + panel->area.paddingy;
@ -149,6 +153,7 @@ void cleanup_launcher()
launcher_enabled = 0;
}
int resize_launcher(void *obj)
{
Launcher *launcher = obj;
@ -222,9 +227,6 @@ int resize_launcher(void *obj)
icons_per_row = count / icons_per_column + (count%icons_per_column != 0);
launcher->area.width = (2 * launcher->area.bg->border.width) + (2 * launcher->area.paddingxlr) + (icon_size * icons_per_row) + ((icons_per_row-1) * launcher->area.paddingx);
}
// launcher->area.posx = panel->area.bg->border.width + panel->area.paddingxlr;
launcher->area.posy = panel->area.bg->border.width;
}
else {
if (!count) launcher->area.height = 0;
@ -236,9 +238,6 @@ int resize_launcher(void *obj)
icons_per_column = count / icons_per_row+ (count%icons_per_row != 0);
launcher->area.height = (2 * launcher->area.bg->border.width) + (2 * launcher->area.paddingxlr) + (icon_size * icons_per_column) + ((icons_per_column-1) * launcher->area.paddingx);
}
launcher->area.posx = panel->area.bg->border.width;
// launcher->area.posy = panel->area.height - panel->area.bg->border.width - panel->area.paddingxlr - launcher->area.height;
}
int i, posx, posy;

View file

@ -68,13 +68,6 @@
* 'panel_items = SC' define a panel with just Systray and Clock.
* So the tree 'Panel.Area' will have 2 childs (Systray and Clock).
*
* 1) ok
* 2) ??
* 3) ??
* répartition entre niveau global et niveau local ??
* size_by_content peut-il modifier redraw=1 en cas de changement ? ou est ce géré par chaque composant ?
* size_by_layout peut-il modifier redraw ?
*
************************************************************/
void rendering(void *obj)