mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
taskswitcher: Fix double KWin & containment animation with windows
Fixes #136
This commit is contained in:
parent
e120f19601
commit
84440498e0
3 changed files with 53 additions and 8 deletions
|
|
@ -18,6 +18,9 @@ import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||||
|
|
||||||
import "../components" as Components
|
import "../components" as Components
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component that provides a task switcher.
|
||||||
|
*/
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
visible: false
|
visible: false
|
||||||
|
|
@ -28,15 +31,27 @@ Item {
|
||||||
taskSwitcher: root
|
taskSwitcher: root
|
||||||
}
|
}
|
||||||
|
|
||||||
// task list model
|
/**
|
||||||
|
* The task manager model to use for the tasks switcher.
|
||||||
|
*/
|
||||||
property TaskManager.TasksModel tasksModel
|
property TaskManager.TasksModel tasksModel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of tasks in the given task manager model.
|
||||||
|
*/
|
||||||
readonly property int tasksCount: tasksModel.count
|
readonly property int tasksCount: tasksModel.count
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The screen model to be used for moving windows between screens.
|
||||||
|
*/
|
||||||
property var displaysModel: MobileShell.DisplaysModel {}
|
property var displaysModel: MobileShell.DisplaysModel {}
|
||||||
|
|
||||||
// if a window has popped up in front, close the task switcher
|
/**
|
||||||
|
* Whether the window is active.
|
||||||
|
*/
|
||||||
property bool windowActive: Window.active
|
property bool windowActive: Window.active
|
||||||
onWindowActiveChanged: {
|
onWindowActiveChanged: {
|
||||||
|
// if a window has popped up in front, close the task switcher
|
||||||
if (visible && !windowActive) {
|
if (visible && !windowActive) {
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
@ -126,12 +141,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function minimizeAll() {
|
function minimizeAll() {
|
||||||
for (var i = 0 ; i < tasksModel.count; i++) {
|
MobileShell.WindowUtil.minimizeAll(root);
|
||||||
var idx = tasksModel.makeModelIndex(i);
|
|
||||||
if (!tasksModel.data(idx, TaskManager.AbstractTasksModel.IsMinimized)) {
|
|
||||||
tasksModel.requestToggleMinimized(idx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//END functions
|
//END functions
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ bool WindowUtil::activeWindowIsShell() const
|
||||||
void WindowUtil::initWayland()
|
void WindowUtil::initWayland()
|
||||||
{
|
{
|
||||||
if (!QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
|
if (!QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
|
||||||
|
qWarning() << "Plasma Mobile must use wayland! The current platform detected is:" << QGuiApplication::platformName();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -150,6 +151,31 @@ void WindowUtil::requestShowingDesktop(bool showingDesktop)
|
||||||
m_windowManagement->setShowingDesktop(showingDesktop);
|
m_windowManagement->setShowingDesktop(showingDesktop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowUtil::minimizeAll(QQuickItem *parent)
|
||||||
|
{
|
||||||
|
if (!m_windowManagement) {
|
||||||
|
qWarning() << "Ignoring request for minimizing all windows since window management hasn't been announced yet!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
KWayland::Client::Surface *surface = nullptr;
|
||||||
|
if (parent) {
|
||||||
|
QWindow *window = parent->window();
|
||||||
|
if (window) {
|
||||||
|
surface = KWayland::Client::Surface::fromWindow(window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto *w : m_windowManagement->windows()) {
|
||||||
|
if (!w->isMinimized()) {
|
||||||
|
if (surface) {
|
||||||
|
w->unsetMinimizedGeometry(surface);
|
||||||
|
}
|
||||||
|
w->requestToggleMinimized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WindowUtil::updateShowingDesktop(bool showing)
|
void WindowUtil::updateShowingDesktop(bool showing)
|
||||||
{
|
{
|
||||||
if (showing != m_showingDesktop) {
|
if (showing != m_showingDesktop) {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QQuickItem>
|
||||||
|
#include <QQuickWindow>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include <KConfigWatcher>
|
#include <KConfigWatcher>
|
||||||
|
|
@ -77,6 +79,13 @@ public:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void requestShowingDesktop(bool showingDesktop);
|
Q_INVOKABLE void requestShowingDesktop(bool showingDesktop);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimize all windows, while also unsetting their respective minimized geometries of the window given.
|
||||||
|
*
|
||||||
|
* @param parent The parent item, which is of the same window that will have geometries unset.
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void minimizeAll(QQuickItem *parent);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void windowCreated(KWayland::Client::PlasmaWindow *window);
|
void windowCreated(KWayland::Client::PlasmaWindow *window);
|
||||||
void showingDesktopChanged(bool showingDesktop);
|
void showingDesktopChanged(bool showingDesktop);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue