-void add_task (Window win)
+Task *add_task (Window win)
{
- if (!win) return;
- if (window_is_hidden(win)) return;
+ if (!win) return 0;
+ if (window_is_hidden(win)) return 0;
int monitor;
new_tsk.win = win;
new_tsk.area.panel = &panel1[0];
new_tsk.desktop = window_get_desktop (win);
- if (panel_mode == SINGLE_MONITOR) monitor = window_get_monitor (win);
+ if (nb_panel > 1) monitor = window_get_monitor (win);
else monitor = 0;
// allocate only one title and one icon
XSelectInput (server.dsp, new_tsk.win, PropertyChangeMask|StructureNotifyMask);
Taskbar *tskbar;
- Task *new_tsk2;
+ Task *new_tsk2=0;
int i, j;
for (i=0 ; i < nb_panel ; i++) {
for (j=0 ; j < panel1[i].nb_desktop ; j++) {
if (new_tsk.desktop != ALLDESKTOP && new_tsk.desktop != j) continue;
- if (panel_mode == SINGLE_MONITOR && panel1[i].monitor != monitor) continue;
+ if (nb_panel > 1 && panel1[i].monitor != monitor) continue;
tskbar = &panel1[i].taskbar[j];
new_tsk2 = malloc(sizeof(Task));
new_tsk2->icon_width = new_tsk.icon_width;
new_tsk2->icon_height = new_tsk.icon_height;
tskbar->area.list = g_slist_append(tskbar->area.list, new_tsk2);
-
+ tskbar->area.resize = 1;
//printf("add_task panel %d, desktop %d, task %s\n", i, j, new_tsk2->title);
- // set_resize (&tskbar->area);
- if (resize_tasks (tskbar))
- set_redraw (&tskbar->area);
}
}
+ return new_tsk2;
}
// free title and icon just for the first task
// even with task_on_all_desktop and with task_on_all_panel
//printf("remove_task %s %d\n", tsk->title, tsk->desktop);
- //printf("remove_task %s \n", tsk->title);
if (tsk->title)
free (tsk->title);
if (tsk->icon_data)
l0 = l0->next;
if (win == tsk2->win) {
tskbar->area.list = g_slist_remove(tskbar->area.list, tsk2);
- set_resize (&tskbar->area);
- set_redraw (&tskbar->area);
+ tskbar->area.resize = 1;
if (tsk2 == task_active)
task_active = 0;
}
-void draw_foreground_task (void *obj, cairo_t *c, int active)
+void draw_task (void *obj, cairo_t *c, int active)
{
Task *tsk = obj;
PangoLayout *layout;
config_color *config_text;
- int width, height;
+ int width=0, height;
Panel *panel = (Panel*)tsk->area.panel;
if (panel->g_task.text) {
pango_layout_set_text (layout, tsk->title, -1);
/* Drawing width and Cut text */
+ // pango use U+22EF or U+2026
pango_layout_set_width (layout, ((Taskbar*)tsk->area.parent)->text_width * PANGO_SCALE);
pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);