Commit 469aac05 authored by Marco Martin's avatar Marco Martin
Browse files

better task switch behavior

close should always close now

peek fixed
unintended task activation shouldn't happen anymore
parent 475d32d0
......@@ -32,8 +32,9 @@ Item {
//Workaround
property bool active: model.IsActive
onActiveChanged: {
//sometimes the task switcher window itself appears, screwing up the state
if (model.IsActive) {
window.currentTaskIndex = index
// window.currentTaskIndex = index
}
}
......@@ -88,8 +89,8 @@ Item {
}
width: parent.width
height: parent.height
radius: units.gridUnit
opacity: 0.8 * (1-Math.abs(x)/width)
radius: units.smallSpacing
opacity: 0.9 * (1-Math.abs(x)/width)
PlasmaCore.IconItem {
anchors.centerIn: parent
width: Math.min(parent.width, parent.height) / 2
......
......@@ -36,7 +36,7 @@ FullScreenPanel {
property int tasksCount: filteredWindowModel.count
property int currentTaskIndex: -1
color: Qt.rgba(0, 0, 0, 0.6 * Math.min(
color: Qt.rgba(0, 0, 0, 0.8 * Math.min(
(Math.min(tasksView.contentY + tasksView.height, tasksView.height) / tasksView.height),
((tasksView.contentHeight - tasksView.contentY - tasksView.headerItem.height - tasksView.footerItem.height)/tasksView.height)))
......@@ -73,15 +73,12 @@ FullScreenPanel {
plasmoid.nativeInterface.windowModel.requestActivate(filteredWindowModel.mapRowToSource(i));
} else if (i != id && !task.IsMinimized) {
plasmoid.nativeInterface.windowModel.requestToggleMinimized(filteredWindowModel.mapRowToSource(i));
}
}
}
if (id >= 0) {
plasmoid.nativeInterface.windowModel.requestActivate(filteredWindowModel.mapRowToSource(id));
} else {
plasmoid.nativeInterface.forgetActiveWindow();
currentTaskIndex = id;
}
currentTaskIndex = id;
}
onOffsetChanged: tasksView.contentY = offset
......@@ -207,8 +204,9 @@ FullScreenPanel {
}
iconSource: "go-home"
onClicked: {
window.hide();
currentTaskIndex = -1;
setSingleActiveWindow(-1);
window.hide();
}
}
Component.onCompleted: plasmoid.nativeInterface.panel = window;
......
......@@ -47,12 +47,22 @@ PlasmaCore.ColorScope {
id: mainMouseArea
anchors.fill: parent
property int oldMouseY: 0
property int startMouseY: 0
property bool isDragging: false
drag.filterChildren: true
onPressed: {
oldMouseY = mouse.y;
function managePressed(mouse) {
startMouseY = oldMouseY = mouse.y;
taskSwitcher.offset = -taskSwitcher.height
}
onPressed: managePressed();
onPositionChanged: {
if (!isDragging && Math.abs(startMouseY - oldMouseY) < root.height) {
oldMouseY = mouse.y;
return;
} else {
isDragging = true;
}
taskSwitcher.offset = taskSwitcher.offset - (mouse.y - oldMouseY);
oldMouseY = mouse.y;
if (taskSwitcher.visibility == Window.Hidden && taskSwitcher.offset > -taskSwitcher.height + units.gridUnit && taskSwitcher.tasksCount) {
......@@ -61,10 +71,15 @@ PlasmaCore.ColorScope {
taskSwitcher.setSingleActiveWindow(-1);
}
onReleased: {
if (!isDragging) {
return;
}
if (taskSwitcher.visibility == Window.Hidden) {
return;
}
if (taskSwitcher.offset > -taskSwitcher.height/2) {
taskSwitcher.currentTaskIndex = -1
taskSwitcher.show();
} else {
taskSwitcher.hide();
......@@ -85,9 +100,13 @@ PlasmaCore.ColorScope {
anchors.left: parent.left
height: parent.height
width: parent.width/3
enabled: taskSwitcher.tasksCount > 0
enabled: taskSwitcher.tasksCount > 0 && plasmoid.nativeInterface.hasCloseableActiveWindow;
iconSource: "window-list"
onClicked: taskSwitcher.visible ? taskSwitcher.hide() : taskSwitcher.show();
onClicked: {
taskSwitcher.currentTaskIndex = -1;
taskSwitcher.visible ? taskSwitcher.hide() : taskSwitcher.show();
}
onPressed: mainMouseArea.managePressed(mouse);
onPositionChanged: mainMouseArea.positionChanged(mouse);
onReleased: mainMouseArea.released(mouse);
}
......@@ -98,11 +117,26 @@ PlasmaCore.ColorScope {
width: parent.width/3
anchors.horizontalCenter: parent.horizontalCenter
iconSource: "go-home"
onClicked: {
root.taskSwitcher.setSingleActiveWindow(-1);
enabled: taskSwitcher.tasksCount > 0
checkable: true
onCheckedChanged: {
if (checked) {
root.taskSwitcher.setSingleActiveWindow(-1);
} else {
root.taskSwitcher.setSingleActiveWindow(root.taskSwitcher.currentTaskIndex);
}
}
onPressed: mainMouseArea.managePressed(mouse);
onPositionChanged: mainMouseArea.positionChanged(mouse);
onReleased: mainMouseArea.released(mouse);
Connections {
target: root.taskSwitcher
onCurrentTaskIndexChanged: {
if (root.taskSwitcher.currentTaskIndex < 0) {
showDesktopButton.checked = false;
}
}
}
}
Button {
......@@ -112,6 +146,7 @@ PlasmaCore.ColorScope {
iconSource: "window-close"
enabled: plasmoid.nativeInterface.hasCloseableActiveWindow;
onClicked: plasmoid.nativeInterface.closeActiveWindow();
onPressed: mainMouseArea.managePressed(mouse);
onPositionChanged: mainMouseArea.positionChanged(mouse);
onReleased: mainMouseArea.released(mouse);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment