- 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 (nb_panel > 1 && panel1[i].monitor != monitor) continue;
-
- tskbar = &panel1[i].taskbar[j];
- new_tsk2 = malloc(sizeof(Task));
- memcpy(&new_tsk2->area, &panel1[i].g_task.area, sizeof(Area));
- new_tsk2->area.parent = tskbar;
- new_tsk2->win = new_tsk.win;
- new_tsk2->desktop = new_tsk.desktop;
- if (new_tsk2->desktop == ALLDESKTOP && server.desktop != j) {
- // hide ALLDESKTOP task on non-current desktop
- new_tsk2->area.on_screen = 0;
- }
- new_tsk2->title = new_tsk.title;
- new_tsk2->area._get_tooltip_text = task_get_tooltip;
- new_tsk2->icon = new_tsk.icon;
- new_tsk2->icon_active = new_tsk.icon_active;
- 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);
+ int j;
+ for (j=0 ; j < panel1[monitor].nb_desktop ; j++) {
+ if (new_tsk.desktop != ALLDESKTOP && new_tsk.desktop != j) continue;
+
+ tskbar = &panel1[monitor].taskbar[j];
+ new_tsk2 = malloc(sizeof(Task));
+ memcpy(&new_tsk2->area, &panel1[monitor].g_task.area, sizeof(Area));
+ new_tsk2->area.parent = tskbar;
+ new_tsk2->win = new_tsk.win;
+ new_tsk2->desktop = new_tsk.desktop;
+ new_tsk2->current_state = -1; // to update the current state later in set_task_state...
+ if (new_tsk2->desktop == ALLDESKTOP && server.desktop != j) {
+ // hide ALLDESKTOP task on non-current desktop
+ new_tsk2->area.on_screen = 0;
+ }
+ new_tsk2->title = new_tsk.title;
+ new_tsk2->area._get_tooltip_text = task_get_tooltip;
+ for (k=0; k<TASK_STATE_COUNT; ++k) {
+ new_tsk2->icon[k] = new_tsk.icon[k];
+ new_tsk2->state_pix[k] = 0;