Fix for incorrect task cycling when windows visible on all desktops are present
git-svn-id: http://tint2.googlecode.com/svn/trunk@651 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
cfa4bc89e1
commit
0a1ceaeed0
3 changed files with 32 additions and 2 deletions
|
@ -405,6 +405,35 @@ void on_change_task (void *obj)
|
||||||
set_task_redraw(tsk);
|
set_task_redraw(tsk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Given a pointer to the active task (active_task) and a pointer
|
||||||
|
// to the task that is currently under the mouse (current_task),
|
||||||
|
// return a pointer to the active task that is on the same desktop
|
||||||
|
// as current_task. Normally this is simply active_task, except when
|
||||||
|
// it is set to appear on all desktops. In that case we search for
|
||||||
|
// another Task on current_task's taskbar, with the same window as
|
||||||
|
// active_task.
|
||||||
|
Task *find_active_task(Task *current_task, Task *active_task)
|
||||||
|
{
|
||||||
|
if (active_task == 0)
|
||||||
|
return current_task;
|
||||||
|
if (active_task->desktop != ALLDESKTOP)
|
||||||
|
return active_task;
|
||||||
|
if (current_task == 0)
|
||||||
|
return active_task;
|
||||||
|
|
||||||
|
GSList *l0;
|
||||||
|
Task *tsk;
|
||||||
|
Taskbar* tskbar = current_task->area.parent;
|
||||||
|
|
||||||
|
l0 = tskbar->area.list;
|
||||||
|
if (taskbarname_enabled) l0 = l0->next;
|
||||||
|
for (; l0 ; l0 = l0->next) {
|
||||||
|
tsk = l0->data;
|
||||||
|
if (tsk->win == active_task->win)
|
||||||
|
return tsk;
|
||||||
|
}
|
||||||
|
return active_task;
|
||||||
|
}
|
||||||
|
|
||||||
Task *next_task(Task *tsk)
|
Task *next_task(Task *tsk)
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,6 +78,7 @@ void active_task();
|
||||||
void set_task_state(Task* tsk, int state);
|
void set_task_state(Task* tsk, int state);
|
||||||
void set_task_redraw(Task* tsk);
|
void set_task_redraw(Task* tsk);
|
||||||
|
|
||||||
|
Task *find_active_task(Task *current_task, Task *active_task);
|
||||||
Task *next_task (Task *tsk);
|
Task *next_task (Task *tsk);
|
||||||
Task *prev_task (Task *tsk);
|
Task *prev_task (Task *tsk);
|
||||||
|
|
||||||
|
|
|
@ -331,14 +331,14 @@ void window_action (Task *tsk, int action)
|
||||||
case NEXT_TASK:
|
case NEXT_TASK:
|
||||||
if (task_active) {
|
if (task_active) {
|
||||||
Task *tsk1;
|
Task *tsk1;
|
||||||
tsk1 = next_task(task_active);
|
tsk1 = next_task(find_active_task(tsk, task_active));
|
||||||
set_active(tsk1->win);
|
set_active(tsk1->win);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PREV_TASK:
|
case PREV_TASK:
|
||||||
if (task_active) {
|
if (task_active) {
|
||||||
Task *tsk1;
|
Task *tsk1;
|
||||||
tsk1 = prev_task(task_active);
|
tsk1 = prev_task(find_active_task(tsk, task_active));
|
||||||
set_active(tsk1->win);
|
set_active(tsk1->win);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue