Merge lp:~gerboland/qtubuntu/delete-qraster-crash into lp:qtubuntu
- delete-qraster-crash
- Merge into trunk
Proposed by
Gerry Boland
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~gerboland/qtubuntu/delete-qraster-crash | ||||
Merge into: | lp:qtubuntu | ||||
Diff against target: |
5402 lines (+2063/-1261) 36 files modified
README (+7/-7) debian/changelog (+17/-0) src/ubuntuappmenu/gmenumodelplatformmenu.cpp (+5/-0) src/ubuntumirclient/qmirclientappstatecontroller.cpp (+46/-22) src/ubuntumirclient/qmirclientappstatecontroller.h (+45/-21) src/ubuntumirclient/qmirclientbackingstore.cpp (+58/-31) src/ubuntumirclient/qmirclientbackingstore.h (+46/-22) src/ubuntumirclient/qmirclientclipboard.cpp (+58/-34) src/ubuntumirclient/qmirclientclipboard.h (+46/-22) src/ubuntumirclient/qmirclientcursor.cpp (+65/-35) src/ubuntumirclient/qmirclientcursor.h (+49/-24) src/ubuntumirclient/qmirclientdebugextension.cpp (+54/-30) src/ubuntumirclient/qmirclientdebugextension.h (+52/-27) src/ubuntumirclient/qmirclientdesktopwindow.cpp (+44/-20) src/ubuntumirclient/qmirclientdesktopwindow.h (+45/-21) src/ubuntumirclient/qmirclientglcontext.cpp (+57/-33) src/ubuntumirclient/qmirclientglcontext.h (+46/-22) src/ubuntumirclient/qmirclientinput.cpp (+119/-94) src/ubuntumirclient/qmirclientinput.h (+59/-36) src/ubuntumirclient/qmirclientintegration.cpp (+97/-74) src/ubuntumirclient/qmirclientintegration.h (+63/-39) src/ubuntumirclient/qmirclientlogging.h (+49/-25) src/ubuntumirclient/qmirclientnativeinterface.cpp (+80/-56) src/ubuntumirclient/qmirclientnativeinterface.h (+49/-25) src/ubuntumirclient/qmirclientorientationchangeevent_p.h (+44/-20) src/ubuntumirclient/qmirclientplatformservices.cpp (+52/-28) src/ubuntumirclient/qmirclientplatformservices.h (+44/-20) src/ubuntumirclient/qmirclientplugin.cpp (+50/-29) src/ubuntumirclient/qmirclientplugin.h (+46/-21) src/ubuntumirclient/qmirclientscreen.cpp (+56/-32) src/ubuntumirclient/qmirclientscreen.h (+50/-26) src/ubuntumirclient/qmirclientscreenobserver.cpp (+59/-35) src/ubuntumirclient/qmirclientscreenobserver.h (+56/-32) src/ubuntumirclient/qmirclientwindow.cpp (+260/-230) src/ubuntumirclient/qmirclientwindow.h (+58/-36) src/ubuntumirclient/ubuntumirclient.pro (+32/-32) |
||||
To merge this branch: | bzr merge lp:~gerboland/qtubuntu/delete-qraster-crash | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity8 CI Bot | continuous-integration | Approve | |
Ubuntu Phablet Team | Pending | ||
Review via email:
|
This proposal has been superseded by a proposal from 2017-02-21.
Commit message
BackingStore: make current only if no existing context current
Paraphrasing QOpenGLComposit
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
review:
Approve
(continuous-integration)
- 372. By Gerry Boland
-
BackingStore: make current only if no existing context current
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'README' |
2 | --- README 2016-09-29 15:12:29 +0000 |
3 | +++ README 2017-02-21 12:29:19 +0000 |
4 | @@ -44,13 +44,13 @@ |
5 | logged and debug messages are disabled. QtUbuntu provides the following |
6 | logging categories: |
7 | |
8 | - * ubuntumirclient.cursor - Messages about the cursor. |
9 | - * ubuntumirclient.input - Messages related to input and other Mir events. |
10 | - * ubuntumirclient.graphics - Messages related to graphics, GL and EGL. |
11 | - * ubuntumirclient.swapBuffers - Messages related to surface buffer swapping. |
12 | - * ubuntumirclient - For all other messages form the ubuntumirclient QPA. |
13 | - * ubuntuappmenu.registrar - Messages related to application menu registration. |
14 | - * ubuntuappmenu - For all other messages form the ubuntuappmenu QPA theme. |
15 | + * qt.qpa.mirclient.cursor - Messages about the cursor. |
16 | + * qt.qpa.mirclient.input - Messages related to input and other Mir events. |
17 | + * qt.qpa.mirclient.graphics - Messages related to graphics, GL and EGL. |
18 | + * qt.qpa.mirclient.swapBuffers - Messages related to surface buffer swapping. |
19 | + * qt.qpa.mirclient - For all other messages form the ubuntumirclient QPA. |
20 | + * ubuntuappmenu.registrar - Messages related to application menu registration. |
21 | + * ubuntuappmenu - For all other messages form the ubuntuappmenu QPA theme. |
22 | |
23 | The QT_QPA_EGLFS_DEBUG environment variable prints a little more information |
24 | from Qt's internals. |
25 | |
26 | === modified file 'debian/changelog' |
27 | --- debian/changelog 2017-01-19 22:55:05 +0000 |
28 | +++ debian/changelog 2017-02-21 12:29:19 +0000 |
29 | @@ -1,3 +1,20 @@ |
30 | +qtubuntu (0.63+17.04.20170215-0ubuntu1) zesty; urgency=medium |
31 | + |
32 | + [ Albert Astals Cid ] |
33 | + * Fix crash when starting konsole |
34 | + |
35 | + [ Alberto Aguirre ] |
36 | + * Changes for mir 0.26.1: PersitentID has been renamed to WindowID |
37 | + |
38 | + [ Arthur Mello ] |
39 | + * Update code to use new Mir Api's. |
40 | + |
41 | + [ Gerry Boland, Nick Dedekind ] |
42 | + * Class renaming and syntax changes to shrink delta with upstream |
43 | + mirclient QPA plugin (which is equivalent to rev 360) |
44 | + |
45 | + -- MichaĆ Sawicz <michal.sawicz@canonical.com> Wed, 15 Feb 2017 08:23:33 +0000 |
46 | + |
47 | qtubuntu (0.63+17.04.20170119.2-0ubuntu1) zesty; urgency=medium |
48 | |
49 | [ Daniel d'Andrada ] |
50 | |
51 | === modified file 'src/ubuntuappmenu/gmenumodelplatformmenu.cpp' |
52 | --- src/ubuntuappmenu/gmenumodelplatformmenu.cpp 2016-12-09 17:04:05 +0000 |
53 | +++ src/ubuntuappmenu/gmenumodelplatformmenu.cpp 2017-02-21 12:29:19 +0000 |
54 | @@ -499,6 +499,11 @@ |
55 | if (m_menu != menu) { |
56 | m_menu = menu; |
57 | Q_EMIT propertyChanged(); |
58 | + |
59 | + if (menu) { |
60 | + connect(menu, &QObject::destroyed, |
61 | + this, [this] { setMenu(nullptr); }); |
62 | + } |
63 | } |
64 | } |
65 | |
66 | |
67 | === renamed file 'src/ubuntumirclient/appstatecontroller.cpp' => 'src/ubuntumirclient/qmirclientappstatecontroller.cpp' |
68 | --- src/ubuntumirclient/appstatecontroller.cpp 2016-10-12 15:07:35 +0000 |
69 | +++ src/ubuntumirclient/qmirclientappstatecontroller.cpp 2017-02-21 12:29:19 +0000 |
70 | @@ -1,31 +1,55 @@ |
71 | -/* |
72 | - * Copyright (C) 2016 Canonical, Ltd. |
73 | - * |
74 | - * This program is free software: you can redistribute it and/or modify it under |
75 | - * the terms of the GNU Lesser General Public License version 3, as published by |
76 | - * the Free Software Foundation. |
77 | - * |
78 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
79 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
80 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
81 | - * Lesser General Public License for more details. |
82 | - * |
83 | - * You should have received a copy of the GNU Lesser General Public License |
84 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
85 | - */ |
86 | - |
87 | -#include "appstatecontroller.h" |
88 | +/**************************************************************************** |
89 | +** |
90 | +** Copyright (C) 2016 Canonical, Ltd. |
91 | +** Contact: https://www.qt.io/licensing/ |
92 | +** |
93 | +** This file is part of the plugins of the Qt Toolkit. |
94 | +** |
95 | +** $QT_BEGIN_LICENSE:LGPL$ |
96 | +** Commercial License Usage |
97 | +** Licensees holding valid commercial Qt licenses may use this file in |
98 | +** accordance with the commercial license agreement provided with the |
99 | +** Software or, alternatively, in accordance with the terms contained in |
100 | +** a written agreement between you and The Qt Company. For licensing terms |
101 | +** and conditions see https://www.qt.io/terms-conditions. For further |
102 | +** information use the contact form at https://www.qt.io/contact-us. |
103 | +** |
104 | +** GNU Lesser General Public License Usage |
105 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
106 | +** General Public License version 3 as published by the Free Software |
107 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
108 | +** packaging of this file. Please review the following information to |
109 | +** ensure the GNU Lesser General Public License version 3 requirements |
110 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
111 | +** |
112 | +** GNU General Public License Usage |
113 | +** Alternatively, this file may be used under the terms of the GNU |
114 | +** General Public License version 2.0 or (at your option) the GNU General |
115 | +** Public license version 3 or any later version approved by the KDE Free |
116 | +** Qt Foundation. The licenses are as published by the Free Software |
117 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
118 | +** included in the packaging of this file. Please review the following |
119 | +** information to ensure the GNU General Public License requirements will |
120 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
121 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
122 | +** |
123 | +** $QT_END_LICENSE$ |
124 | +** |
125 | +****************************************************************************/ |
126 | + |
127 | + |
128 | +#include "qmirclientappstatecontroller.h" |
129 | |
130 | #include <qpa/qwindowsysteminterface.h> |
131 | |
132 | /* |
133 | - * UbuntuAppStateController - updates Qt's QApplication::applicationState property. |
134 | + * QMirClientAppStateController - updates Qt's QApplication::applicationState property. |
135 | * |
136 | * Tries to avoid active-inactive-active invocations using a timer. The rapid state |
137 | * change can confuse some applications. |
138 | */ |
139 | |
140 | -UbuntuAppStateController::UbuntuAppStateController() |
141 | +QMirClientAppStateController::QMirClientAppStateController() |
142 | : m_suspended(false) |
143 | , m_lastActive(true) |
144 | { |
145 | @@ -37,7 +61,7 @@ |
146 | }); |
147 | } |
148 | |
149 | -void UbuntuAppStateController::setSuspended() |
150 | +void QMirClientAppStateController::setSuspended() |
151 | { |
152 | m_inactiveTimer.stop(); |
153 | if (!m_suspended) { |
154 | @@ -47,7 +71,7 @@ |
155 | } |
156 | } |
157 | |
158 | -void UbuntuAppStateController::setResumed() |
159 | +void QMirClientAppStateController::setResumed() |
160 | { |
161 | m_inactiveTimer.stop(); |
162 | if (m_suspended) { |
163 | @@ -61,7 +85,7 @@ |
164 | } |
165 | } |
166 | |
167 | -void UbuntuAppStateController::setWindowFocused(bool focused) |
168 | +void QMirClientAppStateController::setWindowFocused(bool focused) |
169 | { |
170 | if (m_suspended) { |
171 | return; |
172 | |
173 | === renamed file 'src/ubuntumirclient/appstatecontroller.h' => 'src/ubuntumirclient/qmirclientappstatecontroller.h' |
174 | --- src/ubuntumirclient/appstatecontroller.h 2016-10-12 15:05:58 +0000 |
175 | +++ src/ubuntumirclient/qmirclientappstatecontroller.h 2017-02-21 12:29:19 +0000 |
176 | @@ -1,28 +1,52 @@ |
177 | -/* |
178 | - * Copyright (C) 2016 Canonical, Ltd. |
179 | - * |
180 | - * This program is free software: you can redistribute it and/or modify it under |
181 | - * the terms of the GNU Lesser General Public License version 3, as published by |
182 | - * the Free Software Foundation. |
183 | - * |
184 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
185 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
186 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
187 | - * Lesser General Public License for more details. |
188 | - * |
189 | - * You should have received a copy of the GNU Lesser General Public License |
190 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
191 | - */ |
192 | - |
193 | -#ifndef UBUNTUAPPSTATECONTROLLER_H |
194 | -#define UBUNTUAPPSTATECONTROLLER_H |
195 | +/**************************************************************************** |
196 | +** |
197 | +** Copyright (C) 2016 Canonical, Ltd. |
198 | +** Contact: https://www.qt.io/licensing/ |
199 | +** |
200 | +** This file is part of the plugins of the Qt Toolkit. |
201 | +** |
202 | +** $QT_BEGIN_LICENSE:LGPL$ |
203 | +** Commercial License Usage |
204 | +** Licensees holding valid commercial Qt licenses may use this file in |
205 | +** accordance with the commercial license agreement provided with the |
206 | +** Software or, alternatively, in accordance with the terms contained in |
207 | +** a written agreement between you and The Qt Company. For licensing terms |
208 | +** and conditions see https://www.qt.io/terms-conditions. For further |
209 | +** information use the contact form at https://www.qt.io/contact-us. |
210 | +** |
211 | +** GNU Lesser General Public License Usage |
212 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
213 | +** General Public License version 3 as published by the Free Software |
214 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
215 | +** packaging of this file. Please review the following information to |
216 | +** ensure the GNU Lesser General Public License version 3 requirements |
217 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
218 | +** |
219 | +** GNU General Public License Usage |
220 | +** Alternatively, this file may be used under the terms of the GNU |
221 | +** General Public License version 2.0 or (at your option) the GNU General |
222 | +** Public license version 3 or any later version approved by the KDE Free |
223 | +** Qt Foundation. The licenses are as published by the Free Software |
224 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
225 | +** included in the packaging of this file. Please review the following |
226 | +** information to ensure the GNU General Public License requirements will |
227 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
228 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
229 | +** |
230 | +** $QT_END_LICENSE$ |
231 | +** |
232 | +****************************************************************************/ |
233 | + |
234 | + |
235 | +#ifndef QMIRCLIENTAPPSTATECONTROLLER_H |
236 | +#define QMIRCLIENTAPPSTATECONTROLLER_H |
237 | |
238 | #include <QTimer> |
239 | |
240 | -class UbuntuAppStateController |
241 | +class QMirClientAppStateController |
242 | { |
243 | public: |
244 | - UbuntuAppStateController(); |
245 | + QMirClientAppStateController(); |
246 | |
247 | void setSuspended(); |
248 | void setResumed(); |
249 | @@ -35,4 +59,4 @@ |
250 | QTimer m_inactiveTimer; |
251 | }; |
252 | |
253 | -#endif // UBUNTUAPPSTATECONTROLLER_H |
254 | +#endif // QMIRCLIENTAPPSTATECONTROLLER_H |
255 | |
256 | === renamed file 'src/ubuntumirclient/backingstore.cpp' => 'src/ubuntumirclient/qmirclientbackingstore.cpp' |
257 | --- src/ubuntumirclient/backingstore.cpp 2016-10-12 16:31:54 +0000 |
258 | +++ src/ubuntumirclient/qmirclientbackingstore.cpp 2017-02-21 12:29:19 +0000 |
259 | @@ -1,28 +1,52 @@ |
260 | -/* |
261 | - * Copyright (C) 2014 Canonical, Ltd. |
262 | - * |
263 | - * This program is free software: you can redistribute it and/or modify it under |
264 | - * the terms of the GNU Lesser General Public License version 3, as published by |
265 | - * the Free Software Foundation. |
266 | - * |
267 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
268 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
269 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
270 | - * Lesser General Public License for more details. |
271 | - * |
272 | - * You should have received a copy of the GNU Lesser General Public License |
273 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
274 | - */ |
275 | - |
276 | -#include "backingstore.h" |
277 | -#include "logging.h" |
278 | +/**************************************************************************** |
279 | +** |
280 | +** Copyright (C) 2016 Canonical, Ltd. |
281 | +** Contact: https://www.qt.io/licensing/ |
282 | +** |
283 | +** This file is part of the plugins of the Qt Toolkit. |
284 | +** |
285 | +** $QT_BEGIN_LICENSE:LGPL$ |
286 | +** Commercial License Usage |
287 | +** Licensees holding valid commercial Qt licenses may use this file in |
288 | +** accordance with the commercial license agreement provided with the |
289 | +** Software or, alternatively, in accordance with the terms contained in |
290 | +** a written agreement between you and The Qt Company. For licensing terms |
291 | +** and conditions see https://www.qt.io/terms-conditions. For further |
292 | +** information use the contact form at https://www.qt.io/contact-us. |
293 | +** |
294 | +** GNU Lesser General Public License Usage |
295 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
296 | +** General Public License version 3 as published by the Free Software |
297 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
298 | +** packaging of this file. Please review the following information to |
299 | +** ensure the GNU Lesser General Public License version 3 requirements |
300 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
301 | +** |
302 | +** GNU General Public License Usage |
303 | +** Alternatively, this file may be used under the terms of the GNU |
304 | +** General Public License version 2.0 or (at your option) the GNU General |
305 | +** Public license version 3 or any later version approved by the KDE Free |
306 | +** Qt Foundation. The licenses are as published by the Free Software |
307 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
308 | +** included in the packaging of this file. Please review the following |
309 | +** information to ensure the GNU General Public License requirements will |
310 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
311 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
312 | +** |
313 | +** $QT_END_LICENSE$ |
314 | +** |
315 | +****************************************************************************/ |
316 | + |
317 | + |
318 | +#include "qmirclientbackingstore.h" |
319 | +#include "qmirclientlogging.h" |
320 | #include <QtGui/QOpenGLContext> |
321 | #include <QtGui/QOpenGLTexture> |
322 | #include <QtGui/QMatrix4x4> |
323 | #include <QtGui/private/qopengltextureblitter_p.h> |
324 | #include <QtGui/qopenglfunctions.h> |
325 | |
326 | -UbuntuBackingStore::UbuntuBackingStore(QWindow* window) |
327 | +QMirClientBackingStore::QMirClientBackingStore(QWindow* window) |
328 | : QPlatformBackingStore(window) |
329 | , mContext(new QOpenGLContext) |
330 | , mTexture(new QOpenGLTexture(QOpenGLTexture::Target2D)) |
331 | @@ -35,12 +59,17 @@ |
332 | window->setSurfaceType(QSurface::OpenGLSurface); |
333 | } |
334 | |
335 | -UbuntuBackingStore::~UbuntuBackingStore() |
336 | +QMirClientBackingStore::~QMirClientBackingStore() |
337 | { |
338 | - mContext->makeCurrent(window()); // needed as QOpenGLTexture destructor assumes current context |
339 | + // With render-to-texture-widgets QWidget makes sure the TLW's shareContext() is |
340 | + // made current before destroying backingstores. That is however not the case for |
341 | + // windows with regular widgets only. |
342 | + if (!QOpenGLContext::currentContext()) { |
343 | + mContext->makeCurrent(window()); |
344 | + } |
345 | } |
346 | |
347 | -void UbuntuBackingStore::flush(QWindow* window, const QRegion& region, const QPoint& offset) |
348 | +void QMirClientBackingStore::flush(QWindow* window, const QRegion& region, const QPoint& offset) |
349 | { |
350 | Q_UNUSED(region); |
351 | Q_UNUSED(offset); |
352 | @@ -59,7 +88,7 @@ |
353 | mContext->swapBuffers(window); |
354 | } |
355 | |
356 | -void UbuntuBackingStore::updateTexture() |
357 | +void QMirClientBackingStore::updateTexture() |
358 | { |
359 | if (mDirty.isNull()) |
360 | return; |
361 | @@ -76,9 +105,7 @@ |
362 | QRegion fixed; |
363 | QRect imageRect = mImage.rect(); |
364 | |
365 | - /* Following code taken from QEGLPlatformBackingStore under the terms of the Lesser GPL v2.1 licence |
366 | - * Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). */ |
367 | - Q_FOREACH (const QRect &rect, mDirty.rects()) { |
368 | + for (const QRect &rect : mDirty.rects()) { |
369 | // intersect with image rect to be sure |
370 | QRect r = imageRect & rect; |
371 | |
372 | @@ -91,7 +118,7 @@ |
373 | fixed |= r; |
374 | } |
375 | |
376 | - Q_FOREACH (const QRect &rect, fixed.rects()) { |
377 | + for (const QRect &rect : fixed.rects()) { |
378 | // if the sub-rect is full-width we can pass the image data directly to |
379 | // OpenGL instead of copying, since there is no gap between scanlines |
380 | if (rect.width() == imageRect.width()) { |
381 | @@ -108,12 +135,12 @@ |
382 | } |
383 | |
384 | |
385 | -void UbuntuBackingStore::beginPaint(const QRegion& region) |
386 | +void QMirClientBackingStore::beginPaint(const QRegion& region) |
387 | { |
388 | mDirty |= region; |
389 | } |
390 | |
391 | -void UbuntuBackingStore::resize(const QSize& size, const QRegion& /*staticContents*/) |
392 | +void QMirClientBackingStore::resize(const QSize& size, const QRegion& /*staticContents*/) |
393 | { |
394 | mImage = QImage(size, QImage::Format_RGBA8888); |
395 | |
396 | @@ -123,12 +150,12 @@ |
397 | mTexture->destroy(); |
398 | } |
399 | |
400 | -QPaintDevice* UbuntuBackingStore::paintDevice() |
401 | +QPaintDevice* QMirClientBackingStore::paintDevice() |
402 | { |
403 | return &mImage; |
404 | } |
405 | |
406 | -QImage UbuntuBackingStore::toImage() const |
407 | +QImage QMirClientBackingStore::toImage() const |
408 | { |
409 | // used by QPlatformBackingStore::composeAndFlush |
410 | return mImage; |
411 | |
412 | === renamed file 'src/ubuntumirclient/backingstore.h' => 'src/ubuntumirclient/qmirclientbackingstore.h' |
413 | --- src/ubuntumirclient/backingstore.h 2016-10-04 16:20:07 +0000 |
414 | +++ src/ubuntumirclient/qmirclientbackingstore.h 2017-02-21 12:29:19 +0000 |
415 | @@ -1,21 +1,45 @@ |
416 | -/* |
417 | - * Copyright (C) 2014 Canonical, Ltd. |
418 | - * |
419 | - * This program is free software: you can redistribute it and/or modify it under |
420 | - * the terms of the GNU Lesser General Public License version 3, as published by |
421 | - * the Free Software Foundation. |
422 | - * |
423 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
424 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
425 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
426 | - * Lesser General Public License for more details. |
427 | - * |
428 | - * You should have received a copy of the GNU Lesser General Public License |
429 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
430 | - */ |
431 | - |
432 | -#ifndef UBUNTU_BACKING_STORE_H |
433 | -#define UBUNTU_BACKING_STORE_H |
434 | +/**************************************************************************** |
435 | +** |
436 | +** Copyright (C) 2016 Canonical, Ltd. |
437 | +** Contact: https://www.qt.io/licensing/ |
438 | +** |
439 | +** This file is part of the plugins of the Qt Toolkit. |
440 | +** |
441 | +** $QT_BEGIN_LICENSE:LGPL$ |
442 | +** Commercial License Usage |
443 | +** Licensees holding valid commercial Qt licenses may use this file in |
444 | +** accordance with the commercial license agreement provided with the |
445 | +** Software or, alternatively, in accordance with the terms contained in |
446 | +** a written agreement between you and The Qt Company. For licensing terms |
447 | +** and conditions see https://www.qt.io/terms-conditions. For further |
448 | +** information use the contact form at https://www.qt.io/contact-us. |
449 | +** |
450 | +** GNU Lesser General Public License Usage |
451 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
452 | +** General Public License version 3 as published by the Free Software |
453 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
454 | +** packaging of this file. Please review the following information to |
455 | +** ensure the GNU Lesser General Public License version 3 requirements |
456 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
457 | +** |
458 | +** GNU General Public License Usage |
459 | +** Alternatively, this file may be used under the terms of the GNU |
460 | +** General Public License version 2.0 or (at your option) the GNU General |
461 | +** Public license version 3 or any later version approved by the KDE Free |
462 | +** Qt Foundation. The licenses are as published by the Free Software |
463 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
464 | +** included in the packaging of this file. Please review the following |
465 | +** information to ensure the GNU General Public License requirements will |
466 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
467 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
468 | +** |
469 | +** $QT_END_LICENSE$ |
470 | +** |
471 | +****************************************************************************/ |
472 | + |
473 | + |
474 | +#ifndef QMIRCLIENTBACKINGSTORE_H |
475 | +#define QMIRCLIENTBACKINGSTORE_H |
476 | |
477 | #include <qpa/qplatformbackingstore.h> |
478 | |
479 | @@ -23,11 +47,11 @@ |
480 | class QOpenGLTexture; |
481 | class QOpenGLTextureBlitter; |
482 | |
483 | -class UbuntuBackingStore : public QPlatformBackingStore |
484 | +class QMirClientBackingStore : public QPlatformBackingStore |
485 | { |
486 | public: |
487 | - UbuntuBackingStore(QWindow* window); |
488 | - virtual ~UbuntuBackingStore(); |
489 | + QMirClientBackingStore(QWindow* window); |
490 | + virtual ~QMirClientBackingStore(); |
491 | |
492 | // QPlatformBackingStore methods. |
493 | void beginPaint(const QRegion&) override; |
494 | @@ -47,4 +71,4 @@ |
495 | QRegion mDirty; |
496 | }; |
497 | |
498 | -#endif // UBUNTU_BACKING_STORE_H |
499 | +#endif // QMIRCLIENTBACKINGSTORE_H |
500 | |
501 | === renamed file 'src/ubuntumirclient/clipboard.cpp' => 'src/ubuntumirclient/qmirclientclipboard.cpp' |
502 | --- src/ubuntumirclient/clipboard.cpp 2016-08-24 12:40:30 +0000 |
503 | +++ src/ubuntumirclient/qmirclientclipboard.cpp 2017-02-21 12:29:19 +0000 |
504 | @@ -1,22 +1,46 @@ |
505 | -/* |
506 | - * Copyright (C) 2014,2016 Canonical, Ltd. |
507 | - * |
508 | - * This program is free software: you can redistribute it and/or modify it under |
509 | - * the terms of the GNU Lesser General Public License version 3, as published by |
510 | - * the Free Software Foundation. |
511 | - * |
512 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
513 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
514 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
515 | - * Lesser General Public License for more details. |
516 | - * |
517 | - * You should have received a copy of the GNU Lesser General Public License |
518 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
519 | - */ |
520 | - |
521 | -#include "clipboard.h" |
522 | -#include "logging.h" |
523 | -#include "window.h" |
524 | +/**************************************************************************** |
525 | +** |
526 | +** Copyright (C) 2016 Canonical, Ltd. |
527 | +** Contact: https://www.qt.io/licensing/ |
528 | +** |
529 | +** This file is part of the plugins of the Qt Toolkit. |
530 | +** |
531 | +** $QT_BEGIN_LICENSE:LGPL$ |
532 | +** Commercial License Usage |
533 | +** Licensees holding valid commercial Qt licenses may use this file in |
534 | +** accordance with the commercial license agreement provided with the |
535 | +** Software or, alternatively, in accordance with the terms contained in |
536 | +** a written agreement between you and The Qt Company. For licensing terms |
537 | +** and conditions see https://www.qt.io/terms-conditions. For further |
538 | +** information use the contact form at https://www.qt.io/contact-us. |
539 | +** |
540 | +** GNU Lesser General Public License Usage |
541 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
542 | +** General Public License version 3 as published by the Free Software |
543 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
544 | +** packaging of this file. Please review the following information to |
545 | +** ensure the GNU Lesser General Public License version 3 requirements |
546 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
547 | +** |
548 | +** GNU General Public License Usage |
549 | +** Alternatively, this file may be used under the terms of the GNU |
550 | +** General Public License version 2.0 or (at your option) the GNU General |
551 | +** Public license version 3 or any later version approved by the KDE Free |
552 | +** Qt Foundation. The licenses are as published by the Free Software |
553 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
554 | +** included in the packaging of this file. Please review the following |
555 | +** information to ensure the GNU General Public License requirements will |
556 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
557 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
558 | +** |
559 | +** $QT_END_LICENSE$ |
560 | +** |
561 | +****************************************************************************/ |
562 | + |
563 | + |
564 | +#include "qmirclientclipboard.h" |
565 | +#include "qmirclientlogging.h" |
566 | +#include "qmirclientwindow.h" |
567 | |
568 | #include <QDBusPendingCallWatcher> |
569 | #include <QGuiApplication> |
570 | @@ -30,29 +54,29 @@ |
571 | // get this cumbersome nested namespace out of the way |
572 | using namespace com::ubuntu::content; |
573 | |
574 | -UbuntuClipboard::UbuntuClipboard() |
575 | +QMirClientClipboard::QMirClientClipboard() |
576 | : mMimeData(new QMimeData) |
577 | , mContentHub(Hub::Client::instance()) |
578 | { |
579 | connect(mContentHub, &Hub::pasteboardChanged, this, [this]() { |
580 | - if (mClipboardState == UbuntuClipboard::SyncedClipboard) { |
581 | - mClipboardState = UbuntuClipboard::OutdatedClipboard; |
582 | + if (mClipboardState == QMirClientClipboard::SyncedClipboard) { |
583 | + mClipboardState = QMirClientClipboard::OutdatedClipboard; |
584 | emitChanged(QClipboard::Clipboard); |
585 | } |
586 | }); |
587 | |
588 | connect(qGuiApp, &QGuiApplication::applicationStateChanged, |
589 | - this, &UbuntuClipboard::onApplicationStateChanged); |
590 | + this, &QMirClientClipboard::onApplicationStateChanged); |
591 | |
592 | requestMimeData(); |
593 | } |
594 | |
595 | -UbuntuClipboard::~UbuntuClipboard() |
596 | +QMirClientClipboard::~QMirClientClipboard() |
597 | { |
598 | delete mMimeData; |
599 | } |
600 | |
601 | -QMimeData* UbuntuClipboard::mimeData(QClipboard::Mode mode) |
602 | +QMimeData* QMirClientClipboard::mimeData(QClipboard::Mode mode) |
603 | { |
604 | if (mode != QClipboard::Clipboard) |
605 | return nullptr; |
606 | @@ -70,11 +94,11 @@ |
607 | return mMimeData; |
608 | } |
609 | |
610 | -void UbuntuClipboard::setMimeData(QMimeData* mimeData, QClipboard::Mode mode) |
611 | +void QMirClientClipboard::setMimeData(QMimeData* mimeData, QClipboard::Mode mode) |
612 | { |
613 | QWindow *focusWindow = QGuiApplication::focusWindow(); |
614 | if (focusWindow && mode == QClipboard::Clipboard && mimeData != nullptr) { |
615 | - QString surfaceId = static_cast<UbuntuWindow*>(focusWindow->handle())->persistentSurfaceId(); |
616 | + QString surfaceId = static_cast<QMirClientWindow*>(focusWindow->handle())->persistentSurfaceId(); |
617 | |
618 | QDBusPendingCall reply = mContentHub->createPaste(surfaceId, *mimeData); |
619 | |
620 | @@ -89,18 +113,18 @@ |
621 | } |
622 | } |
623 | |
624 | -bool UbuntuClipboard::supportsMode(QClipboard::Mode mode) const |
625 | +bool QMirClientClipboard::supportsMode(QClipboard::Mode mode) const |
626 | { |
627 | return mode == QClipboard::Clipboard; |
628 | } |
629 | |
630 | -bool UbuntuClipboard::ownsMode(QClipboard::Mode mode) const |
631 | +bool QMirClientClipboard::ownsMode(QClipboard::Mode mode) const |
632 | { |
633 | Q_UNUSED(mode); |
634 | return false; |
635 | } |
636 | |
637 | -void UbuntuClipboard::onApplicationStateChanged(Qt::ApplicationState state) |
638 | +void QMirClientClipboard::onApplicationStateChanged(Qt::ApplicationState state) |
639 | { |
640 | if (state == Qt::ApplicationActive) { |
641 | // Only focused or active applications might be allowed to paste, so we probably |
642 | @@ -110,7 +134,7 @@ |
643 | } |
644 | } |
645 | |
646 | -void UbuntuClipboard::updateMimeData() |
647 | +void QMirClientClipboard::updateMimeData() |
648 | { |
649 | if (qGuiApp->applicationState() != Qt::ApplicationActive) { |
650 | // Don't even bother asking as content-hub would probably ignore our request (and should). |
651 | @@ -121,14 +145,14 @@ |
652 | |
653 | QWindow *focusWindow = QGuiApplication::focusWindow(); |
654 | if (focusWindow) { |
655 | - QString surfaceId = static_cast<UbuntuWindow*>(focusWindow->handle())->persistentSurfaceId(); |
656 | + QString surfaceId = static_cast<QMirClientWindow*>(focusWindow->handle())->persistentSurfaceId(); |
657 | mMimeData = mContentHub->latestPaste(surfaceId); |
658 | mClipboardState = SyncedClipboard; |
659 | emitChanged(QClipboard::Clipboard); |
660 | } |
661 | } |
662 | |
663 | -void UbuntuClipboard::requestMimeData() |
664 | +void QMirClientClipboard::requestMimeData() |
665 | { |
666 | if (qGuiApp->applicationState() != Qt::ApplicationActive) { |
667 | // Don't even bother asking as content-hub would probably ignore our request (and should). |
668 | @@ -140,7 +164,7 @@ |
669 | return; |
670 | } |
671 | |
672 | - QString surfaceId = static_cast<UbuntuWindow*>(focusWindow->handle())->persistentSurfaceId(); |
673 | + QString surfaceId = static_cast<QMirClientWindow*>(focusWindow->handle())->persistentSurfaceId(); |
674 | QDBusPendingCall reply = mContentHub->requestLatestPaste(surfaceId); |
675 | mClipboardState = SyncingClipboard; |
676 | |
677 | |
678 | === renamed file 'src/ubuntumirclient/clipboard.h' => 'src/ubuntumirclient/qmirclientclipboard.h' |
679 | --- src/ubuntumirclient/clipboard.h 2016-08-24 12:40:30 +0000 |
680 | +++ src/ubuntumirclient/qmirclientclipboard.h 2017-02-21 12:29:19 +0000 |
681 | @@ -1,21 +1,45 @@ |
682 | -/* |
683 | - * Copyright (C) 2014,2016 Canonical, Ltd. |
684 | - * |
685 | - * This program is free software: you can redistribute it and/or modify it under |
686 | - * the terms of the GNU Lesser General Public License version 3, as published by |
687 | - * the Free Software Foundation. |
688 | - * |
689 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
690 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
691 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
692 | - * Lesser General Public License for more details. |
693 | - * |
694 | - * You should have received a copy of the GNU Lesser General Public License |
695 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
696 | - */ |
697 | - |
698 | -#ifndef UBUNTU_CLIPBOARD_H |
699 | -#define UBUNTU_CLIPBOARD_H |
700 | +/**************************************************************************** |
701 | +** |
702 | +** Copyright (C) 2016 Canonical, Ltd. |
703 | +** Contact: https://www.qt.io/licensing/ |
704 | +** |
705 | +** This file is part of the plugins of the Qt Toolkit. |
706 | +** |
707 | +** $QT_BEGIN_LICENSE:LGPL$ |
708 | +** Commercial License Usage |
709 | +** Licensees holding valid commercial Qt licenses may use this file in |
710 | +** accordance with the commercial license agreement provided with the |
711 | +** Software or, alternatively, in accordance with the terms contained in |
712 | +** a written agreement between you and The Qt Company. For licensing terms |
713 | +** and conditions see https://www.qt.io/terms-conditions. For further |
714 | +** information use the contact form at https://www.qt.io/contact-us. |
715 | +** |
716 | +** GNU Lesser General Public License Usage |
717 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
718 | +** General Public License version 3 as published by the Free Software |
719 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
720 | +** packaging of this file. Please review the following information to |
721 | +** ensure the GNU Lesser General Public License version 3 requirements |
722 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
723 | +** |
724 | +** GNU General Public License Usage |
725 | +** Alternatively, this file may be used under the terms of the GNU |
726 | +** General Public License version 2.0 or (at your option) the GNU General |
727 | +** Public license version 3 or any later version approved by the KDE Free |
728 | +** Qt Foundation. The licenses are as published by the Free Software |
729 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
730 | +** included in the packaging of this file. Please review the following |
731 | +** information to ensure the GNU General Public License requirements will |
732 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
733 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
734 | +** |
735 | +** $QT_END_LICENSE$ |
736 | +** |
737 | +****************************************************************************/ |
738 | + |
739 | + |
740 | +#ifndef QMIRCLIENTCLIPBOARD_H |
741 | +#define QMIRCLIENTCLIPBOARD_H |
742 | |
743 | #include <qpa/qplatformclipboard.h> |
744 | |
745 | @@ -32,12 +56,12 @@ |
746 | |
747 | class QDBusPendingCallWatcher; |
748 | |
749 | -class UbuntuClipboard : public QObject, public QPlatformClipboard |
750 | +class QMirClientClipboard : public QObject, public QPlatformClipboard |
751 | { |
752 | Q_OBJECT |
753 | public: |
754 | - UbuntuClipboard(); |
755 | - virtual ~UbuntuClipboard(); |
756 | + QMirClientClipboard(); |
757 | + virtual ~QMirClientClipboard(); |
758 | |
759 | // QPlatformClipboard methods. |
760 | QMimeData* mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override; |
761 | @@ -65,4 +89,4 @@ |
762 | QDBusPendingCallWatcher *mPasteReply{nullptr}; |
763 | }; |
764 | |
765 | -#endif // UBUNTU_CLIPBOARD_H |
766 | +#endif // QMIRCLIENTCLIPBOARD_H |
767 | |
768 | === renamed file 'src/ubuntumirclient/cursor.cpp' => 'src/ubuntumirclient/qmirclientcursor.cpp' |
769 | --- src/ubuntumirclient/cursor.cpp 2016-12-09 17:02:57 +0000 |
770 | +++ src/ubuntumirclient/qmirclientcursor.cpp 2017-02-21 12:29:19 +0000 |
771 | @@ -1,29 +1,53 @@ |
772 | -/* |
773 | - * Copyright (C) 2015 Canonical, Ltd. |
774 | - * |
775 | - * This program is free software: you can redistribute it and/or modify it under |
776 | - * the terms of the GNU Lesser General Public License version 3, as published by |
777 | - * the Free Software Foundation. |
778 | - * |
779 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
780 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
781 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
782 | - * Lesser General Public License for more details. |
783 | - * |
784 | - * You should have received a copy of the GNU Lesser General Public License |
785 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
786 | - */ |
787 | - |
788 | -#include "cursor.h" |
789 | - |
790 | -#include "logging.h" |
791 | -#include "window.h" |
792 | +/**************************************************************************** |
793 | +** |
794 | +** Copyright (C) 2015-2017 Canonical, Ltd. |
795 | +** Contact: https://www.qt.io/licensing/ |
796 | +** |
797 | +** This file is part of the plugins of the Qt Toolkit. |
798 | +** |
799 | +** $QT_BEGIN_LICENSE:LGPL$ |
800 | +** Commercial License Usage |
801 | +** Licensees holding valid commercial Qt licenses may use this file in |
802 | +** accordance with the commercial license agreement provided with the |
803 | +** Software or, alternatively, in accordance with the terms contained in |
804 | +** a written agreement between you and The Qt Company. For licensing terms |
805 | +** and conditions see https://www.qt.io/terms-conditions. For further |
806 | +** information use the contact form at https://www.qt.io/contact-us. |
807 | +** |
808 | +** GNU Lesser General Public License Usage |
809 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
810 | +** General Public License version 3 as published by the Free Software |
811 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
812 | +** packaging of this file. Please review the following information to |
813 | +** ensure the GNU Lesser General Public License version 3 requirements |
814 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
815 | +** |
816 | +** GNU General Public License Usage |
817 | +** Alternatively, this file may be used under the terms of the GNU |
818 | +** General Public License version 2.0 or (at your option) the GNU General |
819 | +** Public license version 3 or any later version approved by the KDE Free |
820 | +** Qt Foundation. The licenses are as published by the Free Software |
821 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
822 | +** included in the packaging of this file. Please review the following |
823 | +** information to ensure the GNU General Public License requirements will |
824 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
825 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
826 | +** |
827 | +** $QT_END_LICENSE$ |
828 | +** |
829 | +****************************************************************************/ |
830 | + |
831 | + |
832 | +#include "qmirclientcursor.h" |
833 | + |
834 | +#include "qmirclientlogging.h" |
835 | +#include "qmirclientwindow.h" |
836 | |
837 | #include <mir_toolkit/mir_client_library.h> |
838 | |
839 | -Q_LOGGING_CATEGORY(ubuntumirclientCursor, "ubuntumirclient.cursor", QtWarningMsg) |
840 | +Q_LOGGING_CATEGORY(mirclientCursor, "qt.qpa.mirclient.cursor", QtWarningMsg) |
841 | |
842 | -UbuntuCursor::UbuntuCursor(MirConnection *connection) |
843 | +QMirClientCursor::QMirClientCursor(MirConnection *connection) |
844 | : mConnection(connection) |
845 | { |
846 | /* |
847 | @@ -58,7 +82,7 @@ |
848 | namespace { |
849 | const char *qtCursorShapeToStr(Qt::CursorShape shape) |
850 | { |
851 | - switch(shape) { |
852 | + switch (shape) { |
853 | case Qt::ArrowCursor: |
854 | return "Arrow"; |
855 | case Qt::UpArrowCursor: |
856 | @@ -111,39 +135,42 @@ |
857 | } |
858 | } // anonymous namespace |
859 | |
860 | -void UbuntuCursor::changeCursor(QCursor *windowCursor, QWindow *window) |
861 | +void QMirClientCursor::changeCursor(QCursor *windowCursor, QWindow *window) |
862 | { |
863 | if (!window) { |
864 | return; |
865 | } |
866 | |
867 | - MirSurface *surface = static_cast<UbuntuWindow*>(window->handle())->mirSurface(); |
868 | + MirWindow *mirWindow = static_cast<QMirClientWindow*>(window->handle())->mirWindow(); |
869 | |
870 | - if (!surface) { |
871 | + if (!mirWindow) { |
872 | return; |
873 | } |
874 | |
875 | |
876 | if (windowCursor) { |
877 | - qCDebug(ubuntumirclientCursor, "changeCursor shape=%s, window=%p", qtCursorShapeToStr(windowCursor->shape()), window); |
878 | + qCDebug(mirclientCursor, "changeCursor shape=%s, window=%p", qtCursorShapeToStr(windowCursor->shape()), window); |
879 | if (!windowCursor->pixmap().isNull()) { |
880 | - configureMirCursorWithPixmapQCursor(surface, *windowCursor); |
881 | + configureMirCursorWithPixmapQCursor(mirWindow, *windowCursor); |
882 | } else if (windowCursor->shape() == Qt::BitmapCursor) { |
883 | // TODO: Implement bitmap cursor support |
884 | - applyDefaultCursorConfiguration(surface); |
885 | + applyDefaultCursorConfiguration(mirWindow); |
886 | } else { |
887 | const auto &cursorName = mShapeToCursorName.value(windowCursor->shape(), QByteArray("left_ptr")); |
888 | +#pragma GCC diagnostic push |
889 | +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
890 | auto cursorConfiguration = mir_cursor_configuration_from_name(cursorName.data()); |
891 | - mir_surface_configure_cursor(surface, cursorConfiguration); |
892 | +#pragma GCC diagnostic pop |
893 | + mir_window_configure_cursor(mirWindow, cursorConfiguration); |
894 | mir_cursor_configuration_destroy(cursorConfiguration); |
895 | } |
896 | } else { |
897 | - applyDefaultCursorConfiguration(surface); |
898 | + applyDefaultCursorConfiguration(mirWindow); |
899 | } |
900 | |
901 | } |
902 | |
903 | -void UbuntuCursor::configureMirCursorWithPixmapQCursor(MirSurface *surface, QCursor &cursor) |
904 | +void QMirClientCursor::configureMirCursorWithPixmapQCursor(MirWindow *window, QCursor &cursor) |
905 | { |
906 | QImage image = cursor.pixmap().toImage(); |
907 | |
908 | @@ -170,16 +197,19 @@ |
909 | |
910 | { |
911 | auto configuration = mir_cursor_configuration_from_buffer_stream(bufferStream, cursor.hotSpot().x(), cursor.hotSpot().y()); |
912 | - mir_surface_configure_cursor(surface, configuration); |
913 | + mir_window_configure_cursor(window, configuration); |
914 | mir_cursor_configuration_destroy(configuration); |
915 | } |
916 | |
917 | mir_buffer_stream_release_sync(bufferStream); |
918 | } |
919 | |
920 | -void UbuntuCursor::applyDefaultCursorConfiguration(MirSurface *surface) |
921 | +void QMirClientCursor::applyDefaultCursorConfiguration(MirWindow *window) |
922 | { |
923 | +#pragma GCC diagnostic push |
924 | +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
925 | auto cursorConfiguration = mir_cursor_configuration_from_name("left_ptr"); |
926 | - mir_surface_configure_cursor(surface, cursorConfiguration); |
927 | +#pragma GCC diagnostic pop |
928 | + mir_window_configure_cursor(window, cursorConfiguration); |
929 | mir_cursor_configuration_destroy(cursorConfiguration); |
930 | } |
931 | |
932 | === renamed file 'src/ubuntumirclient/cursor.h' => 'src/ubuntumirclient/qmirclientcursor.h' |
933 | --- src/ubuntumirclient/cursor.h 2015-11-11 18:58:44 +0000 |
934 | +++ src/ubuntumirclient/qmirclientcursor.h 2017-02-21 12:29:19 +0000 |
935 | @@ -1,40 +1,65 @@ |
936 | -/* |
937 | - * Copyright (C) 2015 Canonical, Ltd. |
938 | - * |
939 | - * This program is free software: you can redistribute it and/or modify it under |
940 | - * the terms of the GNU Lesser General Public License version 3, as published by |
941 | - * the Free Software Foundation. |
942 | - * |
943 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
944 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
945 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
946 | - * Lesser General Public License for more details. |
947 | - * |
948 | - * You should have received a copy of the GNU Lesser General Public License |
949 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
950 | - */ |
951 | - |
952 | -#ifndef UBUNTU_CURSOR_H |
953 | -#define UBUNTU_CURSOR_H |
954 | +/**************************************************************************** |
955 | +** |
956 | +** Copyright (C) 2015-2017 Canonical, Ltd. |
957 | +** Contact: https://www.qt.io/licensing/ |
958 | +** |
959 | +** This file is part of the plugins of the Qt Toolkit. |
960 | +** |
961 | +** $QT_BEGIN_LICENSE:LGPL$ |
962 | +** Commercial License Usage |
963 | +** Licensees holding valid commercial Qt licenses may use this file in |
964 | +** accordance with the commercial license agreement provided with the |
965 | +** Software or, alternatively, in accordance with the terms contained in |
966 | +** a written agreement between you and The Qt Company. For licensing terms |
967 | +** and conditions see https://www.qt.io/terms-conditions. For further |
968 | +** information use the contact form at https://www.qt.io/contact-us. |
969 | +** |
970 | +** GNU Lesser General Public License Usage |
971 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
972 | +** General Public License version 3 as published by the Free Software |
973 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
974 | +** packaging of this file. Please review the following information to |
975 | +** ensure the GNU Lesser General Public License version 3 requirements |
976 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
977 | +** |
978 | +** GNU General Public License Usage |
979 | +** Alternatively, this file may be used under the terms of the GNU |
980 | +** General Public License version 2.0 or (at your option) the GNU General |
981 | +** Public license version 3 or any later version approved by the KDE Free |
982 | +** Qt Foundation. The licenses are as published by the Free Software |
983 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
984 | +** included in the packaging of this file. Please review the following |
985 | +** information to ensure the GNU General Public License requirements will |
986 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
987 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
988 | +** |
989 | +** $QT_END_LICENSE$ |
990 | +** |
991 | +****************************************************************************/ |
992 | + |
993 | + |
994 | +#ifndef QMIRCLIENTCURSOR_H |
995 | +#define QMIRCLIENTCURSOR_H |
996 | |
997 | #include <qpa/qplatformcursor.h> |
998 | |
999 | #include <QMap> |
1000 | #include <QByteArray> |
1001 | |
1002 | +#include <mir_toolkit/mir_window.h> |
1003 | + |
1004 | struct MirConnection; |
1005 | -struct MirSurface; |
1006 | |
1007 | -class UbuntuCursor : public QPlatformCursor |
1008 | +class QMirClientCursor : public QPlatformCursor |
1009 | { |
1010 | public: |
1011 | - UbuntuCursor(MirConnection *connection); |
1012 | + QMirClientCursor(MirConnection *connection); |
1013 | void changeCursor(QCursor *windowCursor, QWindow *window) override; |
1014 | private: |
1015 | - void configureMirCursorWithPixmapQCursor(MirSurface *surface, QCursor &cursor); |
1016 | - void applyDefaultCursorConfiguration(MirSurface *surface); |
1017 | + void configureMirCursorWithPixmapQCursor(MirWindow *window, QCursor &cursor); |
1018 | + void applyDefaultCursorConfiguration(MirWindow *window); |
1019 | QMap<int, QByteArray> mShapeToCursorName; |
1020 | MirConnection *mConnection; |
1021 | }; |
1022 | |
1023 | -#endif // UBUNTU_CURSOR_H |
1024 | +#endif // QMIRCLIENTCURSOR_H |
1025 | |
1026 | === renamed file 'src/ubuntumirclient/debugextension.cpp' => 'src/ubuntumirclient/qmirclientdebugextension.cpp' |
1027 | --- src/ubuntumirclient/debugextension.cpp 2016-12-01 22:28:20 +0000 |
1028 | +++ src/ubuntumirclient/qmirclientdebugextension.cpp 2017-02-21 12:29:19 +0000 |
1029 | @@ -1,57 +1,81 @@ |
1030 | -/* |
1031 | - * Copyright (C) 2016 Canonical, Ltd. |
1032 | - * |
1033 | - * This program is free software: you can redistribute it and/or modify it under |
1034 | - * the terms of the GNU Lesser General Public License version 3, as published by |
1035 | - * the Free Software Foundation. |
1036 | - * |
1037 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
1038 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1039 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1040 | - * Lesser General Public License for more details. |
1041 | - * |
1042 | - * You should have received a copy of the GNU Lesser General Public License |
1043 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1044 | - */ |
1045 | - |
1046 | -#include "debugextension.h" |
1047 | - |
1048 | -#include "logging.h" |
1049 | +/**************************************************************************** |
1050 | +** |
1051 | +** Copyright (C) 2016-2017 Canonical, Ltd. |
1052 | +** Contact: https://www.qt.io/licensing/ |
1053 | +** |
1054 | +** This file is part of the plugins of the Qt Toolkit. |
1055 | +** |
1056 | +** $QT_BEGIN_LICENSE:LGPL$ |
1057 | +** Commercial License Usage |
1058 | +** Licensees holding valid commercial Qt licenses may use this file in |
1059 | +** accordance with the commercial license agreement provided with the |
1060 | +** Software or, alternatively, in accordance with the terms contained in |
1061 | +** a written agreement between you and The Qt Company. For licensing terms |
1062 | +** and conditions see https://www.qt.io/terms-conditions. For further |
1063 | +** information use the contact form at https://www.qt.io/contact-us. |
1064 | +** |
1065 | +** GNU Lesser General Public License Usage |
1066 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
1067 | +** General Public License version 3 as published by the Free Software |
1068 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
1069 | +** packaging of this file. Please review the following information to |
1070 | +** ensure the GNU Lesser General Public License version 3 requirements |
1071 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
1072 | +** |
1073 | +** GNU General Public License Usage |
1074 | +** Alternatively, this file may be used under the terms of the GNU |
1075 | +** General Public License version 2.0 or (at your option) the GNU General |
1076 | +** Public license version 3 or any later version approved by the KDE Free |
1077 | +** Qt Foundation. The licenses are as published by the Free Software |
1078 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
1079 | +** included in the packaging of this file. Please review the following |
1080 | +** information to ensure the GNU General Public License requirements will |
1081 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
1082 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
1083 | +** |
1084 | +** $QT_END_LICENSE$ |
1085 | +** |
1086 | +****************************************************************************/ |
1087 | + |
1088 | + |
1089 | +#include "qmirclientdebugextension.h" |
1090 | + |
1091 | +#include "qmirclientlogging.h" |
1092 | |
1093 | // mir client debug |
1094 | #include <mir_toolkit/debug/surface.h> |
1095 | |
1096 | -Q_LOGGING_CATEGORY(ubuntumirclientDebug, "ubuntumirclient.debug") |
1097 | +Q_LOGGING_CATEGORY(mirclientDebug, "qt.qpa.mirclient.debug") |
1098 | |
1099 | -UbuntuDebugExtension::UbuntuDebugExtension() |
1100 | +QMirClientDebugExtension::QMirClientDebugExtension() |
1101 | : m_mirclientDebug(QStringLiteral("mirclient-debug-extension"), 1) |
1102 | , m_mapper(nullptr) |
1103 | { |
1104 | - qCDebug(ubuntumirclientDebug) << "NOTICE: Loading mirclient-debug-extension"; |
1105 | - m_mapper = (MapperPrototype) m_mirclientDebug.resolve("mir_debug_surface_coords_to_screen"); |
1106 | + qCDebug(mirclientDebug) << "NOTICE: Loading mirclient-debug-extension"; |
1107 | + m_mapper = (MapperPrototype) m_mirclientDebug.resolve("mir_extension_window_coordinate_translation"); |
1108 | |
1109 | if (!m_mirclientDebug.isLoaded()) { |
1110 | - qCWarning(ubuntumirclientDebug) << "ERROR: mirclient-debug-extension failed to load:" |
1111 | - << m_mirclientDebug.errorString(); |
1112 | + qCWarning(mirclientDebug) << "ERROR: mirclient-debug-extension failed to load:" |
1113 | + << m_mirclientDebug.errorString(); |
1114 | } else if (!m_mapper) { |
1115 | - qCWarning(ubuntumirclientDebug) << "ERROR: unable to find required symbols in mirclient-debug-extension:" |
1116 | - << m_mirclientDebug.errorString(); |
1117 | + qCWarning(mirclientDebug) << "ERROR: unable to find required symbols in mirclient-debug-extension:" |
1118 | + << m_mirclientDebug.errorString(); |
1119 | } |
1120 | } |
1121 | |
1122 | -bool UbuntuDebugExtension::isEnabled() const |
1123 | +bool QMirClientDebugExtension::isEnabled() const |
1124 | { |
1125 | return m_mirclientDebug.isLoaded() && m_mapper; |
1126 | } |
1127 | |
1128 | -QPoint UbuntuDebugExtension::mapSurfacePointToScreen(MirSurface *surface, const QPoint &point) |
1129 | +QPoint QMirClientDebugExtension::mapWindowPointToScreen(MirWindow *window, const QPoint &point) |
1130 | { |
1131 | if (!m_mapper) { |
1132 | return point; |
1133 | } |
1134 | |
1135 | QPoint mappedPoint; |
1136 | - bool status = m_mapper(surface, point.x(), point.y(), &mappedPoint.rx(), &mappedPoint.ry()); |
1137 | + bool status = m_mapper(window, point.x(), point.y(), &mappedPoint.rx(), &mappedPoint.ry()); |
1138 | if (status) { |
1139 | return mappedPoint; |
1140 | } else { |
1141 | |
1142 | === renamed file 'src/ubuntumirclient/debugextension.h' => 'src/ubuntumirclient/qmirclientdebugextension.h' |
1143 | --- src/ubuntumirclient/debugextension.h 2016-12-01 22:28:20 +0000 |
1144 | +++ src/ubuntumirclient/qmirclientdebugextension.h 2017-02-21 12:29:19 +0000 |
1145 | @@ -1,41 +1,66 @@ |
1146 | -/* |
1147 | - * Copyright (C) 2016 Canonical, Ltd. |
1148 | - * |
1149 | - * This program is free software: you can redistribute it and/or modify it under |
1150 | - * the terms of the GNU Lesser General Public License version 3, as published by |
1151 | - * the Free Software Foundation. |
1152 | - * |
1153 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
1154 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1155 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1156 | - * Lesser General Public License for more details. |
1157 | - * |
1158 | - * You should have received a copy of the GNU Lesser General Public License |
1159 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1160 | - */ |
1161 | - |
1162 | -#ifndef UBUNTU_DEBUG_EXTENSION_H |
1163 | -#define UBUNTU_DEBUG_EXTENSION_H |
1164 | +/**************************************************************************** |
1165 | +** |
1166 | +** Copyright (C) 2016-2017 Canonical, Ltd. |
1167 | +** Contact: https://www.qt.io/licensing/ |
1168 | +** |
1169 | +** This file is part of the plugins of the Qt Toolkit. |
1170 | +** |
1171 | +** $QT_BEGIN_LICENSE:LGPL$ |
1172 | +** Commercial License Usage |
1173 | +** Licensees holding valid commercial Qt licenses may use this file in |
1174 | +** accordance with the commercial license agreement provided with the |
1175 | +** Software or, alternatively, in accordance with the terms contained in |
1176 | +** a written agreement between you and The Qt Company. For licensing terms |
1177 | +** and conditions see https://www.qt.io/terms-conditions. For further |
1178 | +** information use the contact form at https://www.qt.io/contact-us. |
1179 | +** |
1180 | +** GNU Lesser General Public License Usage |
1181 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
1182 | +** General Public License version 3 as published by the Free Software |
1183 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
1184 | +** packaging of this file. Please review the following information to |
1185 | +** ensure the GNU Lesser General Public License version 3 requirements |
1186 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
1187 | +** |
1188 | +** GNU General Public License Usage |
1189 | +** Alternatively, this file may be used under the terms of the GNU |
1190 | +** General Public License version 2.0 or (at your option) the GNU General |
1191 | +** Public license version 3 or any later version approved by the KDE Free |
1192 | +** Qt Foundation. The licenses are as published by the Free Software |
1193 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
1194 | +** included in the packaging of this file. Please review the following |
1195 | +** information to ensure the GNU General Public License requirements will |
1196 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
1197 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
1198 | +** |
1199 | +** $QT_END_LICENSE$ |
1200 | +** |
1201 | +****************************************************************************/ |
1202 | + |
1203 | + |
1204 | +#ifndef QMIRCLIENTDEBUGEXTENSION_H |
1205 | +#define QMIRCLIENTDEBUGEXTENSION_H |
1206 | |
1207 | #include <QPoint> |
1208 | #include <QLibrary> |
1209 | -struct MirSurface; |
1210 | - |
1211 | -typedef bool (*MapperPrototype)(MirSurface* surface, int x, int y, int* screenX, int* screenY); |
1212 | - |
1213 | - |
1214 | -class UbuntuDebugExtension |
1215 | + |
1216 | +#include <mir_toolkit/mir_window.h> |
1217 | + |
1218 | +typedef bool (*MapperPrototype)(MirWindow* window, int x, int y, int* screenX, int* screenY); |
1219 | + |
1220 | + |
1221 | +class QMirClientDebugExtension |
1222 | { |
1223 | public: |
1224 | - UbuntuDebugExtension(); |
1225 | + QMirClientDebugExtension(); |
1226 | |
1227 | bool isEnabled() const; |
1228 | |
1229 | - QPoint mapSurfacePointToScreen(MirSurface *, const QPoint &point); |
1230 | + QPoint mapWindowPointToScreen(MirWindow *, const QPoint &point); |
1231 | |
1232 | private: |
1233 | QLibrary m_mirclientDebug; |
1234 | MapperPrototype m_mapper; |
1235 | }; |
1236 | |
1237 | -#endif // UBUNTU_DEBUG_EXTENSION_H |
1238 | +#endif // QMIRCLIENTDEBUGEXTENSION_H |
1239 | |
1240 | === renamed file 'src/ubuntumirclient/desktopwindow.cpp' => 'src/ubuntumirclient/qmirclientdesktopwindow.cpp' |
1241 | --- src/ubuntumirclient/desktopwindow.cpp 2016-10-04 16:20:07 +0000 |
1242 | +++ src/ubuntumirclient/qmirclientdesktopwindow.cpp 2017-02-21 12:29:19 +0000 |
1243 | @@ -1,26 +1,50 @@ |
1244 | -/* |
1245 | - * Copyright (C) 2016 Canonical, Ltd. |
1246 | - * |
1247 | - * This program is free software: you can redistribute it and/or modify it under |
1248 | - * the terms of the GNU Lesser General Public License version 3, as published by |
1249 | - * the Free Software Foundation. |
1250 | - * |
1251 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
1252 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1253 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1254 | - * Lesser General Public License for more details. |
1255 | - * |
1256 | - * You should have received a copy of the GNU Lesser General Public License |
1257 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1258 | - */ |
1259 | - |
1260 | -#include "desktopwindow.h" |
1261 | +/**************************************************************************** |
1262 | +** |
1263 | +** Copyright (C) 2016 Canonical, Ltd. |
1264 | +** Contact: https://www.qt.io/licensing/ |
1265 | +** |
1266 | +** This file is part of the plugins of the Qt Toolkit. |
1267 | +** |
1268 | +** $QT_BEGIN_LICENSE:LGPL$ |
1269 | +** Commercial License Usage |
1270 | +** Licensees holding valid commercial Qt licenses may use this file in |
1271 | +** accordance with the commercial license agreement provided with the |
1272 | +** Software or, alternatively, in accordance with the terms contained in |
1273 | +** a written agreement between you and The Qt Company. For licensing terms |
1274 | +** and conditions see https://www.qt.io/terms-conditions. For further |
1275 | +** information use the contact form at https://www.qt.io/contact-us. |
1276 | +** |
1277 | +** GNU Lesser General Public License Usage |
1278 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
1279 | +** General Public License version 3 as published by the Free Software |
1280 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
1281 | +** packaging of this file. Please review the following information to |
1282 | +** ensure the GNU Lesser General Public License version 3 requirements |
1283 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
1284 | +** |
1285 | +** GNU General Public License Usage |
1286 | +** Alternatively, this file may be used under the terms of the GNU |
1287 | +** General Public License version 2.0 or (at your option) the GNU General |
1288 | +** Public license version 3 or any later version approved by the KDE Free |
1289 | +** Qt Foundation. The licenses are as published by the Free Software |
1290 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
1291 | +** included in the packaging of this file. Please review the following |
1292 | +** information to ensure the GNU General Public License requirements will |
1293 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
1294 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
1295 | +** |
1296 | +** $QT_END_LICENSE$ |
1297 | +** |
1298 | +****************************************************************************/ |
1299 | + |
1300 | + |
1301 | +#include "qmirclientdesktopwindow.h" |
1302 | |
1303 | // local |
1304 | -#include "logging.h" |
1305 | +#include "qmirclientlogging.h" |
1306 | |
1307 | -UbuntuDesktopWindow::UbuntuDesktopWindow(QWindow *window) |
1308 | +QMirClientDesktopWindow::QMirClientDesktopWindow(QWindow *window) |
1309 | : QPlatformWindow(window) |
1310 | { |
1311 | - qCDebug(ubuntumirclient, "UbuntuDesktopWindow(window=%p)", window); |
1312 | + qCDebug(mirclient, "QMirClientDesktopWindow(window=%p)", window); |
1313 | } |
1314 | |
1315 | === renamed file 'src/ubuntumirclient/desktopwindow.h' => 'src/ubuntumirclient/qmirclientdesktopwindow.h' |
1316 | --- src/ubuntumirclient/desktopwindow.h 2016-10-04 16:20:07 +0000 |
1317 | +++ src/ubuntumirclient/qmirclientdesktopwindow.h 2017-02-21 12:29:19 +0000 |
1318 | @@ -1,29 +1,53 @@ |
1319 | -/* |
1320 | - * Copyright (C) 2016 Canonical, Ltd. |
1321 | - * |
1322 | - * This program is free software: you can redistribute it and/or modify it under |
1323 | - * the terms of the GNU Lesser General Public License version 3, as published by |
1324 | - * the Free Software Foundation. |
1325 | - * |
1326 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
1327 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1328 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1329 | - * Lesser General Public License for more details. |
1330 | - * |
1331 | - * You should have received a copy of the GNU Lesser General Public License |
1332 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1333 | - */ |
1334 | - |
1335 | -#ifndef UBUNTU_DESKTOP_WINDOW_H |
1336 | -#define UBUNTU_DESKTOP_WINDOW_H |
1337 | +/**************************************************************************** |
1338 | +** |
1339 | +** Copyright (C) 2016 Canonical, Ltd. |
1340 | +** Contact: https://www.qt.io/licensing/ |
1341 | +** |
1342 | +** This file is part of the plugins of the Qt Toolkit. |
1343 | +** |
1344 | +** $QT_BEGIN_LICENSE:LGPL$ |
1345 | +** Commercial License Usage |
1346 | +** Licensees holding valid commercial Qt licenses may use this file in |
1347 | +** accordance with the commercial license agreement provided with the |
1348 | +** Software or, alternatively, in accordance with the terms contained in |
1349 | +** a written agreement between you and The Qt Company. For licensing terms |
1350 | +** and conditions see https://www.qt.io/terms-conditions. For further |
1351 | +** information use the contact form at https://www.qt.io/contact-us. |
1352 | +** |
1353 | +** GNU Lesser General Public License Usage |
1354 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
1355 | +** General Public License version 3 as published by the Free Software |
1356 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
1357 | +** packaging of this file. Please review the following information to |
1358 | +** ensure the GNU Lesser General Public License version 3 requirements |
1359 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
1360 | +** |
1361 | +** GNU General Public License Usage |
1362 | +** Alternatively, this file may be used under the terms of the GNU |
1363 | +** General Public License version 2.0 or (at your option) the GNU General |
1364 | +** Public license version 3 or any later version approved by the KDE Free |
1365 | +** Qt Foundation. The licenses are as published by the Free Software |
1366 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
1367 | +** included in the packaging of this file. Please review the following |
1368 | +** information to ensure the GNU General Public License requirements will |
1369 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
1370 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
1371 | +** |
1372 | +** $QT_END_LICENSE$ |
1373 | +** |
1374 | +****************************************************************************/ |
1375 | + |
1376 | + |
1377 | +#ifndef QMIRCLIENTDESKTOPWINDOW_H |
1378 | +#define QMIRCLIENTDESKTOPWINDOW_H |
1379 | |
1380 | #include <qpa/qplatformwindow.h> |
1381 | |
1382 | // TODO Implement it. For now it's just an empty, dummy class. |
1383 | -class UbuntuDesktopWindow : public QPlatformWindow |
1384 | +class QMirClientDesktopWindow : public QPlatformWindow |
1385 | { |
1386 | public: |
1387 | - UbuntuDesktopWindow(QWindow*); |
1388 | + QMirClientDesktopWindow(QWindow*); |
1389 | }; |
1390 | |
1391 | -#endif // UBUNTU_DESKTOP_WINDOW_H |
1392 | +#endif // QMIRCLIENTDESKTOPWINDOW_H |
1393 | |
1394 | === renamed file 'src/ubuntumirclient/glcontext.cpp' => 'src/ubuntumirclient/qmirclientglcontext.cpp' |
1395 | --- src/ubuntumirclient/glcontext.cpp 2016-12-09 17:02:57 +0000 |
1396 | +++ src/ubuntumirclient/qmirclientglcontext.cpp 2017-02-21 12:29:19 +0000 |
1397 | @@ -1,29 +1,53 @@ |
1398 | -/* |
1399 | - * Copyright (C) 2014-2016 Canonical, Ltd. |
1400 | - * |
1401 | - * This program is free software: you can redistribute it and/or modify it under |
1402 | - * the terms of the GNU Lesser General Public License version 3, as published by |
1403 | - * the Free Software Foundation. |
1404 | - * |
1405 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
1406 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1407 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1408 | - * Lesser General Public License for more details. |
1409 | - * |
1410 | - * You should have received a copy of the GNU Lesser General Public License |
1411 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1412 | - */ |
1413 | - |
1414 | -#include "glcontext.h" |
1415 | -#include "logging.h" |
1416 | -#include "window.h" |
1417 | +/**************************************************************************** |
1418 | +** |
1419 | +** Copyright (C) 2016 Canonical, Ltd. |
1420 | +** Contact: https://www.qt.io/licensing/ |
1421 | +** |
1422 | +** This file is part of the plugins of the Qt Toolkit. |
1423 | +** |
1424 | +** $QT_BEGIN_LICENSE:LGPL$ |
1425 | +** Commercial License Usage |
1426 | +** Licensees holding valid commercial Qt licenses may use this file in |
1427 | +** accordance with the commercial license agreement provided with the |
1428 | +** Software or, alternatively, in accordance with the terms contained in |
1429 | +** a written agreement between you and The Qt Company. For licensing terms |
1430 | +** and conditions see https://www.qt.io/terms-conditions. For further |
1431 | +** information use the contact form at https://www.qt.io/contact-us. |
1432 | +** |
1433 | +** GNU Lesser General Public License Usage |
1434 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
1435 | +** General Public License version 3 as published by the Free Software |
1436 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
1437 | +** packaging of this file. Please review the following information to |
1438 | +** ensure the GNU Lesser General Public License version 3 requirements |
1439 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
1440 | +** |
1441 | +** GNU General Public License Usage |
1442 | +** Alternatively, this file may be used under the terms of the GNU |
1443 | +** General Public License version 2.0 or (at your option) the GNU General |
1444 | +** Public license version 3 or any later version approved by the KDE Free |
1445 | +** Qt Foundation. The licenses are as published by the Free Software |
1446 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
1447 | +** included in the packaging of this file. Please review the following |
1448 | +** information to ensure the GNU General Public License requirements will |
1449 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
1450 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
1451 | +** |
1452 | +** $QT_END_LICENSE$ |
1453 | +** |
1454 | +****************************************************************************/ |
1455 | + |
1456 | + |
1457 | +#include "qmirclientglcontext.h" |
1458 | +#include "qmirclientlogging.h" |
1459 | +#include "qmirclientwindow.h" |
1460 | |
1461 | #include <QOpenGLFramebufferObject> |
1462 | #include <QtPlatformSupport/private/qeglconvenience_p.h> |
1463 | #include <QtPlatformSupport/private/qeglpbuffer_p.h> |
1464 | #include <QtGui/private/qopenglcontext_p.h> |
1465 | |
1466 | -Q_LOGGING_CATEGORY(ubuntumirclientGraphics, "ubuntumirclient.graphics", QtWarningMsg) |
1467 | +Q_LOGGING_CATEGORY(mirclientGraphics, "qt.qpa.mirclient.graphics", QtWarningMsg) |
1468 | |
1469 | namespace { |
1470 | |
1471 | @@ -33,25 +57,25 @@ |
1472 | Q_ASSERT(config != nullptr); |
1473 | |
1474 | const char *string = eglQueryString(display, EGL_VENDOR); |
1475 | - qCDebug(ubuntumirclientGraphics, "EGL vendor: %s", string); |
1476 | + qCDebug(mirclientGraphics, "EGL vendor: %s", string); |
1477 | |
1478 | string = eglQueryString(display, EGL_VERSION); |
1479 | - qCDebug(ubuntumirclientGraphics, "EGL version: %s", string); |
1480 | + qCDebug(mirclientGraphics, "EGL version: %s", string); |
1481 | |
1482 | string = eglQueryString(display, EGL_EXTENSIONS); |
1483 | - qCDebug(ubuntumirclientGraphics, "EGL extensions: %s", string); |
1484 | + qCDebug(mirclientGraphics, "EGL extensions: %s", string); |
1485 | |
1486 | - qCDebug(ubuntumirclientGraphics, "EGL configuration attributes:"); |
1487 | + qCDebug(mirclientGraphics, "EGL configuration attributes:"); |
1488 | q_printEglConfig(display, config); |
1489 | } |
1490 | |
1491 | } // anonymous namespace |
1492 | |
1493 | -UbuntuOpenGLContext::UbuntuOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, |
1494 | +QMirClientOpenGLContext::QMirClientOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, |
1495 | EGLDisplay display) |
1496 | : QEGLPlatformContext(format, share, display, 0) |
1497 | { |
1498 | - if (ubuntumirclientGraphics().isDebugEnabled()) { |
1499 | + if (mirclientGraphics().isDebugEnabled()) { |
1500 | printEglConfig(display, eglConfig()); |
1501 | } |
1502 | } |
1503 | @@ -72,7 +96,7 @@ |
1504 | return needsWorkaround; |
1505 | } |
1506 | |
1507 | -bool UbuntuOpenGLContext::makeCurrent(QPlatformSurface* surface) |
1508 | +bool QMirClientOpenGLContext::makeCurrent(QPlatformSurface* surface) |
1509 | { |
1510 | const bool ret = QEGLPlatformContext::makeCurrent(surface); |
1511 | |
1512 | @@ -86,23 +110,23 @@ |
1513 | } |
1514 | |
1515 | // Following method used internally in the base class QEGLPlatformContext to access |
1516 | -// the egl surface of a QPlatformSurface/UbuntuWindow |
1517 | -EGLSurface UbuntuOpenGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) |
1518 | +// the egl surface of a QPlatformSurface/QMirClientWindow |
1519 | +EGLSurface QMirClientOpenGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) |
1520 | { |
1521 | if (surface->surface()->surfaceClass() == QSurface::Window) { |
1522 | - return static_cast<UbuntuWindow *>(surface)->eglSurface(); |
1523 | + return static_cast<QMirClientWindow *>(surface)->eglSurface(); |
1524 | } else { |
1525 | return static_cast<QEGLPbuffer *>(surface)->pbuffer(); |
1526 | } |
1527 | } |
1528 | |
1529 | -void UbuntuOpenGLContext::swapBuffers(QPlatformSurface *surface) |
1530 | +void QMirClientOpenGLContext::swapBuffers(QPlatformSurface *surface) |
1531 | { |
1532 | QEGLPlatformContext::swapBuffers(surface); |
1533 | |
1534 | if (surface->surface()->surfaceClass() == QSurface::Window) { |
1535 | // notify window on swap completion |
1536 | - auto ubuntuWindow = static_cast<UbuntuWindow *>(surface); |
1537 | - ubuntuWindow->onSwapBuffersDone(); |
1538 | + auto platformWindow = static_cast<QMirClientWindow *>(surface); |
1539 | + platformWindow->onSwapBuffersDone(); |
1540 | } |
1541 | } |
1542 | |
1543 | === renamed file 'src/ubuntumirclient/glcontext.h' => 'src/ubuntumirclient/qmirclientglcontext.h' |
1544 | --- src/ubuntumirclient/glcontext.h 2016-07-21 11:55:40 +0000 |
1545 | +++ src/ubuntumirclient/qmirclientglcontext.h 2017-02-21 12:29:19 +0000 |
1546 | @@ -1,31 +1,55 @@ |
1547 | -/* |
1548 | - * Copyright (C) 2014,2016 Canonical, Ltd. |
1549 | - * |
1550 | - * This program is free software: you can redistribute it and/or modify it under |
1551 | - * the terms of the GNU Lesser General Public License version 3, as published by |
1552 | - * the Free Software Foundation. |
1553 | - * |
1554 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
1555 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1556 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1557 | - * Lesser General Public License for more details. |
1558 | - * |
1559 | - * You should have received a copy of the GNU Lesser General Public License |
1560 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1561 | - */ |
1562 | - |
1563 | -#ifndef UBUNTU_OPENGL_CONTEXT_H |
1564 | -#define UBUNTU_OPENGL_CONTEXT_H |
1565 | +/**************************************************************************** |
1566 | +** |
1567 | +** Copyright (C) 2016 Canonical, Ltd. |
1568 | +** Contact: https://www.qt.io/licensing/ |
1569 | +** |
1570 | +** This file is part of the plugins of the Qt Toolkit. |
1571 | +** |
1572 | +** $QT_BEGIN_LICENSE:LGPL$ |
1573 | +** Commercial License Usage |
1574 | +** Licensees holding valid commercial Qt licenses may use this file in |
1575 | +** accordance with the commercial license agreement provided with the |
1576 | +** Software or, alternatively, in accordance with the terms contained in |
1577 | +** a written agreement between you and The Qt Company. For licensing terms |
1578 | +** and conditions see https://www.qt.io/terms-conditions. For further |
1579 | +** information use the contact form at https://www.qt.io/contact-us. |
1580 | +** |
1581 | +** GNU Lesser General Public License Usage |
1582 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
1583 | +** General Public License version 3 as published by the Free Software |
1584 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
1585 | +** packaging of this file. Please review the following information to |
1586 | +** ensure the GNU Lesser General Public License version 3 requirements |
1587 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
1588 | +** |
1589 | +** GNU General Public License Usage |
1590 | +** Alternatively, this file may be used under the terms of the GNU |
1591 | +** General Public License version 2.0 or (at your option) the GNU General |
1592 | +** Public license version 3 or any later version approved by the KDE Free |
1593 | +** Qt Foundation. The licenses are as published by the Free Software |
1594 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
1595 | +** included in the packaging of this file. Please review the following |
1596 | +** information to ensure the GNU General Public License requirements will |
1597 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
1598 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
1599 | +** |
1600 | +** $QT_END_LICENSE$ |
1601 | +** |
1602 | +****************************************************************************/ |
1603 | + |
1604 | + |
1605 | +#ifndef QMIRCLIENTGLCONTEXT_H |
1606 | +#define QMIRCLIENTGLCONTEXT_H |
1607 | |
1608 | #include <qpa/qplatformopenglcontext.h> |
1609 | -#include <private/qeglplatformcontext_p.h> |
1610 | +#include <QtPlatformSupport/private/qeglplatformcontext_p.h> |
1611 | |
1612 | #include <EGL/egl.h> |
1613 | |
1614 | -class UbuntuOpenGLContext : public QEGLPlatformContext |
1615 | +class QMirClientOpenGLContext : public QEGLPlatformContext |
1616 | { |
1617 | public: |
1618 | - UbuntuOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, |
1619 | + QMirClientOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, |
1620 | EGLDisplay display); |
1621 | |
1622 | // QEGLPlatformContext methods. |
1623 | @@ -36,4 +60,4 @@ |
1624 | EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) final; |
1625 | }; |
1626 | |
1627 | -#endif // UBUNTU_OPENGL_CONTEXT_H |
1628 | +#endif // QMIRCLIENTGLCONTEXT_H |
1629 | |
1630 | === renamed file 'src/ubuntumirclient/input.cpp' => 'src/ubuntumirclient/qmirclientinput.cpp' |
1631 | --- src/ubuntumirclient/input.cpp 2017-01-10 06:41:48 +0000 |
1632 | +++ src/ubuntumirclient/qmirclientinput.cpp 2017-02-21 12:29:19 +0000 |
1633 | @@ -1,33 +1,57 @@ |
1634 | -/* |
1635 | - * Copyright (C) 2014-2016 Canonical, Ltd. |
1636 | - * |
1637 | - * This program is free software: you can redistribute it and/or modify it under |
1638 | - * the terms of the GNU Lesser General Public License version 3, as published by |
1639 | - * the Free Software Foundation. |
1640 | - * |
1641 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
1642 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1643 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1644 | - * Lesser General Public License for more details. |
1645 | - * |
1646 | - * You should have received a copy of the GNU Lesser General Public License |
1647 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1648 | - */ |
1649 | +/**************************************************************************** |
1650 | +** |
1651 | +** Copyright (C) 2014-2017 Canonical, Ltd. |
1652 | +** Contact: https://www.qt.io/licensing/ |
1653 | +** |
1654 | +** This file is part of the plugins of the Qt Toolkit. |
1655 | +** |
1656 | +** $QT_BEGIN_LICENSE:LGPL$ |
1657 | +** Commercial License Usage |
1658 | +** Licensees holding valid commercial Qt licenses may use this file in |
1659 | +** accordance with the commercial license agreement provided with the |
1660 | +** Software or, alternatively, in accordance with the terms contained in |
1661 | +** a written agreement between you and The Qt Company. For licensing terms |
1662 | +** and conditions see https://www.qt.io/terms-conditions. For further |
1663 | +** information use the contact form at https://www.qt.io/contact-us. |
1664 | +** |
1665 | +** GNU Lesser General Public License Usage |
1666 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
1667 | +** General Public License version 3 as published by the Free Software |
1668 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
1669 | +** packaging of this file. Please review the following information to |
1670 | +** ensure the GNU Lesser General Public License version 3 requirements |
1671 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
1672 | +** |
1673 | +** GNU General Public License Usage |
1674 | +** Alternatively, this file may be used under the terms of the GNU |
1675 | +** General Public License version 2.0 or (at your option) the GNU General |
1676 | +** Public license version 3 or any later version approved by the KDE Free |
1677 | +** Qt Foundation. The licenses are as published by the Free Software |
1678 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
1679 | +** included in the packaging of this file. Please review the following |
1680 | +** information to ensure the GNU General Public License requirements will |
1681 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
1682 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
1683 | +** |
1684 | +** $QT_END_LICENSE$ |
1685 | +** |
1686 | +****************************************************************************/ |
1687 | + |
1688 | |
1689 | // Local |
1690 | -#include "input.h" |
1691 | -#include "integration.h" |
1692 | -#include "nativeinterface.h" |
1693 | -#include "screen.h" |
1694 | -#include "window.h" |
1695 | -#include "logging.h" |
1696 | -#include "orientationchangeevent_p.h" |
1697 | +#include "qmirclientinput.h" |
1698 | +#include "qmirclientintegration.h" |
1699 | +#include "qmirclientnativeinterface.h" |
1700 | +#include "qmirclientscreen.h" |
1701 | +#include "qmirclientwindow.h" |
1702 | +#include "qmirclientlogging.h" |
1703 | +#include "qmirclientorientationchangeevent_p.h" |
1704 | |
1705 | // Qt |
1706 | #include <QtCore/QThread> |
1707 | #include <QtCore/qglobal.h> |
1708 | #include <QtCore/QCoreApplication> |
1709 | -#include <private/qguiapplication_p.h> |
1710 | +#include <QtGui/private/qguiapplication_p.h> |
1711 | #include <qpa/qplatforminputcontext.h> |
1712 | #include <qpa/qwindowsysteminterface.h> |
1713 | #include <QTextCodec> |
1714 | @@ -37,7 +61,7 @@ |
1715 | |
1716 | #include <mir_toolkit/mir_client_library.h> |
1717 | |
1718 | -Q_LOGGING_CATEGORY(ubuntumirclientInput, "ubuntumirclient.input", QtWarningMsg) |
1719 | +Q_LOGGING_CATEGORY(mirclientInput, "qt.qpa.mirclient.input", QtWarningMsg) |
1720 | |
1721 | namespace |
1722 | { |
1723 | @@ -143,22 +167,22 @@ |
1724 | 0, 0 |
1725 | }; |
1726 | |
1727 | -Qt::WindowState mirSurfaceStateToWindowState(MirSurfaceState state) |
1728 | +Qt::WindowState mirWindowStateToQt(MirWindowState state) |
1729 | { |
1730 | switch (state) { |
1731 | - case mir_surface_state_fullscreen: |
1732 | + case mir_window_state_fullscreen: |
1733 | return Qt::WindowFullScreen; |
1734 | - case mir_surface_state_maximized: |
1735 | - case mir_surface_state_vertmaximized: |
1736 | - case mir_surface_state_horizmaximized: |
1737 | + case mir_window_state_maximized: |
1738 | + case mir_window_state_vertmaximized: |
1739 | + case mir_window_state_horizmaximized: |
1740 | return Qt::WindowMaximized; |
1741 | - case mir_surface_state_minimized: |
1742 | + case mir_window_state_minimized: |
1743 | return Qt::WindowMinimized; |
1744 | - case mir_surface_state_hidden: |
1745 | + case mir_window_state_hidden: |
1746 | // We should be handling this state separately. |
1747 | Q_ASSERT(false); |
1748 | - case mir_surface_state_restored: |
1749 | - case mir_surface_state_unknown: |
1750 | + case mir_window_state_restored: |
1751 | + case mir_window_state_unknown: |
1752 | default: |
1753 | return Qt::WindowNoState; |
1754 | } |
1755 | @@ -169,7 +193,7 @@ |
1756 | class UbuntuEvent : public QEvent |
1757 | { |
1758 | public: |
1759 | - UbuntuEvent(UbuntuWindow* window, const MirEvent *event, QEvent::Type type) |
1760 | + UbuntuEvent(QMirClientWindow* window, const MirEvent *event, QEvent::Type type) |
1761 | : QEvent(type), window(window) { |
1762 | nativeEvent = mir_event_ref(event); |
1763 | } |
1764 | @@ -178,14 +202,14 @@ |
1765 | mir_event_unref(nativeEvent); |
1766 | } |
1767 | |
1768 | - QPointer<UbuntuWindow> window; |
1769 | + QPointer<QMirClientWindow> window; |
1770 | const MirEvent *nativeEvent; |
1771 | }; |
1772 | |
1773 | -UbuntuInput::UbuntuInput(UbuntuClientIntegration* integration) |
1774 | +QMirClientInput::QMirClientInput(QMirClientClientIntegration* integration) |
1775 | : QObject(nullptr) |
1776 | , mIntegration(integration) |
1777 | - , mEventFilterType(static_cast<UbuntuNativeInterface*>( |
1778 | + , mEventFilterType(static_cast<QMirClientNativeInterface*>( |
1779 | integration->nativeInterface())->genericEventFilterType()) |
1780 | , mEventType(static_cast<QEvent::Type>(QEvent::registerEventType())) |
1781 | , mLastInputWindow(nullptr) |
1782 | @@ -199,7 +223,7 @@ |
1783 | QWindowSystemInterface::registerTouchDevice(mTouchDevice); |
1784 | } |
1785 | |
1786 | -UbuntuInput::~UbuntuInput() |
1787 | +QMirClientInput::~QMirClientInput() |
1788 | { |
1789 | // Qt will take care of deleting mTouchDevice. |
1790 | } |
1791 | @@ -212,40 +236,40 @@ |
1792 | return "key"; |
1793 | case mir_event_type_motion: |
1794 | return "motion"; |
1795 | - case mir_event_type_surface: |
1796 | - return "surface"; |
1797 | + case mir_event_type_window: |
1798 | + return "window"; |
1799 | case mir_event_type_resize: |
1800 | return "resize"; |
1801 | case mir_event_type_prompt_session_state_change: |
1802 | return "prompt_session_state_change"; |
1803 | case mir_event_type_orientation: |
1804 | return "orientation"; |
1805 | - case mir_event_type_close_surface: |
1806 | - return "close_surface"; |
1807 | + case mir_event_type_close_window: |
1808 | + return "close_window"; |
1809 | case mir_event_type_input: |
1810 | return "input"; |
1811 | case mir_event_type_keymap: |
1812 | return "keymap"; |
1813 | - case mir_event_type_input_configuration: |
1814 | - return "input_configuration"; |
1815 | - case mir_event_type_surface_output: |
1816 | - return "surface_output"; |
1817 | + case mir_event_type_window_output: |
1818 | + return "window_output"; |
1819 | case mir_event_type_input_device_state: |
1820 | return "input_device_state"; |
1821 | - case mir_event_type_surface_placement: |
1822 | - return "surface_placement"; |
1823 | + case mir_event_type_window_placement: |
1824 | + return "window_placement"; |
1825 | + default: |
1826 | + Q_UNREACHABLE(); |
1827 | } |
1828 | Q_UNREACHABLE(); |
1829 | } |
1830 | |
1831 | -void UbuntuInput::customEvent(QEvent* event) |
1832 | +void QMirClientInput::customEvent(QEvent* event) |
1833 | { |
1834 | Q_ASSERT(QThread::currentThread() == thread()); |
1835 | UbuntuEvent* ubuntuEvent = static_cast<UbuntuEvent*>(event); |
1836 | const MirEvent *nativeEvent = ubuntuEvent->nativeEvent; |
1837 | |
1838 | if ((ubuntuEvent->window == nullptr) || (ubuntuEvent->window->window() == nullptr)) { |
1839 | - qCWarning(ubuntumirclient) << "Attempted to deliver an event to a non-existent window, ignoring."; |
1840 | + qCWarning(mirclient) << "Attempted to deliver an event to a non-existent window, ignoring."; |
1841 | return; |
1842 | } |
1843 | |
1844 | @@ -254,11 +278,11 @@ |
1845 | if (QWindowSystemInterface::handleNativeEvent( |
1846 | ubuntuEvent->window->window(), mEventFilterType, |
1847 | const_cast<void *>(static_cast<const void *>(nativeEvent)), &result) == true) { |
1848 | - qCDebug(ubuntumirclient, "event filtered out by native interface"); |
1849 | + qCDebug(mirclient, "event filtered out by native interface"); |
1850 | return; |
1851 | } |
1852 | |
1853 | - qCDebug(ubuntumirclientInput, "customEvent(type=%s)", nativeEventTypeToStr(mir_event_get_type(nativeEvent))); |
1854 | + qCDebug(mirclientInput, "customEvent(type=%s)", nativeEventTypeToStr(mir_event_get_type(nativeEvent))); |
1855 | |
1856 | // Event dispatching. |
1857 | switch (mir_event_get_type(nativeEvent)) |
1858 | @@ -273,7 +297,7 @@ |
1859 | // Enable workaround for Screen rotation |
1860 | auto const targetWindow = ubuntuEvent->window; |
1861 | if (targetWindow) { |
1862 | - auto const screen = static_cast<UbuntuScreen*>(targetWindow->screen()); |
1863 | + auto const screen = static_cast<QMirClientScreen*>(targetWindow->screen()); |
1864 | if (screen) { |
1865 | screen->handleWindowSurfaceResize( |
1866 | mir_resize_event_get_width(resizeEvent), |
1867 | @@ -286,24 +310,24 @@ |
1868 | } |
1869 | break; |
1870 | } |
1871 | - case mir_event_type_surface: |
1872 | - handleSurfaceEvent(ubuntuEvent->window, mir_event_get_surface_event(nativeEvent)); |
1873 | + case mir_event_type_window: |
1874 | + handleWindowEvent(ubuntuEvent->window, mir_event_get_window_event(nativeEvent)); |
1875 | break; |
1876 | - case mir_event_type_surface_output: |
1877 | - handleSurfaceOutputEvent(ubuntuEvent->window, mir_event_get_surface_output_event(nativeEvent)); |
1878 | + case mir_event_type_window_output: |
1879 | + handleWindowOutputEvent(ubuntuEvent->window, mir_event_get_window_output_event(nativeEvent)); |
1880 | break; |
1881 | case mir_event_type_orientation: |
1882 | dispatchOrientationEvent(ubuntuEvent->window->window(), mir_event_get_orientation_event(nativeEvent)); |
1883 | break; |
1884 | - case mir_event_type_close_surface: |
1885 | + case mir_event_type_close_window: |
1886 | QWindowSystemInterface::handleCloseEvent(ubuntuEvent->window->window()); |
1887 | break; |
1888 | default: |
1889 | - qCDebug(ubuntumirclient, "unhandled event type: %d", static_cast<int>(mir_event_get_type(nativeEvent))); |
1890 | + qCDebug(mirclient, "unhandled event type: %d", static_cast<int>(mir_event_get_type(nativeEvent))); |
1891 | } |
1892 | } |
1893 | |
1894 | -void UbuntuInput::postEvent(UbuntuWindow *platformWindow, const MirEvent *event) |
1895 | +void QMirClientInput::postEvent(QMirClientWindow *platformWindow, const MirEvent *event) |
1896 | { |
1897 | QWindow *window = platformWindow->window(); |
1898 | |
1899 | @@ -312,12 +336,12 @@ |
1900 | |
1901 | if ((window->flags().testFlag(Qt::WindowTransparentForInput)) && window->parent()) { |
1902 | QCoreApplication::postEvent(this, new UbuntuEvent( |
1903 | - static_cast<UbuntuWindow*>(platformWindow->QPlatformWindow::parent()), |
1904 | + static_cast<QMirClientWindow*>(platformWindow->QPlatformWindow::parent()), |
1905 | event, mEventType)); |
1906 | } |
1907 | } |
1908 | |
1909 | -void UbuntuInput::dispatchInputEvent(UbuntuWindow *window, const MirInputEvent *ev) |
1910 | +void QMirClientInput::dispatchInputEvent(QMirClientWindow *window, const MirInputEvent *ev) |
1911 | { |
1912 | switch (mir_input_event_get_type(ev)) |
1913 | { |
1914 | @@ -335,7 +359,7 @@ |
1915 | } |
1916 | } |
1917 | |
1918 | -void UbuntuInput::dispatchTouchEvent(UbuntuWindow *window, const MirInputEvent *ev) |
1919 | +void QMirClientInput::dispatchTouchEvent(QMirClientWindow *window, const MirInputEvent *ev) |
1920 | { |
1921 | const MirTouchEvent *tev = mir_input_event_get_touch_event(ev); |
1922 | |
1923 | @@ -433,7 +457,7 @@ |
1924 | } |
1925 | } |
1926 | |
1927 | -void UbuntuInput::dispatchKeyEvent(UbuntuWindow *window, const MirInputEvent *event) |
1928 | +void QMirClientInput::dispatchKeyEvent(QMirClientWindow *window, const MirInputEvent *event) |
1929 | { |
1930 | const MirKeyboardEvent *key_event = mir_input_event_get_keyboard_event(event); |
1931 | |
1932 | @@ -470,7 +494,7 @@ |
1933 | QKeyEvent qKeyEvent(keyType, sym, modifiers, scan_code, xk_sym, native_modifiers, text, is_auto_rep); |
1934 | qKeyEvent.setTimestamp(timestamp); |
1935 | if (context->filterEvent(&qKeyEvent)) { |
1936 | - qCDebug(ubuntumirclient, "key event filtered out by input context"); |
1937 | + qCDebug(mirclient, "key event filtered out by input context"); |
1938 | return; |
1939 | } |
1940 | } |
1941 | @@ -498,7 +522,7 @@ |
1942 | } |
1943 | } |
1944 | |
1945 | -void UbuntuInput::dispatchPointerEvent(UbuntuWindow *platformWindow, const MirInputEvent *ev) |
1946 | +void QMirClientInput::dispatchPointerEvent(QMirClientWindow *platformWindow, const MirInputEvent *ev) |
1947 | { |
1948 | const auto window = platformWindow->window(); |
1949 | const auto timestamp = mir_input_event_get_event_time(ev) / 1000000; |
1950 | @@ -557,13 +581,13 @@ |
1951 | Q_UNREACHABLE(); |
1952 | } |
1953 | |
1954 | -void UbuntuInput::dispatchOrientationEvent(QWindow *window, const MirOrientationEvent *event) |
1955 | +void QMirClientInput::dispatchOrientationEvent(QWindow *window, const MirOrientationEvent *event) |
1956 | { |
1957 | MirOrientation mir_orientation = mir_orientation_event_get_direction(event); |
1958 | - qCDebug(ubuntumirclientInput, "orientation direction: %s", nativeOrientationDirectionToStr(mir_orientation)); |
1959 | + qCDebug(mirclientInput, "orientation direction: %s", nativeOrientationDirectionToStr(mir_orientation)); |
1960 | |
1961 | if (!window->screen()) { |
1962 | - qCDebug(ubuntumirclient, "Window has no associated screen, dropping orientation event"); |
1963 | + qCDebug(mirclient, "Window has no associated screen, dropping orientation event"); |
1964 | return; |
1965 | } |
1966 | |
1967 | @@ -582,7 +606,7 @@ |
1968 | orientation = OrientationChangeEvent::RightUp; |
1969 | break; |
1970 | default: |
1971 | - qCDebug(ubuntumirclient, "No such orientation %d", mir_orientation); |
1972 | + qCDebug(mirclient, "No such orientation %d", mir_orientation); |
1973 | return; |
1974 | } |
1975 | |
1976 | @@ -590,57 +614,58 @@ |
1977 | // notifying Qt of the actual orientation change - done to prevent multiple Windows each creating |
1978 | // an identical orientation change event and passing it directly to Qt. |
1979 | // [Platform]Screen can also factor in the native orientation. |
1980 | - QCoreApplication::postEvent(static_cast<UbuntuScreen*>(window->screen()->handle()), |
1981 | + QCoreApplication::postEvent(static_cast<QMirClientScreen*>(window->screen()->handle()), |
1982 | new OrientationChangeEvent(OrientationChangeEvent::mType, orientation)); |
1983 | } |
1984 | |
1985 | -void UbuntuInput::handleSurfaceEvent(const QPointer<UbuntuWindow> &window, const MirSurfaceEvent *event) |
1986 | +void QMirClientInput::handleWindowEvent(const QPointer<QMirClientWindow> &window, const MirWindowEvent *event) |
1987 | { |
1988 | - auto surfaceEventAttribute = mir_surface_event_get_attribute(event); |
1989 | + auto windowEventAttribute = mir_window_event_get_attribute(event); |
1990 | |
1991 | - switch (surfaceEventAttribute) { |
1992 | - case mir_surface_attrib_focus: { |
1993 | + switch (windowEventAttribute) { |
1994 | + case mir_window_attrib_focus: { |
1995 | window->handleSurfaceFocusChanged( |
1996 | - mir_surface_event_get_attribute_value(event) == mir_surface_focused); |
1997 | + mir_window_event_get_attribute_value(event) == mir_window_focus_state_focused); |
1998 | break; |
1999 | } |
2000 | - case mir_surface_attrib_visibility: |
2001 | + case mir_window_attrib_visibility: { |
2002 | window->handleSurfaceExposeChange( |
2003 | - mir_surface_event_get_attribute_value(event) == mir_surface_visibility_exposed); |
2004 | + mir_window_event_get_attribute_value(event) == mir_window_visibility_exposed); |
2005 | break; |
2006 | + } |
2007 | // Remaining attributes are ones client sets for server, and server should not override them |
2008 | - case mir_surface_attrib_state: { |
2009 | - MirSurfaceState state = static_cast<MirSurfaceState>(mir_surface_event_get_attribute_value(event)); |
2010 | + case mir_window_attrib_state: { |
2011 | + MirWindowState state = static_cast<MirWindowState>(mir_window_event_get_attribute_value(event)); |
2012 | |
2013 | - if (state == mir_surface_state_hidden) { |
2014 | + if (state == mir_window_state_hidden) { |
2015 | window->handleSurfaceVisibilityChanged(false); |
2016 | } else { |
2017 | // it's visible! |
2018 | window->handleSurfaceVisibilityChanged(true); |
2019 | - window->handleSurfaceStateChanged(mirSurfaceStateToWindowState(state)); |
2020 | + window->handleSurfaceStateChanged(mirWindowStateToQt(state)); |
2021 | } |
2022 | break; |
2023 | } |
2024 | - case mir_surface_attrib_type: |
2025 | - case mir_surface_attrib_swapinterval: |
2026 | - case mir_surface_attrib_dpi: |
2027 | - case mir_surface_attrib_preferred_orientation: |
2028 | - case mir_surface_attribs: |
2029 | + case mir_window_attrib_type: |
2030 | + case mir_window_attrib_swapinterval: |
2031 | + case mir_window_attrib_dpi: |
2032 | + case mir_window_attrib_preferred_orientation: |
2033 | + case mir_window_attribs: |
2034 | break; |
2035 | } |
2036 | } |
2037 | |
2038 | -void UbuntuInput::handleSurfaceOutputEvent(const QPointer<UbuntuWindow> &window, const MirSurfaceOutputEvent *event) |
2039 | +void QMirClientInput::handleWindowOutputEvent(const QPointer<QMirClientWindow> &window, const MirWindowOutputEvent *event) |
2040 | { |
2041 | - const uint32_t outputId = mir_surface_output_event_get_output_id(event); |
2042 | - const int dpi = mir_surface_output_event_get_dpi(event); |
2043 | - const MirFormFactor formFactor = mir_surface_output_event_get_form_factor(event); |
2044 | - const float scale = mir_surface_output_event_get_scale(event); |
2045 | + const uint32_t outputId = mir_window_output_event_get_output_id(event); |
2046 | + const int dpi = mir_window_output_event_get_dpi(event); |
2047 | + const MirFormFactor formFactor = mir_window_output_event_get_form_factor(event); |
2048 | + const float scale = mir_window_output_event_get_scale(event); |
2049 | |
2050 | const auto screenObserver = mIntegration->screenObserver(); |
2051 | - UbuntuScreen *screen = screenObserver->findScreenWithId(outputId); |
2052 | + QMirClientScreen *screen = screenObserver->findScreenWithId(outputId); |
2053 | if (!screen) { |
2054 | - qCWarning(ubuntumirclient) << "Mir notified window" << window->window() << "on an unknown screen with id" << outputId; |
2055 | + qCWarning(mirclient) << "Mir notified window" << window->window() << "on an unknown screen with id" << outputId; |
2056 | return; |
2057 | } |
2058 | |
2059 | |
2060 | === renamed file 'src/ubuntumirclient/input.h' => 'src/ubuntumirclient/qmirclientinput.h' |
2061 | --- src/ubuntumirclient/input.h 2016-09-21 10:25:33 +0000 |
2062 | +++ src/ubuntumirclient/qmirclientinput.h 2017-02-21 12:29:19 +0000 |
2063 | @@ -1,63 +1,86 @@ |
2064 | -/* |
2065 | - * Copyright (C) 2014-2016 Canonical, Ltd. |
2066 | - * |
2067 | - * This program is free software: you can redistribute it and/or modify it under |
2068 | - * the terms of the GNU Lesser General Public License version 3, as published by |
2069 | - * the Free Software Foundation. |
2070 | - * |
2071 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
2072 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
2073 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2074 | - * Lesser General Public License for more details. |
2075 | - * |
2076 | - * You should have received a copy of the GNU Lesser General Public License |
2077 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2078 | - */ |
2079 | - |
2080 | -#ifndef UBUNTU_INPUT_H |
2081 | -#define UBUNTU_INPUT_H |
2082 | +/**************************************************************************** |
2083 | +** |
2084 | +** Copyright (C) 2014-2017 Canonical, Ltd. |
2085 | +** Contact: https://www.qt.io/licensing/ |
2086 | +** |
2087 | +** This file is part of the plugins of the Qt Toolkit. |
2088 | +** |
2089 | +** $QT_BEGIN_LICENSE:LGPL$ |
2090 | +** Commercial License Usage |
2091 | +** Licensees holding valid commercial Qt licenses may use this file in |
2092 | +** accordance with the commercial license agreement provided with the |
2093 | +** Software or, alternatively, in accordance with the terms contained in |
2094 | +** a written agreement between you and The Qt Company. For licensing terms |
2095 | +** and conditions see https://www.qt.io/terms-conditions. For further |
2096 | +** information use the contact form at https://www.qt.io/contact-us. |
2097 | +** |
2098 | +** GNU Lesser General Public License Usage |
2099 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
2100 | +** General Public License version 3 as published by the Free Software |
2101 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
2102 | +** packaging of this file. Please review the following information to |
2103 | +** ensure the GNU Lesser General Public License version 3 requirements |
2104 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
2105 | +** |
2106 | +** GNU General Public License Usage |
2107 | +** Alternatively, this file may be used under the terms of the GNU |
2108 | +** General Public License version 2.0 or (at your option) the GNU General |
2109 | +** Public license version 3 or any later version approved by the KDE Free |
2110 | +** Qt Foundation. The licenses are as published by the Free Software |
2111 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
2112 | +** included in the packaging of this file. Please review the following |
2113 | +** information to ensure the GNU General Public License requirements will |
2114 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
2115 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
2116 | +** |
2117 | +** $QT_END_LICENSE$ |
2118 | +** |
2119 | +****************************************************************************/ |
2120 | + |
2121 | + |
2122 | +#ifndef QMIRCLIENTINPUT_H |
2123 | +#define QMIRCLIENTINPUT_H |
2124 | |
2125 | // Qt |
2126 | #include <qpa/qwindowsysteminterface.h> |
2127 | -#include <QLoggingCategory> |
2128 | |
2129 | #include <mir_toolkit/mir_client_library.h> |
2130 | |
2131 | -class UbuntuClientIntegration; |
2132 | -class UbuntuWindow; |
2133 | +class QMirClientClientIntegration; |
2134 | +class QMirClientWindow; |
2135 | |
2136 | -class UbuntuInput : public QObject |
2137 | +class QMirClientInput : public QObject |
2138 | { |
2139 | Q_OBJECT |
2140 | |
2141 | public: |
2142 | - UbuntuInput(UbuntuClientIntegration* integration); |
2143 | - virtual ~UbuntuInput(); |
2144 | + QMirClientInput(QMirClientClientIntegration* integration); |
2145 | + virtual ~QMirClientInput(); |
2146 | |
2147 | // QObject methods. |
2148 | void customEvent(QEvent* event) override; |
2149 | |
2150 | - void postEvent(UbuntuWindow* window, const MirEvent *event); |
2151 | - UbuntuClientIntegration* integration() const { return mIntegration; } |
2152 | - UbuntuWindow *lastInputWindow() const {return mLastInputWindow; } |
2153 | + void postEvent(QMirClientWindow* window, const MirEvent *event); |
2154 | + QMirClientClientIntegration* integration() const { return mIntegration; } |
2155 | + QMirClientWindow *lastInputWindow() const {return mLastInputWindow; } |
2156 | |
2157 | protected: |
2158 | - void dispatchKeyEvent(UbuntuWindow *window, const MirInputEvent *event); |
2159 | - void dispatchPointerEvent(UbuntuWindow *window, const MirInputEvent *event); |
2160 | - void dispatchTouchEvent(UbuntuWindow *window, const MirInputEvent *event); |
2161 | - void dispatchInputEvent(UbuntuWindow *window, const MirInputEvent *event); |
2162 | + void dispatchKeyEvent(QMirClientWindow *window, const MirInputEvent *event); |
2163 | + void dispatchPointerEvent(QMirClientWindow *window, const MirInputEvent *event); |
2164 | + void dispatchTouchEvent(QMirClientWindow *window, const MirInputEvent *event); |
2165 | + void dispatchInputEvent(QMirClientWindow *window, const MirInputEvent *event); |
2166 | |
2167 | void dispatchOrientationEvent(QWindow* window, const MirOrientationEvent *event); |
2168 | - void handleSurfaceEvent(const QPointer<UbuntuWindow> &window, const MirSurfaceEvent *event); |
2169 | - void handleSurfaceOutputEvent(const QPointer<UbuntuWindow> &window, const MirSurfaceOutputEvent *event); |
2170 | + void handleWindowEvent(const QPointer<QMirClientWindow> &window, const MirWindowEvent *event); |
2171 | + void handleWindowOutputEvent(const QPointer<QMirClientWindow> &window, const MirWindowOutputEvent *event); |
2172 | |
2173 | private: |
2174 | - UbuntuClientIntegration* mIntegration; |
2175 | + QMirClientClientIntegration* mIntegration; |
2176 | QTouchDevice* mTouchDevice; |
2177 | const QByteArray mEventFilterType; |
2178 | const QEvent::Type mEventType; |
2179 | |
2180 | - UbuntuWindow *mLastInputWindow; |
2181 | + QMirClientWindow *mLastInputWindow; |
2182 | }; |
2183 | |
2184 | -#endif // UBUNTU_INPUT_H |
2185 | +#endif // QMIRCLIENTINPUT_H |
2186 | |
2187 | === renamed file 'src/ubuntumirclient/integration.cpp' => 'src/ubuntumirclient/qmirclientintegration.cpp' |
2188 | --- src/ubuntumirclient/integration.cpp 2017-01-19 22:54:37 +0000 |
2189 | +++ src/ubuntumirclient/qmirclientintegration.cpp 2017-02-21 12:29:19 +0000 |
2190 | @@ -1,36 +1,59 @@ |
2191 | -/* |
2192 | - * Copyright (C) 2014-2016 Canonical, Ltd. |
2193 | - * |
2194 | - * This program is free software: you can redistribute it and/or modify it under |
2195 | - * the terms of the GNU Lesser General Public License version 3, as published by |
2196 | - * the Free Software Foundation. |
2197 | - * |
2198 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
2199 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
2200 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2201 | - * Lesser General Public License for more details. |
2202 | - * |
2203 | - * You should have received a copy of the GNU Lesser General Public License |
2204 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2205 | - */ |
2206 | +/**************************************************************************** |
2207 | +** |
2208 | +** Copyright (C) 2014-2016 Canonical, Ltd. |
2209 | +** Contact: https://www.qt.io/licensing/ |
2210 | +** |
2211 | +** This file is part of the plugins of the Qt Toolkit. |
2212 | +** |
2213 | +** $QT_BEGIN_LICENSE:LGPL$ |
2214 | +** Commercial License Usage |
2215 | +** Licensees holding valid commercial Qt licenses may use this file in |
2216 | +** accordance with the commercial license agreement provided with the |
2217 | +** Software or, alternatively, in accordance with the terms contained in |
2218 | +** a written agreement between you and The Qt Company. For licensing terms |
2219 | +** and conditions see https://www.qt.io/terms-conditions. For further |
2220 | +** information use the contact form at https://www.qt.io/contact-us. |
2221 | +** |
2222 | +** GNU Lesser General Public License Usage |
2223 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
2224 | +** General Public License version 3 as published by the Free Software |
2225 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
2226 | +** packaging of this file. Please review the following information to |
2227 | +** ensure the GNU Lesser General Public License version 3 requirements |
2228 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
2229 | +** |
2230 | +** GNU General Public License Usage |
2231 | +** Alternatively, this file may be used under the terms of the GNU |
2232 | +** General Public License version 2.0 or (at your option) the GNU General |
2233 | +** Public license version 3 or any later version approved by the KDE Free |
2234 | +** Qt Foundation. The licenses are as published by the Free Software |
2235 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
2236 | +** included in the packaging of this file. Please review the following |
2237 | +** information to ensure the GNU General Public License requirements will |
2238 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
2239 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
2240 | +** |
2241 | +** $QT_END_LICENSE$ |
2242 | +** |
2243 | +****************************************************************************/ |
2244 | + |
2245 | |
2246 | // Local |
2247 | -#include "integration.h" |
2248 | -#include "backingstore.h" |
2249 | -#include "clipboard.h" |
2250 | -#include "desktopwindow.h" |
2251 | -#include "debugextension.h" |
2252 | -#include "glcontext.h" |
2253 | -#include "input.h" |
2254 | -#include "logging.h" |
2255 | -#include "nativeinterface.h" |
2256 | -#include "screen.h" |
2257 | -#include "window.h" |
2258 | +#include "qmirclientintegration.h" |
2259 | +#include "qmirclientbackingstore.h" |
2260 | +#include "qmirclientclipboard.h" |
2261 | +#include "qmirclientdebugextension.h" |
2262 | +#include "qmirclientdesktopwindow.h" |
2263 | +#include "qmirclientglcontext.h" |
2264 | +#include "qmirclientinput.h" |
2265 | +#include "qmirclientlogging.h" |
2266 | +#include "qmirclientnativeinterface.h" |
2267 | +#include "qmirclientscreen.h" |
2268 | +#include "qmirclientwindow.h" |
2269 | |
2270 | // Qt |
2271 | #include <QFileInfo> |
2272 | #include <QGuiApplication> |
2273 | -#include <private/qeglpbuffer_p.h> |
2274 | #include <qpa/qplatformnativeinterface.h> |
2275 | #include <qpa/qplatforminputcontextfactory_p.h> |
2276 | #include <qpa/qplatforminputcontext.h> |
2277 | @@ -71,29 +94,29 @@ |
2278 | |
2279 | static void resumedCallback(const UApplicationOptions */*options*/, void *context) |
2280 | { |
2281 | - auto integration = static_cast<UbuntuClientIntegration*>(context); |
2282 | + auto integration = static_cast<QMirClientClientIntegration*>(context); |
2283 | integration->appStateController()->setResumed(); |
2284 | } |
2285 | |
2286 | static void aboutToStopCallback(UApplicationArchive */*archive*/, void *context) |
2287 | { |
2288 | - auto integration = static_cast<UbuntuClientIntegration*>(context); |
2289 | + auto integration = static_cast<QMirClientClientIntegration*>(context); |
2290 | auto inputContext = integration->inputContext(); |
2291 | if (inputContext) { |
2292 | inputContext->hideInputPanel(); |
2293 | } else { |
2294 | - qCWarning(ubuntumirclient) << "aboutToStopCallback(): no input context"; |
2295 | + qCWarning(mirclient) << "aboutToStopCallback(): no input context"; |
2296 | } |
2297 | integration->appStateController()->setSuspended(); |
2298 | } |
2299 | |
2300 | |
2301 | -UbuntuClientIntegration::UbuntuClientIntegration(int argc, char **argv) |
2302 | +QMirClientClientIntegration::QMirClientClientIntegration(int argc, char **argv) |
2303 | : QPlatformIntegration() |
2304 | - , mNativeInterface(new UbuntuNativeInterface(this)) |
2305 | + , mNativeInterface(new QMirClientNativeInterface(this)) |
2306 | , mFontDb(new QGenericUnixFontDatabase) |
2307 | - , mServices(new UbuntuPlatformServices) |
2308 | - , mAppStateController(new UbuntuAppStateController) |
2309 | + , mServices(new QMirClientPlatformServices) |
2310 | + , mAppStateController(new QMirClientAppStateController) |
2311 | , mScaleFactor(1.0) |
2312 | { |
2313 | QByteArray sessionName; |
2314 | @@ -108,7 +131,7 @@ |
2315 | mInstance = u_application_instance_new_from_description_with_options(mDesc, mOptions); |
2316 | |
2317 | if (mInstance == nullptr) { |
2318 | - qCritical("[QPA] UbuntuClientIntegration: connection to Mir server failed.\n"); |
2319 | + qCritical("[QPA] QMirClientClientIntegration: connection to Mir server failed.\n"); |
2320 | |
2321 | // TODO: add API to platform-api to fetch Mir's error message (bug:1655970). |
2322 | // Workaround by retrying the connection here in order to get the message. |
2323 | @@ -140,28 +163,28 @@ |
2324 | } |
2325 | } |
2326 | if (testability) { |
2327 | - mDebugExtension.reset(new UbuntuDebugExtension); |
2328 | + mDebugExtension.reset(new QMirClientDebugExtension); |
2329 | if (!mDebugExtension->isEnabled()) { |
2330 | mDebugExtension.reset(); |
2331 | } |
2332 | } |
2333 | } |
2334 | |
2335 | -void UbuntuClientIntegration::initialize() |
2336 | +void QMirClientClientIntegration::initialize() |
2337 | { |
2338 | // Init the ScreenObserver |
2339 | - mScreenObserver.reset(new UbuntuScreenObserver(mMirConnection)); |
2340 | - connect(mScreenObserver.data(), &UbuntuScreenObserver::screenAdded, |
2341 | - [this](UbuntuScreen *screen) { this->screenAdded(screen); }); |
2342 | - connect(mScreenObserver.data(), &UbuntuScreenObserver::screenRemoved, |
2343 | - this, &UbuntuClientIntegration::destroyScreen); |
2344 | + mScreenObserver.reset(new QMirClientScreenObserver(mMirConnection)); |
2345 | + connect(mScreenObserver.data(), &QMirClientScreenObserver::screenAdded, |
2346 | + [this](QMirClientScreen *screen) { this->screenAdded(screen); }); |
2347 | + connect(mScreenObserver.data(), &QMirClientScreenObserver::screenRemoved, |
2348 | + this, &QMirClientClientIntegration::destroyScreen); |
2349 | |
2350 | - Q_FOREACH(auto screen, mScreenObserver->screens()) { |
2351 | + Q_FOREACH (auto screen, mScreenObserver->screens()) { |
2352 | screenAdded(screen); |
2353 | } |
2354 | |
2355 | // Initialize input. |
2356 | - mInput = new UbuntuInput(this); |
2357 | + mInput = new QMirClientInput(this); |
2358 | mInputContext = QPlatformInputContextFactory::create(); |
2359 | |
2360 | // compute the scale factor |
2361 | @@ -178,7 +201,7 @@ |
2362 | mScaleFactor = static_cast<qreal>(gridUnit) / defaultGridUnit; |
2363 | } |
2364 | |
2365 | -UbuntuClientIntegration::~UbuntuClientIntegration() |
2366 | +QMirClientClientIntegration::~QMirClientClientIntegration() |
2367 | { |
2368 | eglTerminate(mEglDisplay); |
2369 | delete mInput; |
2370 | @@ -186,12 +209,12 @@ |
2371 | delete mServices; |
2372 | } |
2373 | |
2374 | -QPlatformServices *UbuntuClientIntegration::services() const |
2375 | +QPlatformServices *QMirClientClientIntegration::services() const |
2376 | { |
2377 | return mServices; |
2378 | } |
2379 | |
2380 | -void UbuntuClientIntegration::setupOptions(QStringList &args) |
2381 | +void QMirClientClientIntegration::setupOptions(QStringList &args) |
2382 | { |
2383 | int argc = args.size() + 1; |
2384 | char **argv = new char*[argc]; |
2385 | @@ -206,7 +229,7 @@ |
2386 | delete [] argv; |
2387 | } |
2388 | |
2389 | -void UbuntuClientIntegration::setupDescription(QByteArray &sessionName) |
2390 | +void QMirClientClientIntegration::setupDescription(QByteArray &sessionName) |
2391 | { |
2392 | mDesc = u_application_description_new(); |
2393 | |
2394 | @@ -220,7 +243,7 @@ |
2395 | u_application_description_set_application_lifecycle_delegate(mDesc, delegate); |
2396 | } |
2397 | |
2398 | -QByteArray UbuntuClientIntegration::generateSessionName(QStringList &args) |
2399 | +QByteArray QMirClientClientIntegration::generateSessionName(QStringList &args) |
2400 | { |
2401 | // Try to come up with some meaningful session name to uniquely identify this session, |
2402 | // helping with shell debugging |
2403 | @@ -236,7 +259,7 @@ |
2404 | } |
2405 | } |
2406 | |
2407 | -QByteArray UbuntuClientIntegration::generateSessionNameFromQmlFile(QStringList &args) |
2408 | +QByteArray QMirClientClientIntegration::generateSessionNameFromQmlFile(QStringList &args) |
2409 | { |
2410 | Q_FOREACH (QString arg, args) { |
2411 | if (arg.endsWith(".qml")) { |
2412 | @@ -249,25 +272,25 @@ |
2413 | return "qmlscene"; |
2414 | } |
2415 | |
2416 | -QPlatformWindow* UbuntuClientIntegration::createPlatformWindow(QWindow* window) const |
2417 | +QPlatformWindow* QMirClientClientIntegration::createPlatformWindow(QWindow* window) const |
2418 | { |
2419 | if (window->type() == Qt::Desktop) { |
2420 | // Desktop windows should not be backed up by a mir surface as they don't draw anything (nor should). |
2421 | - return new UbuntuDesktopWindow(window); |
2422 | + return new QMirClientDesktopWindow(window); |
2423 | } else { |
2424 | - return new UbuntuWindow(window, mInput, mNativeInterface, mAppStateController.data(), |
2425 | - mEglDisplay, mMirConnection, mDebugExtension.data()); |
2426 | + return new QMirClientWindow(window, mInput, mNativeInterface, mAppStateController.data(), |
2427 | + mEglDisplay, mMirConnection, mDebugExtension.data()); |
2428 | } |
2429 | } |
2430 | |
2431 | -bool UbuntuClientIntegration::hasCapability(QPlatformIntegration::Capability cap) const |
2432 | +bool QMirClientClientIntegration::hasCapability(QPlatformIntegration::Capability cap) const |
2433 | { |
2434 | switch (cap) { |
2435 | case ThreadedOpenGL: |
2436 | if (qEnvironmentVariableIsEmpty("QTUBUNTU_NO_THREADED_OPENGL")) { |
2437 | return true; |
2438 | } else { |
2439 | - qCDebug(ubuntumirclient, "disabled threaded OpenGL"); |
2440 | + qCDebug(mirclient, "disabled threaded OpenGL"); |
2441 | return false; |
2442 | } |
2443 | |
2444 | @@ -286,52 +309,52 @@ |
2445 | } |
2446 | } |
2447 | |
2448 | -QAbstractEventDispatcher *UbuntuClientIntegration::createEventDispatcher() const |
2449 | +QAbstractEventDispatcher *QMirClientClientIntegration::createEventDispatcher() const |
2450 | { |
2451 | return createUnixEventDispatcher(); |
2452 | } |
2453 | |
2454 | -QPlatformBackingStore* UbuntuClientIntegration::createPlatformBackingStore(QWindow* window) const |
2455 | +QPlatformBackingStore* QMirClientClientIntegration::createPlatformBackingStore(QWindow* window) const |
2456 | { |
2457 | - return new UbuntuBackingStore(window); |
2458 | + return new QMirClientBackingStore(window); |
2459 | } |
2460 | |
2461 | -QPlatformOpenGLContext* UbuntuClientIntegration::createPlatformOpenGLContext( |
2462 | +QPlatformOpenGLContext* QMirClientClientIntegration::createPlatformOpenGLContext( |
2463 | QOpenGLContext* context) const |
2464 | { |
2465 | QSurfaceFormat format(context->format()); |
2466 | |
2467 | - auto platformContext = new UbuntuOpenGLContext(format, context->shareHandle(), mEglDisplay); |
2468 | + auto platformContext = new QMirClientOpenGLContext(format, context->shareHandle(), mEglDisplay); |
2469 | if (!platformContext->isValid()) { |
2470 | // Older Intel Atom-based devices only support OpenGL 1.4 compatibility profile but by default |
2471 | // QML asks for at least OpenGL 2.0. The XCB GLX backend ignores this request and returns a |
2472 | - // 1.4 context, but the XCB EGL backend tries to honour it, and fails. The 1.4 context appears to |
2473 | + // 1.4 context, but the XCB EGL backend tries to honor it, and fails. The 1.4 context appears to |
2474 | // have sufficient capabilities on MESA (i915) to render correctly however. So reduce the default |
2475 | // requested OpenGL version to 1.0 to ensure EGL will give us a working context (lp:1549455). |
2476 | static const bool isMesa = QString(eglQueryString(mEglDisplay, EGL_VENDOR)).contains(QStringLiteral("Mesa")); |
2477 | if (isMesa) { |
2478 | - qCDebug(ubuntumirclientGraphics, "Attempting to choose OpenGL 1.4 context which may suit Mesa"); |
2479 | + qCDebug(mirclientGraphics, "Attempting to choose OpenGL 1.4 context which may suit Mesa"); |
2480 | format.setMajorVersion(1); |
2481 | format.setMinorVersion(4); |
2482 | delete platformContext; |
2483 | - platformContext = new UbuntuOpenGLContext(format, context->shareHandle(), mEglDisplay); |
2484 | + platformContext = new QMirClientOpenGLContext(format, context->shareHandle(), mEglDisplay); |
2485 | } |
2486 | } |
2487 | return platformContext; |
2488 | } |
2489 | |
2490 | -QStringList UbuntuClientIntegration::themeNames() const |
2491 | +QStringList QMirClientClientIntegration::themeNames() const |
2492 | { |
2493 | return QStringList(QStringLiteral("ubuntuappmenu")); |
2494 | } |
2495 | |
2496 | -QPlatformTheme* UbuntuClientIntegration::createPlatformTheme(const QString& name) const |
2497 | +QPlatformTheme* QMirClientClientIntegration::createPlatformTheme(const QString& name) const |
2498 | { |
2499 | Q_UNUSED(name); |
2500 | return new UbuntuIconTheme; |
2501 | } |
2502 | |
2503 | -QVariant UbuntuClientIntegration::styleHint(StyleHint hint) const |
2504 | +QVariant QMirClientClientIntegration::styleHint(StyleHint hint) const |
2505 | { |
2506 | switch (hint) { |
2507 | case QPlatformIntegration::StartDragDistance: { |
2508 | @@ -348,27 +371,27 @@ |
2509 | return QPlatformIntegration::styleHint(hint); |
2510 | } |
2511 | |
2512 | -QPlatformClipboard* UbuntuClientIntegration::clipboard() const |
2513 | +QPlatformClipboard* QMirClientClientIntegration::clipboard() const |
2514 | { |
2515 | static QPlatformClipboard *clipboard = nullptr; |
2516 | if (!clipboard) { |
2517 | - clipboard = new UbuntuClipboard; |
2518 | + clipboard = new QMirClientClipboard; |
2519 | } |
2520 | return clipboard; |
2521 | } |
2522 | |
2523 | -QPlatformNativeInterface* UbuntuClientIntegration::nativeInterface() const |
2524 | +QPlatformNativeInterface* QMirClientClientIntegration::nativeInterface() const |
2525 | { |
2526 | return mNativeInterface; |
2527 | } |
2528 | |
2529 | -QPlatformOffscreenSurface *UbuntuClientIntegration::createPlatformOffscreenSurface( |
2530 | +QPlatformOffscreenSurface *QMirClientClientIntegration::createPlatformOffscreenSurface( |
2531 | QOffscreenSurface *surface) const |
2532 | { |
2533 | return new QEGLPbuffer(mEglDisplay, surface->requestedFormat(), surface); |
2534 | } |
2535 | |
2536 | -void UbuntuClientIntegration::destroyScreen(UbuntuScreen *screen) |
2537 | +void QMirClientClientIntegration::destroyScreen(QMirClientScreen *screen) |
2538 | { |
2539 | // FIXME: on deleting a screen while a Window is on it, Qt will automatically |
2540 | // move the window to the primaryScreen(). This will trigger a screenChanged |
2541 | @@ -391,7 +414,7 @@ |
2542 | } |
2543 | } |
2544 | |
2545 | - qCDebug(ubuntumirclient) << "Removing Screen with id" << screen->mirOutputId() << "and geometry" << screen->geometry(); |
2546 | + qCDebug(mirclient) << "Removing Screen with id" << screen->mirOutputId() << "and geometry" << screen->geometry(); |
2547 | #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) |
2548 | delete screen; |
2549 | #else |
2550 | @@ -399,7 +422,7 @@ |
2551 | #endif |
2552 | } |
2553 | |
2554 | -QPlatformAccessibility *UbuntuClientIntegration::accessibility() const |
2555 | +QPlatformAccessibility *QMirClientClientIntegration::accessibility() const |
2556 | { |
2557 | if (!mAccessibility) { |
2558 | mAccessibility.reset(new QSpiAccessibleBridge()); |
2559 | |
2560 | === renamed file 'src/ubuntumirclient/integration.h' => 'src/ubuntumirclient/qmirclientintegration.h' |
2561 | --- src/ubuntumirclient/integration.h 2016-12-09 17:02:57 +0000 |
2562 | +++ src/ubuntumirclient/qmirclientintegration.h 2017-02-21 12:29:19 +0000 |
2563 | @@ -1,28 +1,52 @@ |
2564 | -/* |
2565 | - * Copyright (C) 2014,2016 Canonical, Ltd. |
2566 | - * |
2567 | - * This program is free software: you can redistribute it and/or modify it under |
2568 | - * the terms of the GNU Lesser General Public License version 3, as published by |
2569 | - * the Free Software Foundation. |
2570 | - * |
2571 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
2572 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
2573 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2574 | - * Lesser General Public License for more details. |
2575 | - * |
2576 | - * You should have received a copy of the GNU Lesser General Public License |
2577 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2578 | - */ |
2579 | - |
2580 | -#ifndef UBUNTU_CLIENT_INTEGRATION_H |
2581 | -#define UBUNTU_CLIENT_INTEGRATION_H |
2582 | +/**************************************************************************** |
2583 | +** |
2584 | +** Copyright (C) 2016 Canonical, Ltd. |
2585 | +** Contact: https://www.qt.io/licensing/ |
2586 | +** |
2587 | +** This file is part of the plugins of the Qt Toolkit. |
2588 | +** |
2589 | +** $QT_BEGIN_LICENSE:LGPL$ |
2590 | +** Commercial License Usage |
2591 | +** Licensees holding valid commercial Qt licenses may use this file in |
2592 | +** accordance with the commercial license agreement provided with the |
2593 | +** Software or, alternatively, in accordance with the terms contained in |
2594 | +** a written agreement between you and The Qt Company. For licensing terms |
2595 | +** and conditions see https://www.qt.io/terms-conditions. For further |
2596 | +** information use the contact form at https://www.qt.io/contact-us. |
2597 | +** |
2598 | +** GNU Lesser General Public License Usage |
2599 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
2600 | +** General Public License version 3 as published by the Free Software |
2601 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
2602 | +** packaging of this file. Please review the following information to |
2603 | +** ensure the GNU Lesser General Public License version 3 requirements |
2604 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
2605 | +** |
2606 | +** GNU General Public License Usage |
2607 | +** Alternatively, this file may be used under the terms of the GNU |
2608 | +** General Public License version 2.0 or (at your option) the GNU General |
2609 | +** Public license version 3 or any later version approved by the KDE Free |
2610 | +** Qt Foundation. The licenses are as published by the Free Software |
2611 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
2612 | +** included in the packaging of this file. Please review the following |
2613 | +** information to ensure the GNU General Public License requirements will |
2614 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
2615 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
2616 | +** |
2617 | +** $QT_END_LICENSE$ |
2618 | +** |
2619 | +****************************************************************************/ |
2620 | + |
2621 | + |
2622 | +#ifndef QMIRCLIENTINTEGRATION_H |
2623 | +#define QMIRCLIENTINTEGRATION_H |
2624 | |
2625 | #include <qpa/qplatformintegration.h> |
2626 | #include <QSharedPointer> |
2627 | |
2628 | -#include "appstatecontroller.h" |
2629 | -#include "platformservices.h" |
2630 | -#include "screenobserver.h" |
2631 | +#include "qmirclientappstatecontroller.h" |
2632 | +#include "qmirclientplatformservices.h" |
2633 | +#include "qmirclientscreenobserver.h" |
2634 | |
2635 | // platform-api |
2636 | #include <ubuntu/application/description.h> |
2637 | @@ -30,19 +54,19 @@ |
2638 | |
2639 | #include <EGL/egl.h> |
2640 | |
2641 | -class UbuntuDebugExtension; |
2642 | -class UbuntuInput; |
2643 | -class UbuntuNativeInterface; |
2644 | -class UbuntuScreen; |
2645 | +class QMirClientDebugExtension; |
2646 | +class QMirClientInput; |
2647 | +class QMirClientNativeInterface; |
2648 | +class QMirClientScreen; |
2649 | class MirConnection; |
2650 | |
2651 | -class UbuntuClientIntegration : public QObject, public QPlatformIntegration |
2652 | +class QMirClientClientIntegration : public QObject, public QPlatformIntegration |
2653 | { |
2654 | Q_OBJECT |
2655 | |
2656 | public: |
2657 | - UbuntuClientIntegration(int argc, char **argv); |
2658 | - virtual ~UbuntuClientIntegration(); |
2659 | + QMirClientClientIntegration(int argc, char **argv); |
2660 | + virtual ~QMirClientClientIntegration(); |
2661 | |
2662 | // QPlatformIntegration methods. |
2663 | bool hasCapability(QPlatformIntegration::Capability cap) const override; |
2664 | @@ -66,12 +90,12 @@ |
2665 | MirConnection *mirConnection() const { return mMirConnection; } |
2666 | EGLDisplay eglDisplay() const { return mEglDisplay; } |
2667 | EGLNativeDisplayType eglNativeDisplay() const { return mEglNativeDisplay; } |
2668 | - UbuntuAppStateController *appStateController() const { return mAppStateController.data(); } |
2669 | - UbuntuScreenObserver *screenObserver() const { return mScreenObserver.data(); } |
2670 | - UbuntuDebugExtension *debugExtension() const { return mDebugExtension.data(); } |
2671 | + QMirClientAppStateController *appStateController() const { return mAppStateController.data(); } |
2672 | + QMirClientScreenObserver *screenObserver() const { return mScreenObserver.data(); } |
2673 | + QMirClientDebugExtension *debugExtension() const { return mDebugExtension.data(); } |
2674 | |
2675 | private Q_SLOTS: |
2676 | - void destroyScreen(UbuntuScreen *screen); |
2677 | + void destroyScreen(QMirClientScreen *screen); |
2678 | |
2679 | private: |
2680 | void setupOptions(QStringList &args); |
2681 | @@ -79,17 +103,17 @@ |
2682 | static QByteArray generateSessionName(QStringList &args); |
2683 | static QByteArray generateSessionNameFromQmlFile(QStringList &args); |
2684 | |
2685 | - UbuntuNativeInterface* mNativeInterface; |
2686 | + QMirClientNativeInterface* mNativeInterface; |
2687 | QPlatformFontDatabase* mFontDb; |
2688 | |
2689 | - UbuntuPlatformServices* mServices; |
2690 | + QMirClientPlatformServices* mServices; |
2691 | |
2692 | - UbuntuInput* mInput; |
2693 | + QMirClientInput* mInput; |
2694 | QPlatformInputContext* mInputContext; |
2695 | mutable QScopedPointer<QPlatformAccessibility> mAccessibility; |
2696 | - QScopedPointer<UbuntuDebugExtension> mDebugExtension; |
2697 | - QScopedPointer<UbuntuScreenObserver> mScreenObserver; |
2698 | - QScopedPointer<UbuntuAppStateController> mAppStateController; |
2699 | + QScopedPointer<QMirClientDebugExtension> mDebugExtension; |
2700 | + QScopedPointer<QMirClientScreenObserver> mScreenObserver; |
2701 | + QScopedPointer<QMirClientAppStateController> mAppStateController; |
2702 | qreal mScaleFactor; |
2703 | |
2704 | MirConnection *mMirConnection; |
2705 | @@ -104,4 +128,4 @@ |
2706 | EGLNativeDisplayType mEglNativeDisplay; |
2707 | }; |
2708 | |
2709 | -#endif // UBUNTU_CLIENT_INTEGRATION_H |
2710 | +#endif // QMIRCLIENTINTEGRATION_H |
2711 | |
2712 | === renamed file 'src/ubuntumirclient/logging.h' => 'src/ubuntumirclient/qmirclientlogging.h' |
2713 | --- src/ubuntumirclient/logging.h 2016-12-09 17:02:57 +0000 |
2714 | +++ src/ubuntumirclient/qmirclientlogging.h 2017-02-21 12:29:19 +0000 |
2715 | @@ -1,31 +1,55 @@ |
2716 | -/* |
2717 | - * Copyright (C) 2014-2015 Canonical, Ltd. |
2718 | - * |
2719 | - * This program is free software: you can redistribute it and/or modify it under |
2720 | - * the terms of the GNU Lesser General Public License version 3, as published by |
2721 | - * the Free Software Foundation. |
2722 | - * |
2723 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
2724 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
2725 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2726 | - * Lesser General Public License for more details. |
2727 | - * |
2728 | - * You should have received a copy of the GNU Lesser General Public License |
2729 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2730 | - */ |
2731 | - |
2732 | -#ifndef QUBUNTULOGGING_H |
2733 | -#define QUBUNTULOGGING_H |
2734 | +/**************************************************************************** |
2735 | +** |
2736 | +** Copyright (C) 2016 Canonical, Ltd. |
2737 | +** Contact: https://www.qt.io/licensing/ |
2738 | +** |
2739 | +** This file is part of the plugins of the Qt Toolkit. |
2740 | +** |
2741 | +** $QT_BEGIN_LICENSE:LGPL$ |
2742 | +** Commercial License Usage |
2743 | +** Licensees holding valid commercial Qt licenses may use this file in |
2744 | +** accordance with the commercial license agreement provided with the |
2745 | +** Software or, alternatively, in accordance with the terms contained in |
2746 | +** a written agreement between you and The Qt Company. For licensing terms |
2747 | +** and conditions see https://www.qt.io/terms-conditions. For further |
2748 | +** information use the contact form at https://www.qt.io/contact-us. |
2749 | +** |
2750 | +** GNU Lesser General Public License Usage |
2751 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
2752 | +** General Public License version 3 as published by the Free Software |
2753 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
2754 | +** packaging of this file. Please review the following information to |
2755 | +** ensure the GNU Lesser General Public License version 3 requirements |
2756 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
2757 | +** |
2758 | +** GNU General Public License Usage |
2759 | +** Alternatively, this file may be used under the terms of the GNU |
2760 | +** General Public License version 2.0 or (at your option) the GNU General |
2761 | +** Public license version 3 or any later version approved by the KDE Free |
2762 | +** Qt Foundation. The licenses are as published by the Free Software |
2763 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
2764 | +** included in the packaging of this file. Please review the following |
2765 | +** information to ensure the GNU General Public License requirements will |
2766 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
2767 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
2768 | +** |
2769 | +** $QT_END_LICENSE$ |
2770 | +** |
2771 | +****************************************************************************/ |
2772 | + |
2773 | + |
2774 | +#ifndef QMIRCLIENTLOGGING_H |
2775 | +#define QMIRCLIENTLOGGING_H |
2776 | |
2777 | #include <QLoggingCategory> |
2778 | |
2779 | #define ASSERT(cond) ((!(cond)) ? qt_assert(#cond,__FILE__,__LINE__) : qt_noop()) |
2780 | |
2781 | -Q_DECLARE_LOGGING_CATEGORY(ubuntumirclient) |
2782 | -Q_DECLARE_LOGGING_CATEGORY(ubuntumirclientBufferSwap) |
2783 | -Q_DECLARE_LOGGING_CATEGORY(ubuntumirclientInput) |
2784 | -Q_DECLARE_LOGGING_CATEGORY(ubuntumirclientGraphics) |
2785 | -Q_DECLARE_LOGGING_CATEGORY(ubuntumirclientCursor) |
2786 | -Q_DECLARE_LOGGING_CATEGORY(ubuntumirclientDebug) |
2787 | +Q_DECLARE_LOGGING_CATEGORY(mirclient) |
2788 | +Q_DECLARE_LOGGING_CATEGORY(mirclientBufferSwap) |
2789 | +Q_DECLARE_LOGGING_CATEGORY(mirclientInput) |
2790 | +Q_DECLARE_LOGGING_CATEGORY(mirclientGraphics) |
2791 | +Q_DECLARE_LOGGING_CATEGORY(mirclientCursor) |
2792 | +Q_DECLARE_LOGGING_CATEGORY(mirclientDebug) |
2793 | |
2794 | -#endif // QUBUNTULOGGING_H |
2795 | +#endif // QMIRCLIENTLOGGING_H |
2796 | |
2797 | === renamed file 'src/ubuntumirclient/nativeinterface.cpp' => 'src/ubuntumirclient/qmirclientnativeinterface.cpp' |
2798 | --- src/ubuntumirclient/nativeinterface.cpp 2016-08-23 17:03:35 +0000 |
2799 | +++ src/ubuntumirclient/qmirclientnativeinterface.cpp 2017-02-21 12:29:19 +0000 |
2800 | @@ -1,63 +1,87 @@ |
2801 | -/* |
2802 | - * Copyright (C) 2014,2016 Canonical, Ltd. |
2803 | - * |
2804 | - * This program is free software: you can redistribute it and/or modify it under |
2805 | - * the terms of the GNU Lesser General Public License version 3, as published by |
2806 | - * the Free Software Foundation. |
2807 | - * |
2808 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
2809 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
2810 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2811 | - * Lesser General Public License for more details. |
2812 | - * |
2813 | - * You should have received a copy of the GNU Lesser General Public License |
2814 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2815 | - */ |
2816 | +/**************************************************************************** |
2817 | +** |
2818 | +** Copyright (C) 2016-2017 Canonical, Ltd. |
2819 | +** Contact: https://www.qt.io/licensing/ |
2820 | +** |
2821 | +** This file is part of the plugins of the Qt Toolkit. |
2822 | +** |
2823 | +** $QT_BEGIN_LICENSE:LGPL$ |
2824 | +** Commercial License Usage |
2825 | +** Licensees holding valid commercial Qt licenses may use this file in |
2826 | +** accordance with the commercial license agreement provided with the |
2827 | +** Software or, alternatively, in accordance with the terms contained in |
2828 | +** a written agreement between you and The Qt Company. For licensing terms |
2829 | +** and conditions see https://www.qt.io/terms-conditions. For further |
2830 | +** information use the contact form at https://www.qt.io/contact-us. |
2831 | +** |
2832 | +** GNU Lesser General Public License Usage |
2833 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
2834 | +** General Public License version 3 as published by the Free Software |
2835 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
2836 | +** packaging of this file. Please review the following information to |
2837 | +** ensure the GNU Lesser General Public License version 3 requirements |
2838 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
2839 | +** |
2840 | +** GNU General Public License Usage |
2841 | +** Alternatively, this file may be used under the terms of the GNU |
2842 | +** General Public License version 2.0 or (at your option) the GNU General |
2843 | +** Public license version 3 or any later version approved by the KDE Free |
2844 | +** Qt Foundation. The licenses are as published by the Free Software |
2845 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
2846 | +** included in the packaging of this file. Please review the following |
2847 | +** information to ensure the GNU General Public License requirements will |
2848 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
2849 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
2850 | +** |
2851 | +** $QT_END_LICENSE$ |
2852 | +** |
2853 | +****************************************************************************/ |
2854 | + |
2855 | |
2856 | // Local |
2857 | -#include "nativeinterface.h" |
2858 | -#include "screen.h" |
2859 | -#include "glcontext.h" |
2860 | -#include "window.h" |
2861 | +#include "qmirclientnativeinterface.h" |
2862 | +#include "qmirclientscreen.h" |
2863 | +#include "qmirclientglcontext.h" |
2864 | +#include "qmirclientwindow.h" |
2865 | |
2866 | // Qt |
2867 | -#include <private/qguiapplication_p.h> |
2868 | +#include <QtGui/private/qguiapplication_p.h> |
2869 | #include <QtGui/qopenglcontext.h> |
2870 | #include <QtGui/qscreen.h> |
2871 | #include <QtCore/QMap> |
2872 | |
2873 | -class UbuntuResourceMap : public QMap<QByteArray, UbuntuNativeInterface::ResourceType> |
2874 | +class UbuntuResourceMap : public QMap<QByteArray, QMirClientNativeInterface::ResourceType> |
2875 | { |
2876 | public: |
2877 | UbuntuResourceMap() |
2878 | - : QMap<QByteArray, UbuntuNativeInterface::ResourceType>() { |
2879 | - insert("egldisplay", UbuntuNativeInterface::EglDisplay); |
2880 | - insert("eglcontext", UbuntuNativeInterface::EglContext); |
2881 | - insert("nativeorientation", UbuntuNativeInterface::NativeOrientation); |
2882 | - insert("display", UbuntuNativeInterface::Display); |
2883 | - insert("mirconnection", UbuntuNativeInterface::MirConnection); |
2884 | - insert("mirsurface", UbuntuNativeInterface::MirSurface); |
2885 | - insert("scale", UbuntuNativeInterface::Scale); |
2886 | - insert("formfactor", UbuntuNativeInterface::FormFactor); |
2887 | + : QMap<QByteArray, QMirClientNativeInterface::ResourceType>() { |
2888 | + insert("egldisplay", QMirClientNativeInterface::EglDisplay); |
2889 | + insert("eglcontext", QMirClientNativeInterface::EglContext); |
2890 | + insert("nativeorientation", QMirClientNativeInterface::NativeOrientation); |
2891 | + insert("display", QMirClientNativeInterface::Display); |
2892 | + insert("mirconnection", QMirClientNativeInterface::MirConnection); |
2893 | + insert("mirwindow", QMirClientNativeInterface::MirWindow); |
2894 | + insert("scale", QMirClientNativeInterface::Scale); |
2895 | + insert("formfactor", QMirClientNativeInterface::FormFactor); |
2896 | } |
2897 | }; |
2898 | |
2899 | Q_GLOBAL_STATIC(UbuntuResourceMap, ubuntuResourceMap) |
2900 | |
2901 | -UbuntuNativeInterface::UbuntuNativeInterface(const UbuntuClientIntegration *integration) |
2902 | +QMirClientNativeInterface::QMirClientNativeInterface(const QMirClientClientIntegration *integration) |
2903 | : mIntegration(integration) |
2904 | , mGenericEventFilterType(QByteArrayLiteral("Event")) |
2905 | , mNativeOrientation(nullptr) |
2906 | { |
2907 | } |
2908 | |
2909 | -UbuntuNativeInterface::~UbuntuNativeInterface() |
2910 | +QMirClientNativeInterface::~QMirClientNativeInterface() |
2911 | { |
2912 | delete mNativeOrientation; |
2913 | mNativeOrientation = nullptr; |
2914 | } |
2915 | |
2916 | -void* UbuntuNativeInterface::nativeResourceForIntegration(const QByteArray &resourceString) |
2917 | +void* QMirClientNativeInterface::nativeResourceForIntegration(const QByteArray &resourceString) |
2918 | { |
2919 | const QByteArray lowerCaseResource = resourceString.toLower(); |
2920 | |
2921 | @@ -67,14 +91,14 @@ |
2922 | |
2923 | const ResourceType resourceType = ubuntuResourceMap()->value(lowerCaseResource); |
2924 | |
2925 | - if (resourceType == UbuntuNativeInterface::MirConnection) { |
2926 | + if (resourceType == QMirClientNativeInterface::MirConnection) { |
2927 | return mIntegration->mirConnection(); |
2928 | } else { |
2929 | return nullptr; |
2930 | } |
2931 | } |
2932 | |
2933 | -void* UbuntuNativeInterface::nativeResourceForContext( |
2934 | +void* QMirClientNativeInterface::nativeResourceForContext( |
2935 | const QByteArray& resourceString, QOpenGLContext* context) |
2936 | { |
2937 | if (!context) |
2938 | @@ -87,13 +111,13 @@ |
2939 | |
2940 | const ResourceType kResourceType = ubuntuResourceMap()->value(kLowerCaseResource); |
2941 | |
2942 | - if (kResourceType == UbuntuNativeInterface::EglContext) |
2943 | - return static_cast<UbuntuOpenGLContext*>(context->handle())->eglContext(); |
2944 | + if (kResourceType == QMirClientNativeInterface::EglContext) |
2945 | + return static_cast<QMirClientOpenGLContext*>(context->handle())->eglContext(); |
2946 | else |
2947 | return nullptr; |
2948 | } |
2949 | |
2950 | -void* UbuntuNativeInterface::nativeResourceForWindow(const QByteArray& resourceString, QWindow* window) |
2951 | +void* QMirClientNativeInterface::nativeResourceForWindow(const QByteArray& resourceString, QWindow* window) |
2952 | { |
2953 | const QByteArray kLowerCaseResource = resourceString.toLower(); |
2954 | if (!ubuntuResourceMap()->contains(kLowerCaseResource)) |
2955 | @@ -106,18 +130,18 @@ |
2956 | case NativeOrientation: |
2957 | // Return the device's native screen orientation. |
2958 | if (window) { |
2959 | - UbuntuScreen *ubuntuScreen = static_cast<UbuntuScreen*>(window->screen()->handle()); |
2960 | + QMirClientScreen *ubuntuScreen = static_cast<QMirClientScreen*>(window->screen()->handle()); |
2961 | mNativeOrientation = new Qt::ScreenOrientation(ubuntuScreen->nativeOrientation()); |
2962 | } else { |
2963 | QPlatformScreen *platformScreen = QGuiApplication::primaryScreen()->handle(); |
2964 | mNativeOrientation = new Qt::ScreenOrientation(platformScreen->nativeOrientation()); |
2965 | } |
2966 | return mNativeOrientation; |
2967 | - case MirSurface: |
2968 | + case MirWindow: |
2969 | if (window) { |
2970 | - auto ubuntuWindow = static_cast<UbuntuWindow*>(window->handle()); |
2971 | + auto ubuntuWindow = static_cast<QMirClientWindow*>(window->handle()); |
2972 | if (ubuntuWindow) { |
2973 | - return ubuntuWindow->mirSurface(); |
2974 | + return ubuntuWindow->mirWindow(); |
2975 | } else { |
2976 | return nullptr; |
2977 | } |
2978 | @@ -129,7 +153,7 @@ |
2979 | } |
2980 | } |
2981 | |
2982 | -void* UbuntuNativeInterface::nativeResourceForScreen(const QByteArray& resourceString, QScreen* screen) |
2983 | +void* QMirClientNativeInterface::nativeResourceForScreen(const QByteArray& resourceString, QScreen* screen) |
2984 | { |
2985 | const QByteArray kLowerCaseResource = resourceString.toLower(); |
2986 | if (!ubuntuResourceMap()->contains(kLowerCaseResource)) |
2987 | @@ -137,28 +161,28 @@ |
2988 | const ResourceType kResourceType = ubuntuResourceMap()->value(kLowerCaseResource); |
2989 | if (!screen) |
2990 | screen = QGuiApplication::primaryScreen(); |
2991 | - auto ubuntuScreen = static_cast<UbuntuScreen*>(screen->handle()); |
2992 | - if (kResourceType == UbuntuNativeInterface::Display) { |
2993 | + auto ubuntuScreen = static_cast<QMirClientScreen*>(screen->handle()); |
2994 | + if (kResourceType == QMirClientNativeInterface::Display) { |
2995 | return mIntegration->eglNativeDisplay(); |
2996 | - // Changes to the following properties are emitted via the UbuntuNativeInterface::screenPropertyChanged |
2997 | - // signal fired by UbuntuScreen. Connect to this signal for these properties updates. |
2998 | + // Changes to the following properties are emitted via the QMirClientNativeInterface::screenPropertyChanged |
2999 | + // signal fired by QMirClientScreen. Connect to this signal for these properties updates. |
3000 | // WARNING: code highly thread unsafe! |
3001 | - } else if (kResourceType == UbuntuNativeInterface::Scale) { |
3002 | + } else if (kResourceType == QMirClientNativeInterface::Scale) { |
3003 | // In application code, read with: |
3004 | // float scale = *reinterpret_cast<float*>(nativeResourceForScreen("scale", screen())); |
3005 | return &ubuntuScreen->mScale; |
3006 | - } else if (kResourceType == UbuntuNativeInterface::FormFactor) { |
3007 | + } else if (kResourceType == QMirClientNativeInterface::FormFactor) { |
3008 | return &ubuntuScreen->mFormFactor; |
3009 | } else |
3010 | return NULL; |
3011 | } |
3012 | |
3013 | -// Changes to these properties are emitted via the UbuntuNativeInterface::windowPropertyChanged |
3014 | -// signal fired by UbuntuWindow. Connect to this signal for these properties updates. |
3015 | -QVariantMap UbuntuNativeInterface::windowProperties(QPlatformWindow *window) const |
3016 | +// Changes to these properties are emitted via the QMirClientNativeInterface::windowPropertyChanged |
3017 | +// signal fired by QMirClientWindow. Connect to this signal for these properties updates. |
3018 | +QVariantMap QMirClientNativeInterface::windowProperties(QPlatformWindow *window) const |
3019 | { |
3020 | QVariantMap propertyMap; |
3021 | - auto w = static_cast<UbuntuWindow*>(window); |
3022 | + auto w = static_cast<QMirClientWindow*>(window); |
3023 | if (w) { |
3024 | propertyMap.insert("scale", w->scale()); |
3025 | propertyMap.insert("formFactor", w->formFactor()); |
3026 | @@ -167,9 +191,9 @@ |
3027 | return propertyMap; |
3028 | } |
3029 | |
3030 | -QVariant UbuntuNativeInterface::windowProperty(QPlatformWindow *window, const QString &name) const |
3031 | +QVariant QMirClientNativeInterface::windowProperty(QPlatformWindow *window, const QString &name) const |
3032 | { |
3033 | - auto w = static_cast<UbuntuWindow*>(window); |
3034 | + auto w = static_cast<QMirClientWindow*>(window); |
3035 | if (!w) { |
3036 | return QVariant(); |
3037 | } |
3038 | @@ -185,7 +209,7 @@ |
3039 | } |
3040 | } |
3041 | |
3042 | -QVariant UbuntuNativeInterface::windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const |
3043 | +QVariant QMirClientNativeInterface::windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const |
3044 | { |
3045 | QVariant returnVal = windowProperty(window, name); |
3046 | if (!returnVal.isValid()) { |
3047 | |
3048 | === renamed file 'src/ubuntumirclient/nativeinterface.h' => 'src/ubuntumirclient/qmirclientnativeinterface.h' |
3049 | --- src/ubuntumirclient/nativeinterface.h 2016-06-21 12:17:55 +0000 |
3050 | +++ src/ubuntumirclient/qmirclientnativeinterface.h 2017-02-21 12:29:19 +0000 |
3051 | @@ -1,35 +1,59 @@ |
3052 | -/* |
3053 | - * Copyright (C) 2014,2016 Canonical, Ltd. |
3054 | - * |
3055 | - * This program is free software: you can redistribute it and/or modify it under |
3056 | - * the terms of the GNU Lesser General Public License version 3, as published by |
3057 | - * the Free Software Foundation. |
3058 | - * |
3059 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
3060 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
3061 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3062 | - * Lesser General Public License for more details. |
3063 | - * |
3064 | - * You should have received a copy of the GNU Lesser General Public License |
3065 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3066 | - */ |
3067 | - |
3068 | -#ifndef UBUNTU_NATIVE_INTERFACE_H |
3069 | -#define UBUNTU_NATIVE_INTERFACE_H |
3070 | +/**************************************************************************** |
3071 | +** |
3072 | +** Copyright (C) 2016-2017 Canonical, Ltd. |
3073 | +** Contact: https://www.qt.io/licensing/ |
3074 | +** |
3075 | +** This file is part of the plugins of the Qt Toolkit. |
3076 | +** |
3077 | +** $QT_BEGIN_LICENSE:LGPL$ |
3078 | +** Commercial License Usage |
3079 | +** Licensees holding valid commercial Qt licenses may use this file in |
3080 | +** accordance with the commercial license agreement provided with the |
3081 | +** Software or, alternatively, in accordance with the terms contained in |
3082 | +** a written agreement between you and The Qt Company. For licensing terms |
3083 | +** and conditions see https://www.qt.io/terms-conditions. For further |
3084 | +** information use the contact form at https://www.qt.io/contact-us. |
3085 | +** |
3086 | +** GNU Lesser General Public License Usage |
3087 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
3088 | +** General Public License version 3 as published by the Free Software |
3089 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
3090 | +** packaging of this file. Please review the following information to |
3091 | +** ensure the GNU Lesser General Public License version 3 requirements |
3092 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
3093 | +** |
3094 | +** GNU General Public License Usage |
3095 | +** Alternatively, this file may be used under the terms of the GNU |
3096 | +** General Public License version 2.0 or (at your option) the GNU General |
3097 | +** Public license version 3 or any later version approved by the KDE Free |
3098 | +** Qt Foundation. The licenses are as published by the Free Software |
3099 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
3100 | +** included in the packaging of this file. Please review the following |
3101 | +** information to ensure the GNU General Public License requirements will |
3102 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
3103 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
3104 | +** |
3105 | +** $QT_END_LICENSE$ |
3106 | +** |
3107 | +****************************************************************************/ |
3108 | + |
3109 | + |
3110 | +#ifndef QMIRCLIENTNATIVEINTERFACE_H |
3111 | +#define QMIRCLIENTNATIVEINTERFACE_H |
3112 | |
3113 | #include <qpa/qplatformnativeinterface.h> |
3114 | |
3115 | -#include "integration.h" |
3116 | +#include "qmirclientintegration.h" |
3117 | |
3118 | class QPlatformScreen; |
3119 | |
3120 | -class UbuntuNativeInterface : public QPlatformNativeInterface { |
3121 | +class QMirClientNativeInterface : public QPlatformNativeInterface { |
3122 | Q_OBJECT |
3123 | public: |
3124 | - enum ResourceType { EglDisplay, EglContext, NativeOrientation, Display, MirConnection, MirSurface, Scale, FormFactor }; |
3125 | + enum ResourceType { EglDisplay, EglContext, NativeOrientation, Display, MirConnection, MirWindow, Scale, FormFactor }; |
3126 | |
3127 | - UbuntuNativeInterface(const UbuntuClientIntegration *integration); |
3128 | - ~UbuntuNativeInterface(); |
3129 | + QMirClientNativeInterface(const QMirClientClientIntegration *integration); |
3130 | + ~QMirClientNativeInterface(); |
3131 | |
3132 | // QPlatformNativeInterface methods. |
3133 | void* nativeResourceForIntegration(const QByteArray &resource) override; |
3134 | @@ -51,9 +75,9 @@ |
3135 | void screenPropertyChanged(QPlatformScreen *screen, const QString &propertyName); |
3136 | |
3137 | private: |
3138 | - const UbuntuClientIntegration *mIntegration; |
3139 | + const QMirClientClientIntegration *mIntegration; |
3140 | const QByteArray mGenericEventFilterType; |
3141 | Qt::ScreenOrientation* mNativeOrientation; |
3142 | }; |
3143 | |
3144 | -#endif // UBUNTU_NATIVE_INTERFACE_H |
3145 | +#endif // QMIRCLIENTNATIVEINTERFACE_H |
3146 | |
3147 | === renamed file 'src/ubuntumirclient/orientationchangeevent_p.h' => 'src/ubuntumirclient/qmirclientorientationchangeevent_p.h' |
3148 | --- src/ubuntumirclient/orientationchangeevent_p.h 2015-08-06 14:14:39 +0000 |
3149 | +++ src/ubuntumirclient/qmirclientorientationchangeevent_p.h 2017-02-21 12:29:19 +0000 |
3150 | @@ -1,24 +1,48 @@ |
3151 | -/* |
3152 | - * Copyright (C) 2014 Canonical, Ltd. |
3153 | - * |
3154 | - * This program is free software: you can redistribute it and/or modify it under |
3155 | - * the terms of the GNU Lesser General Public License version 3, as published by |
3156 | - * the Free Software Foundation. |
3157 | - * |
3158 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
3159 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
3160 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3161 | - * Lesser General Public License for more details. |
3162 | - * |
3163 | - * You should have received a copy of the GNU Lesser General Public License |
3164 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3165 | - */ |
3166 | - |
3167 | -#ifndef ORIENTATIONCHANGEEVENT_P_H |
3168 | -#define ORIENTATIONCHANGEEVENT_P_H |
3169 | +/**************************************************************************** |
3170 | +** |
3171 | +** Copyright (C) 2016 Canonical, Ltd. |
3172 | +** Contact: https://www.qt.io/licensing/ |
3173 | +** |
3174 | +** This file is part of the plugins of the Qt Toolkit. |
3175 | +** |
3176 | +** $QT_BEGIN_LICENSE:LGPL$ |
3177 | +** Commercial License Usage |
3178 | +** Licensees holding valid commercial Qt licenses may use this file in |
3179 | +** accordance with the commercial license agreement provided with the |
3180 | +** Software or, alternatively, in accordance with the terms contained in |
3181 | +** a written agreement between you and The Qt Company. For licensing terms |
3182 | +** and conditions see https://www.qt.io/terms-conditions. For further |
3183 | +** information use the contact form at https://www.qt.io/contact-us. |
3184 | +** |
3185 | +** GNU Lesser General Public License Usage |
3186 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
3187 | +** General Public License version 3 as published by the Free Software |
3188 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
3189 | +** packaging of this file. Please review the following information to |
3190 | +** ensure the GNU Lesser General Public License version 3 requirements |
3191 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
3192 | +** |
3193 | +** GNU General Public License Usage |
3194 | +** Alternatively, this file may be used under the terms of the GNU |
3195 | +** General Public License version 2.0 or (at your option) the GNU General |
3196 | +** Public license version 3 or any later version approved by the KDE Free |
3197 | +** Qt Foundation. The licenses are as published by the Free Software |
3198 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
3199 | +** included in the packaging of this file. Please review the following |
3200 | +** information to ensure the GNU General Public License requirements will |
3201 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
3202 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
3203 | +** |
3204 | +** $QT_END_LICENSE$ |
3205 | +** |
3206 | +****************************************************************************/ |
3207 | + |
3208 | + |
3209 | +#ifndef QMIRCLIENTORIENTATIONCHANGEEVENT_P_H |
3210 | +#define QMIRCLIENTORIENTATIONCHANGEEVENT_P_H |
3211 | |
3212 | #include <QEvent> |
3213 | -#include "logging.h" |
3214 | +#include "qmirclientlogging.h" |
3215 | |
3216 | class OrientationChangeEvent : public QEvent { |
3217 | public: |
3218 | @@ -34,4 +58,4 @@ |
3219 | Orientation mOrientation; |
3220 | }; |
3221 | |
3222 | -#endif // ORIENTATIONCHANGEEVENT_P_H |
3223 | +#endif // QMIRCLIENTORIENTATIONCHANGEEVENT_P_H |
3224 | |
3225 | === renamed file 'src/ubuntumirclient/platformservices.cpp' => 'src/ubuntumirclient/qmirclientplatformservices.cpp' |
3226 | --- src/ubuntumirclient/platformservices.cpp 2014-06-18 23:10:00 +0000 |
3227 | +++ src/ubuntumirclient/qmirclientplatformservices.cpp 2017-02-21 12:29:19 +0000 |
3228 | @@ -1,37 +1,61 @@ |
3229 | -/* |
3230 | - * Copyright (C) 2014 Canonical, Ltd. |
3231 | - * |
3232 | - * This program is free software: you can redistribute it and/or modify it under |
3233 | - * the terms of the GNU Lesser General Public License version 3, as published by |
3234 | - * the Free Software Foundation. |
3235 | - * |
3236 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
3237 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
3238 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3239 | - * Lesser General Public License for more details. |
3240 | - * |
3241 | - * You should have received a copy of the GNU Lesser General Public License |
3242 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3243 | - */ |
3244 | - |
3245 | -#include "platformservices.h" |
3246 | +/**************************************************************************** |
3247 | +** |
3248 | +** Copyright (C) 2016 Canonical, Ltd. |
3249 | +** Contact: https://www.qt.io/licensing/ |
3250 | +** |
3251 | +** This file is part of the plugins of the Qt Toolkit. |
3252 | +** |
3253 | +** $QT_BEGIN_LICENSE:LGPL$ |
3254 | +** Commercial License Usage |
3255 | +** Licensees holding valid commercial Qt licenses may use this file in |
3256 | +** accordance with the commercial license agreement provided with the |
3257 | +** Software or, alternatively, in accordance with the terms contained in |
3258 | +** a written agreement between you and The Qt Company. For licensing terms |
3259 | +** and conditions see https://www.qt.io/terms-conditions. For further |
3260 | +** information use the contact form at https://www.qt.io/contact-us. |
3261 | +** |
3262 | +** GNU Lesser General Public License Usage |
3263 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
3264 | +** General Public License version 3 as published by the Free Software |
3265 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
3266 | +** packaging of this file. Please review the following information to |
3267 | +** ensure the GNU Lesser General Public License version 3 requirements |
3268 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
3269 | +** |
3270 | +** GNU General Public License Usage |
3271 | +** Alternatively, this file may be used under the terms of the GNU |
3272 | +** General Public License version 2.0 or (at your option) the GNU General |
3273 | +** Public license version 3 or any later version approved by the KDE Free |
3274 | +** Qt Foundation. The licenses are as published by the Free Software |
3275 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
3276 | +** included in the packaging of this file. Please review the following |
3277 | +** information to ensure the GNU General Public License requirements will |
3278 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
3279 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
3280 | +** |
3281 | +** $QT_END_LICENSE$ |
3282 | +** |
3283 | +****************************************************************************/ |
3284 | + |
3285 | + |
3286 | +#include "qmirclientplatformservices.h" |
3287 | |
3288 | #include <QUrl> |
3289 | |
3290 | #include <ubuntu/application/url_dispatcher/service.h> |
3291 | #include <ubuntu/application/url_dispatcher/session.h> |
3292 | |
3293 | -bool UbuntuPlatformServices::openUrl(const QUrl &url) |
3294 | -{ |
3295 | - return callDispatcher(url); |
3296 | -} |
3297 | - |
3298 | -bool UbuntuPlatformServices::openDocument(const QUrl &url) |
3299 | -{ |
3300 | - return callDispatcher(url); |
3301 | -} |
3302 | - |
3303 | -bool UbuntuPlatformServices::callDispatcher(const QUrl &url) |
3304 | +bool QMirClientPlatformServices::openUrl(const QUrl &url) |
3305 | +{ |
3306 | + return callDispatcher(url); |
3307 | +} |
3308 | + |
3309 | +bool QMirClientPlatformServices::openDocument(const QUrl &url) |
3310 | +{ |
3311 | + return callDispatcher(url); |
3312 | +} |
3313 | + |
3314 | +bool QMirClientPlatformServices::callDispatcher(const QUrl &url) |
3315 | { |
3316 | UAUrlDispatcherSession* session = ua_url_dispatcher_session(); |
3317 | if (!session) |
3318 | |
3319 | === renamed file 'src/ubuntumirclient/platformservices.h' => 'src/ubuntumirclient/qmirclientplatformservices.h' |
3320 | --- src/ubuntumirclient/platformservices.h 2014-06-18 23:10:00 +0000 |
3321 | +++ src/ubuntumirclient/qmirclientplatformservices.h 2017-02-21 12:29:19 +0000 |
3322 | @@ -1,27 +1,51 @@ |
3323 | -/* |
3324 | - * Copyright (C) 2014 Canonical, Ltd. |
3325 | - * |
3326 | - * This program is free software: you can redistribute it and/or modify it under |
3327 | - * the terms of the GNU Lesser General Public License version 3, as published by |
3328 | - * the Free Software Foundation. |
3329 | - * |
3330 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
3331 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
3332 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3333 | - * Lesser General Public License for more details. |
3334 | - * |
3335 | - * You should have received a copy of the GNU Lesser General Public License |
3336 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3337 | - */ |
3338 | - |
3339 | -#ifndef UBUNTU_PLATFORM_SERVICES_H |
3340 | -#define UBUNTU_PLATFORM_SERVICES_H |
3341 | +/**************************************************************************** |
3342 | +** |
3343 | +** Copyright (C) 2016 Canonical, Ltd. |
3344 | +** Contact: https://www.qt.io/licensing/ |
3345 | +** |
3346 | +** This file is part of the plugins of the Qt Toolkit. |
3347 | +** |
3348 | +** $QT_BEGIN_LICENSE:LGPL$ |
3349 | +** Commercial License Usage |
3350 | +** Licensees holding valid commercial Qt licenses may use this file in |
3351 | +** accordance with the commercial license agreement provided with the |
3352 | +** Software or, alternatively, in accordance with the terms contained in |
3353 | +** a written agreement between you and The Qt Company. For licensing terms |
3354 | +** and conditions see https://www.qt.io/terms-conditions. For further |
3355 | +** information use the contact form at https://www.qt.io/contact-us. |
3356 | +** |
3357 | +** GNU Lesser General Public License Usage |
3358 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
3359 | +** General Public License version 3 as published by the Free Software |
3360 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
3361 | +** packaging of this file. Please review the following information to |
3362 | +** ensure the GNU Lesser General Public License version 3 requirements |
3363 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
3364 | +** |
3365 | +** GNU General Public License Usage |
3366 | +** Alternatively, this file may be used under the terms of the GNU |
3367 | +** General Public License version 2.0 or (at your option) the GNU General |
3368 | +** Public license version 3 or any later version approved by the KDE Free |
3369 | +** Qt Foundation. The licenses are as published by the Free Software |
3370 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
3371 | +** included in the packaging of this file. Please review the following |
3372 | +** information to ensure the GNU General Public License requirements will |
3373 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
3374 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
3375 | +** |
3376 | +** $QT_END_LICENSE$ |
3377 | +** |
3378 | +****************************************************************************/ |
3379 | + |
3380 | + |
3381 | +#ifndef QMIRCLIENTPLATFORMSERVICES_H |
3382 | +#define QMIRCLIENTPLATFORMSERVICES_H |
3383 | |
3384 | #include <qpa/qplatformservices.h> |
3385 | #include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h> |
3386 | #include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> |
3387 | |
3388 | -class UbuntuPlatformServices : public QPlatformServices { |
3389 | +class QMirClientPlatformServices : public QPlatformServices { |
3390 | public: |
3391 | bool openUrl(const QUrl &url) override; |
3392 | bool openDocument(const QUrl &url) override; |
3393 | @@ -30,4 +54,4 @@ |
3394 | bool callDispatcher(const QUrl &url); |
3395 | }; |
3396 | |
3397 | -#endif // UBUNTU_PLATFORM_SERVICES_H |
3398 | +#endif // QMIRCLIENTPLATFORMSERVICES_H |
3399 | |
3400 | === renamed file 'src/ubuntumirclient/plugin.cpp' => 'src/ubuntumirclient/qmirclientplugin.cpp' |
3401 | --- src/ubuntumirclient/plugin.cpp 2016-12-09 17:02:57 +0000 |
3402 | +++ src/ubuntumirclient/qmirclientplugin.cpp 2017-02-21 12:29:19 +0000 |
3403 | @@ -1,39 +1,60 @@ |
3404 | -/* |
3405 | - * Copyright (C) 2014-2016 Canonical, Ltd. |
3406 | - * |
3407 | - * This program is free software: you can redistribute it and/or modify it under |
3408 | - * the terms of the GNU Lesser General Public License version 3, as published by |
3409 | - * the Free Software Foundation. |
3410 | - * |
3411 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
3412 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
3413 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3414 | - * Lesser General Public License for more details. |
3415 | - * |
3416 | - * You should have received a copy of the GNU Lesser General Public License |
3417 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3418 | - */ |
3419 | - |
3420 | -#include "plugin.h" |
3421 | -#include "integration.h" |
3422 | -#include "logging.h" |
3423 | -#include "qpa/qplatformwindow.h" |
3424 | - |
3425 | -Q_LOGGING_CATEGORY(ubuntumirclient, "ubuntumirclient", QtWarningMsg) |
3426 | - |
3427 | -QPlatformIntegration *UbuntuMirClientIntegrationPlugin::create(const QString &system, |
3428 | - const QStringList &/*paramList*/, |
3429 | - int &argc, char **argv) |
3430 | +/**************************************************************************** |
3431 | +** |
3432 | +** Copyright (C) 2016 Canonical, Ltd. |
3433 | +** Contact: https://www.qt.io/licensing/ |
3434 | +** |
3435 | +** This file is part of the plugins of the Qt Toolkit. |
3436 | +** |
3437 | +** $QT_BEGIN_LICENSE:LGPL$ |
3438 | +** Commercial License Usage |
3439 | +** Licensees holding valid commercial Qt licenses may use this file in |
3440 | +** accordance with the commercial license agreement provided with the |
3441 | +** Software or, alternatively, in accordance with the terms contained in |
3442 | +** a written agreement between you and The Qt Company. For licensing terms |
3443 | +** and conditions see https://www.qt.io/terms-conditions. For further |
3444 | +** information use the contact form at https://www.qt.io/contact-us. |
3445 | +** |
3446 | +** GNU Lesser General Public License Usage |
3447 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
3448 | +** General Public License version 3 as published by the Free Software |
3449 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
3450 | +** packaging of this file. Please review the following information to |
3451 | +** ensure the GNU Lesser General Public License version 3 requirements |
3452 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
3453 | +** |
3454 | +** GNU General Public License Usage |
3455 | +** Alternatively, this file may be used under the terms of the GNU |
3456 | +** General Public License version 2.0 or (at your option) the GNU General |
3457 | +** Public license version 3 or any later version approved by the KDE Free |
3458 | +** Qt Foundation. The licenses are as published by the Free Software |
3459 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
3460 | +** included in the packaging of this file. Please review the following |
3461 | +** information to ensure the GNU General Public License requirements will |
3462 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
3463 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
3464 | +** |
3465 | +** $QT_END_LICENSE$ |
3466 | +** |
3467 | +****************************************************************************/ |
3468 | + |
3469 | + |
3470 | +#include "qmirclientplugin.h" |
3471 | +#include "qmirclientintegration.h" |
3472 | +#include "qmirclientlogging.h" |
3473 | + |
3474 | +Q_LOGGING_CATEGORY(mirclient, "qt.qpa.mirclient", QtWarningMsg) |
3475 | + |
3476 | +QPlatformIntegration *QMirClientIntegrationPlugin::create(const QString &system, |
3477 | + const QStringList &/*paramList*/, |
3478 | + int &argc, char **argv) |
3479 | { |
3480 | - qRegisterMetaType<QPlatformWindow*>("QPlatformWindow*"); |
3481 | - |
3482 | if (system.toLower() == QLatin1String("ubuntumirclient")) { |
3483 | #ifdef PLATFORM_API_TOUCH |
3484 | setenv("UBUNTU_PLATFORM_API_BACKEND", "touch_mirclient", 1); |
3485 | #else |
3486 | setenv("UBUNTU_PLATFORM_API_BACKEND", "desktop_mirclient", 1); |
3487 | #endif |
3488 | - return new UbuntuClientIntegration(argc, argv); |
3489 | + return new QMirClientClientIntegration(argc, argv); |
3490 | } else { |
3491 | return 0; |
3492 | } |
3493 | |
3494 | === renamed file 'src/ubuntumirclient/plugin.h' => 'src/ubuntumirclient/qmirclientplugin.h' |
3495 | --- src/ubuntumirclient/plugin.h 2016-06-24 12:36:24 +0000 |
3496 | +++ src/ubuntumirclient/qmirclientplugin.h 2017-02-21 12:29:19 +0000 |
3497 | @@ -1,31 +1,56 @@ |
3498 | -/* |
3499 | - * Copyright (C) 2014-2016 Canonical, Ltd. |
3500 | - * |
3501 | - * This program is free software: you can redistribute it and/or modify it under |
3502 | - * the terms of the GNU Lesser General Public License version 3, as published by |
3503 | - * the Free Software Foundation. |
3504 | - * |
3505 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
3506 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
3507 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3508 | - * Lesser General Public License for more details. |
3509 | - * |
3510 | - * You should have received a copy of the GNU Lesser General Public License |
3511 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3512 | - */ |
3513 | - |
3514 | -#ifndef UBUNTU_CLIENT_PLUGIN_H |
3515 | -#define UBUNTU_CLIENT_PLUGIN_H |
3516 | +/**************************************************************************** |
3517 | +** |
3518 | +** Copyright (C) 2016 Canonical, Ltd. |
3519 | +** Contact: https://www.qt.io/licensing/ |
3520 | +** |
3521 | +** This file is part of the plugins of the Qt Toolkit. |
3522 | +** |
3523 | +** $QT_BEGIN_LICENSE:LGPL$ |
3524 | +** Commercial License Usage |
3525 | +** Licensees holding valid commercial Qt licenses may use this file in |
3526 | +** accordance with the commercial license agreement provided with the |
3527 | +** Software or, alternatively, in accordance with the terms contained in |
3528 | +** a written agreement between you and The Qt Company. For licensing terms |
3529 | +** and conditions see https://www.qt.io/terms-conditions. For further |
3530 | +** information use the contact form at https://www.qt.io/contact-us. |
3531 | +** |
3532 | +** GNU Lesser General Public License Usage |
3533 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
3534 | +** General Public License version 3 as published by the Free Software |
3535 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
3536 | +** packaging of this file. Please review the following information to |
3537 | +** ensure the GNU Lesser General Public License version 3 requirements |
3538 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
3539 | +** |
3540 | +** GNU General Public License Usage |
3541 | +** Alternatively, this file may be used under the terms of the GNU |
3542 | +** General Public License version 2.0 or (at your option) the GNU General |
3543 | +** Public license version 3 or any later version approved by the KDE Free |
3544 | +** Qt Foundation. The licenses are as published by the Free Software |
3545 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
3546 | +** included in the packaging of this file. Please review the following |
3547 | +** information to ensure the GNU General Public License requirements will |
3548 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
3549 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
3550 | +** |
3551 | +** $QT_END_LICENSE$ |
3552 | +** |
3553 | +****************************************************************************/ |
3554 | + |
3555 | + |
3556 | +#ifndef QMIRCLIENTPLUGIN_H |
3557 | +#define QMIRCLIENTPLUGIN_H |
3558 | |
3559 | #include <qpa/qplatformintegrationplugin.h> |
3560 | |
3561 | -class UbuntuMirClientIntegrationPlugin : public QPlatformIntegrationPlugin |
3562 | +class QMirClientIntegrationPlugin : public QPlatformIntegrationPlugin |
3563 | { |
3564 | Q_OBJECT |
3565 | Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "ubuntumirclient.json") |
3566 | |
3567 | public: |
3568 | - QPlatformIntegration *create(const QString &system, const QStringList ¶mList, int &argc, char **argv) override; |
3569 | + QPlatformIntegration *create(const QString &system, const QStringList ¶mList, |
3570 | + int &argc, char **argv) override; |
3571 | }; |
3572 | |
3573 | -#endif // UBUNTU_CLIENT_PLUGIN_H |
3574 | +#endif // QMIRCLIENTPLUGIN_H |
3575 | |
3576 | === renamed file 'src/ubuntumirclient/screen.cpp' => 'src/ubuntumirclient/qmirclientscreen.cpp' |
3577 | --- src/ubuntumirclient/screen.cpp 2016-09-14 14:43:12 +0000 |
3578 | +++ src/ubuntumirclient/qmirclientscreen.cpp 2017-02-21 12:29:19 +0000 |
3579 | @@ -1,24 +1,48 @@ |
3580 | -/* |
3581 | - * Copyright (C) 2014-2016 Canonical, Ltd. |
3582 | - * |
3583 | - * This program is free software: you can redistribute it and/or modify it under |
3584 | - * the terms of the GNU Lesser General Public License version 3, as published by |
3585 | - * the Free Software Foundation. |
3586 | - * |
3587 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
3588 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
3589 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3590 | - * Lesser General Public License for more details. |
3591 | - * |
3592 | - * You should have received a copy of the GNU Lesser General Public License |
3593 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3594 | - */ |
3595 | +/**************************************************************************** |
3596 | +** |
3597 | +** Copyright (C) 2014-2016 Canonical, Ltd. |
3598 | +** Contact: https://www.qt.io/licensing/ |
3599 | +** |
3600 | +** This file is part of the plugins of the Qt Toolkit. |
3601 | +** |
3602 | +** $QT_BEGIN_LICENSE:LGPL$ |
3603 | +** Commercial License Usage |
3604 | +** Licensees holding valid commercial Qt licenses may use this file in |
3605 | +** accordance with the commercial license agreement provided with the |
3606 | +** Software or, alternatively, in accordance with the terms contained in |
3607 | +** a written agreement between you and The Qt Company. For licensing terms |
3608 | +** and conditions see https://www.qt.io/terms-conditions. For further |
3609 | +** information use the contact form at https://www.qt.io/contact-us. |
3610 | +** |
3611 | +** GNU Lesser General Public License Usage |
3612 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
3613 | +** General Public License version 3 as published by the Free Software |
3614 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
3615 | +** packaging of this file. Please review the following information to |
3616 | +** ensure the GNU Lesser General Public License version 3 requirements |
3617 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
3618 | +** |
3619 | +** GNU General Public License Usage |
3620 | +** Alternatively, this file may be used under the terms of the GNU |
3621 | +** General Public License version 2.0 or (at your option) the GNU General |
3622 | +** Public license version 3 or any later version approved by the KDE Free |
3623 | +** Qt Foundation. The licenses are as published by the Free Software |
3624 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
3625 | +** included in the packaging of this file. Please review the following |
3626 | +** information to ensure the GNU General Public License requirements will |
3627 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
3628 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
3629 | +** |
3630 | +** $QT_END_LICENSE$ |
3631 | +** |
3632 | +****************************************************************************/ |
3633 | + |
3634 | |
3635 | // local |
3636 | -#include "screen.h" |
3637 | -#include "logging.h" |
3638 | -#include "orientationchangeevent_p.h" |
3639 | -#include "nativeinterface.h" |
3640 | +#include "qmirclientscreen.h" |
3641 | +#include "qmirclientlogging.h" |
3642 | +#include "qmirclientorientationchangeevent_p.h" |
3643 | +#include "qmirclientnativeinterface.h" |
3644 | |
3645 | #include <mir_toolkit/mir_client_library.h> |
3646 | |
3647 | @@ -54,7 +78,7 @@ |
3648 | static_cast<QEvent::Type>(QEvent::registerEventType()); |
3649 | |
3650 | |
3651 | -UbuntuScreen::UbuntuScreen(const MirOutput *output, MirConnection *connection) |
3652 | +QMirClientScreen::QMirClientScreen(const MirOutput *output, MirConnection *connection) |
3653 | : mDevicePixelRatio(1.0) |
3654 | , mFormat(QImage::Format_RGB32) |
3655 | , mDepth(32) |
3656 | @@ -67,11 +91,11 @@ |
3657 | setMirOutput(output); |
3658 | } |
3659 | |
3660 | -UbuntuScreen::~UbuntuScreen() |
3661 | +QMirClientScreen::~QMirClientScreen() |
3662 | { |
3663 | } |
3664 | |
3665 | -void UbuntuScreen::customEvent(QEvent* event) { |
3666 | +void QMirClientScreen::customEvent(QEvent* event) { |
3667 | Q_ASSERT(QThread::currentThread() == thread()); |
3668 | |
3669 | OrientationChangeEvent* oReadingEvent = static_cast<OrientationChangeEvent*>(event); |
3670 | @@ -99,11 +123,11 @@ |
3671 | } |
3672 | |
3673 | // Raise the event signal so that client apps know the orientation changed |
3674 | - qCDebug(ubuntumirclient, "UbuntuScreen::customEvent - handling orientation change to %s", orientationToStr(mCurrentOrientation)); |
3675 | + qCDebug(mirclient, "QMirClientScreen::customEvent - handling orientation change to %s", orientationToStr(mCurrentOrientation)); |
3676 | QWindowSystemInterface::handleScreenOrientationChange(screen(), mCurrentOrientation); |
3677 | } |
3678 | |
3679 | -void UbuntuScreen::handleWindowSurfaceResize(int windowWidth, int windowHeight) |
3680 | +void QMirClientScreen::handleWindowSurfaceResize(int windowWidth, int windowHeight) |
3681 | { |
3682 | if ((windowWidth > windowHeight && mGeometry.width() < mGeometry.height()) |
3683 | || (windowWidth < windowHeight && mGeometry.width() > mGeometry.height())) { |
3684 | @@ -120,7 +144,7 @@ |
3685 | mGeometry.setWidth(currGeometry.height()); |
3686 | mGeometry.setHeight(currGeometry.width()); |
3687 | |
3688 | - qCDebug(ubuntumirclient, "UbuntuScreen::handleWindowSurfaceResize - new screen geometry (w=%d, h=%d)", |
3689 | + qCDebug(mirclient, "QMirClientScreen::handleWindowSurfaceResize - new screen geometry (w=%d, h=%d)", |
3690 | mGeometry.width(), mGeometry.height()); |
3691 | QWindowSystemInterface::handleScreenGeometryChange(screen(), |
3692 | mGeometry /* newGeometry */, |
3693 | @@ -131,12 +155,12 @@ |
3694 | } else { |
3695 | mCurrentOrientation = Qt::LandscapeOrientation; |
3696 | } |
3697 | - qCDebug(ubuntumirclient, "UbuntuScreen::handleWindowSurfaceResize - new orientation %s",orientationToStr(mCurrentOrientation)); |
3698 | + qCDebug(mirclient, "QMirClientScreen::handleWindowSurfaceResize - new orientation %s",orientationToStr(mCurrentOrientation)); |
3699 | QWindowSystemInterface::handleScreenOrientationChange(screen(), mCurrentOrientation); |
3700 | } |
3701 | } |
3702 | |
3703 | -void UbuntuScreen::setMirOutput(const MirOutput *output) |
3704 | +void QMirClientScreen::setMirOutput(const MirOutput *output) |
3705 | { |
3706 | // Physical screen size (in mm) |
3707 | mPhysicalSize.setWidth(mir_output_get_physical_width_mm(output)); |
3708 | @@ -181,7 +205,7 @@ |
3709 | mCurrentOrientation = (mNativeOrientation == Qt::LandscapeOrientation) ? Qt::LandscapeOrientation : Qt::PortraitOrientation; |
3710 | } |
3711 | |
3712 | -void UbuntuScreen::updateMirOutput(const MirOutput *output) |
3713 | +void QMirClientScreen::updateMirOutput(const MirOutput *output) |
3714 | { |
3715 | auto oldRefreshRate = mRefreshRate; |
3716 | auto oldScale = mScale; |
3717 | @@ -201,7 +225,7 @@ |
3718 | QWindowSystemInterface::handleScreenRefreshRateChange(screen(), mRefreshRate); |
3719 | } |
3720 | |
3721 | - auto nativeInterface = static_cast<UbuntuNativeInterface *>(qGuiApp->platformNativeInterface()); |
3722 | + auto nativeInterface = static_cast<QMirClientNativeInterface *>(qGuiApp->platformNativeInterface()); |
3723 | if (!qFuzzyCompare(mScale, oldScale)) { |
3724 | nativeInterface->screenPropertyChanged(this, QStringLiteral("scale")); |
3725 | } |
3726 | @@ -210,14 +234,14 @@ |
3727 | } |
3728 | } |
3729 | |
3730 | -void UbuntuScreen::setAdditionalMirDisplayProperties(float scale, MirFormFactor formFactor, int dpi) |
3731 | +void QMirClientScreen::setAdditionalMirDisplayProperties(float scale, MirFormFactor formFactor, int dpi) |
3732 | { |
3733 | if (mDpi != dpi) { |
3734 | mDpi = dpi; |
3735 | QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(), dpi, dpi); |
3736 | } |
3737 | |
3738 | - auto nativeInterface = static_cast<UbuntuNativeInterface *>(qGuiApp->platformNativeInterface()); |
3739 | + auto nativeInterface = static_cast<QMirClientNativeInterface *>(qGuiApp->platformNativeInterface()); |
3740 | if (!qFuzzyCompare(mScale, scale)) { |
3741 | mScale = scale; |
3742 | nativeInterface->screenPropertyChanged(this, QStringLiteral("scale")); |
3743 | @@ -228,7 +252,7 @@ |
3744 | } |
3745 | } |
3746 | |
3747 | -QDpi UbuntuScreen::logicalDpi() const |
3748 | +QDpi QMirClientScreen::logicalDpi() const |
3749 | { |
3750 | if (mDpi > 0) { |
3751 | return QDpi(mDpi, mDpi); |
3752 | |
3753 | === renamed file 'src/ubuntumirclient/screen.h' => 'src/ubuntumirclient/qmirclientscreen.h' |
3754 | --- src/ubuntumirclient/screen.h 2016-12-19 10:16:55 +0000 |
3755 | +++ src/ubuntumirclient/qmirclientscreen.h 2017-02-21 12:29:19 +0000 |
3756 | @@ -1,38 +1,62 @@ |
3757 | -/* |
3758 | - * Copyright (C) 2014-2016 Canonical, Ltd. |
3759 | - * |
3760 | - * This program is free software: you can redistribute it and/or modify it under |
3761 | - * the terms of the GNU Lesser General Public License version 3, as published by |
3762 | - * the Free Software Foundation. |
3763 | - * |
3764 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
3765 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
3766 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3767 | - * Lesser General Public License for more details. |
3768 | - * |
3769 | - * You should have received a copy of the GNU Lesser General Public License |
3770 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3771 | - */ |
3772 | - |
3773 | -#ifndef UBUNTU_SCREEN_H |
3774 | -#define UBUNTU_SCREEN_H |
3775 | +/**************************************************************************** |
3776 | +** |
3777 | +** Copyright (C) 2014-2016 Canonical, Ltd. |
3778 | +** Contact: https://www.qt.io/licensing/ |
3779 | +** |
3780 | +** This file is part of the plugins of the Qt Toolkit. |
3781 | +** |
3782 | +** $QT_BEGIN_LICENSE:LGPL$ |
3783 | +** Commercial License Usage |
3784 | +** Licensees holding valid commercial Qt licenses may use this file in |
3785 | +** accordance with the commercial license agreement provided with the |
3786 | +** Software or, alternatively, in accordance with the terms contained in |
3787 | +** a written agreement between you and The Qt Company. For licensing terms |
3788 | +** and conditions see https://www.qt.io/terms-conditions. For further |
3789 | +** information use the contact form at https://www.qt.io/contact-us. |
3790 | +** |
3791 | +** GNU Lesser General Public License Usage |
3792 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
3793 | +** General Public License version 3 as published by the Free Software |
3794 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
3795 | +** packaging of this file. Please review the following information to |
3796 | +** ensure the GNU Lesser General Public License version 3 requirements |
3797 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
3798 | +** |
3799 | +** GNU General Public License Usage |
3800 | +** Alternatively, this file may be used under the terms of the GNU |
3801 | +** General Public License version 2.0 or (at your option) the GNU General |
3802 | +** Public license version 3 or any later version approved by the KDE Free |
3803 | +** Qt Foundation. The licenses are as published by the Free Software |
3804 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
3805 | +** included in the packaging of this file. Please review the following |
3806 | +** information to ensure the GNU General Public License requirements will |
3807 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
3808 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
3809 | +** |
3810 | +** $QT_END_LICENSE$ |
3811 | +** |
3812 | +****************************************************************************/ |
3813 | + |
3814 | + |
3815 | +#ifndef QMIRCLIENTSCREEN_H |
3816 | +#define QMIRCLIENTSCREEN_H |
3817 | |
3818 | #include <qpa/qplatformscreen.h> |
3819 | #include <QSurfaceFormat> |
3820 | |
3821 | #include <mir_toolkit/common.h> // just for MirFormFactor enum |
3822 | |
3823 | -#include "cursor.h" |
3824 | +#include "qmirclientcursor.h" |
3825 | |
3826 | struct MirConnection; |
3827 | struct MirOutput; |
3828 | |
3829 | -class UbuntuScreen : public QObject, public QPlatformScreen |
3830 | +class QMirClientScreen : public QObject, public QPlatformScreen |
3831 | { |
3832 | Q_OBJECT |
3833 | public: |
3834 | - UbuntuScreen(const MirOutput *output, MirConnection *connection); |
3835 | - virtual ~UbuntuScreen(); |
3836 | + QMirClientScreen(const MirOutput *output, MirConnection *connection); |
3837 | + virtual ~QMirClientScreen(); |
3838 | |
3839 | // QPlatformScreen methods. |
3840 | QImage::Format format() const override { return mFormat; } |
3841 | @@ -44,7 +68,7 @@ |
3842 | QDpi logicalDpi() const override; |
3843 | Qt::ScreenOrientation nativeOrientation() const override { return mNativeOrientation; } |
3844 | Qt::ScreenOrientation orientation() const override { return mNativeOrientation; } |
3845 | - QPlatformCursor *cursor() const override { return const_cast<UbuntuCursor*>(&mCursor); } |
3846 | + QPlatformCursor *cursor() const override { return const_cast<QMirClientCursor*>(&mCursor); } |
3847 | |
3848 | // Additional Screen properties from Mir |
3849 | int mirOutputId() const { return mOutputId; } |
3850 | @@ -74,9 +98,9 @@ |
3851 | MirFormFactor mFormFactor; |
3852 | float mScale; |
3853 | int mOutputId; |
3854 | - UbuntuCursor mCursor; |
3855 | + QMirClientCursor mCursor; |
3856 | |
3857 | - friend class UbuntuNativeInterface; |
3858 | + friend class QMirClientNativeInterface; |
3859 | }; |
3860 | |
3861 | -#endif // UBUNTU_SCREEN_H |
3862 | +#endif // QMIRCLIENTSCREEN_H |
3863 | |
3864 | === renamed file 'src/ubuntumirclient/screenobserver.cpp' => 'src/ubuntumirclient/qmirclientscreenobserver.cpp' |
3865 | --- src/ubuntumirclient/screenobserver.cpp 2016-09-14 14:43:12 +0000 |
3866 | +++ src/ubuntumirclient/qmirclientscreenobserver.cpp 2017-02-21 12:29:19 +0000 |
3867 | @@ -1,23 +1,47 @@ |
3868 | -/* |
3869 | - * Copyright (C) 2016 Canonical, Ltd. |
3870 | - * |
3871 | - * This program is free software: you can redistribute it and/or modify it under |
3872 | - * the terms of the GNU Lesser General Public License version 3, as published by |
3873 | - * the Free Software Foundation. |
3874 | - * |
3875 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
3876 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
3877 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3878 | - * Lesser General Public License for more details. |
3879 | - * |
3880 | - * You should have received a copy of the GNU Lesser General Public License |
3881 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3882 | - */ |
3883 | - |
3884 | -#include "screenobserver.h" |
3885 | -#include "screen.h" |
3886 | -#include "window.h" |
3887 | -#include "logging.h" |
3888 | +/**************************************************************************** |
3889 | +** |
3890 | +** Copyright (C) 2016 Canonical, Ltd. |
3891 | +** Contact: https://www.qt.io/licensing/ |
3892 | +** |
3893 | +** This file is part of the plugins of the Qt Toolkit. |
3894 | +** |
3895 | +** $QT_BEGIN_LICENSE:LGPL$ |
3896 | +** Commercial License Usage |
3897 | +** Licensees holding valid commercial Qt licenses may use this file in |
3898 | +** accordance with the commercial license agreement provided with the |
3899 | +** Software or, alternatively, in accordance with the terms contained in |
3900 | +** a written agreement between you and The Qt Company. For licensing terms |
3901 | +** and conditions see https://www.qt.io/terms-conditions. For further |
3902 | +** information use the contact form at https://www.qt.io/contact-us. |
3903 | +** |
3904 | +** GNU Lesser General Public License Usage |
3905 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
3906 | +** General Public License version 3 as published by the Free Software |
3907 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
3908 | +** packaging of this file. Please review the following information to |
3909 | +** ensure the GNU Lesser General Public License version 3 requirements |
3910 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
3911 | +** |
3912 | +** GNU General Public License Usage |
3913 | +** Alternatively, this file may be used under the terms of the GNU |
3914 | +** General Public License version 2.0 or (at your option) the GNU General |
3915 | +** Public license version 3 or any later version approved by the KDE Free |
3916 | +** Qt Foundation. The licenses are as published by the Free Software |
3917 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
3918 | +** included in the packaging of this file. Please review the following |
3919 | +** information to ensure the GNU General Public License requirements will |
3920 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
3921 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
3922 | +** |
3923 | +** $QT_END_LICENSE$ |
3924 | +** |
3925 | +****************************************************************************/ |
3926 | + |
3927 | + |
3928 | +#include "qmirclientscreenobserver.h" |
3929 | +#include "qmirclientscreen.h" |
3930 | +#include "qmirclientwindow.h" |
3931 | +#include "qmirclientlogging.h" |
3932 | |
3933 | // Qt |
3934 | #include <QMetaObject> |
3935 | @@ -33,7 +57,7 @@ |
3936 | static void displayConfigurationChangedCallback(MirConnection */*connection*/, void* context) |
3937 | { |
3938 | ASSERT(context != NULL); |
3939 | - UbuntuScreenObserver *observer = static_cast<UbuntuScreenObserver *>(context); |
3940 | + QMirClientScreenObserver *observer = static_cast<QMirClientScreenObserver *>(context); |
3941 | QMetaObject::invokeMethod(observer, "update"); |
3942 | } |
3943 | |
3944 | @@ -51,14 +75,14 @@ |
3945 | } |
3946 | } // anonymous namespace |
3947 | |
3948 | -UbuntuScreenObserver::UbuntuScreenObserver(MirConnection *mirConnection) |
3949 | +QMirClientScreenObserver::QMirClientScreenObserver(MirConnection *mirConnection) |
3950 | : mMirConnection(mirConnection) |
3951 | { |
3952 | mir_connection_set_display_config_change_callback(mirConnection, ::displayConfigurationChangedCallback, this); |
3953 | update(); |
3954 | } |
3955 | |
3956 | -void UbuntuScreenObserver::update() |
3957 | +void QMirClientScreenObserver::update() |
3958 | { |
3959 | // Wrap MirDisplayConfiguration to always delete when out of scope |
3960 | auto configDeleter = [](MirDisplayConfig *config) { mir_display_config_release(config); }; |
3961 | @@ -66,22 +90,22 @@ |
3962 | configUp displayConfig(mir_connection_create_display_configuration(mMirConnection), configDeleter); |
3963 | |
3964 | // Mir only tells us something changed, it is up to us to figure out what. |
3965 | - QList<UbuntuScreen*> newScreenList; |
3966 | - QList<UbuntuScreen*> oldScreenList = mScreenList; |
3967 | + QList<QMirClientScreen*> newScreenList; |
3968 | + QList<QMirClientScreen*> oldScreenList = mScreenList; |
3969 | mScreenList.clear(); |
3970 | |
3971 | for (int i = 0; i < mir_display_config_get_num_outputs(displayConfig.get()); i++) { |
3972 | const MirOutput *output = mir_display_config_get_output(displayConfig.get(), i); |
3973 | if (mir_output_is_enabled(output)) { |
3974 | - UbuntuScreen *screen = findScreenWithId(oldScreenList, mir_output_get_id(output)); |
3975 | + QMirClientScreen *screen = findScreenWithId(oldScreenList, mir_output_get_id(output)); |
3976 | if (screen) { // we've already set up this display before |
3977 | screen->updateMirOutput(output); |
3978 | oldScreenList.removeAll(screen); |
3979 | } else { |
3980 | - // new display, so create UbuntuScreen for it |
3981 | - screen = new UbuntuScreen(output, mMirConnection); |
3982 | + // new display, so create QMirClientScreen for it |
3983 | + screen = new QMirClientScreen(output, mMirConnection); |
3984 | newScreenList.append(screen); |
3985 | - qCDebug(ubuntumirclient) << "Added Screen with id" << mir_output_get_id(output) |
3986 | + qCDebug(mirclient) << "Added Screen with id" << mir_output_get_id(output) |
3987 | << "and geometry" << screen->geometry(); |
3988 | } |
3989 | mScreenList.append(screen); |
3990 | @@ -104,22 +128,22 @@ |
3991 | Q_EMIT screenAdded(screen); |
3992 | } |
3993 | |
3994 | - qCDebug(ubuntumirclient) << "======================================="; |
3995 | + qCDebug(mirclient) << "======================================="; |
3996 | for (auto screen: mScreenList) { |
3997 | - qCDebug(ubuntumirclient) << screen << "- id:" << screen->mirOutputId() |
3998 | + qCDebug(mirclient) << screen << "- id:" << screen->mirOutputId() |
3999 | << "geometry:" << screen->geometry() |
4000 | << "form factor:" << mirFormFactorToStr(screen->formFactor()) |
4001 | << "scale:" << screen->scale(); |
4002 | } |
4003 | - qCDebug(ubuntumirclient) << "======================================="; |
4004 | + qCDebug(mirclient) << "======================================="; |
4005 | } |
4006 | |
4007 | -UbuntuScreen *UbuntuScreenObserver::findScreenWithId(int id) |
4008 | +QMirClientScreen *QMirClientScreenObserver::findScreenWithId(int id) |
4009 | { |
4010 | return findScreenWithId(mScreenList, id); |
4011 | } |
4012 | |
4013 | -UbuntuScreen *UbuntuScreenObserver::findScreenWithId(const QList<UbuntuScreen *> &list, int id) |
4014 | +QMirClientScreen *QMirClientScreenObserver::findScreenWithId(const QList<QMirClientScreen *> &list, int id) |
4015 | { |
4016 | Q_FOREACH (const auto screen, list) { |
4017 | if (screen->mirOutputId() == id) { |
4018 | @@ -129,7 +153,7 @@ |
4019 | return nullptr; |
4020 | } |
4021 | |
4022 | -void UbuntuScreenObserver::handleScreenPropertiesChange(UbuntuScreen *screen, int dpi, |
4023 | +void QMirClientScreenObserver::handleScreenPropertiesChange(QMirClientScreen *screen, int dpi, |
4024 | MirFormFactor formFactor, float scale) |
4025 | { |
4026 | screen->setAdditionalMirDisplayProperties(scale, formFactor, dpi); |
4027 | |
4028 | === renamed file 'src/ubuntumirclient/screenobserver.h' => 'src/ubuntumirclient/qmirclientscreenobserver.h' |
4029 | --- src/ubuntumirclient/screenobserver.h 2016-04-25 09:39:59 +0000 |
4030 | +++ src/ubuntumirclient/qmirclientscreenobserver.h 2017-02-21 12:29:19 +0000 |
4031 | @@ -1,54 +1,78 @@ |
4032 | -/* |
4033 | - * Copyright (C) 2016 Canonical, Ltd. |
4034 | - * |
4035 | - * This program is free software: you can redistribute it and/or modify it under |
4036 | - * the terms of the GNU Lesser General Public License version 3, as published by |
4037 | - * the Free Software Foundation. |
4038 | - * |
4039 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
4040 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
4041 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4042 | - * Lesser General Public License for more details. |
4043 | - * |
4044 | - * You should have received a copy of the GNU Lesser General Public License |
4045 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4046 | - */ |
4047 | - |
4048 | -#ifndef UBUNTU_SCREEN_OBSERVER_H |
4049 | -#define UBUNTU_SCREEN_OBSERVER_H |
4050 | +/**************************************************************************** |
4051 | +** |
4052 | +** Copyright (C) 2016 Canonical, Ltd. |
4053 | +** Contact: https://www.qt.io/licensing/ |
4054 | +** |
4055 | +** This file is part of the plugins of the Qt Toolkit. |
4056 | +** |
4057 | +** $QT_BEGIN_LICENSE:LGPL$ |
4058 | +** Commercial License Usage |
4059 | +** Licensees holding valid commercial Qt licenses may use this file in |
4060 | +** accordance with the commercial license agreement provided with the |
4061 | +** Software or, alternatively, in accordance with the terms contained in |
4062 | +** a written agreement between you and The Qt Company. For licensing terms |
4063 | +** and conditions see https://www.qt.io/terms-conditions. For further |
4064 | +** information use the contact form at https://www.qt.io/contact-us. |
4065 | +** |
4066 | +** GNU Lesser General Public License Usage |
4067 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
4068 | +** General Public License version 3 as published by the Free Software |
4069 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
4070 | +** packaging of this file. Please review the following information to |
4071 | +** ensure the GNU Lesser General Public License version 3 requirements |
4072 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
4073 | +** |
4074 | +** GNU General Public License Usage |
4075 | +** Alternatively, this file may be used under the terms of the GNU |
4076 | +** General Public License version 2.0 or (at your option) the GNU General |
4077 | +** Public license version 3 or any later version approved by the KDE Free |
4078 | +** Qt Foundation. The licenses are as published by the Free Software |
4079 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
4080 | +** included in the packaging of this file. Please review the following |
4081 | +** information to ensure the GNU General Public License requirements will |
4082 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
4083 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
4084 | +** |
4085 | +** $QT_END_LICENSE$ |
4086 | +** |
4087 | +****************************************************************************/ |
4088 | + |
4089 | + |
4090 | +#ifndef QMIRCLIENTSCREENOBSERVER_H |
4091 | +#define QMIRCLIENTSCREENOBSERVER_H |
4092 | |
4093 | #include <QObject> |
4094 | |
4095 | #include <mir_toolkit/mir_connection.h> |
4096 | |
4097 | -class UbuntuScreen; |
4098 | +class QMirClientScreen; |
4099 | |
4100 | -class UbuntuScreenObserver : public QObject |
4101 | +class QMirClientScreenObserver : public QObject |
4102 | { |
4103 | Q_OBJECT |
4104 | |
4105 | public: |
4106 | - UbuntuScreenObserver(MirConnection *connection); |
4107 | - |
4108 | - QList<UbuntuScreen*> screens() const { return mScreenList; } |
4109 | - UbuntuScreen *findScreenWithId(int id); |
4110 | - |
4111 | - void handleScreenPropertiesChange(UbuntuScreen *screen, int dpi, |
4112 | + QMirClientScreenObserver(MirConnection *connection); |
4113 | + |
4114 | + QList<QMirClientScreen*> screens() const { return mScreenList; } |
4115 | + QMirClientScreen *findScreenWithId(int id); |
4116 | + |
4117 | + void handleScreenPropertiesChange(QMirClientScreen *screen, int dpi, |
4118 | MirFormFactor formFactor, float scale); |
4119 | |
4120 | Q_SIGNALS: |
4121 | - void screenAdded(UbuntuScreen *screen); |
4122 | - void screenRemoved(UbuntuScreen *screen); |
4123 | + void screenAdded(QMirClientScreen *screen); |
4124 | + void screenRemoved(QMirClientScreen *screen); |
4125 | |
4126 | private Q_SLOTS: |
4127 | void update(); |
4128 | |
4129 | private: |
4130 | - UbuntuScreen *findScreenWithId(const QList<UbuntuScreen *> &list, int id); |
4131 | - void removeScreen(UbuntuScreen *screen); |
4132 | + QMirClientScreen *findScreenWithId(const QList<QMirClientScreen *> &list, int id); |
4133 | + void removeScreen(QMirClientScreen *screen); |
4134 | |
4135 | MirConnection *mMirConnection; |
4136 | - QList<UbuntuScreen*> mScreenList; |
4137 | + QList<QMirClientScreen*> mScreenList; |
4138 | }; |
4139 | |
4140 | -#endif // UBUNTU_SCREEN_OBSERVER_H |
4141 | +#endif // QMIRCLIENTSCREENOBSERVER_H |
4142 | |
4143 | === renamed file 'src/ubuntumirclient/window.cpp' => 'src/ubuntumirclient/qmirclientwindow.cpp' |
4144 | --- src/ubuntumirclient/window.cpp 2017-01-19 18:27:29 +0000 |
4145 | +++ src/ubuntumirclient/qmirclientwindow.cpp 2017-02-21 12:29:19 +0000 |
4146 | @@ -1,27 +1,51 @@ |
4147 | -/* |
4148 | - * Copyright (C) 2014-2017 Canonical, Ltd. |
4149 | - * |
4150 | - * This program is free software: you can redistribute it and/or modify it under |
4151 | - * the terms of the GNU Lesser General Public License version 3, as published by |
4152 | - * the Free Software Foundation. |
4153 | - * |
4154 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
4155 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
4156 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4157 | - * Lesser General Public License for more details. |
4158 | - * |
4159 | - * You should have received a copy of the GNU Lesser General Public License |
4160 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4161 | - */ |
4162 | +/**************************************************************************** |
4163 | +** |
4164 | +** Copyright (C) 2014-2017 Canonical, Ltd. |
4165 | +** Contact: https://www.qt.io/licensing/ |
4166 | +** |
4167 | +** This file is part of the plugins of the Qt Toolkit. |
4168 | +** |
4169 | +** $QT_BEGIN_LICENSE:LGPL$ |
4170 | +** Commercial License Usage |
4171 | +** Licensees holding valid commercial Qt licenses may use this file in |
4172 | +** accordance with the commercial license agreement provided with the |
4173 | +** Software or, alternatively, in accordance with the terms contained in |
4174 | +** a written agreement between you and The Qt Company. For licensing terms |
4175 | +** and conditions see https://www.qt.io/terms-conditions. For further |
4176 | +** information use the contact form at https://www.qt.io/contact-us. |
4177 | +** |
4178 | +** GNU Lesser General Public License Usage |
4179 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
4180 | +** General Public License version 3 as published by the Free Software |
4181 | +** Foundation and appearing in the file LICENSE.LGPL3 included in the |
4182 | +** packaging of this file. Please review the following information to |
4183 | +** ensure the GNU Lesser General Public License version 3 requirements |
4184 | +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
4185 | +** |
4186 | +** GNU General Public License Usage |
4187 | +** Alternatively, this file may be used under the terms of the GNU |
4188 | +** General Public License version 2.0 or (at your option) the GNU General |
4189 | +** Public license version 3 or any later version approved by the KDE Free |
4190 | +** Qt Foundation. The licenses are as published by the Free Software |
4191 | +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
4192 | +** included in the packaging of this file. Please review the following |
4193 | +** information to ensure the GNU General Public License requirements will |
4194 | +** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
4195 | +** https://www.gnu.org/licenses/gpl-3.0.html. |
4196 | +** |
4197 | +** $QT_END_LICENSE$ |
4198 | +** |
4199 | +****************************************************************************/ |
4200 | + |
4201 | |
4202 | // Local |
4203 | -#include "window.h" |
4204 | -#include "debugextension.h" |
4205 | -#include "nativeinterface.h" |
4206 | -#include "input.h" |
4207 | -#include "integration.h" |
4208 | -#include "screen.h" |
4209 | -#include "logging.h" |
4210 | +#include "qmirclientwindow.h" |
4211 | +#include "qmirclientdebugextension.h" |
4212 | +#include "qmirclientnativeinterface.h" |
4213 | +#include "qmirclientinput.h" |
4214 | +#include "qmirclientintegration.h" |
4215 | +#include "qmirclientscreen.h" |
4216 | +#include "qmirclientlogging.h" |
4217 | |
4218 | #include <mir_toolkit/mir_client_library.h> |
4219 | #include <mir_toolkit/version.h> |
4220 | @@ -31,21 +55,20 @@ |
4221 | #include <QMutexLocker> |
4222 | #include <QSize> |
4223 | #include <QtMath> |
4224 | -#include <private/qeglconvenience_p.h> |
4225 | -#include <private/qguiapplication_p.h> |
4226 | +#include <QtGui/private/qguiapplication_p.h> |
4227 | +#include <QtPlatformSupport/private/qeglconvenience_p.h> |
4228 | |
4229 | // Platform API |
4230 | #include <ubuntu/application/instance.h> |
4231 | |
4232 | #include <EGL/egl.h> |
4233 | |
4234 | -Q_LOGGING_CATEGORY(ubuntumirclientBufferSwap, "ubuntumirclient.bufferSwap", QtWarningMsg) |
4235 | +Q_LOGGING_CATEGORY(mirclientBufferSwap, "qt.qpa.mirclient.bufferSwap", QtWarningMsg) |
4236 | |
4237 | +namespace |
4238 | +{ |
4239 | const Qt::WindowType LowChromeWindowHint = (Qt::WindowType)0x00800000; |
4240 | |
4241 | -namespace |
4242 | -{ |
4243 | - |
4244 | // FIXME: this used to be defined by platform-api, but it's been removed in v3. Change ubuntu-keyboard to use |
4245 | // a different enum for window roles. |
4246 | enum UAUiWindowRole { |
4247 | @@ -61,14 +84,14 @@ |
4248 | |
4249 | struct MirSpecDeleter |
4250 | { |
4251 | - void operator()(MirSurfaceSpec *spec) { mir_surface_spec_release(spec); } |
4252 | + void operator()(MirWindowSpec *spec) { mir_window_spec_release(spec); } |
4253 | }; |
4254 | |
4255 | -using Spec = std::unique_ptr<MirSurfaceSpec, MirSpecDeleter>; |
4256 | +using Spec = std::unique_ptr<MirWindowSpec, MirSpecDeleter>; |
4257 | |
4258 | -EGLNativeWindowType nativeWindowFor(MirSurface *surf) |
4259 | +EGLNativeWindowType nativeWindowFor(MirWindow *surf) |
4260 | { |
4261 | - auto stream = mir_surface_get_buffer_stream(surf); |
4262 | + auto stream = mir_window_get_buffer_stream(surf); |
4263 | return reinterpret_cast<EGLNativeWindowType>(mir_buffer_stream_get_egl_native_window(stream)); |
4264 | } |
4265 | |
4266 | @@ -89,18 +112,18 @@ |
4267 | Q_UNREACHABLE(); |
4268 | } |
4269 | |
4270 | -const char *mirSurfaceStateToStr(MirSurfaceState surfaceState) |
4271 | +const char *mirWindowStateToStr(MirWindowState windowState) |
4272 | { |
4273 | - switch (surfaceState) { |
4274 | - case mir_surface_state_unknown: return "unknown"; |
4275 | - case mir_surface_state_restored: return "restored"; |
4276 | - case mir_surface_state_minimized: return "minimized"; |
4277 | - case mir_surface_state_maximized: return "vertmaximized"; |
4278 | - case mir_surface_state_vertmaximized: return "vertmaximized"; |
4279 | - case mir_surface_state_fullscreen: return "fullscreen"; |
4280 | - case mir_surface_state_horizmaximized: return "horizmaximized"; |
4281 | - case mir_surface_state_hidden: return "hidden"; |
4282 | - case mir_surface_states: Q_UNREACHABLE(); |
4283 | + switch (windowState) { |
4284 | + case mir_window_state_unknown: return "unknown"; |
4285 | + case mir_window_state_restored: return "restored"; |
4286 | + case mir_window_state_minimized: return "minimized"; |
4287 | + case mir_window_state_maximized: return "vertmaximized"; |
4288 | + case mir_window_state_vertmaximized: return "vertmaximized"; |
4289 | + case mir_window_state_fullscreen: return "fullscreen"; |
4290 | + case mir_window_state_horizmaximized: return "horizmaximized"; |
4291 | + case mir_window_state_hidden: return "hidden"; |
4292 | + case mir_window_states: Q_UNREACHABLE(); |
4293 | } |
4294 | Q_UNREACHABLE(); |
4295 | } |
4296 | @@ -123,57 +146,57 @@ |
4297 | Q_UNREACHABLE(); |
4298 | } |
4299 | |
4300 | -const char *mirSurfaceTypeToStr(MirSurfaceType type) |
4301 | +const char *mirWindowTypeToStr(MirWindowType type) |
4302 | { |
4303 | switch (type) { |
4304 | - case mir_surface_type_normal: return "Normal"; /**< AKA "regular" */ |
4305 | - case mir_surface_type_utility: return "Utility"; /**< AKA "floating regular" */ |
4306 | - case mir_surface_type_dialog: return "Dialog"; |
4307 | - case mir_surface_type_gloss: return "Gloss"; |
4308 | - case mir_surface_type_freestyle: return "Freestyle"; |
4309 | - case mir_surface_type_menu: return "Menu"; |
4310 | - case mir_surface_type_inputmethod: return "Input Method"; /**< AKA "OSK" or handwriting etc. */ |
4311 | - case mir_surface_type_satellite: return "Satellite"; /**< AKA "toolbox"/"toolbar" */ |
4312 | - case mir_surface_type_tip: return "Tip"; /**< AKA "tooltip" */ |
4313 | - case mir_surface_types: Q_UNREACHABLE(); |
4314 | + case mir_window_type_normal: return "Normal"; /**< AKA "regular" */ |
4315 | + case mir_window_type_utility: return "Utility"; /**< AKA "floating regular" */ |
4316 | + case mir_window_type_dialog: return "Dialog"; |
4317 | + case mir_window_type_gloss: return "Gloss"; |
4318 | + case mir_window_type_freestyle: return "Freestyle"; |
4319 | + case mir_window_type_menu: return "Menu"; |
4320 | + case mir_window_type_inputmethod: return "Input Method"; /**< AKA "OSK" or handwriting etc. */ |
4321 | + case mir_window_type_satellite: return "Satellite"; /**< AKA "toolbox"/"toolbar" */ |
4322 | + case mir_window_type_tip: return "Tip"; /**< AKA "tooltip" */ |
4323 | + case mir_window_types: Q_UNREACHABLE(); |
4324 | } |
4325 | return ""; |
4326 | } |
4327 | |
4328 | -MirSurfaceState qtWindowStateToMirSurfaceState(Qt::WindowState state) |
4329 | +MirWindowState qtWindowStateToMirWindowState(Qt::WindowState state) |
4330 | { |
4331 | switch (state) { |
4332 | case Qt::WindowNoState: |
4333 | case Qt::WindowActive: |
4334 | - return mir_surface_state_restored; |
4335 | + return mir_window_state_restored; |
4336 | case Qt::WindowFullScreen: |
4337 | - return mir_surface_state_fullscreen; |
4338 | + return mir_window_state_fullscreen; |
4339 | case Qt::WindowMaximized: |
4340 | - return mir_surface_state_maximized; |
4341 | + return mir_window_state_maximized; |
4342 | case Qt::WindowMinimized: |
4343 | - return mir_surface_state_minimized; |
4344 | + return mir_window_state_minimized; |
4345 | } |
4346 | - return mir_surface_state_unknown; // should never be reached |
4347 | + return mir_window_state_unknown; // should never be reached |
4348 | } |
4349 | |
4350 | -MirSurfaceType qtWindowTypeToMirSurfaceType(Qt::WindowType type) |
4351 | +MirWindowType qtWindowTypeToMirWindowType(Qt::WindowType type) |
4352 | { |
4353 | switch (type & Qt::WindowType_Mask) { |
4354 | case Qt::Dialog: |
4355 | - return mir_surface_type_dialog; |
4356 | + return mir_window_type_dialog; |
4357 | case Qt::Sheet: |
4358 | case Qt::Drawer: |
4359 | - return mir_surface_type_utility; |
4360 | + return mir_window_type_utility; |
4361 | case Qt::Popup: |
4362 | case Qt::Tool: |
4363 | - return mir_surface_type_menu; |
4364 | + return mir_window_type_menu; |
4365 | case Qt::ToolTip: |
4366 | - return mir_surface_type_tip; |
4367 | + return mir_window_type_tip; |
4368 | case Qt::SplashScreen: |
4369 | - return mir_surface_type_freestyle; |
4370 | + return mir_window_type_freestyle; |
4371 | case Qt::Window: |
4372 | default: |
4373 | - return mir_surface_type_normal; |
4374 | + return mir_window_type_normal; |
4375 | } |
4376 | } |
4377 | |
4378 | @@ -196,21 +219,21 @@ |
4379 | return static_cast<UAUiWindowRole>(role); |
4380 | } |
4381 | |
4382 | -UbuntuWindow *transientParentFor(QWindow *window) |
4383 | +QMirClientWindow *transientParentFor(QWindow *window) |
4384 | { |
4385 | QWindow *parent = window->transientParent(); |
4386 | - return parent ? static_cast<UbuntuWindow *>(parent->handle()) : nullptr; |
4387 | + return parent ? static_cast<QMirClientWindow *>(parent->handle()) : nullptr; |
4388 | } |
4389 | |
4390 | -bool requiresParent(const MirSurfaceType type) |
4391 | +bool requiresParent(const MirWindowType type) |
4392 | { |
4393 | switch (type) { |
4394 | - case mir_surface_type_dialog: //FIXME - not quite what the specification dictates, but is what Mir's api dictates |
4395 | - case mir_surface_type_utility: |
4396 | - case mir_surface_type_gloss: |
4397 | - case mir_surface_type_menu: |
4398 | - case mir_surface_type_satellite: |
4399 | - case mir_surface_type_tip: |
4400 | + case mir_window_type_dialog: //FIXME - not quite what the specification dictates, but is what Mir's api dictates |
4401 | + case mir_window_type_utility: |
4402 | + case mir_window_type_gloss: |
4403 | + case mir_window_type_menu: |
4404 | + case mir_window_type_satellite: |
4405 | + case mir_window_type_tip: |
4406 | return true; |
4407 | default: |
4408 | return false; |
4409 | @@ -219,25 +242,25 @@ |
4410 | |
4411 | bool requiresParent(const Qt::WindowType type) |
4412 | { |
4413 | - return requiresParent(qtWindowTypeToMirSurfaceType(type)); |
4414 | + return requiresParent(qtWindowTypeToMirWindowType(type)); |
4415 | } |
4416 | |
4417 | -Spec makeSurfaceSpec(QWindow *window, MirPixelFormat pixelFormat, UbuntuWindow *parentWindowHandle, |
4418 | +Spec makeSurfaceSpec(QWindow *window, MirPixelFormat pixelFormat, QMirClientWindow *parentWindowHandle, |
4419 | MirConnection *connection) |
4420 | { |
4421 | const auto geometry = window->geometry(); |
4422 | const int width = geometry.width() > 0 ? geometry.width() : 1; |
4423 | const int height = geometry.height() > 0 ? geometry.height() : 1; |
4424 | - auto type = qtWindowTypeToMirSurfaceType(window->type()); |
4425 | + auto type = qtWindowTypeToMirWindowType(window->type()); |
4426 | |
4427 | if (U_ON_SCREEN_KEYBOARD_ROLE == roleFor(window)) { |
4428 | - type = mir_surface_type_inputmethod; |
4429 | + type = mir_window_type_inputmethod; |
4430 | } |
4431 | |
4432 | MirRectangle location{geometry.x(), geometry.y(), 0, 0}; |
4433 | - MirSurface *parent = nullptr; |
4434 | + MirWindow *parent = nullptr; |
4435 | if (parentWindowHandle) { |
4436 | - parent = parentWindowHandle->mirSurface(); |
4437 | + parent = parentWindowHandle->mirWindow(); |
4438 | // Qt uses absolute positioning, but Mir positions surfaces relative to parent. |
4439 | location.top -= parentWindowHandle->geometry().top(); |
4440 | location.left -= parentWindowHandle->geometry().left(); |
4441 | @@ -246,91 +269,93 @@ |
4442 | Spec spec; |
4443 | |
4444 | switch (type) { |
4445 | - case mir_surface_type_menu: |
4446 | - spec = Spec{mir_connection_create_spec_for_menu(connection, width, height, pixelFormat, parent, |
4447 | + case mir_window_type_menu: |
4448 | + spec = Spec{mir_create_menu_window_spec(connection, width, height, parent, |
4449 | &location, mir_edge_attachment_any)}; |
4450 | break; |
4451 | - case mir_surface_type_dialog: |
4452 | - spec = Spec{mir_connection_create_spec_for_modal_dialog(connection, width, height, pixelFormat, parent)}; |
4453 | - break; |
4454 | - case mir_surface_type_utility: |
4455 | - spec = Spec{mir_connection_create_spec_for_dialog(connection, width, height, pixelFormat)}; |
4456 | - break; |
4457 | - case mir_surface_type_tip: |
4458 | + case mir_window_type_dialog: |
4459 | + spec = Spec{mir_create_modal_dialog_window_spec(connection, width, height, parent)}; |
4460 | + break; |
4461 | + case mir_window_type_utility: |
4462 | + spec = Spec{mir_create_dialog_window_spec(connection, width, height)}; |
4463 | + break; |
4464 | + case mir_window_type_tip: |
4465 | #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 4, 0) |
4466 | spec = Spec{mir_connection_create_spec_for_tooltip(connection, width, height, pixelFormat, parent, |
4467 | &location)}; |
4468 | #else |
4469 | - spec = Spec{mir_connection_create_spec_for_tip(connection, width, height, pixelFormat, parent, |
4470 | + spec = Spec{mir_create_tip_window_spec(connection, width, height, parent, |
4471 | &location, mir_edge_attachment_any)}; |
4472 | #endif |
4473 | break; |
4474 | - case mir_surface_type_inputmethod: |
4475 | - spec = Spec{mir_connection_create_spec_for_input_method(connection, width, height, pixelFormat)}; |
4476 | + case mir_window_type_inputmethod: |
4477 | + spec = Spec{mir_create_input_method_window_spec(connection, width, height)}; |
4478 | break; |
4479 | default: |
4480 | - spec = Spec{mir_connection_create_spec_for_normal_surface(connection, width, height, pixelFormat)}; |
4481 | + spec = Spec{mir_create_normal_window_spec(connection, width, height)}; |
4482 | break; |
4483 | } |
4484 | |
4485 | - qCDebug(ubuntumirclient, "makeSurfaceSpec(window=%p): %s spec (type=0x%x, position=(%d, %d)px, size=(%dx%d)px)", |
4486 | - window, mirSurfaceTypeToStr(type), window->type(), location.left, location.top, width, height); |
4487 | + mir_window_spec_set_pixel_format(spec.get(), pixelFormat); |
4488 | + |
4489 | + qCDebug(mirclient, "makeSurfaceSpec(window=%p): %s spec (type=0x%x, position=(%d, %d)px, size=(%dx%d)px)", |
4490 | + window, mirWindowTypeToStr(type), window->type(), location.left, location.top, width, height); |
4491 | |
4492 | return std::move(spec); |
4493 | } |
4494 | |
4495 | -void setSizingConstraints(MirSurfaceSpec *spec, const QSize& minSize, const QSize& maxSize, const QSize& increment) |
4496 | +void setSizingConstraints(MirWindowSpec *spec, const QSize& minSize, const QSize& maxSize, const QSize& increment) |
4497 | { |
4498 | - mir_surface_spec_set_min_width(spec, minSize.width()); |
4499 | - mir_surface_spec_set_min_height(spec, minSize.height()); |
4500 | + mir_window_spec_set_min_width(spec, minSize.width()); |
4501 | + mir_window_spec_set_min_height(spec, minSize.height()); |
4502 | if (maxSize.width() >= minSize.width()) { |
4503 | - mir_surface_spec_set_max_width(spec, maxSize.width()); |
4504 | + mir_window_spec_set_max_width(spec, maxSize.width()); |
4505 | } |
4506 | if (maxSize.height() >= minSize.height()) { |
4507 | - mir_surface_spec_set_max_height(spec, maxSize.height()); |
4508 | + mir_window_spec_set_max_height(spec, maxSize.height()); |
4509 | } |
4510 | if (increment.width() > 0) { |
4511 | - mir_surface_spec_set_width_increment(spec, increment.width()); |
4512 | + mir_window_spec_set_width_increment(spec, increment.width()); |
4513 | } |
4514 | if (increment.height() > 0) { |
4515 | - mir_surface_spec_set_height_increment(spec, increment.height()); |
4516 | + mir_window_spec_set_height_increment(spec, increment.height()); |
4517 | } |
4518 | } |
4519 | |
4520 | -MirSurface *createMirSurface(QWindow *window, int mirOutputId, UbuntuWindow *parentWindowHandle, |
4521 | +MirWindow *createMirWindow(QWindow *window, int mirOutputId, QMirClientWindow *parentWindowHandle, |
4522 | MirPixelFormat pixelFormat, MirConnection *connection, |
4523 | - mir_surface_event_callback inputCallback, void *inputContext) |
4524 | + MirWindowEventCallback inputCallback, void *inputContext) |
4525 | { |
4526 | auto spec = makeSurfaceSpec(window, pixelFormat, parentWindowHandle, connection); |
4527 | |
4528 | // Install event handler as early as possible |
4529 | - mir_surface_spec_set_event_handler(spec.get(), inputCallback, inputContext); |
4530 | + mir_window_spec_set_event_handler(spec.get(), inputCallback, inputContext); |
4531 | |
4532 | const auto title = window->title().toUtf8(); |
4533 | - mir_surface_spec_set_name(spec.get(), title.constData()); |
4534 | + mir_window_spec_set_name(spec.get(), title.constData()); |
4535 | |
4536 | setSizingConstraints(spec.get(), window->minimumSize(), window->maximumSize(), window->sizeIncrement()); |
4537 | |
4538 | if (window->windowState() == Qt::WindowFullScreen) { |
4539 | - mir_surface_spec_set_fullscreen_on_output(spec.get(), mirOutputId); |
4540 | + mir_window_spec_set_fullscreen_on_output(spec.get(), mirOutputId); |
4541 | } |
4542 | |
4543 | if (window->flags() & LowChromeWindowHint) { |
4544 | - mir_surface_spec_set_shell_chrome(spec.get(), mir_shell_chrome_low); |
4545 | + mir_window_spec_set_shell_chrome(spec.get(), mir_shell_chrome_low); |
4546 | } |
4547 | |
4548 | if (!window->isVisible()) { |
4549 | - mir_surface_spec_set_state(spec.get(), mir_surface_state_hidden); |
4550 | + mir_window_spec_set_state(spec.get(), mir_window_state_hidden); |
4551 | } |
4552 | |
4553 | - auto surface = mir_surface_create_sync(spec.get()); |
4554 | - Q_ASSERT(mir_surface_is_valid(surface)); |
4555 | + auto surface = mir_create_window_sync(spec.get()); |
4556 | + Q_ASSERT(mir_window_is_valid(surface)); |
4557 | return surface; |
4558 | } |
4559 | |
4560 | -UbuntuWindow *getParentIfNecessary(QWindow *window, UbuntuInput *input) |
4561 | +QMirClientWindow *getParentIfNecessary(QWindow *window, QMirClientInput *input) |
4562 | { |
4563 | - UbuntuWindow *parentWindowHandle = nullptr; |
4564 | + QMirClientWindow *parentWindowHandle = nullptr; |
4565 | if (requiresParent(window->type())) { |
4566 | parentWindowHandle = transientParentFor(window); |
4567 | if (parentWindowHandle == nullptr) { |
4568 | @@ -344,7 +369,7 @@ |
4569 | |
4570 | MirPixelFormat disableAlphaBufferIfPossible(MirPixelFormat pixelFormat) |
4571 | { |
4572 | - switch(pixelFormat) { |
4573 | + switch (pixelFormat) { |
4574 | case mir_pixel_format_abgr_8888: |
4575 | return mir_pixel_format_xbgr_8888; |
4576 | case mir_pixel_format_argb_8888: |
4577 | @@ -378,7 +403,7 @@ |
4578 | class UbuntuSurface |
4579 | { |
4580 | public: |
4581 | - UbuntuSurface(UbuntuWindow *platformWindow, EGLDisplay display, UbuntuInput *input, MirConnection *connection); |
4582 | + UbuntuSurface(QMirClientWindow *platformWindow, EGLDisplay display, QMirClientInput *input, MirConnection *connection); |
4583 | ~UbuntuSurface(); |
4584 | |
4585 | UbuntuSurface(const UbuntuSurface &) = delete; |
4586 | @@ -392,17 +417,17 @@ |
4587 | void handleSurfaceResized(int width, int height); |
4588 | int needsRepaint() const; |
4589 | |
4590 | - MirSurfaceState state() const { return mir_surface_get_state(mMirSurface); } |
4591 | - void setState(MirSurfaceState state); |
4592 | + MirWindowState state() const { return mir_window_get_state(mMirWindow); } |
4593 | + void setState(MirWindowState state); |
4594 | |
4595 | - MirSurfaceType type() const { return mir_surface_get_type(mMirSurface); } |
4596 | + MirWindowType type() const { return mir_window_get_type(mMirWindow); } |
4597 | |
4598 | void setShellChrome(MirShellChrome shellChrome); |
4599 | |
4600 | EGLSurface eglSurface() const { return mEglSurface; } |
4601 | - MirSurface *mirSurface() const { return mMirSurface; } |
4602 | + MirWindow *mirWindow() const { return mMirWindow; } |
4603 | |
4604 | - void setSurfaceParent(MirSurface*); |
4605 | + void setSurfaceParent(MirWindow*); |
4606 | bool hasParent() const { return mParented; } |
4607 | |
4608 | QSurfaceFormat format() const { return mFormat; } |
4609 | @@ -412,16 +437,16 @@ |
4610 | QString persistentSurfaceId(); |
4611 | |
4612 | private: |
4613 | - static void surfaceEventCallback(MirSurface* surface, const MirEvent *event, void* context); |
4614 | + static void surfaceEventCallback(MirWindow* surface, const MirEvent *event, void* context); |
4615 | void postEvent(const MirEvent *event); |
4616 | |
4617 | QWindow * const mWindow; |
4618 | - UbuntuWindow * const mPlatformWindow; |
4619 | - UbuntuInput * const mInput; |
4620 | + QMirClientWindow * const mPlatformWindow; |
4621 | + QMirClientInput * const mInput; |
4622 | MirConnection * const mConnection; |
4623 | - UbuntuWindow * mParentWindowHandle{nullptr}; |
4624 | + QMirClientWindow * mParentWindowHandle{nullptr}; |
4625 | |
4626 | - MirSurface* mMirSurface; |
4627 | + MirWindow* mMirWindow; |
4628 | const EGLDisplay mEglDisplay; |
4629 | EGLSurface mEglSurface; |
4630 | |
4631 | @@ -437,7 +462,7 @@ |
4632 | QString mPersistentIdStr; |
4633 | }; |
4634 | |
4635 | -UbuntuSurface::UbuntuSurface(UbuntuWindow *platformWindow, EGLDisplay display, UbuntuInput *input, MirConnection *connection) |
4636 | +UbuntuSurface::UbuntuSurface(QMirClientWindow *platformWindow, EGLDisplay display, QMirClientInput *input, MirConnection *connection) |
4637 | : mWindow(platformWindow->window()) |
4638 | , mPlatformWindow(platformWindow) |
4639 | , mInput(input) |
4640 | @@ -453,12 +478,12 @@ |
4641 | if (config == 0) { |
4642 | // Older Intel Atom-based devices only support OpenGL 1.4 compatibility profile but by default |
4643 | // QML asks for at least OpenGL 2.0. The XCB GLX backend ignores this request and returns a |
4644 | - // 1.4 context, but the XCB EGL backend tries to honour it, and fails. The 1.4 context appears to |
4645 | + // 1.4 context, but the XCB EGL backend tries to honor it, and fails. The 1.4 context appears to |
4646 | // have sufficient capabilities on MESA (i915) to render correctly however. So reduce the default |
4647 | // requested OpenGL version to 1.0 to ensure EGL will give us a working context (lp:1549455). |
4648 | static const bool isMesa = QString(eglQueryString(display, EGL_VENDOR)).contains(QStringLiteral("Mesa")); |
4649 | if (isMesa) { |
4650 | - qCDebug(ubuntumirclientGraphics, "Attempting to choose OpenGL 1.4 context which may suit Mesa"); |
4651 | + qCDebug(mirclientGraphics, "Attempting to choose OpenGL 1.4 context which may suit Mesa"); |
4652 | mFormat.setMajorVersion(1); |
4653 | mFormat.setMinorVersion(4); |
4654 | config = q_configFromGLFormat(display, mFormat, true); |
4655 | @@ -475,24 +500,24 @@ |
4656 | mPixelFormat = mir_connection_get_egl_pixel_format(connection, display, config); |
4657 | // But the chosen EGLConfig might have an alpha buffer enabled, even if not requested by the client. |
4658 | // If that's the case, try to edit the chosen pixel format in order to disable the alpha buffer. |
4659 | - // This is an optimisation for the compositor, as it can avoid blending this surface. |
4660 | + // This is an optimization for the compositor, as it can avoid blending this surface. |
4661 | if (mWindow->requestedFormat().alphaBufferSize() < 0) { |
4662 | mPixelFormat = disableAlphaBufferIfPossible(mPixelFormat); |
4663 | } |
4664 | |
4665 | - const auto outputId = static_cast<UbuntuScreen *>(mWindow->screen()->handle())->mirOutputId(); |
4666 | + const auto outputId = static_cast<QMirClientScreen *>(mWindow->screen()->handle())->mirOutputId(); |
4667 | |
4668 | mParentWindowHandle = getParentIfNecessary(mWindow, input); |
4669 | |
4670 | - mMirSurface = createMirSurface(mWindow, outputId, mParentWindowHandle, mPixelFormat, connection, surfaceEventCallback, this); |
4671 | - mEglSurface = eglCreateWindowSurface(mEglDisplay, config, nativeWindowFor(mMirSurface), nullptr); |
4672 | + mMirWindow = createMirWindow(mWindow, outputId, mParentWindowHandle, mPixelFormat, connection, surfaceEventCallback, this); |
4673 | + mEglSurface = eglCreateWindowSurface(mEglDisplay, config, nativeWindowFor(mMirWindow), nullptr); |
4674 | |
4675 | - mNeedsExposeCatchup = mir_surface_get_visibility(mMirSurface) == mir_surface_visibility_occluded; |
4676 | + mNeedsExposeCatchup = mir_window_get_visibility(mMirWindow) == mir_window_visibility_occluded; |
4677 | |
4678 | // Window manager can give us a final size different from what we asked for |
4679 | // so let's check what we ended up getting |
4680 | - MirSurfaceParameters parameters; |
4681 | - mir_surface_get_parameters(mMirSurface, ¶meters); |
4682 | + MirWindowParameters parameters; |
4683 | + mir_window_get_parameters(mMirWindow, ¶meters); |
4684 | |
4685 | auto geom = mWindow->geometry(); |
4686 | geom.setWidth(parameters.width); |
4687 | @@ -503,68 +528,68 @@ |
4688 | platformWindow->QPlatformWindow::setGeometry(geom); |
4689 | QWindowSystemInterface::handleGeometryChange(mWindow, geom); |
4690 | |
4691 | - qCDebug(ubuntumirclient) << "Created surface with geometry:" << geom << "title:" << mWindow->title() |
4692 | - << "role:" << roleFor(mWindow); |
4693 | - qCDebug(ubuntumirclientGraphics) |
4694 | - << "Requested format:" << mWindow->requestedFormat() |
4695 | - << "\nActual format:" << mFormat |
4696 | - << "with associated Mir pixel format:" << mirPixelFormatToStr(mPixelFormat); |
4697 | + qCDebug(mirclient) << "Created surface with geometry:" << geom << "title:" << mWindow->title() |
4698 | + << "role:" << roleFor(mWindow); |
4699 | + qCDebug(mirclientGraphics) |
4700 | + << "Requested format:" << mWindow->requestedFormat() |
4701 | + << "\nActual format:" << mFormat |
4702 | + << "with associated Mir pixel format:" << mirPixelFormatToStr(mPixelFormat); |
4703 | } |
4704 | |
4705 | UbuntuSurface::~UbuntuSurface() |
4706 | { |
4707 | if (mEglSurface != EGL_NO_SURFACE) |
4708 | eglDestroySurface(mEglDisplay, mEglSurface); |
4709 | - if (mMirSurface) { |
4710 | - mir_surface_release_sync(mMirSurface); |
4711 | + if (mMirWindow) { |
4712 | + mir_window_release_sync(mMirWindow); |
4713 | } |
4714 | } |
4715 | |
4716 | void UbuntuSurface::updateGeometry(const QRect &newGeometry) |
4717 | { |
4718 | |
4719 | - auto spec = Spec{mir_connection_create_spec_for_changes(mConnection)}; |
4720 | + auto spec = Spec{mir_create_window_spec(mConnection)}; |
4721 | |
4722 | - mir_surface_spec_set_width(spec.get(), newGeometry.width()); |
4723 | - mir_surface_spec_set_height(spec.get(), newGeometry.height()); |
4724 | + mir_window_spec_set_width(spec.get(), newGeometry.width()); |
4725 | + mir_window_spec_set_height(spec.get(), newGeometry.height()); |
4726 | |
4727 | MirRectangle mirRect {0,0,0,0}; |
4728 | |
4729 | if (mParentWindowHandle) { |
4730 | - qCDebug(ubuntumirclient,"updateGeometry(window=%p, x=%d, y=%d, width=%d, height=%d, child)", mWindow, |
4731 | + qCDebug(mirclient,"updateGeometry(window=%p, x=%d, y=%d, width=%d, height=%d, child)", mWindow, |
4732 | newGeometry.x(), newGeometry.y(), newGeometry.width(), newGeometry.height()); |
4733 | |
4734 | mirRect.left = newGeometry.x() - mParentWindowHandle->window()->x(); |
4735 | mirRect.top = newGeometry.y() - mParentWindowHandle->window()->y(); |
4736 | |
4737 | } else { |
4738 | - qCDebug(ubuntumirclient,"updateGeometry(window=%p, x=%d, y=%d, width=%d, height=%d, top-level)", mWindow, |
4739 | + qCDebug(mirclient,"updateGeometry(window=%p, x=%d, y=%d, width=%d, height=%d, top-level)", mWindow, |
4740 | newGeometry.x(), newGeometry.y(), newGeometry.width(), newGeometry.height()); |
4741 | |
4742 | mirRect.left = newGeometry.x(); |
4743 | mirRect.top = newGeometry.y(); |
4744 | } |
4745 | |
4746 | - mir_surface_spec_set_placement(spec.get(), &mirRect, |
4747 | + mir_window_spec_set_placement(spec.get(), &mirRect, |
4748 | mir_placement_gravity_northwest /* rect_gravity */, mir_placement_gravity_northwest /* surface_gravity */, |
4749 | (MirPlacementHints)0, 0 /* offset_dx */, 0 /* offset_dy */); |
4750 | |
4751 | - mir_surface_apply_spec(mMirSurface, spec.get()); |
4752 | + mir_window_apply_spec(mMirWindow, spec.get()); |
4753 | } |
4754 | |
4755 | void UbuntuSurface::updateTitle(const QString& newTitle) |
4756 | { |
4757 | const auto title = newTitle.toUtf8(); |
4758 | - Spec spec{mir_connection_create_spec_for_changes(mConnection)}; |
4759 | - mir_surface_spec_set_name(spec.get(), title.constData()); |
4760 | - mir_surface_apply_spec(mMirSurface, spec.get()); |
4761 | + Spec spec{mir_create_window_spec(mConnection)}; |
4762 | + mir_window_spec_set_name(spec.get(), title.constData()); |
4763 | + mir_window_apply_spec(mMirWindow, spec.get()); |
4764 | } |
4765 | |
4766 | void UbuntuSurface::setSizingConstraints(const QSize& minSize, const QSize& maxSize, const QSize& increment) |
4767 | { |
4768 | - Spec spec{mir_connection_create_spec_for_changes(mConnection)}; |
4769 | + Spec spec{mir_create_window_spec(mConnection)}; |
4770 | ::setSizingConstraints(spec.get(), minSize, maxSize, increment); |
4771 | - mir_surface_apply_spec(mMirSurface, spec.get()); |
4772 | + mir_window_apply_spec(mMirWindow, spec.get()); |
4773 | } |
4774 | |
4775 | void UbuntuSurface::handleSurfaceResized(int width, int height) |
4776 | @@ -597,17 +622,17 @@ |
4777 | return 0; |
4778 | } |
4779 | |
4780 | -void UbuntuSurface::setState(MirSurfaceState state) |
4781 | +void UbuntuSurface::setState(MirWindowState state) |
4782 | { |
4783 | - mir_wait_for(mir_surface_set_state(mMirSurface, state)); |
4784 | + mir_window_set_state(mMirWindow, state); |
4785 | } |
4786 | |
4787 | void UbuntuSurface::setShellChrome(MirShellChrome chrome) |
4788 | { |
4789 | if (chrome != mShellChrome) { |
4790 | - auto spec = Spec{mir_connection_create_spec_for_changes(mConnection)}; |
4791 | - mir_surface_spec_set_shell_chrome(spec.get(), chrome); |
4792 | - mir_surface_apply_spec(mMirSurface, spec.get()); |
4793 | + auto spec = Spec{mir_create_window_spec(mConnection)}; |
4794 | + mir_window_spec_set_shell_chrome(spec.get(), chrome); |
4795 | + mir_window_apply_spec(mMirWindow, spec.get()); |
4796 | |
4797 | mShellChrome = chrome; |
4798 | } |
4799 | @@ -627,7 +652,7 @@ |
4800 | |
4801 | if (validSize && (mBufferSize.width() != eglSurfaceWidth || mBufferSize.height() != eglSurfaceHeight)) { |
4802 | |
4803 | - qCDebug(ubuntumirclientBufferSwap, "onSwapBuffersDone(window=%p) [%d] - size changed (%d, %d) => (%d, %d)", |
4804 | + qCDebug(mirclientBufferSwap, "onSwapBuffersDone(window=%p) [%d] - size changed (%d, %d) => (%d, %d)", |
4805 | mWindow, sFrameNumber, mBufferSize.width(), mBufferSize.height(), eglSurfaceWidth, eglSurfaceHeight); |
4806 | |
4807 | mBufferSize.rwidth() = eglSurfaceWidth; |
4808 | @@ -639,12 +664,12 @@ |
4809 | mPlatformWindow->QPlatformWindow::setGeometry(newGeometry); |
4810 | QWindowSystemInterface::handleGeometryChange(mWindow, newGeometry); |
4811 | } else { |
4812 | - qCDebug(ubuntumirclientBufferSwap, "onSwapBuffersDone(window=%p) [%d] - buffer size (%d,%d)", |
4813 | + qCDebug(mirclientBufferSwap, "onSwapBuffersDone(window=%p) [%d] - buffer size (%d,%d)", |
4814 | mWindow, sFrameNumber, mBufferSize.width(), mBufferSize.height()); |
4815 | } |
4816 | } |
4817 | |
4818 | -void UbuntuSurface::surfaceEventCallback(MirSurface *surface, const MirEvent *event, void* context) |
4819 | +void UbuntuSurface::surfaceEventCallback(MirWindow *surface, const MirEvent *event, void* context) |
4820 | { |
4821 | Q_UNUSED(surface); |
4822 | Q_ASSERT(context != nullptr); |
4823 | @@ -664,7 +689,7 @@ |
4824 | const auto resizeEvent = mir_event_get_resize_event(event); |
4825 | const auto width = mir_resize_event_get_width(resizeEvent); |
4826 | const auto height = mir_resize_event_get_height(resizeEvent); |
4827 | - qCDebug(ubuntumirclient, "resizeEvent(window=%p, width=%d, height=%d)", mWindow, width, height); |
4828 | + qCDebug(mirclient, "resizeEvent(window=%p, width=%d, height=%d)", mWindow, width, height); |
4829 | |
4830 | QMutexLocker lock(&mTargetSizeMutex); |
4831 | mTargetSize.rwidth() = width; |
4832 | @@ -674,48 +699,48 @@ |
4833 | mInput->postEvent(mPlatformWindow, event); |
4834 | } |
4835 | |
4836 | -void UbuntuSurface::setSurfaceParent(MirSurface* parent) |
4837 | +void UbuntuSurface::setSurfaceParent(MirWindow* parent) |
4838 | { |
4839 | - qCDebug(ubuntumirclient, "setSurfaceParent(window=%p)", mWindow); |
4840 | + qCDebug(mirclient, "setSurfaceParent(window=%p)", mWindow); |
4841 | |
4842 | mParented = true; |
4843 | - Spec spec{mir_connection_create_spec_for_changes(mConnection)}; |
4844 | - mir_surface_spec_set_parent(spec.get(), parent); |
4845 | - mir_surface_apply_spec(mMirSurface, spec.get()); |
4846 | + Spec spec{mir_create_window_spec(mConnection)}; |
4847 | + mir_window_spec_set_parent(spec.get(), parent); |
4848 | + mir_window_apply_spec(mMirWindow, spec.get()); |
4849 | } |
4850 | |
4851 | QString UbuntuSurface::persistentSurfaceId() |
4852 | { |
4853 | if (mPersistentIdStr.isEmpty()) { |
4854 | - MirPersistentId* mirPermaId = mir_surface_request_persistent_id_sync(mMirSurface); |
4855 | - mPersistentIdStr = mir_persistent_id_as_string(mirPermaId); |
4856 | - mir_persistent_id_release(mirPermaId); |
4857 | + auto id = mir_window_request_window_id_sync(mMirWindow); |
4858 | + mPersistentIdStr = mir_window_id_as_string(id); |
4859 | + mir_window_id_release(id); |
4860 | } |
4861 | return mPersistentIdStr; |
4862 | } |
4863 | |
4864 | -UbuntuWindow::UbuntuWindow(QWindow *w, UbuntuInput *input, UbuntuNativeInterface *native, |
4865 | - UbuntuAppStateController *appState, EGLDisplay eglDisplay, |
4866 | - MirConnection *mirConnection, UbuntuDebugExtension *debugExt) |
4867 | +QMirClientWindow::QMirClientWindow(QWindow *w, QMirClientInput *input, QMirClientNativeInterface *native, |
4868 | + QMirClientAppStateController *appState, EGLDisplay eglDisplay, |
4869 | + MirConnection *mirConnection, QMirClientDebugExtension *debugExt) |
4870 | : QObject(nullptr) |
4871 | , QPlatformWindow(w) |
4872 | , mId(makeId()) |
4873 | , mWindowState(w->windowState()) |
4874 | , mWindowFlags(w->flags()) |
4875 | , mWindowVisible(false) |
4876 | + , mAppStateController(appState) |
4877 | , mDebugExtention(debugExt) |
4878 | , mNativeInterface(native) |
4879 | - , mAppStateController(appState) |
4880 | , mSurface(new UbuntuSurface{this, eglDisplay, input, mirConnection}) |
4881 | , mScale(1.0) |
4882 | , mFormFactor(mir_form_factor_unknown) |
4883 | { |
4884 | mWindowExposed = mSurface->mNeedsExposeCatchup == false; |
4885 | |
4886 | - qCDebug(ubuntumirclient, "UbuntuWindow(window=%p, screen=%p, input=%p, surf=%p) with title '%s', role: '%d'", |
4887 | + qCDebug(mirclient, "QMirClientWindow(window=%p, screen=%p, input=%p, surf=%p) with title '%s', role: '%d'", |
4888 | w, w->screen()->handle(), input, mSurface.get(), qPrintable(window()->title()), roleFor(window())); |
4889 | |
4890 | - updatePanelHeightHack(mSurface->state() != mir_surface_state_fullscreen); |
4891 | + updatePanelHeightHack(mSurface->state() != mir_window_state_fullscreen); |
4892 | |
4893 | // queue the windowPropertyChanged signal. If it's emitted directly, the platformWindow will not yet be set for the window. |
4894 | QMetaObject::invokeMethod(mNativeInterface, "windowPropertyChanged", Qt::QueuedConnection, |
4895 | @@ -723,15 +748,15 @@ |
4896 | Q_ARG(QString, "persistentSurfaceId")); |
4897 | } |
4898 | |
4899 | -UbuntuWindow::~UbuntuWindow() |
4900 | +QMirClientWindow::~QMirClientWindow() |
4901 | { |
4902 | - qCDebug(ubuntumirclient, "~UbuntuWindow(window=%p)", this); |
4903 | + qCDebug(mirclient, "~QMirClientWindow(window=%p)", this); |
4904 | } |
4905 | |
4906 | -void UbuntuWindow::handleSurfaceResized(int width, int height) |
4907 | +void QMirClientWindow::handleSurfaceResized(int width, int height) |
4908 | { |
4909 | QMutexLocker lock(&mMutex); |
4910 | - qCDebug(ubuntumirclient, "handleSurfaceResize(window=%p, size=(%dx%d)px", window(), width, height); |
4911 | + qCDebug(mirclient, "handleSurfaceResize(window=%p, size=(%dx%d)px", window(), width, height); |
4912 | |
4913 | mSurface->handleSurfaceResized(width, height); |
4914 | |
4915 | @@ -742,17 +767,17 @@ |
4916 | // A mir API to drop the currently held buffer would help here, so that we wouldn't have to redraw twice |
4917 | auto const numRepaints = mSurface->needsRepaint(); |
4918 | lock.unlock(); |
4919 | - qCDebug(ubuntumirclient, "handleSurfaceResize(window=%p) redraw %d times", window(), numRepaints); |
4920 | + qCDebug(mirclient, "handleSurfaceResize(window=%p) redraw %d times", window(), numRepaints); |
4921 | for (int i = 0; i < numRepaints; i++) { |
4922 | - qCDebug(ubuntumirclient, "handleSurfaceResize(window=%p) repainting size=(%dx%d)dp", window(), geometry().size().width(), geometry().size().height()); |
4923 | + qCDebug(mirclient, "handleSurfaceResize(window=%p) repainting size=(%dx%d)dp", window(), geometry().size().width(), geometry().size().height()); |
4924 | QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); |
4925 | } |
4926 | } |
4927 | |
4928 | -void UbuntuWindow::handleSurfaceExposeChange(bool exposed) |
4929 | +void QMirClientWindow::handleSurfaceExposeChange(bool exposed) |
4930 | { |
4931 | QMutexLocker lock(&mMutex); |
4932 | - qCDebug(ubuntumirclient, "handleSurfaceExposeChange(window=%p, exposed=%s)", window(), exposed ? "true" : "false"); |
4933 | + qCDebug(mirclient, "handleSurfaceExposeChange(window=%p, exposed=%s)", window(), exposed ? "true" : "false"); |
4934 | |
4935 | mSurface->mNeedsExposeCatchup = false; |
4936 | if (mWindowExposed == exposed) return; |
4937 | @@ -762,22 +787,27 @@ |
4938 | QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); |
4939 | } |
4940 | |
4941 | -void UbuntuWindow::handleSurfaceFocusChanged(bool focused) |
4942 | +void QMirClientWindow::handleSurfaceFocusChanged(bool focused) |
4943 | { |
4944 | - qCDebug(ubuntumirclient, "handleSurfaceFocusChanged(window=%p, focused=%d)", window(), focused); |
4945 | + qCDebug(mirclient, "handleSurfaceFocusChanged(window=%p, focused=%d)", window(), focused); |
4946 | |
4947 | if (focused) { |
4948 | mAppStateController->setWindowFocused(true); |
4949 | QWindowSystemInterface::handleWindowActivated(window(), Qt::ActiveWindowFocusReason); |
4950 | } else { |
4951 | - QWindowSystemInterface::handleWindowActivated(nullptr, Qt::ActiveWindowFocusReason); |
4952 | - mAppStateController->setWindowFocused(false); |
4953 | + // Flush events so that we update QGuiApplicationPrivate::focus_window first |
4954 | + QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); |
4955 | + |
4956 | + if (window() == QGuiApplicationPrivate::focus_window) { // don't handle unfocus if this window wasn't currently focused. |
4957 | + QWindowSystemInterface::handleWindowActivated(nullptr, Qt::ActiveWindowFocusReason); |
4958 | + mAppStateController->setWindowFocused(false); |
4959 | + } |
4960 | } |
4961 | } |
4962 | |
4963 | -void UbuntuWindow::handleSurfaceVisibilityChanged(bool visible) |
4964 | +void QMirClientWindow::handleSurfaceVisibilityChanged(bool visible) |
4965 | { |
4966 | - qCDebug(ubuntumirclient, "handleSurfaceVisibilityChanged(window=%p, visible=%d)", window(), visible); |
4967 | + qCDebug(mirclient, "handleSurfaceVisibilityChanged(window=%p, visible=%d)", window(), visible); |
4968 | |
4969 | if (mWindowVisible == visible) return; |
4970 | mWindowVisible = visible; |
4971 | @@ -785,9 +815,9 @@ |
4972 | QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); |
4973 | } |
4974 | |
4975 | -void UbuntuWindow::handleSurfaceStateChanged(Qt::WindowState state) |
4976 | +void QMirClientWindow::handleSurfaceStateChanged(Qt::WindowState state) |
4977 | { |
4978 | - qCDebug(ubuntumirclient, "handleSurfaceStateChanged(window=%p, %s)", window(), qtWindowStateToStr(state)); |
4979 | + qCDebug(mirclient, "handleSurfaceStateChanged(window=%p, %s)", window(), qtWindowStateToStr(state)); |
4980 | |
4981 | if (mWindowState == state) return; |
4982 | mWindowState = state; |
4983 | @@ -795,10 +825,10 @@ |
4984 | QWindowSystemInterface::handleWindowStateChanged(window(), state); |
4985 | } |
4986 | |
4987 | -void UbuntuWindow::setWindowState(Qt::WindowState state) |
4988 | +void QMirClientWindow::setWindowState(Qt::WindowState state) |
4989 | { |
4990 | QMutexLocker lock(&mMutex); |
4991 | - qCDebug(ubuntumirclient, "setWindowState(window=%p, %s)", this, qtWindowStateToStr(state)); |
4992 | + qCDebug(mirclient, "setWindowState(window=%p, %s)", this, qtWindowStateToStr(state)); |
4993 | |
4994 | if (mWindowState == state) return; |
4995 | mWindowState = state; |
4996 | @@ -807,10 +837,10 @@ |
4997 | updateSurfaceState(); |
4998 | } |
4999 | |
5000 | -void UbuntuWindow::setWindowFlags(Qt::WindowFlags flags) |
The diff has been truncated for viewing.
PASSED: Continuous integration, rev:372 /unity8- jenkins. ubuntu. com/job/ lp-qtubuntu- ci/185/ /unity8- jenkins. ubuntu. com/job/ build/4144 /unity8- jenkins. ubuntu. com/job/ build-0- fetch/4172 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 4010 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 4010/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= zesty/4010 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= zesty/4010/ artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 4010 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 4010/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= zesty/4010 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= zesty/4010/ artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 4010 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 4010/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= zesty/4010 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= zesty/4010/ artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-qtubuntu- ci/185/ rebuild
https:/