new solution for omnipresent task

git-svn-id: http://tint2.googlecode.com/svn/trunk@198 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
lorthiois@bbsoft.fr 2009-09-26 11:04:02 +00:00
parent c59330d16a
commit 2b10ed7460
5 changed files with 38 additions and 33 deletions

View file

@ -83,7 +83,7 @@ typedef struct {
// -------------------------------------------------- // --------------------------------------------------
// taskbar point to the first taskbar in panel.area.list. // 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, // taskbar[i] is used to loop over taskbar,
// while panel->area.list is used to loop over all panel's objects // while panel->area.list is used to loop over all panel's objects
Taskbar *taskbar; Taskbar *taskbar;

View file

@ -61,12 +61,6 @@ Task *add_task (Window win)
Taskbar *tskbar; Taskbar *tskbar;
Task *new_tsk2=0; Task *new_tsk2=0;
int i, j; 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 (i=0 ; i < nb_panel ; i++) {
for (j=0 ; j < panel1[i].nb_desktop ; j++) { for (j=0 ; j < panel1[i].nb_desktop ; j++) {
if (new_tsk.desktop != ALLDESKTOP && new_tsk.desktop != j) continue; if (new_tsk.desktop != ALLDESKTOP && new_tsk.desktop != j) continue;
@ -78,6 +72,10 @@ Task *add_task (Window win)
new_tsk2->area.parent = tskbar; new_tsk2->area.parent = tskbar;
new_tsk2->win = new_tsk.win; new_tsk2->win = new_tsk.win;
new_tsk2->desktop = new_tsk.desktop; 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->title = new_tsk.title;
new_tsk2->icon = new_tsk.icon; new_tsk2->icon = new_tsk.icon;
new_tsk2->icon_active = new_tsk.icon_active; new_tsk2->icon_active = new_tsk.icon_active;

View file

@ -261,7 +261,6 @@ void resize_taskbar(void *obj)
if (!tsk->area.on_screen) continue; if (!tsk->area.on_screen) continue;
tsk->area.posx = x; tsk->area.posx = x;
tsk->area.width = pixel_width; tsk->area.width = pixel_width;
tsk->area.redraw = 1;
if (modulo_width) { if (modulo_width) {
tsk->area.width++; tsk->area.width++;
modulo_width--; modulo_width--;
@ -303,7 +302,6 @@ void resize_taskbar(void *obj)
if (!tsk->area.on_screen) continue; if (!tsk->area.on_screen) continue;
tsk->area.posy = y; tsk->area.posy = y;
tsk->area.height = pixel_height; tsk->area.height = pixel_height;
tsk->area.redraw = 1;
if (modulo_height) { if (modulo_height) {
tsk->area.height++; tsk->area.height++;
modulo_height--; modulo_height--;

View file

@ -169,7 +169,7 @@ Task *click_task (Panel *panel, int x, int y)
Task *tsk; Task *tsk;
for (l0 = tskbar->area.list; l0 ; l0 = l0->next) { for (l0 = tskbar->area.list; l0 ; l0 = l0->next) {
tsk = l0->data; 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; return tsk;
} }
} }
@ -178,7 +178,7 @@ Task *click_task (Panel *panel, int x, int y)
Task *tsk; Task *tsk;
for (l0 = tskbar->area.list; l0 ; l0 = l0->next) { for (l0 = tskbar->area.list; l0 ; l0 = l0->next) {
tsk = l0->data; 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; return tsk;
} }
} }
@ -393,33 +393,37 @@ void event_property_notify (XEvent *e)
} }
// Change desktop // Change desktop
else if (at == server.atom._NET_CURRENT_DESKTOP) { else if (at == server.atom._NET_CURRENT_DESKTOP) {
int old_desktop = server.desktop;
server.desktop = server_get_current_desktop (); server.desktop = server_get_current_desktop ();
for (i=0 ; i < nb_panel ; i++) { for (i=0 ; i < nb_panel ; i++) {
Panel *panel = &panel1[i]; Panel *panel = &panel1[i];
if (panel_mode == MULTI_DESKTOP && panel->g_taskbar.use_active) { 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; panel_refresh = 1;
Taskbar *tskbar; }
Task *tsk; // check ALLDESKTOP task => resize taskbar
GSList *l; Taskbar *tskbar;
for (j=0 ; j < panel->nb_desktop ; j++) { Task *tsk;
tskbar = &panel->taskbar[j]; GSList *l;
if (tskbar->area.is_active) { tskbar = &panel->taskbar[old_desktop];
tskbar->area.is_active = 0; for (l = tskbar->area.list; l ; l = l->next) {
tskbar->area.redraw = 1; tsk = l->data;
for (l = tskbar->area.list; l ; l = l->next) { if (tsk->desktop == ALLDESKTOP) {
tsk = l->data; tsk->area.on_screen = 0;
tsk->area.redraw = 1; tskbar->area.resize = 1;
} panel_refresh = 1;
} }
if (j == server.desktop) { }
tskbar->area.is_active = 1; tskbar = &panel->taskbar[server.desktop];
tskbar->area.redraw = 1; for (l = tskbar->area.list; l ; l = l->next) {
for (l = tskbar->area.list; l ; l = l->next) { tsk = l->data;
tsk = l->data; if (tsk->desktop == ALLDESKTOP) {
tsk->area.redraw = 1; tsk->area.on_screen = 1;
} tskbar->area.resize = 1;
}
} }
} }
} }

View file

@ -43,6 +43,11 @@ void refresh (Area *a)
// don't draw transparent objects (without foreground and without background) // don't draw transparent objects (without foreground and without background)
if (a->redraw) { if (a->redraw) {
a->redraw = 0; a->redraw = 0;
// force redraw of child
GSList *l;
for (l = a->list ; l ; l = l->next)
set_redraw(l->data);
//printf("draw area posx %d, width %d\n", a->posx, a->width); //printf("draw area posx %d, width %d\n", a->posx, a->width);
draw(a, 0); draw(a, 0);
if (a->use_active) if (a->use_active)