Commit 16b1cae7 authored by Marco Martin's avatar Marco Martin

when task switch appears release minimize on launchers

parent 6677d9a8
......@@ -453,10 +453,6 @@ void ApplicationListModel::setMinimizedDelegate(int row, QQuickItem *delegate)
return;
}
if (!delegate || !delegate->parentItem() || !delegate->window()) {
return;
}
QWindow *delegateWindow = delegate->window();
if (!delegateWindow) {
......@@ -480,5 +476,32 @@ void ApplicationListModel::setMinimizedDelegate(int row, QQuickItem *delegate)
window->setMinimizedGeometry(surface, rect);
}
void ApplicationListModel::unsetMinimizedDelegate(int row, QQuickItem *delegate)
{
if (row < 0 || row >= m_applicationList.count()) {
return;
}
QWindow *delegateWindow = delegate->window();
if (!delegateWindow) {
return;
}
using namespace KWayland::Client;
KWayland::Client::PlasmaWindow *window = m_applicationList[row].window;
if (!window) {
return;
}
Surface *surface = Surface::fromWindow(delegateWindow);
if (!surface) {
return;
}
qWarning()<<"UNSETTING"<<window->title();
window->unsetMinimizedGeometry(surface);
}
#include "moc_applicationlistmodel.cpp"
......@@ -107,6 +107,7 @@ public:
Q_INVOKABLE void loadApplications();
Q_INVOKABLE void setMinimizedDelegate(int row, QQuickItem *delegate);
Q_INVOKABLE void unsetMinimizedDelegate(int row, QQuickItem *delegate);
public Q_SLOTS:
void sycocaDbChanged(const QStringList &change);
......
......@@ -51,29 +51,35 @@ ContainmentLayoutManager.ItemContainer {
signal launch(int x, int y, var source, string title)
readonly property bool applicationRunning: model.applicationRunning
onApplicationRunningChanged: {
if (applicationRunning && !MobileShell.HomeScreenControls.taskSwitcherVisible) {
function syncDelegateGeometry() {
if (!applicationRunning) {
return;
}
if (!MobileShell.HomeScreenControls.taskSwitcherVisible) {
plasmoid.nativeInterface.applicationListModel.setMinimizedDelegate(index, delegate);
} else {
plasmoid.nativeInterface.applicationListModel.unsetMinimizedDelegate(index, delegate);
}
}
readonly property bool applicationRunning: model.applicationRunning
onApplicationRunningChanged: {
syncDelegateGeometry();
}
Connections {
target: mainFlickable
function onCancelEditModeForItemsRequested() {
cancelEdit()
}
function onContentYChanged() {
if (applicationRunning && !MobileShell.HomeScreenControls.taskSwitcherVisible) {
plasmoid.nativeInterface.applicationListModel.setMinimizedDelegate(index, delegate);
}
syncDelegateGeometry()
}
}
Connections {
target: MobileShell.HomeScreenControls
function taskSwitcherVisibleChanged() {
if (applicationRunning && !MobileShell.HomeScreenControls.taskSwitcherVisible) {
plasmoid.nativeInterface.applicationListModel.setMinimizedDelegate(index, delegate);
}
function onTaskSwitcherVisibleChanged() {
syncDelegateGeometry();
}
}
onDragActiveChanged: {
......
......@@ -132,10 +132,9 @@ Item {
}
onPressed: delegate.z = 10;
onClicked: {
if (model.IsActive) {
window.hide();
} else {
window.setSingleActiveWindow(model.index, delegate);
window.setSingleActiveWindow(model.index, delegate);
if (!model.IsMinimized) {
window.visible = false;
}
}
onReleased: {
......
......@@ -98,8 +98,17 @@ NanoShell.FullScreenOverlay {
onVisibleChanged: {
if (!visible) {
tasksView.contentY = 0;
moveTransition.enabled = false;
scrollAnim.running = false;
activateAnim.running = false;
window.contentItem.opacity = 1;
if (activateAnim.delegate) {
activateAnim.delegate.z = 0;
activateAnim.delegate.scale = 1;
}
}
MobileShell.HomeScreenControls.taskSwitcherVisible = visible;
print("BBBB"+MobileShell.HomeScreenControls.taskSwitcherVisible)
}
SequentialAnimation {
......@@ -121,6 +130,8 @@ NanoShell.FullScreenOverlay {
if (tasksView.contentY <= 0 || tasksView.contentY >= tasksView.contentHeight - window.height) {
window.visible = false;
setSingleActiveWindow(currentTaskIndex);
} else {
moveTransition.enabled = true;
}
}
}
......@@ -262,6 +273,8 @@ NanoShell.FullScreenOverlay {
}
move: Transition {
id: moveTransition
enabled: false
NumberAnimation {
properties: "x,y"
duration: units.longDuration
......
Markdown is supported
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