Plasma-workspace

xwindowtasksmodel.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 "abstractwindowtasksmodel.h"
10
11#include "taskmanager_export.h"
12
13#include <QMimeData>
14#include <qwindowdefs.h>
15
16#include <memory>
17
18#include <netwm.h>
19
20namespace TaskManager
21{
22/**
23 * @short A tasks model for X Window System windows.
24 *
25 * This model presents tasks sourced from window data on the X Windows
26 * server the host process is connected to.
27 *
28 * For the purposes of presentation in a user interface and efficiency,
29 * certain types of windows (e.g. utility windows, or windows that are
30 * transients for an otherwise-included window) are omitted from the
31 * model.
32 *
33 * @see WindowTasksModel
34 *
35 * @author Eike Hein <hein@kde.org>
36 */
37
38class TASKMANAGER_EXPORT XWindowTasksModel : public AbstractWindowTasksModel
39{
40 Q_OBJECT
41
42public:
43 explicit XWindowTasksModel(QObject *parent = nullptr);
44 ~XWindowTasksModel() 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 /**
50 * Request activation of the window at the given index.
51 *
52 * If the window has a transient demanding attention, it will be
53 * activated instead.
54 *
55 * If the window has a transient in shaded state, it will be
56 * activated instead.
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 * If the window is not currently the active window, it will be activated.
92 *
93 * If the window is not on the current desktop, the current desktop will
94 * be set to the window's desktop.
95 * FIXME: Desktop logic should maybe move into proxy.
96 *
97 * @param index An index in this window tasks model.
98 **/
99 void requestMove(const QModelIndex &index) override;
100
101 /**
102 * Request starting an interactive resize for the window at the given index.
103 *
104 * If the window is not currently the active window, it will be activated.
105 *
106 * If the window is not on the current desktop, the current desktop will
107 * be set to the window's desktop.
108 * FIXME: Desktop logic should maybe move into proxy.
109 *
110 * @param index An index in this window tasks model.
111 **/
112 void requestResize(const QModelIndex &index) override;
113
114 /**
115 * Request toggling the minimized state of the window at the given index.
116 *
117 * If the window is not on the current desktop, the current desktop will
118 * be set to the window's desktop.
119 * FIXME: Desktop logic should maybe move into proxy.
120 *
121 * @param index An index in this window tasks model.
122 **/
123 void requestToggleMinimized(const QModelIndex &index) override;
124
125 /**
126 * Request toggling the maximized state of the task at the given index.
127 *
128 * If the window is not on the current desktop, the current desktop will
129 * be set to the window's desktop.
130 * FIXME: Desktop logic should maybe move into proxy.
131 *
132 * @param index An index in this window tasks model.
133 **/
134 void requestToggleMaximized(const QModelIndex &index) override;
135
136 /**
137 * Request toggling the keep-above state of the task at the given index.
138 *
139 * @param index An index in this window tasks model.
140 **/
141 void requestToggleKeepAbove(const QModelIndex &index) override;
142
143 /**
144 * Request toggling the keep-below state of the task at the given index.
145 *
146 * @param index An index in this window tasks model.
147 **/
148 void requestToggleKeepBelow(const QModelIndex &index) override;
149
150 /**
151 * Request toggling the fullscreen state of the task at the given index.
152 *
153 * @param index An index in this window tasks model.
154 **/
155 void requestToggleFullScreen(const QModelIndex &index) override;
156
157 /**
158 * Request toggling the shaded state of the task at the given index.
159 *
160 * @param index An index in this window tasks model.
161 **/
162 void requestToggleShaded(const QModelIndex &index) override;
163
164 /**
165 * Request entering the window at the given index on the specified virtual desktop.
166 * For compatibility across windowing systems the library supports, the desktops
167 * parameter is a list; however, on X11 a window can only be on one or all virtual
168 * desktops. Therefore, only the first list entry is actually used.
169 *
170 * An empty list has a special meaning: The window is entered on all virtual desktops
171 * in the session.
172 *
173 * The id 0 has a special meaning: The window is entered on all virtual desktops in
174 * the session.
175 *
176 * @param index An index in this window tasks model.
177 * @param desktops A list of virtual desktop ids (uint).
178 **/
179 void requestVirtualDesktops(const QModelIndex &index, const QVariantList &desktops) override;
180
181 /**
182 * Request entering the window at the given index on a new virtual desktop,
183 * which is created in response to this request.
184 *
185 * @param index An index in this window tasks model.
186 **/
187 void requestNewVirtualDesktop(const QModelIndex &index) override;
188
189 /**
190 * Request moving the task at the given index to the specified activities.
191 *
192 * This is meant for tasks that have an associated window, and may be
193 * a no-op when there is no window.
194 * *
195 * @param index An index in this tasks model.
196 * @param activities The new list of activities.
197 **/
198 void requestActivities(const QModelIndex &index, const QStringList &activities) override;
199
200 /**
201 * Request informing the window manager of new geometry for a visual
202 * delegate for the window at the given index.
203 *
204 * @param index An index in this window tasks model.
205 * @param geometry Visual delegate geometry in screen coordinates.
206 * @param delegate The delegate. Unused in this implementation.
207 **/
208 void requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry, QObject *delegate = nullptr) override;
209
210 /**
211 * Tries to extract a X11 window id from supplied mime data.
212 *
213 * @param mimeData Some mime data.
214 * @param @ok Set to true or false on success or failure.
215 */
216 static WId winIdFromMimeData(const QMimeData *mimeData, bool *ok = nullptr);
217
218 /**
219 * Tries to extract X11 window ids from supplied mime data.
220 *
221 * @param mimeData Some mime data.
222 * @param @ok Set to true or false on success or failure.
223 */
224 static QList<WId> winIdsFromMimeData(const QMimeData *mimeData, bool *ok = nullptr);
225
226private:
227 class Private;
228 std::unique_ptr<Private> d;
229};
230
231}
An abstract base class for window tasks models.
A tasks model for X Window System windows.
DisplayRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:06:10 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.