Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/waylandtasksmodel.h
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | Copyright 2016 Eike Hein <hein.org> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU Lesser General Public | ||||
6 | License as published by the Free Software Foundation; either | ||||
7 | version 2.1 of the License, or (at your option) version 3, or any | ||||
8 | later version accepted by the membership of KDE e.V. (or its | ||||
9 | successor approved by the membership of KDE e.V.), which shall | ||||
10 | act as a proxy defined in Section 6 of version 3 of the license. | ||||
11 | | ||||
12 | This library is distributed in the hope that it will be useful, | ||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
15 | Lesser General Public License for more details. | ||||
16 | | ||||
17 | You should have received a copy of the GNU Lesser General Public | ||||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | *********************************************************************/ | ||||
20 | | ||||
21 | #ifndef WAYLANDTASKSMODEL_H | ||||
22 | #define WAYLANDTASKSMODEL_H | ||||
23 | | ||||
24 | #include "abstracttasksmodel.h" | ||||
25 | | ||||
26 | #include "taskmanager_export.h" | ||||
27 | | ||||
28 | namespace KWayland { | ||||
29 | | ||||
30 | namespace Client { | ||||
31 | class PlasmaWindowManagement; | ||||
32 | class Surface; | ||||
33 | } | ||||
34 | | ||||
35 | } | ||||
36 | | ||||
37 | namespace TaskManager | ||||
38 | { | ||||
39 | | ||||
40 | /** | ||||
41 | * @short A tasks model for Wayland windows. | ||||
42 | * | ||||
43 | * This model presents tasks sourced from window data on the Wayland | ||||
44 | * server the host process is connected to. | ||||
45 | * | ||||
46 | * FIXME: Filtering by window type still needed. | ||||
47 | * FIXME: Support for taskmanagerrulesrc (maybe) still needed. | ||||
48 | * | ||||
49 | * @author Eike Hein <hein@kde.org> | ||||
50 | */ | ||||
51 | | ||||
52 | class TASKMANAGER_EXPORT WaylandTasksModel : public AbstractTasksModel | ||||
53 | { | ||||
54 | Q_OBJECT | ||||
55 | | ||||
56 | public: | ||||
57 | explicit WaylandTasksModel(QObject *parent = 0); | ||||
58 | virtual ~WaylandTasksModel(); | ||||
59 | | ||||
60 | virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; | ||||
61 | virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override; | ||||
62 | | ||||
63 | virtual QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override; | ||||
64 | | ||||
65 | /** | ||||
66 | * Request activation of the window at the given index. | ||||
67 | * | ||||
68 | * FIXME: Lacks transient handling of X Windows version. | ||||
69 | * | ||||
70 | * @param index An index in this window tasks model. | ||||
71 | **/ | ||||
72 | void requestActivate(const QModelIndex &index) override; | ||||
73 | | ||||
74 | /** | ||||
75 | * Request an additional instance of the application owning the window | ||||
76 | * at the given index. Success depends on whether a | ||||
77 | * AbstractTasksModel::LauncherUrl could be derived from window metadata. | ||||
78 | * | ||||
79 | * @param index An index in this window tasks model. | ||||
80 | **/ | ||||
81 | void requestNewInstance(const QModelIndex &index) override; | ||||
82 | | ||||
83 | /** | ||||
84 | * Request the window at the given index be closed. | ||||
85 | * | ||||
86 | * @param index An index in this window tasks model. | ||||
87 | **/ | ||||
88 | void requestClose(const QModelIndex &index) override; | ||||
89 | | ||||
90 | /** | ||||
91 | * Request starting an interactive move for the window at the given index. | ||||
92 | * | ||||
93 | * FIXME: X Windows version has extra virtual desktop logic. | ||||
94 | * | ||||
95 | * @param index An index in this window tasks model. | ||||
96 | **/ | ||||
97 | void requestMove(const QModelIndex &index) override; | ||||
98 | | ||||
99 | /** | ||||
100 | * Request starting an interactive move for the window at the given index. | ||||
101 | * | ||||
102 | * FIXME: X Windows version has extra virtual desktop logic. | ||||
103 | * | ||||
104 | * @param index An index in this window tasks model. | ||||
105 | **/ | ||||
106 | void requestResize(const QModelIndex &index) override; | ||||
107 | | ||||
108 | /** | ||||
109 | * Request toggling the minimized state of the window at the given index. | ||||
110 | * | ||||
111 | * FIXME: X Windows version has extra virtual desktop logic. | ||||
112 | * | ||||
113 | * @param index An index in this window tasks model. | ||||
114 | **/ | ||||
115 | void requestToggleMinimized(const QModelIndex &index) override; | ||||
116 | | ||||
117 | /** | ||||
118 | * Request toggling the maximized state of the task at the given index. | ||||
119 | * | ||||
120 | * FIXME: X Windows version has extra virtual desktop logic. | ||||
121 | * | ||||
122 | * @param index An index in this window tasks model. | ||||
123 | **/ | ||||
124 | void requestToggleMaximized(const QModelIndex &index) override; | ||||
125 | | ||||
126 | /** | ||||
127 | * Request toggling the keep-above state of the task at the given index. | ||||
128 | * | ||||
129 | * @param index An index in this window tasks model. | ||||
130 | **/ | ||||
131 | void requestToggleKeepAbove(const QModelIndex &index) override; | ||||
132 | | ||||
133 | /** | ||||
134 | * Request toggling the keep-below state of the task at the given index. | ||||
135 | * | ||||
136 | * @param index An index in this window tasks model. | ||||
137 | **/ | ||||
138 | void requestToggleKeepBelow(const QModelIndex &index) override; | ||||
139 | | ||||
140 | /** | ||||
141 | * Request toggling the fullscreen state of the task at the given index. | ||||
142 | * | ||||
143 | * @param index An index in this window tasks model. | ||||
144 | **/ | ||||
145 | void requestToggleFullScreen(const QModelIndex &index) override; | ||||
146 | | ||||
147 | /** | ||||
148 | * Request toggling the shaded state of the task at the given index. | ||||
149 | * | ||||
150 | * @param index An index in this window tasks model. | ||||
151 | **/ | ||||
152 | void requestToggleShaded(const QModelIndex &index) override; | ||||
153 | | ||||
154 | /** | ||||
155 | * Request moving the window at the given index to the specified virtual | ||||
156 | * desktop. | ||||
157 | * | ||||
158 | * FIXME: X Windows version has extra virtual desktop logic. | ||||
159 | * | ||||
160 | * @param index An index in this window tasks model. | ||||
161 | * @param desktop A virtual desktop number. | ||||
162 | **/ | ||||
163 | void requestVirtualDesktop(const QModelIndex &index, qint32 desktop) override; | ||||
164 | | ||||
165 | /** | ||||
166 | * Request informing the window manager of new geometry for a visual | ||||
167 | * delegate for the window at the given index. The geometry is retrieved | ||||
168 | * from the delegate object passed. Right now, QQuickItem is the only | ||||
169 | * supported delegate object type. | ||||
170 | * | ||||
171 | * FIXME: This introduces the dependency on Qt5::Quick. I might prefer | ||||
172 | * reversing this and publishing the window pointer through the model, | ||||
173 | * then calling PlasmaWindow::setMinimizeGeometry in the applet backend, | ||||
174 | * rather than hand delegate items into the lib, keeping the lib more UI- | ||||
175 | * agnostic. | ||||
176 | * | ||||
177 | * @param index An index in this window tasks model. | ||||
178 | * @param geometry Visual delegate geometry in screen coordinates. Unused | ||||
179 | * in this implementation. | ||||
180 | * @param delegate The delegate. This implementation will attempt to cast | ||||
181 | * it to QQuickItem, map its coordinates to its window and find the Wayland | ||||
182 | * Surface for the window. | ||||
183 | **/ | ||||
184 | void requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry, | ||||
185 | QObject *delegate = nullptr) override; | ||||
186 | | ||||
187 | private: | ||||
188 | class Private; | ||||
189 | QScopedPointer<Private> d; | ||||
190 | }; | ||||
191 | | ||||
192 | } | ||||
193 | | ||||
194 | #endif |