when task switch appears release minimize on launchers

This commit is contained in:
Marco Martin 2020-07-31 11:11:26 +02:00
parent 6677d9a887
commit 16b1cae73e
5 changed files with 60 additions and 18 deletions

View file

@ -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"

View file

@ -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);

View file

@ -51,11 +51,21 @@ ContainmentLayoutManager.ItemContainer {
signal launch(int x, int y, var source, string title)
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: {
if (applicationRunning && !MobileShell.HomeScreenControls.taskSwitcherVisible) {
plasmoid.nativeInterface.applicationListModel.setMinimizedDelegate(index, delegate);
}
syncDelegateGeometry();
}
Connections {
target: mainFlickable
@ -63,17 +73,13 @@ ContainmentLayoutManager.ItemContainer {
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: {

View file

@ -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: {

View file

@ -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