Plasma-workspace

waylandtasksmodel.h
1/*
2 SPDX-FileCopyrightText: 2016 Eike Hein <hein@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#pragma once
8
9#include <memory>
10
11#include "abstractwindowtasksmodel.h"
12
13#include "taskmanager_export.h"
14
15namespace KWayland
16{
17namespace Client
18{
19class PlasmaWindowManagement;
20class Surface;
21}
22
23}
24
25namespace TaskManager
26{
27/**
28 * @short A tasks model for Wayland windows.
29 *
30 * This model presents tasks sourced from window data on the Wayland
31 * server the host process is connected to.
32 *
33 * FIXME: Filtering by window type still needed.
34 *
35 * @see WindowTasksModel
36 *
37 * @author Eike Hein <hein@kde.org>
38 */
39
40class TASKMANAGER_EXPORT WaylandTasksModel : public AbstractWindowTasksModel
41{
42 Q_OBJECT
43
44public:
45 explicit WaylandTasksModel(QObject *parent = nullptr);
46 ~WaylandTasksModel() override;
47
48 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
49 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
50
51 QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override;
52
53 /**
54 * Request activation of the window at the given index.
55 *
56 * FIXME: Lacks transient handling of X Windows version.
57 *
58 * @param index An index in this window tasks model.
59 **/
60 void requestActivate(const QModelIndex &index) override;
61
62 /**
63 * Request an additional instance of the application owning the window
64 * at the given index. Success depends on whether a
65 * AbstractTasksModel::LauncherUrl could be derived from window metadata.
66 *
67 * @param index An index in this window tasks model.
68 **/
69 void requestNewInstance(const QModelIndex &index) override;
70
71 /**
72 * Runs the application backing the launcher at the given index with the given URLs.
73 * Success depends on whether a AbstractTasksModel::LauncherUrl could be
74 * derived from window metadata and a KService could be found from that.
75 *
76 * @param index An index in this launcher tasks model
77 * @param urls The URLs to be passed to the application
78 */
79 void requestOpenUrls(const QModelIndex &index, const QList<QUrl> &urls) override;
80
81 /**
82 * Request the window at the given index be closed.
83 *
84 * @param index An index in this window tasks model.
85 **/
86 void requestClose(const QModelIndex &index) override;
87
88 /**
89 * Request starting an interactive move for the window at the given index.
90 *
91 * FIXME: X Windows version has extra virtual desktop logic.
92 *
93 * @param index An index in this window tasks model.
94 **/
95 void requestMove(const QModelIndex &index) override;
96
97 /**
98 * Request starting an interactive move for the window at the given index.
99 *
100 * FIXME: X Windows version has extra virtual desktop logic.
101 *
102 * @param index An index in this window tasks model.
103 **/
104 void requestResize(const QModelIndex &index) override;
105
106 /**
107 * Request toggling the minimized state of the window at the given index.
108 *
109 * FIXME: X Windows version has extra virtual desktop logic.
110 *
111 * @param index An index in this window tasks model.
112 **/
113 void requestToggleMinimized(const QModelIndex &index) override;
114
115 /**
116 * Request toggling the maximized state of the task at the given index.
117 *
118 * FIXME: X Windows version has extra virtual desktop logic.
119 *
120 * @param index An index in this window tasks model.
121 **/
122 void requestToggleMaximized(const QModelIndex &index) override;
123
124 /**
125 * Request toggling the keep-above state of the task at the given index.
126 *
127 * @param index An index in this window tasks model.
128 **/
129 void requestToggleKeepAbove(const QModelIndex &index) override;
130
131 /**
132 * Request toggling the keep-below state of the task at the given index.
133 *
134 * @param index An index in this window tasks model.
135 **/
136 void requestToggleKeepBelow(const QModelIndex &index) override;
137
138 /**
139 * Request toggling the fullscreen state of the task at the given index.
140 *
141 * @param index An index in this window tasks model.
142 **/
143 void requestToggleFullScreen(const QModelIndex &index) override;
144
145 /**
146 * Request toggling the shaded state of the task at the given index.
147 *
148 * @param index An index in this window tasks model.
149 **/
150 void requestToggleShaded(const QModelIndex &index) override;
151
152 /**
153 * Request entering the window at the given index on the specified virtual desktops,
154 * leaving any other desktops.
155 *
156 * Virtual desktop ids are QStrings.
157 *
158 * An empty list has a special meaning: The window is entered on all virtual desktops
159 * in the session.
160 *
161 * @param index An index in this window tasks model.
162 * @param desktops A list of virtual desktop ids.
163 **/
164 void requestVirtualDesktops(const QModelIndex &index, const QVariantList &desktops) override;
165
166 /**
167 * Request entering the window at the given index on a new virtual desktop,
168 * which is created in response to this request.
169 *
170 * @param index An index in this window tasks model.
171 **/
172 void requestNewVirtualDesktop(const QModelIndex &index) override;
173
174 /**
175 * Request moving the window at the given index to the specified activities
176 *
177 * FIXME: This currently does nothing as activities is not implemented in kwin/kwayland
178 *
179 * @param index An index in this window tasks model.
180 * @param desktop A virtual desktop number.
181 **/
182 void requestActivities(const QModelIndex &index, const QStringList &activities) override;
183
184 /**
185 * Request informing the window manager of new geometry for a visual
186 * delegate for the window at the given index. The geometry is retrieved
187 * from the delegate object passed. Right now, QQuickItem is the only
188 * supported delegate object type.
189 *
190 * FIXME: This introduces the dependency on Qt::Quick. I might prefer
191 * reversing this and publishing the window pointer through the model,
192 * then calling PlasmaWindow::setMinimizeGeometry in the applet backend,
193 * rather than hand delegate items into the lib, keeping the lib more UI-
194 * agnostic.
195 *
196 * @param index An index in this window tasks model.
197 * @param geometry Visual delegate geometry in screen coordinates. Unused
198 * in this implementation.
199 * @param delegate The delegate. This implementation will attempt to cast
200 * it to QQuickItem, map its coordinates to its window and find the Wayland
201 * Surface for the window.
202 **/
203 void requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry, QObject *delegate = nullptr) override;
204
205 /**
206 * Tries to extract a process-internal Wayland window id from supplied mime data.
207 *
208 * @param mimeData Some mime data.
209 * @param @ok Set to true or false on success or failure.
210 */
211 static QUuid winIdFromMimeData(const QMimeData *mimeData, bool *ok = nullptr);
212
213 /**
214 * Tries to extract process-internal Wayland window ids from supplied mime data.
215 *
216 * @param mimeData Some mime data.
217 * @param @ok Set to true or false on success or failure.
218 */
219 static QList<QUuid> winIdsFromMimeData(const QMimeData *mimeData, bool *ok = nullptr);
220
221private:
222 class Private;
223 std::unique_ptr<Private> d;
224};
225
226}
An abstract base class for window tasks models.
A tasks model for Wayland windows.
DisplayRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:42 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.