mouse wheel to cycle through groupped tasks

pull/1/head
Michail Vourlakos 8 years ago
parent e0f7b9b220
commit 7e104ee3a2

@ -954,6 +954,41 @@ MouseArea{
if(!inAnimation && !root.latteDock) if(!inAnimation && !root.latteDock)
checkListHovered.startDuration(3*units.longDuration); checkListHovered.startDuration(3*units.longDuration);
} }
onWheel: {
var angle = wheel.angleDelta.y / 8;
//positive direction
if (angle > 12) {
if (isLauncher) {
mouseEntered = false;
wrapper.runLauncherAnimation();
} else if (isGroupParent) {
tasksWindows.activateNextTask();
} else {
activateTask();
}
//negative direction
} else if (angle < 12) {
if (isLauncher) {
mouseEntered = false;
wrapper.runLauncherAnimation();
} else if (isGroupParent) {
tasksWindows.activatePreviousTask();
} else {
if (IsMinimized === true) {
var i = modelIndex();
tasksModel.requestToggleMinimized(i);
tasksModel.requestActivate(i);
} else if (IsActive === true) {
tasksModel.requestToggleMinimized(modelIndex());
} else {
tasksModel.requestActivate(modelIndex());
}
}
}
}
///////////////// End Of Mouse Area Events /////////////////// ///////////////// End Of Mouse Area Events ///////////////////
///// Handlers for Signals ///// ///// Handlers for Signals /////

@ -141,6 +141,7 @@ Item{
} }
} }
//the active window is the last one
if (nextAvailableWindow >= childs.count) { if (nextAvailableWindow >= childs.count) {
nextAvailableWindow = 0; nextAvailableWindow = 0;
} }
@ -161,6 +162,51 @@ Item{
tasksModel.requestActivate(tasksModel.makeModelIndex(index,nextAvailableWindow)); tasksModel.requestActivate(tasksModel.makeModelIndex(index,nextAvailableWindow));
} }
//! function which is used to cycle activation into
//! a group of windows backwise
function activatePreviousTask() {
if (!mainItemContainer.isGroupParent) {
return;
}
windowsLocalModel.currentIndex = index;
var childs = windowsLocalModel.items;
//indicates than nothing was found
var prevAvailableWindow = -2;
for(var i=childs.count-1; i>=0; --i){
var kid = childs.get(i);
if (kid.model.IsActive === true) {
prevAvailableWindow = i - 1;
break;
}
}
//the active window is 0
if (prevAvailableWindow == -1) {
prevAvailableWindow = childs.count-1;
}
if (prevAvailableWindow === -2 && lastActiveWinInGroup !==-1){
for(var i=childs.count-1; i>=0; --i){
var kid = childs.get(i);
if (kid.model.LegacyWinIdList[0] === lastActiveWinInGroup) {
prevAvailableWindow = i;
break;
}
}
}
//no window was found
if (prevAvailableWindow === -2)
prevAvailableWindow = 0;
tasksModel.requestActivate(tasksModel.makeModelIndex(index,prevAvailableWindow));
}
// keep a record of the last active window in a group // keep a record of the last active window in a group
Connections{ Connections{
target:tasksModel target:tasksModel

Loading…
Cancel
Save