Common subdirectories: kicker/taskbar.orig/.deps and kicker/taskbar/.deps Common subdirectories: kicker/taskbar.orig/CVS and kicker/taskbar/CVS diff -u kicker/taskbar.orig/taskcontainer.cpp kicker/taskbar/taskcontainer.cpp --- kicker/taskbar.orig/taskcontainer.cpp Fri Feb 20 23:17:26 2004 +++ kicker/taskbar/taskcontainer.cpp Sat Feb 21 01:52:32 2004 @@ -831,15 +831,74 @@ void TaskContainer::wheelEvent( QWheelEvent* e ) { - if ( ftasks.count() > 1 ) { - if ( e->delta() > 0 ) { - // scroll away from user, previous task - performAction( TaskBar::ActivateRaiseOrIconifyReverse ); - } else { - // scroll towards user, next task - performAction( TaskBar::ActivateRaiseOrIconify ); + TaskList tasklist = taskManager->tasks(); + TaskList filtered; + Task* t; + + for ( t = tasklist.first(); t ; t = tasklist.next() ) { + if ( showAll || t->isOnCurrentDesktop() ) { + if( !showOnlyIconified || t->isIconified() ) { + filtered.append( t ); + } } } + + TaskList sorted; + /* antlarr: residue shouldn't be needed, as "in theory" we already + iterate through all applications, but kicker is a core app and we + don't want it to crash nor hang under any circumstance in the real + world, so in case a window has been moved to an out-of-range desktop + (which may be possible just by calling NETWinInfo::setDesktop(42) ) + we want to keep sanity */ + TaskList residue = filtered; + for ( int desktop = -1; desktop <= taskManager->numberOfDesktops(); desktop++ ) { + for ( t = filtered.first(); t; t = filtered.next() ) { + if ( t->desktop() == desktop ) + { + sorted.append( t ); + residue.remove( t ); + } + } + } + filtered = sorted; + + /* maxlor: Don't care about windows on invalid desktops + for ( t = residue.first(); t; t = residue.next() ) { + filtered.append( t ); + } + */ + + if (filtered.count() < 2) { return; } // no app switching if there's only one app! + + for ( t = filtered.first(); t; t = filtered.next() ) { + if (t->isActive()) { + if (e->delta() > 0) { // scroll away from user, previous task + if (t == filtered.getFirst()) { // wrap around + t = filtered.getLast(); + } else { + t = filtered.prev(); + if (t == 0) { t = filtered.getFirst(); } + } + } else { // scroll towards user, next task + if (t == filtered.getLast()) { // wrap around + t = filtered.getFirst(); + } else { + t = filtered.next(); + if (t == 0) { t = filtered.getLast(); } + } + } + if (not t) { return; } + + t->activate(); + return; + } + } + + // Still here, huh? Guess no app is active then... let's make the first + // one active. + + t = filtered.first(); + if (t != 0) { t->activate(); } } int TaskContainer::desktop()