battery->area._draw_foreground = draw_battery;
battery->area.size_mode = SIZE_BY_CONTENT;
battery->area._resize = resize_battery;
+ battery->area.on_screen = 1;
+ battery->area.resize = 1;
}
int id = atoi (value);
id = (id < backgrounds->len && id >= 0) ? id : 0;
panel_config.g_taskbar.bg = &g_array_index(backgrounds, Background, id);
+ if (panel_config.g_taskbar.bg_active == 0)
+ panel_config.g_taskbar.bg_active = panel_config.g_taskbar.bg;
panel_config.g_taskbar.area.bg = panel_config.g_taskbar.bg;
}
else if (strcmp (key, "taskbar_active_background_id") == 0) {
int id = atoi (value);
id = (id < backgrounds->len && id >= 0) ? id : 0;
panel_config.g_taskbar.bg_active = &g_array_index(backgrounds, Background, id);
- panel_config.g_taskbar.use_active = 1;
}
/* Task */
if (panel_autohide)
add_timeout(panel_autohide_hide_timeout, 0, autohide_hide, p);
+
+ visible_taskbar(p);
}
- visible_object();
task_refresh_tasklist();
active_task();
}
}
-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 update_strut(Panel* p)
{
if (panel_strut_policy == STRUT_NONE) {
void set_panel_items_order(Panel *p);
void set_panel_properties(Panel *p);
-void visible_object();
// draw background panel
void set_panel_background(Panel *p);
Color *config_text;
int width=0, height;
Panel *panel = (Panel*)tsk->area.panel;
+ //printf("draw_task %d %d\n", tsk->area.posx, tsk->area.posy);
if (panel->g_task.text) {
/* Layout */
tskbar = &panel->taskbar[j];
memcpy(&tskbar->area, &panel->g_taskbar, sizeof(Area));
tskbar->desktop = j;
- if (j == server.desktop && panel->g_taskbar.use_active)
+ if (j == server.desktop)
tskbar->area.bg = panel->g_taskbar.bg_active;
}
}
GSList *l;
int task_count, border_width;
- //printf("resize_taskbar : posx et width des taches\n");
- taskbar->area.redraw = 1;
-
+// taskbar->area.redraw = 1;
border_width = taskbar->area.bg->border.width;
if (panel_horizontal) {
for (l = taskbar->area.list; l ; l = l->next) {
tsk = l->data;
if (!tsk->area.on_screen) continue;
- set_task_redraw(tsk); // always redraw task, because the background could have changed (taskbar_active_id)
+ //set_task_redraw(tsk); // always redraw task, because the background could have changed (taskbar_active_id)
tsk->area.width = pixel_width;
// TODO : move later (when posx is known)
// long value[] = { panel->posx+x, panel->posy, pixel_width, panel->area.height };
for (l = taskbar->area.list; l ; l = l->next) {
tsk = l->data;
if (!tsk->area.on_screen) continue;
- set_task_redraw(tsk); // always redraw task, because the background could have changed (taskbar_active_id)
+ //set_task_redraw(tsk); // always redraw task, because the background could have changed (taskbar_active_id)
tsk->area.height = pixel_height;
// TODO : move later (when posy is known)
// long value[] = { panel->posx, panel->posy+y, panel->area.width, pixel_height };
}
}
}
+
return 0;
}
+
+void visible_taskbar(void *p)
+{
+ Panel *panel =(Panel*)p;
+ int j;
+
+ 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;
+}
+
Area area;
Background* bg;
Background* bg_active;
- int use_active;
} Global_taskbar;
int resize_taskbar(void *obj);
+// show/hide taskbar according to current desktop
+void visible_taskbar(void *p);
+
#endif
for (i=0 ; i < nb_panel ; i++) {
init_taskbar_panel(&panel1[i]);
set_panel_items_order(&panel1[i]);
+ visible_taskbar(&panel1[i]);
panel1[i].area.resize = 1;
}
- visible_object();
task_refresh_tasklist();
active_task();
panel_refresh = 1;
server.desktop = server_get_current_desktop ();
for (i=0 ; i < nb_panel ; i++) {
Panel *panel = &panel1[i];
- if (panel_mode == MULTI_DESKTOP && panel->g_taskbar.use_active) {
+ if (panel_mode == MULTI_DESKTOP && panel->g_taskbar.bg != panel->g_taskbar.bg_active) {
// redraw both taskbar
if (server.nb_desktop > old_desktop) {
// can happen if last desktop is deleted and we've been on the last desktop
tskbar->area.resize = 1;
}
}
- }
- if (panel_mode != MULTI_DESKTOP) {
- visible_object();
+ if (panel_mode != MULTI_DESKTOP)
+ visible_taskbar(panel);
}
}
// Window list
Area *child, *a = (Area*)obj;
int size, nb_by_content=0, nb_by_layout=0;
- printf("resize_by_layout\n");
if (panel_horizontal) {
// detect free size for SIZE_BY_LAYOUT's Area
size = a->width - (2 * (a->paddingxlr + a->bg->border.width));
// each object can overwrite following function
void (*_draw_foreground)(void *obj, cairo_t *c);
- // calculate size. return '1' if size changed, '0' otherwise.
+ // update area's content and update size (width/heith).
+ // return '1' if size changed, '0' otherwise.
int (*_resize)(void *obj);
void (*_add_child)(void *obj);
int (*_remove_child)(void *obj);