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

KDE's Doxygen guidelines are available online.