mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-04 18:54:45 +00:00
when task switch appears release minimize on launchers
This commit is contained in:
parent
6677d9a887
commit
16b1cae73e
5 changed files with 60 additions and 18 deletions
|
|
@ -453,10 +453,6 @@ void ApplicationListModel::setMinimizedDelegate(int row, QQuickItem *delegate)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!delegate || !delegate->parentItem() || !delegate->window()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWindow *delegateWindow = delegate->window();
|
QWindow *delegateWindow = delegate->window();
|
||||||
|
|
||||||
if (!delegateWindow) {
|
if (!delegateWindow) {
|
||||||
|
|
@ -480,5 +476,32 @@ void ApplicationListModel::setMinimizedDelegate(int row, QQuickItem *delegate)
|
||||||
window->setMinimizedGeometry(surface, rect);
|
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"
|
#include "moc_applicationlistmodel.cpp"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ public:
|
||||||
Q_INVOKABLE void loadApplications();
|
Q_INVOKABLE void loadApplications();
|
||||||
|
|
||||||
Q_INVOKABLE void setMinimizedDelegate(int row, QQuickItem *delegate);
|
Q_INVOKABLE void setMinimizedDelegate(int row, QQuickItem *delegate);
|
||||||
|
Q_INVOKABLE void unsetMinimizedDelegate(int row, QQuickItem *delegate);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void sycocaDbChanged(const QStringList &change);
|
void sycocaDbChanged(const QStringList &change);
|
||||||
|
|
|
||||||
|
|
@ -51,11 +51,21 @@ ContainmentLayoutManager.ItemContainer {
|
||||||
|
|
||||||
signal launch(int x, int y, var source, string title)
|
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
|
readonly property bool applicationRunning: model.applicationRunning
|
||||||
onApplicationRunningChanged: {
|
onApplicationRunningChanged: {
|
||||||
if (applicationRunning && !MobileShell.HomeScreenControls.taskSwitcherVisible) {
|
syncDelegateGeometry();
|
||||||
plasmoid.nativeInterface.applicationListModel.setMinimizedDelegate(index, delegate);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Connections {
|
Connections {
|
||||||
target: mainFlickable
|
target: mainFlickable
|
||||||
|
|
@ -63,17 +73,13 @@ ContainmentLayoutManager.ItemContainer {
|
||||||
cancelEdit()
|
cancelEdit()
|
||||||
}
|
}
|
||||||
function onContentYChanged() {
|
function onContentYChanged() {
|
||||||
if (applicationRunning && !MobileShell.HomeScreenControls.taskSwitcherVisible) {
|
syncDelegateGeometry()
|
||||||
plasmoid.nativeInterface.applicationListModel.setMinimizedDelegate(index, delegate);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Connections {
|
Connections {
|
||||||
target: MobileShell.HomeScreenControls
|
target: MobileShell.HomeScreenControls
|
||||||
function taskSwitcherVisibleChanged() {
|
function onTaskSwitcherVisibleChanged() {
|
||||||
if (applicationRunning && !MobileShell.HomeScreenControls.taskSwitcherVisible) {
|
syncDelegateGeometry();
|
||||||
plasmoid.nativeInterface.applicationListModel.setMinimizedDelegate(index, delegate);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onDragActiveChanged: {
|
onDragActiveChanged: {
|
||||||
|
|
|
||||||
|
|
@ -132,10 +132,9 @@ Item {
|
||||||
}
|
}
|
||||||
onPressed: delegate.z = 10;
|
onPressed: delegate.z = 10;
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (model.IsActive) {
|
|
||||||
window.hide();
|
|
||||||
} else {
|
|
||||||
window.setSingleActiveWindow(model.index, delegate);
|
window.setSingleActiveWindow(model.index, delegate);
|
||||||
|
if (!model.IsMinimized) {
|
||||||
|
window.visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onReleased: {
|
onReleased: {
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,17 @@ NanoShell.FullScreenOverlay {
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
tasksView.contentY = 0;
|
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;
|
MobileShell.HomeScreenControls.taskSwitcherVisible = visible;
|
||||||
|
print("BBBB"+MobileShell.HomeScreenControls.taskSwitcherVisible)
|
||||||
}
|
}
|
||||||
|
|
||||||
SequentialAnimation {
|
SequentialAnimation {
|
||||||
|
|
@ -121,6 +130,8 @@ NanoShell.FullScreenOverlay {
|
||||||
if (tasksView.contentY <= 0 || tasksView.contentY >= tasksView.contentHeight - window.height) {
|
if (tasksView.contentY <= 0 || tasksView.contentY >= tasksView.contentHeight - window.height) {
|
||||||
window.visible = false;
|
window.visible = false;
|
||||||
setSingleActiveWindow(currentTaskIndex);
|
setSingleActiveWindow(currentTaskIndex);
|
||||||
|
} else {
|
||||||
|
moveTransition.enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -262,6 +273,8 @@ NanoShell.FullScreenOverlay {
|
||||||
}
|
}
|
||||||
|
|
||||||
move: Transition {
|
move: Transition {
|
||||||
|
id: moveTransition
|
||||||
|
enabled: false
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
properties: "x,y"
|
properties: "x,y"
|
||||||
duration: units.longDuration
|
duration: units.longDuration
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue