// --------------------------------------------------
// taskbar point to the first taskbar in panel.area.list.
- // number of tasbar == nb_desktop
+ // number of tasbar == nb_desktop. taskbar[i] is for desktop(i).
// taskbar[i] is used to loop over taskbar,
// while panel->area.list is used to loop over all panel's objects
Taskbar *taskbar;
Taskbar *tskbar;
Task *new_tsk2=0;
int i, j;
-// for (i = 0; i < nb_panel; i++) {
-// if (nb_panel > 1 && panel1[i].monitor != monitor) continue;
-// for (j = 0; j < panel1[i].nb_desktop; j++) {
-// if ((new_tsk.desktop != ALLDESKTOP && new_tsk.desktop != j)
-// || (panel_mode == MULTI_DESKTOP && new_tsk.desktop == ALLDESKTOP && server.desktop != j))
-// continue;
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;
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->icon = new_tsk.icon;
new_tsk2->icon_active = new_tsk.icon_active;
Task *tsk;
for (l0 = tskbar->area.list; l0 ; l0 = l0->next) {
tsk = l0->data;
- if (x >= tsk->area.posx && x <= (tsk->area.posx + tsk->area.width)) {
+ if (tsk->area.on_screen && x >= tsk->area.posx && x <= (tsk->area.posx + tsk->area.width)) {
return tsk;
}
}
Task *tsk;
for (l0 = tskbar->area.list; l0 ; l0 = l0->next) {
tsk = l0->data;
- if (y >= tsk->area.posy && y <= (tsk->area.posy + tsk->area.height)) {
+ if (tsk->area.on_screen && y >= tsk->area.posy && y <= (tsk->area.posy + tsk->area.height)) {
return tsk;
}
}
}
// Change desktop
else if (at == server.atom._NET_CURRENT_DESKTOP) {
+ int old_desktop = server.desktop;
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) {
- // redraw taskbar
+ // redraw both taskbar
+ panel->taskbar[old_desktop].area.is_active = 0;
+ panel->taskbar[old_desktop].area.redraw = 1;
+ panel->taskbar[server.desktop].area.is_active = 1;
+ panel->taskbar[server.desktop].area.redraw = 1;
panel_refresh = 1;
- Taskbar *tskbar;
- Task *tsk;
- GSList *l;
- for (j=0 ; j < panel->nb_desktop ; j++) {
- tskbar = &panel->taskbar[j];
- if (tskbar->area.is_active) {
- tskbar->area.is_active = 0;
- tskbar->area.redraw = 1;
- for (l = tskbar->area.list; l ; l = l->next) {
- tsk = l->data;
- tsk->area.redraw = 1;
- }
- }
- if (j == server.desktop) {
- tskbar->area.is_active = 1;
- tskbar->area.redraw = 1;
- for (l = tskbar->area.list; l ; l = l->next) {
- tsk = l->data;
- tsk->area.redraw = 1;
- }
- }
+ }
+ // check ALLDESKTOP task => resize taskbar
+ Taskbar *tskbar;
+ Task *tsk;
+ GSList *l;
+ tskbar = &panel->taskbar[old_desktop];
+ for (l = tskbar->area.list; l ; l = l->next) {
+ tsk = l->data;
+ if (tsk->desktop == ALLDESKTOP) {
+ tsk->area.on_screen = 0;
+ tskbar->area.resize = 1;
+ panel_refresh = 1;
+ }
+ }
+ tskbar = &panel->taskbar[server.desktop];
+ for (l = tskbar->area.list; l ; l = l->next) {
+ tsk = l->data;
+ if (tsk->desktop == ALLDESKTOP) {
+ tsk->area.on_screen = 1;
+ tskbar->area.resize = 1;
}
}
}