Merge lp:~gerboland/qtubuntu/upstream-closer into lp:qtubuntu

Proposed by Gerry Boland
Status: Merged
Approved by: Daniel d'Andrada
Approved revision: no longer in the source branch.
Merged at revision: 367
Proposed branch: lp:~gerboland/qtubuntu/upstream-closer
Merge into: lp:qtubuntu
Diff against target: 4706 lines (+1834/-1069)
34 files modified
README (+7/-7)
src/ubuntumirclient/qmirclientappstatecontroller.cpp (+46/-22)
src/ubuntumirclient/qmirclientappstatecontroller.h (+45/-21)
src/ubuntumirclient/qmirclientbackingstore.cpp (+52/-30)
src/ubuntumirclient/qmirclientbackingstore.h (+46/-22)
src/ubuntumirclient/qmirclientclipboard.cpp (+58/-34)
src/ubuntumirclient/qmirclientclipboard.h (+46/-22)
src/ubuntumirclient/qmirclientcursor.cpp (+52/-28)
src/ubuntumirclient/qmirclientcursor.h (+45/-21)
src/ubuntumirclient/qmirclientdebugextension.cpp (+52/-28)
src/ubuntumirclient/qmirclientdebugextension.h (+45/-21)
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 (+77/-52)
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 (+78/-54)
src/ubuntumirclient/qmirclientnativeinterface.h (+48/-24)
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 (+132/-104)
src/ubuntumirclient/qmirclientwindow.h (+56/-34)
src/ubuntumirclient/ubuntumirclient.pro (+32/-32)
To merge this branch: bzr merge lp:~gerboland/qtubuntu/upstream-closer
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) Approve
Unity8 CI Bot continuous-integration Approve
Review via email: mp+315486@code.launchpad.net

Commit message

Class renaming and syntax changes to shrink delta with upstream mirclient QPA plugin (which is equivalent to rev 360)

Changes:
 - Rename classes to prefix "QMirClient" instead of "Ubuntu"
 - Update licence headers to match Qt's
 - change logging categories spec to match Qt: qt.qpa.mirclient
 - Enforce American English
 - some minor syntax tweaks

Some differences will still exist between lp:qtubuntu and upstream, some unavoidable:
 - QPA plugin remains "ubuntumirclient" and not "mirclient" as used upstream.
 - some header paths differ between in-Qt code and externally built code
 - I've not included build-type switches for things like accessibility support
 - relaxed switch cases to allow older versions of Mir not break a build
 - panel height hack removed from upstream
 - platform-api env var setting removed from upstream

Description of the change

This is designed to land *after* the following branches still in the queue:

lp:~nick-dedekind/qtubuntu/1648842.window-focus-regression
lp:~gerboland/qtubuntu/quit-gracefully-on-no-mirconnection
lp:~dandrader/qtubuntu/resizeToolTip

The resulting delta between this and Qt upstream can be seen in this diff:
http://pastebin.ubuntu.com/23858329/

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:367
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/174/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3917
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3945
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3790
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3790/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3790
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3790/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3790
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3790/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3790
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3790/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3790
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3790/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3790
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3790/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/174/rebuild

review: Approve (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Didn't check the code yet. But after building & installing it on my test machine unity8-dash (or any qt app) no longer comes up.

Log says:
This application failed to start because it could not find or load the Qt platform plugin "ubuntumirclient"

You sure you didn't rename the qpa?

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

=== renamed and modified file src/ubuntumirclient/plugin.cpp => src/ubuntumirclient/qmirclientplugin.cpp

"""
- if (system.toLower() == QLatin1String("ubuntumirclient")) {
+ if (system.toLower() == QLatin1String("mirclient")) {
"""

Indeed you renamed it

review: Needs Fixing
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

The rest looks fine.

After undoing the rename of the platform, all works well again.

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

all good now

review: Approve
363. By Nick Dedekind

merged trunk

365. By Gerry Boland

Undo qpa plugin name change

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'README'
--- README 2016-09-29 15:12:29 +0000
+++ README 2017-02-08 16:34:34 +0000
@@ -44,13 +44,13 @@
44 logged and debug messages are disabled. QtUbuntu provides the following44 logged and debug messages are disabled. QtUbuntu provides the following
45 logging categories:45 logging categories:
4646
47 * ubuntumirclient.cursor - Messages about the cursor.47 * qt.qpa.mirclient.cursor - Messages about the cursor.
48 * ubuntumirclient.input - Messages related to input and other Mir events.48 * qt.qpa.mirclient.input - Messages related to input and other Mir events.
49 * ubuntumirclient.graphics - Messages related to graphics, GL and EGL.49 * qt.qpa.mirclient.graphics - Messages related to graphics, GL and EGL.
50 * ubuntumirclient.swapBuffers - Messages related to surface buffer swapping.50 * qt.qpa.mirclient.swapBuffers - Messages related to surface buffer swapping.
51 * ubuntumirclient - For all other messages form the ubuntumirclient QPA.51 * qt.qpa.mirclient - For all other messages form the ubuntumirclient QPA.
52 * ubuntuappmenu.registrar - Messages related to application menu registration.52 * ubuntuappmenu.registrar - Messages related to application menu registration.
53 * ubuntuappmenu - For all other messages form the ubuntuappmenu QPA theme.53 * ubuntuappmenu - For all other messages form the ubuntuappmenu QPA theme.
5454
55 The QT_QPA_EGLFS_DEBUG environment variable prints a little more information55 The QT_QPA_EGLFS_DEBUG environment variable prints a little more information
56 from Qt's internals.56 from Qt's internals.
5757
=== renamed file 'src/ubuntumirclient/appstatecontroller.cpp' => 'src/ubuntumirclient/qmirclientappstatecontroller.cpp'
--- src/ubuntumirclient/appstatecontroller.cpp 2016-10-12 15:07:35 +0000
+++ src/ubuntumirclient/qmirclientappstatecontroller.cpp 2017-02-08 16:34:34 +0000
@@ -1,31 +1,55 @@
1/*1/****************************************************************************
2 * Copyright (C) 2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#include "appstatecontroller.h"17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#include "qmirclientappstatecontroller.h"
1842
19#include <qpa/qwindowsysteminterface.h>43#include <qpa/qwindowsysteminterface.h>
2044
21/*45/*
22 * UbuntuAppStateController - updates Qt's QApplication::applicationState property.46 * QMirClientAppStateController - updates Qt's QApplication::applicationState property.
23 *47 *
24 * Tries to avoid active-inactive-active invocations using a timer. The rapid state48 * Tries to avoid active-inactive-active invocations using a timer. The rapid state
25 * change can confuse some applications.49 * change can confuse some applications.
26 */50 */
2751
28UbuntuAppStateController::UbuntuAppStateController()52QMirClientAppStateController::QMirClientAppStateController()
29 : m_suspended(false)53 : m_suspended(false)
30 , m_lastActive(true)54 , m_lastActive(true)
31{55{
@@ -37,7 +61,7 @@
37 });61 });
38}62}
3963
40void UbuntuAppStateController::setSuspended()64void QMirClientAppStateController::setSuspended()
41{65{
42 m_inactiveTimer.stop();66 m_inactiveTimer.stop();
43 if (!m_suspended) {67 if (!m_suspended) {
@@ -47,7 +71,7 @@
47 }71 }
48}72}
4973
50void UbuntuAppStateController::setResumed()74void QMirClientAppStateController::setResumed()
51{75{
52 m_inactiveTimer.stop();76 m_inactiveTimer.stop();
53 if (m_suspended) {77 if (m_suspended) {
@@ -61,7 +85,7 @@
61 }85 }
62}86}
6387
64void UbuntuAppStateController::setWindowFocused(bool focused)88void QMirClientAppStateController::setWindowFocused(bool focused)
65{89{
66 if (m_suspended) {90 if (m_suspended) {
67 return;91 return;
6892
=== renamed file 'src/ubuntumirclient/appstatecontroller.h' => 'src/ubuntumirclient/qmirclientappstatecontroller.h'
--- src/ubuntumirclient/appstatecontroller.h 2016-10-12 15:05:58 +0000
+++ src/ubuntumirclient/qmirclientappstatecontroller.h 2017-02-08 16:34:34 +0000
@@ -1,28 +1,52 @@
1/*1/****************************************************************************
2 * Copyright (C) 2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTUAPPSTATECONTROLLER_H17** GNU Lesser General Public License Usage
18#define UBUNTUAPPSTATECONTROLLER_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTAPPSTATECONTROLLER_H
42#define QMIRCLIENTAPPSTATECONTROLLER_H
1943
20#include <QTimer>44#include <QTimer>
2145
22class UbuntuAppStateController46class QMirClientAppStateController
23{47{
24public:48public:
25 UbuntuAppStateController();49 QMirClientAppStateController();
2650
27 void setSuspended();51 void setSuspended();
28 void setResumed();52 void setResumed();
@@ -35,4 +59,4 @@
35 QTimer m_inactiveTimer;59 QTimer m_inactiveTimer;
36};60};
3761
38#endif // UBUNTUAPPSTATECONTROLLER_H62#endif // QMIRCLIENTAPPSTATECONTROLLER_H
3963
=== renamed file 'src/ubuntumirclient/backingstore.cpp' => 'src/ubuntumirclient/qmirclientbackingstore.cpp'
--- src/ubuntumirclient/backingstore.cpp 2016-10-12 16:31:54 +0000
+++ src/ubuntumirclient/qmirclientbackingstore.cpp 2017-02-08 16:34:34 +0000
@@ -1,28 +1,52 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#include "backingstore.h"17** GNU Lesser General Public License Usage
18#include "logging.h"18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#include "qmirclientbackingstore.h"
42#include "qmirclientlogging.h"
19#include <QtGui/QOpenGLContext>43#include <QtGui/QOpenGLContext>
20#include <QtGui/QOpenGLTexture>44#include <QtGui/QOpenGLTexture>
21#include <QtGui/QMatrix4x4>45#include <QtGui/QMatrix4x4>
22#include <QtGui/private/qopengltextureblitter_p.h>46#include <QtGui/private/qopengltextureblitter_p.h>
23#include <QtGui/qopenglfunctions.h>47#include <QtGui/qopenglfunctions.h>
2448
25UbuntuBackingStore::UbuntuBackingStore(QWindow* window)49QMirClientBackingStore::QMirClientBackingStore(QWindow* window)
26 : QPlatformBackingStore(window)50 : QPlatformBackingStore(window)
27 , mContext(new QOpenGLContext)51 , mContext(new QOpenGLContext)
28 , mTexture(new QOpenGLTexture(QOpenGLTexture::Target2D))52 , mTexture(new QOpenGLTexture(QOpenGLTexture::Target2D))
@@ -35,12 +59,12 @@
35 window->setSurfaceType(QSurface::OpenGLSurface);59 window->setSurfaceType(QSurface::OpenGLSurface);
36}60}
3761
38UbuntuBackingStore::~UbuntuBackingStore()62QMirClientBackingStore::~QMirClientBackingStore()
39{63{
40 mContext->makeCurrent(window()); // needed as QOpenGLTexture destructor assumes current context64 mContext->makeCurrent(window()); // needed as QOpenGLTexture destructor assumes current context
41}65}
4266
43void UbuntuBackingStore::flush(QWindow* window, const QRegion& region, const QPoint& offset)67void QMirClientBackingStore::flush(QWindow* window, const QRegion& region, const QPoint& offset)
44{68{
45 Q_UNUSED(region);69 Q_UNUSED(region);
46 Q_UNUSED(offset);70 Q_UNUSED(offset);
@@ -59,7 +83,7 @@
59 mContext->swapBuffers(window);83 mContext->swapBuffers(window);
60}84}
6185
62void UbuntuBackingStore::updateTexture()86void QMirClientBackingStore::updateTexture()
63{87{
64 if (mDirty.isNull())88 if (mDirty.isNull())
65 return;89 return;
@@ -76,9 +100,7 @@
76 QRegion fixed;100 QRegion fixed;
77 QRect imageRect = mImage.rect();101 QRect imageRect = mImage.rect();
78102
79 /* Following code taken from QEGLPlatformBackingStore under the terms of the Lesser GPL v2.1 licence103 for (const QRect &rect : mDirty.rects()) {
80 * Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). */
81 Q_FOREACH (const QRect &rect, mDirty.rects()) {
82 // intersect with image rect to be sure104 // intersect with image rect to be sure
83 QRect r = imageRect & rect;105 QRect r = imageRect & rect;
84106
@@ -91,7 +113,7 @@
91 fixed |= r;113 fixed |= r;
92 }114 }
93115
94 Q_FOREACH (const QRect &rect, fixed.rects()) {116 for (const QRect &rect : fixed.rects()) {
95 // if the sub-rect is full-width we can pass the image data directly to117 // if the sub-rect is full-width we can pass the image data directly to
96 // OpenGL instead of copying, since there is no gap between scanlines118 // OpenGL instead of copying, since there is no gap between scanlines
97 if (rect.width() == imageRect.width()) {119 if (rect.width() == imageRect.width()) {
@@ -108,12 +130,12 @@
108}130}
109131
110132
111void UbuntuBackingStore::beginPaint(const QRegion& region)133void QMirClientBackingStore::beginPaint(const QRegion& region)
112{134{
113 mDirty |= region;135 mDirty |= region;
114}136}
115137
116void UbuntuBackingStore::resize(const QSize& size, const QRegion& /*staticContents*/)138void QMirClientBackingStore::resize(const QSize& size, const QRegion& /*staticContents*/)
117{139{
118 mImage = QImage(size, QImage::Format_RGBA8888);140 mImage = QImage(size, QImage::Format_RGBA8888);
119141
@@ -123,12 +145,12 @@
123 mTexture->destroy();145 mTexture->destroy();
124}146}
125147
126QPaintDevice* UbuntuBackingStore::paintDevice()148QPaintDevice* QMirClientBackingStore::paintDevice()
127{149{
128 return &mImage;150 return &mImage;
129}151}
130152
131QImage UbuntuBackingStore::toImage() const153QImage QMirClientBackingStore::toImage() const
132{154{
133 // used by QPlatformBackingStore::composeAndFlush155 // used by QPlatformBackingStore::composeAndFlush
134 return mImage;156 return mImage;
135157
=== renamed file 'src/ubuntumirclient/backingstore.h' => 'src/ubuntumirclient/qmirclientbackingstore.h'
--- src/ubuntumirclient/backingstore.h 2016-10-04 16:20:07 +0000
+++ src/ubuntumirclient/qmirclientbackingstore.h 2017-02-08 16:34:34 +0000
@@ -1,21 +1,45 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTU_BACKING_STORE_H17** GNU Lesser General Public License Usage
18#define UBUNTU_BACKING_STORE_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTBACKINGSTORE_H
42#define QMIRCLIENTBACKINGSTORE_H
1943
20#include <qpa/qplatformbackingstore.h>44#include <qpa/qplatformbackingstore.h>
2145
@@ -23,11 +47,11 @@
23class QOpenGLTexture;47class QOpenGLTexture;
24class QOpenGLTextureBlitter;48class QOpenGLTextureBlitter;
2549
26class UbuntuBackingStore : public QPlatformBackingStore50class QMirClientBackingStore : public QPlatformBackingStore
27{51{
28public:52public:
29 UbuntuBackingStore(QWindow* window);53 QMirClientBackingStore(QWindow* window);
30 virtual ~UbuntuBackingStore();54 virtual ~QMirClientBackingStore();
3155
32 // QPlatformBackingStore methods.56 // QPlatformBackingStore methods.
33 void beginPaint(const QRegion&) override;57 void beginPaint(const QRegion&) override;
@@ -47,4 +71,4 @@
47 QRegion mDirty;71 QRegion mDirty;
48};72};
4973
50#endif // UBUNTU_BACKING_STORE_H74#endif // QMIRCLIENTBACKINGSTORE_H
5175
=== renamed file 'src/ubuntumirclient/clipboard.cpp' => 'src/ubuntumirclient/qmirclientclipboard.cpp'
--- src/ubuntumirclient/clipboard.cpp 2016-08-24 12:40:30 +0000
+++ src/ubuntumirclient/qmirclientclipboard.cpp 2017-02-08 16:34:34 +0000
@@ -1,22 +1,46 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014,2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#include "clipboard.h"17** GNU Lesser General Public License Usage
18#include "logging.h"18** Alternatively, this file may be used under the terms of the GNU Lesser
19#include "window.h"19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#include "qmirclientclipboard.h"
42#include "qmirclientlogging.h"
43#include "qmirclientwindow.h"
2044
21#include <QDBusPendingCallWatcher>45#include <QDBusPendingCallWatcher>
22#include <QGuiApplication>46#include <QGuiApplication>
@@ -30,29 +54,29 @@
30// get this cumbersome nested namespace out of the way54// get this cumbersome nested namespace out of the way
31using namespace com::ubuntu::content;55using namespace com::ubuntu::content;
3256
33UbuntuClipboard::UbuntuClipboard()57QMirClientClipboard::QMirClientClipboard()
34 : mMimeData(new QMimeData)58 : mMimeData(new QMimeData)
35 , mContentHub(Hub::Client::instance())59 , mContentHub(Hub::Client::instance())
36{60{
37 connect(mContentHub, &Hub::pasteboardChanged, this, [this]() {61 connect(mContentHub, &Hub::pasteboardChanged, this, [this]() {
38 if (mClipboardState == UbuntuClipboard::SyncedClipboard) {62 if (mClipboardState == QMirClientClipboard::SyncedClipboard) {
39 mClipboardState = UbuntuClipboard::OutdatedClipboard;63 mClipboardState = QMirClientClipboard::OutdatedClipboard;
40 emitChanged(QClipboard::Clipboard);64 emitChanged(QClipboard::Clipboard);
41 }65 }
42 });66 });
4367
44 connect(qGuiApp, &QGuiApplication::applicationStateChanged,68 connect(qGuiApp, &QGuiApplication::applicationStateChanged,
45 this, &UbuntuClipboard::onApplicationStateChanged);69 this, &QMirClientClipboard::onApplicationStateChanged);
4670
47 requestMimeData();71 requestMimeData();
48}72}
4973
50UbuntuClipboard::~UbuntuClipboard()74QMirClientClipboard::~QMirClientClipboard()
51{75{
52 delete mMimeData;76 delete mMimeData;
53}77}
5478
55QMimeData* UbuntuClipboard::mimeData(QClipboard::Mode mode)79QMimeData* QMirClientClipboard::mimeData(QClipboard::Mode mode)
56{80{
57 if (mode != QClipboard::Clipboard)81 if (mode != QClipboard::Clipboard)
58 return nullptr;82 return nullptr;
@@ -70,11 +94,11 @@
70 return mMimeData;94 return mMimeData;
71}95}
7296
73void UbuntuClipboard::setMimeData(QMimeData* mimeData, QClipboard::Mode mode)97void QMirClientClipboard::setMimeData(QMimeData* mimeData, QClipboard::Mode mode)
74{98{
75 QWindow *focusWindow = QGuiApplication::focusWindow();99 QWindow *focusWindow = QGuiApplication::focusWindow();
76 if (focusWindow && mode == QClipboard::Clipboard && mimeData != nullptr) {100 if (focusWindow && mode == QClipboard::Clipboard && mimeData != nullptr) {
77 QString surfaceId = static_cast<UbuntuWindow*>(focusWindow->handle())->persistentSurfaceId();101 QString surfaceId = static_cast<QMirClientWindow*>(focusWindow->handle())->persistentSurfaceId();
78102
79 QDBusPendingCall reply = mContentHub->createPaste(surfaceId, *mimeData);103 QDBusPendingCall reply = mContentHub->createPaste(surfaceId, *mimeData);
80104
@@ -89,18 +113,18 @@
89 }113 }
90}114}
91115
92bool UbuntuClipboard::supportsMode(QClipboard::Mode mode) const116bool QMirClientClipboard::supportsMode(QClipboard::Mode mode) const
93{117{
94 return mode == QClipboard::Clipboard;118 return mode == QClipboard::Clipboard;
95}119}
96120
97bool UbuntuClipboard::ownsMode(QClipboard::Mode mode) const121bool QMirClientClipboard::ownsMode(QClipboard::Mode mode) const
98{122{
99 Q_UNUSED(mode);123 Q_UNUSED(mode);
100 return false;124 return false;
101}125}
102126
103void UbuntuClipboard::onApplicationStateChanged(Qt::ApplicationState state)127void QMirClientClipboard::onApplicationStateChanged(Qt::ApplicationState state)
104{128{
105 if (state == Qt::ApplicationActive) {129 if (state == Qt::ApplicationActive) {
106 // Only focused or active applications might be allowed to paste, so we probably130 // Only focused or active applications might be allowed to paste, so we probably
@@ -110,7 +134,7 @@
110 }134 }
111}135}
112136
113void UbuntuClipboard::updateMimeData()137void QMirClientClipboard::updateMimeData()
114{138{
115 if (qGuiApp->applicationState() != Qt::ApplicationActive) {139 if (qGuiApp->applicationState() != Qt::ApplicationActive) {
116 // Don't even bother asking as content-hub would probably ignore our request (and should).140 // Don't even bother asking as content-hub would probably ignore our request (and should).
@@ -121,14 +145,14 @@
121145
122 QWindow *focusWindow = QGuiApplication::focusWindow();146 QWindow *focusWindow = QGuiApplication::focusWindow();
123 if (focusWindow) {147 if (focusWindow) {
124 QString surfaceId = static_cast<UbuntuWindow*>(focusWindow->handle())->persistentSurfaceId();148 QString surfaceId = static_cast<QMirClientWindow*>(focusWindow->handle())->persistentSurfaceId();
125 mMimeData = mContentHub->latestPaste(surfaceId);149 mMimeData = mContentHub->latestPaste(surfaceId);
126 mClipboardState = SyncedClipboard;150 mClipboardState = SyncedClipboard;
127 emitChanged(QClipboard::Clipboard);151 emitChanged(QClipboard::Clipboard);
128 }152 }
129}153}
130154
131void UbuntuClipboard::requestMimeData()155void QMirClientClipboard::requestMimeData()
132{156{
133 if (qGuiApp->applicationState() != Qt::ApplicationActive) {157 if (qGuiApp->applicationState() != Qt::ApplicationActive) {
134 // Don't even bother asking as content-hub would probably ignore our request (and should).158 // Don't even bother asking as content-hub would probably ignore our request (and should).
@@ -140,7 +164,7 @@
140 return;164 return;
141 }165 }
142166
143 QString surfaceId = static_cast<UbuntuWindow*>(focusWindow->handle())->persistentSurfaceId();167 QString surfaceId = static_cast<QMirClientWindow*>(focusWindow->handle())->persistentSurfaceId();
144 QDBusPendingCall reply = mContentHub->requestLatestPaste(surfaceId);168 QDBusPendingCall reply = mContentHub->requestLatestPaste(surfaceId);
145 mClipboardState = SyncingClipboard;169 mClipboardState = SyncingClipboard;
146170
147171
=== renamed file 'src/ubuntumirclient/clipboard.h' => 'src/ubuntumirclient/qmirclientclipboard.h'
--- src/ubuntumirclient/clipboard.h 2016-08-24 12:40:30 +0000
+++ src/ubuntumirclient/qmirclientclipboard.h 2017-02-08 16:34:34 +0000
@@ -1,21 +1,45 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014,2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTU_CLIPBOARD_H17** GNU Lesser General Public License Usage
18#define UBUNTU_CLIPBOARD_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTCLIPBOARD_H
42#define QMIRCLIENTCLIPBOARD_H
1943
20#include <qpa/qplatformclipboard.h>44#include <qpa/qplatformclipboard.h>
2145
@@ -32,12 +56,12 @@
3256
33class QDBusPendingCallWatcher;57class QDBusPendingCallWatcher;
3458
35class UbuntuClipboard : public QObject, public QPlatformClipboard59class QMirClientClipboard : public QObject, public QPlatformClipboard
36{60{
37 Q_OBJECT61 Q_OBJECT
38public:62public:
39 UbuntuClipboard();63 QMirClientClipboard();
40 virtual ~UbuntuClipboard();64 virtual ~QMirClientClipboard();
4165
42 // QPlatformClipboard methods.66 // QPlatformClipboard methods.
43 QMimeData* mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override;67 QMimeData* mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override;
@@ -65,4 +89,4 @@
65 QDBusPendingCallWatcher *mPasteReply{nullptr};89 QDBusPendingCallWatcher *mPasteReply{nullptr};
66};90};
6791
68#endif // UBUNTU_CLIPBOARD_H92#endif // QMIRCLIENTCLIPBOARD_H
6993
=== renamed file 'src/ubuntumirclient/cursor.cpp' => 'src/ubuntumirclient/qmirclientcursor.cpp'
--- src/ubuntumirclient/cursor.cpp 2016-12-09 17:02:57 +0000
+++ src/ubuntumirclient/qmirclientcursor.cpp 2017-02-08 16:34:34 +0000
@@ -1,29 +1,53 @@
1/*1/****************************************************************************
2 * Copyright (C) 2015 Canonical, Ltd.2**
3 *3** Copyright (C) 2015-2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#include "cursor.h"17** GNU Lesser General Public License Usage
1818** Alternatively, this file may be used under the terms of the GNU Lesser
19#include "logging.h"19** General Public License version 3 as published by the Free Software
20#include "window.h"20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#include "qmirclientcursor.h"
42
43#include "qmirclientlogging.h"
44#include "qmirclientwindow.h"
2145
22#include <mir_toolkit/mir_client_library.h>46#include <mir_toolkit/mir_client_library.h>
2347
24Q_LOGGING_CATEGORY(ubuntumirclientCursor, "ubuntumirclient.cursor", QtWarningMsg)48Q_LOGGING_CATEGORY(mirclientCursor, "qt.qpa.mirclient.cursor", QtWarningMsg)
2549
26UbuntuCursor::UbuntuCursor(MirConnection *connection)50QMirClientCursor::QMirClientCursor(MirConnection *connection)
27 : mConnection(connection)51 : mConnection(connection)
28{52{
29 /*53 /*
@@ -58,7 +82,7 @@
58namespace {82namespace {
59const char *qtCursorShapeToStr(Qt::CursorShape shape)83const char *qtCursorShapeToStr(Qt::CursorShape shape)
60{84{
61 switch(shape) {85 switch (shape) {
62 case Qt::ArrowCursor:86 case Qt::ArrowCursor:
63 return "Arrow";87 return "Arrow";
64 case Qt::UpArrowCursor:88 case Qt::UpArrowCursor:
@@ -111,13 +135,13 @@
111}135}
112} // anonymous namespace136} // anonymous namespace
113137
114void UbuntuCursor::changeCursor(QCursor *windowCursor, QWindow *window)138void QMirClientCursor::changeCursor(QCursor *windowCursor, QWindow *window)
115{139{
116 if (!window) {140 if (!window) {
117 return;141 return;
118 }142 }
119143
120 MirSurface *surface = static_cast<UbuntuWindow*>(window->handle())->mirSurface();144 MirSurface *surface = static_cast<QMirClientWindow*>(window->handle())->mirSurface();
121145
122 if (!surface) {146 if (!surface) {
123 return;147 return;
@@ -125,7 +149,7 @@
125149
126150
127 if (windowCursor) {151 if (windowCursor) {
128 qCDebug(ubuntumirclientCursor, "changeCursor shape=%s, window=%p", qtCursorShapeToStr(windowCursor->shape()), window);152 qCDebug(mirclientCursor, "changeCursor shape=%s, window=%p", qtCursorShapeToStr(windowCursor->shape()), window);
129 if (!windowCursor->pixmap().isNull()) {153 if (!windowCursor->pixmap().isNull()) {
130 configureMirCursorWithPixmapQCursor(surface, *windowCursor);154 configureMirCursorWithPixmapQCursor(surface, *windowCursor);
131 } else if (windowCursor->shape() == Qt::BitmapCursor) {155 } else if (windowCursor->shape() == Qt::BitmapCursor) {
@@ -143,7 +167,7 @@
143167
144}168}
145169
146void UbuntuCursor::configureMirCursorWithPixmapQCursor(MirSurface *surface, QCursor &cursor)170void QMirClientCursor::configureMirCursorWithPixmapQCursor(MirSurface *surface, QCursor &cursor)
147{171{
148 QImage image = cursor.pixmap().toImage();172 QImage image = cursor.pixmap().toImage();
149173
@@ -177,7 +201,7 @@
177 mir_buffer_stream_release_sync(bufferStream);201 mir_buffer_stream_release_sync(bufferStream);
178}202}
179203
180void UbuntuCursor::applyDefaultCursorConfiguration(MirSurface *surface)204void QMirClientCursor::applyDefaultCursorConfiguration(MirSurface *surface)
181{205{
182 auto cursorConfiguration = mir_cursor_configuration_from_name("left_ptr");206 auto cursorConfiguration = mir_cursor_configuration_from_name("left_ptr");
183 mir_surface_configure_cursor(surface, cursorConfiguration);207 mir_surface_configure_cursor(surface, cursorConfiguration);
184208
=== renamed file 'src/ubuntumirclient/cursor.h' => 'src/ubuntumirclient/qmirclientcursor.h'
--- src/ubuntumirclient/cursor.h 2015-11-11 18:58:44 +0000
+++ src/ubuntumirclient/qmirclientcursor.h 2017-02-08 16:34:34 +0000
@@ -1,21 +1,45 @@
1/*1/****************************************************************************
2 * Copyright (C) 2015 Canonical, Ltd.2**
3 *3** Copyright (C) 2015-2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTU_CURSOR_H17** GNU Lesser General Public License Usage
18#define UBUNTU_CURSOR_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTCURSOR_H
42#define QMIRCLIENTCURSOR_H
1943
20#include <qpa/qplatformcursor.h>44#include <qpa/qplatformcursor.h>
2145
@@ -25,10 +49,10 @@
25struct MirConnection;49struct MirConnection;
26struct MirSurface;50struct MirSurface;
2751
28class UbuntuCursor : public QPlatformCursor52class QMirClientCursor : public QPlatformCursor
29{53{
30public:54public:
31 UbuntuCursor(MirConnection *connection);55 QMirClientCursor(MirConnection *connection);
32 void changeCursor(QCursor *windowCursor, QWindow *window) override;56 void changeCursor(QCursor *windowCursor, QWindow *window) override;
33private:57private:
34 void configureMirCursorWithPixmapQCursor(MirSurface *surface, QCursor &cursor);58 void configureMirCursorWithPixmapQCursor(MirSurface *surface, QCursor &cursor);
@@ -37,4 +61,4 @@
37 MirConnection *mConnection;61 MirConnection *mConnection;
38};62};
3963
40#endif // UBUNTU_CURSOR_H64#endif // QMIRCLIENTCURSOR_H
4165
=== renamed file 'src/ubuntumirclient/debugextension.cpp' => 'src/ubuntumirclient/qmirclientdebugextension.cpp'
--- src/ubuntumirclient/debugextension.cpp 2016-12-01 22:28:20 +0000
+++ src/ubuntumirclient/qmirclientdebugextension.cpp 2017-02-08 16:34:34 +0000
@@ -1,50 +1,74 @@
1/*1/****************************************************************************
2 * Copyright (C) 2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#include "debugextension.h"17** GNU Lesser General Public License Usage
1818** Alternatively, this file may be used under the terms of the GNU Lesser
19#include "logging.h"19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#include "qmirclientdebugextension.h"
42
43#include "qmirclientlogging.h"
2044
21// mir client debug45// mir client debug
22#include <mir_toolkit/debug/surface.h>46#include <mir_toolkit/debug/surface.h>
2347
24Q_LOGGING_CATEGORY(ubuntumirclientDebug, "ubuntumirclient.debug")48Q_LOGGING_CATEGORY(mirclientDebug, "qt.qpa.mirclient.debug")
2549
26UbuntuDebugExtension::UbuntuDebugExtension()50QMirClientDebugExtension::QMirClientDebugExtension()
27 : m_mirclientDebug(QStringLiteral("mirclient-debug-extension"), 1)51 : m_mirclientDebug(QStringLiteral("mirclient-debug-extension"), 1)
28 , m_mapper(nullptr)52 , m_mapper(nullptr)
29{53{
30 qCDebug(ubuntumirclientDebug) << "NOTICE: Loading mirclient-debug-extension";54 qCDebug(mirclientDebug) << "NOTICE: Loading mirclient-debug-extension";
31 m_mapper = (MapperPrototype) m_mirclientDebug.resolve("mir_debug_surface_coords_to_screen");55 m_mapper = (MapperPrototype) m_mirclientDebug.resolve("mir_debug_surface_coords_to_screen");
3256
33 if (!m_mirclientDebug.isLoaded()) {57 if (!m_mirclientDebug.isLoaded()) {
34 qCWarning(ubuntumirclientDebug) << "ERROR: mirclient-debug-extension failed to load:"58 qCWarning(mirclientDebug) << "ERROR: mirclient-debug-extension failed to load:"
35 << m_mirclientDebug.errorString();59 << m_mirclientDebug.errorString();
36 } else if (!m_mapper) {60 } else if (!m_mapper) {
37 qCWarning(ubuntumirclientDebug) << "ERROR: unable to find required symbols in mirclient-debug-extension:"61 qCWarning(mirclientDebug) << "ERROR: unable to find required symbols in mirclient-debug-extension:"
38 << m_mirclientDebug.errorString();62 << m_mirclientDebug.errorString();
39 }63 }
40}64}
4165
42bool UbuntuDebugExtension::isEnabled() const66bool QMirClientDebugExtension::isEnabled() const
43{67{
44 return m_mirclientDebug.isLoaded() && m_mapper;68 return m_mirclientDebug.isLoaded() && m_mapper;
45}69}
4670
47QPoint UbuntuDebugExtension::mapSurfacePointToScreen(MirSurface *surface, const QPoint &point)71QPoint QMirClientDebugExtension::mapSurfacePointToScreen(MirSurface *surface, const QPoint &point)
48{72{
49 if (!m_mapper) {73 if (!m_mapper) {
50 return point;74 return point;
5175
=== renamed file 'src/ubuntumirclient/debugextension.h' => 'src/ubuntumirclient/qmirclientdebugextension.h'
--- src/ubuntumirclient/debugextension.h 2016-12-01 22:28:20 +0000
+++ src/ubuntumirclient/qmirclientdebugextension.h 2017-02-08 16:34:34 +0000
@@ -1,21 +1,45 @@
1/*1/****************************************************************************
2 * Copyright (C) 2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTU_DEBUG_EXTENSION_H17** GNU Lesser General Public License Usage
18#define UBUNTU_DEBUG_EXTENSION_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTDEBUGEXTENSION_H
42#define QMIRCLIENTDEBUGEXTENSION_H
1943
20#include <QPoint>44#include <QPoint>
21#include <QLibrary>45#include <QLibrary>
@@ -24,10 +48,10 @@
24typedef bool (*MapperPrototype)(MirSurface* surface, int x, int y, int* screenX, int* screenY);48typedef bool (*MapperPrototype)(MirSurface* surface, int x, int y, int* screenX, int* screenY);
2549
2650
27class UbuntuDebugExtension51class QMirClientDebugExtension
28{52{
29public:53public:
30 UbuntuDebugExtension();54 QMirClientDebugExtension();
3155
32 bool isEnabled() const;56 bool isEnabled() const;
3357
@@ -38,4 +62,4 @@
38 MapperPrototype m_mapper;62 MapperPrototype m_mapper;
39};63};
4064
41#endif // UBUNTU_DEBUG_EXTENSION_H65#endif // QMIRCLIENTDEBUGEXTENSION_H
4266
=== renamed file 'src/ubuntumirclient/desktopwindow.cpp' => 'src/ubuntumirclient/qmirclientdesktopwindow.cpp'
--- src/ubuntumirclient/desktopwindow.cpp 2016-10-04 16:20:07 +0000
+++ src/ubuntumirclient/qmirclientdesktopwindow.cpp 2017-02-08 16:34:34 +0000
@@ -1,26 +1,50 @@
1/*1/****************************************************************************
2 * Copyright (C) 2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#include "desktopwindow.h"17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#include "qmirclientdesktopwindow.h"
1842
19// local43// local
20#include "logging.h"44#include "qmirclientlogging.h"
2145
22UbuntuDesktopWindow::UbuntuDesktopWindow(QWindow *window)46QMirClientDesktopWindow::QMirClientDesktopWindow(QWindow *window)
23 : QPlatformWindow(window)47 : QPlatformWindow(window)
24{48{
25 qCDebug(ubuntumirclient, "UbuntuDesktopWindow(window=%p)", window);49 qCDebug(mirclient, "QMirClientDesktopWindow(window=%p)", window);
26}50}
2751
=== renamed file 'src/ubuntumirclient/desktopwindow.h' => 'src/ubuntumirclient/qmirclientdesktopwindow.h'
--- src/ubuntumirclient/desktopwindow.h 2016-10-04 16:20:07 +0000
+++ src/ubuntumirclient/qmirclientdesktopwindow.h 2017-02-08 16:34:34 +0000
@@ -1,29 +1,53 @@
1/*1/****************************************************************************
2 * Copyright (C) 2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTU_DESKTOP_WINDOW_H17** GNU Lesser General Public License Usage
18#define UBUNTU_DESKTOP_WINDOW_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTDESKTOPWINDOW_H
42#define QMIRCLIENTDESKTOPWINDOW_H
1943
20#include <qpa/qplatformwindow.h>44#include <qpa/qplatformwindow.h>
2145
22// TODO Implement it. For now it's just an empty, dummy class.46// TODO Implement it. For now it's just an empty, dummy class.
23class UbuntuDesktopWindow : public QPlatformWindow47class QMirClientDesktopWindow : public QPlatformWindow
24{48{
25public:49public:
26 UbuntuDesktopWindow(QWindow*);50 QMirClientDesktopWindow(QWindow*);
27};51};
2852
29#endif // UBUNTU_DESKTOP_WINDOW_H53#endif // QMIRCLIENTDESKTOPWINDOW_H
3054
=== renamed file 'src/ubuntumirclient/glcontext.cpp' => 'src/ubuntumirclient/qmirclientglcontext.cpp'
--- src/ubuntumirclient/glcontext.cpp 2016-12-09 17:02:57 +0000
+++ src/ubuntumirclient/qmirclientglcontext.cpp 2017-02-08 16:34:34 +0000
@@ -1,29 +1,53 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014-2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#include "glcontext.h"17** GNU Lesser General Public License Usage
18#include "logging.h"18** Alternatively, this file may be used under the terms of the GNU Lesser
19#include "window.h"19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#include "qmirclientglcontext.h"
42#include "qmirclientlogging.h"
43#include "qmirclientwindow.h"
2044
21#include <QOpenGLFramebufferObject>45#include <QOpenGLFramebufferObject>
22#include <QtPlatformSupport/private/qeglconvenience_p.h>46#include <QtPlatformSupport/private/qeglconvenience_p.h>
23#include <QtPlatformSupport/private/qeglpbuffer_p.h>47#include <QtPlatformSupport/private/qeglpbuffer_p.h>
24#include <QtGui/private/qopenglcontext_p.h>48#include <QtGui/private/qopenglcontext_p.h>
2549
26Q_LOGGING_CATEGORY(ubuntumirclientGraphics, "ubuntumirclient.graphics", QtWarningMsg)50Q_LOGGING_CATEGORY(mirclientGraphics, "qt.qpa.mirclient.graphics", QtWarningMsg)
2751
28namespace {52namespace {
2953
@@ -33,25 +57,25 @@
33 Q_ASSERT(config != nullptr);57 Q_ASSERT(config != nullptr);
3458
35 const char *string = eglQueryString(display, EGL_VENDOR);59 const char *string = eglQueryString(display, EGL_VENDOR);
36 qCDebug(ubuntumirclientGraphics, "EGL vendor: %s", string);60 qCDebug(mirclientGraphics, "EGL vendor: %s", string);
3761
38 string = eglQueryString(display, EGL_VERSION);62 string = eglQueryString(display, EGL_VERSION);
39 qCDebug(ubuntumirclientGraphics, "EGL version: %s", string);63 qCDebug(mirclientGraphics, "EGL version: %s", string);
4064
41 string = eglQueryString(display, EGL_EXTENSIONS);65 string = eglQueryString(display, EGL_EXTENSIONS);
42 qCDebug(ubuntumirclientGraphics, "EGL extensions: %s", string);66 qCDebug(mirclientGraphics, "EGL extensions: %s", string);
4367
44 qCDebug(ubuntumirclientGraphics, "EGL configuration attributes:");68 qCDebug(mirclientGraphics, "EGL configuration attributes:");
45 q_printEglConfig(display, config);69 q_printEglConfig(display, config);
46}70}
4771
48} // anonymous namespace72} // anonymous namespace
4973
50UbuntuOpenGLContext::UbuntuOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share,74QMirClientOpenGLContext::QMirClientOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share,
51 EGLDisplay display)75 EGLDisplay display)
52 : QEGLPlatformContext(format, share, display, 0)76 : QEGLPlatformContext(format, share, display, 0)
53{77{
54 if (ubuntumirclientGraphics().isDebugEnabled()) {78 if (mirclientGraphics().isDebugEnabled()) {
55 printEglConfig(display, eglConfig());79 printEglConfig(display, eglConfig());
56 }80 }
57}81}
@@ -72,7 +96,7 @@
72 return needsWorkaround;96 return needsWorkaround;
73}97}
7498
75bool UbuntuOpenGLContext::makeCurrent(QPlatformSurface* surface)99bool QMirClientOpenGLContext::makeCurrent(QPlatformSurface* surface)
76{100{
77 const bool ret = QEGLPlatformContext::makeCurrent(surface);101 const bool ret = QEGLPlatformContext::makeCurrent(surface);
78102
@@ -86,23 +110,23 @@
86}110}
87111
88// Following method used internally in the base class QEGLPlatformContext to access112// Following method used internally in the base class QEGLPlatformContext to access
89// the egl surface of a QPlatformSurface/UbuntuWindow113// the egl surface of a QPlatformSurface/QMirClientWindow
90EGLSurface UbuntuOpenGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface)114EGLSurface QMirClientOpenGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface)
91{115{
92 if (surface->surface()->surfaceClass() == QSurface::Window) {116 if (surface->surface()->surfaceClass() == QSurface::Window) {
93 return static_cast<UbuntuWindow *>(surface)->eglSurface();117 return static_cast<QMirClientWindow *>(surface)->eglSurface();
94 } else {118 } else {
95 return static_cast<QEGLPbuffer *>(surface)->pbuffer();119 return static_cast<QEGLPbuffer *>(surface)->pbuffer();
96 }120 }
97}121}
98122
99void UbuntuOpenGLContext::swapBuffers(QPlatformSurface *surface)123void QMirClientOpenGLContext::swapBuffers(QPlatformSurface *surface)
100{124{
101 QEGLPlatformContext::swapBuffers(surface);125 QEGLPlatformContext::swapBuffers(surface);
102126
103 if (surface->surface()->surfaceClass() == QSurface::Window) {127 if (surface->surface()->surfaceClass() == QSurface::Window) {
104 // notify window on swap completion128 // notify window on swap completion
105 auto ubuntuWindow = static_cast<UbuntuWindow *>(surface);129 auto platformWindow = static_cast<QMirClientWindow *>(surface);
106 ubuntuWindow->onSwapBuffersDone();130 platformWindow->onSwapBuffersDone();
107 }131 }
108}132}
109133
=== renamed file 'src/ubuntumirclient/glcontext.h' => 'src/ubuntumirclient/qmirclientglcontext.h'
--- src/ubuntumirclient/glcontext.h 2016-07-21 11:55:40 +0000
+++ src/ubuntumirclient/qmirclientglcontext.h 2017-02-08 16:34:34 +0000
@@ -1,31 +1,55 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014,2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTU_OPENGL_CONTEXT_H17** GNU Lesser General Public License Usage
18#define UBUNTU_OPENGL_CONTEXT_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTGLCONTEXT_H
42#define QMIRCLIENTGLCONTEXT_H
1943
20#include <qpa/qplatformopenglcontext.h>44#include <qpa/qplatformopenglcontext.h>
21#include <private/qeglplatformcontext_p.h>45#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
2246
23#include <EGL/egl.h>47#include <EGL/egl.h>
2448
25class UbuntuOpenGLContext : public QEGLPlatformContext49class QMirClientOpenGLContext : public QEGLPlatformContext
26{50{
27public:51public:
28 UbuntuOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share,52 QMirClientOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share,
29 EGLDisplay display);53 EGLDisplay display);
3054
31 // QEGLPlatformContext methods.55 // QEGLPlatformContext methods.
@@ -36,4 +60,4 @@
36 EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) final;60 EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) final;
37};61};
3862
39#endif // UBUNTU_OPENGL_CONTEXT_H63#endif // QMIRCLIENTGLCONTEXT_H
4064
=== renamed file 'src/ubuntumirclient/input.cpp' => 'src/ubuntumirclient/qmirclientinput.cpp'
--- src/ubuntumirclient/input.cpp 2017-01-10 06:41:48 +0000
+++ src/ubuntumirclient/qmirclientinput.cpp 2017-02-08 16:34:34 +0000
@@ -1,33 +1,57 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014-2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2014-2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
1640
17// Local41// Local
18#include "input.h"42#include "qmirclientinput.h"
19#include "integration.h"43#include "qmirclientintegration.h"
20#include "nativeinterface.h"44#include "qmirclientnativeinterface.h"
21#include "screen.h"45#include "qmirclientscreen.h"
22#include "window.h"46#include "qmirclientwindow.h"
23#include "logging.h"47#include "qmirclientlogging.h"
24#include "orientationchangeevent_p.h"48#include "qmirclientorientationchangeevent_p.h"
2549
26// Qt50// Qt
27#include <QtCore/QThread>51#include <QtCore/QThread>
28#include <QtCore/qglobal.h>52#include <QtCore/qglobal.h>
29#include <QtCore/QCoreApplication>53#include <QtCore/QCoreApplication>
30#include <private/qguiapplication_p.h>54#include <QtGui/private/qguiapplication_p.h>
31#include <qpa/qplatforminputcontext.h>55#include <qpa/qplatforminputcontext.h>
32#include <qpa/qwindowsysteminterface.h>56#include <qpa/qwindowsysteminterface.h>
33#include <QTextCodec>57#include <QTextCodec>
@@ -37,7 +61,7 @@
3761
38#include <mir_toolkit/mir_client_library.h>62#include <mir_toolkit/mir_client_library.h>
3963
40Q_LOGGING_CATEGORY(ubuntumirclientInput, "ubuntumirclient.input", QtWarningMsg)64Q_LOGGING_CATEGORY(mirclientInput, "qt.qpa.mirclient.input", QtWarningMsg)
4165
42namespace66namespace
43{67{
@@ -169,7 +193,7 @@
169class UbuntuEvent : public QEvent193class UbuntuEvent : public QEvent
170{194{
171public:195public:
172 UbuntuEvent(UbuntuWindow* window, const MirEvent *event, QEvent::Type type)196 UbuntuEvent(QMirClientWindow* window, const MirEvent *event, QEvent::Type type)
173 : QEvent(type), window(window) {197 : QEvent(type), window(window) {
174 nativeEvent = mir_event_ref(event);198 nativeEvent = mir_event_ref(event);
175 }199 }
@@ -178,14 +202,14 @@
178 mir_event_unref(nativeEvent);202 mir_event_unref(nativeEvent);
179 }203 }
180204
181 QPointer<UbuntuWindow> window;205 QPointer<QMirClientWindow> window;
182 const MirEvent *nativeEvent;206 const MirEvent *nativeEvent;
183};207};
184208
185UbuntuInput::UbuntuInput(UbuntuClientIntegration* integration)209QMirClientInput::QMirClientInput(QMirClientClientIntegration* integration)
186 : QObject(nullptr)210 : QObject(nullptr)
187 , mIntegration(integration)211 , mIntegration(integration)
188 , mEventFilterType(static_cast<UbuntuNativeInterface*>(212 , mEventFilterType(static_cast<QMirClientNativeInterface*>(
189 integration->nativeInterface())->genericEventFilterType())213 integration->nativeInterface())->genericEventFilterType())
190 , mEventType(static_cast<QEvent::Type>(QEvent::registerEventType()))214 , mEventType(static_cast<QEvent::Type>(QEvent::registerEventType()))
191 , mLastInputWindow(nullptr)215 , mLastInputWindow(nullptr)
@@ -199,7 +223,7 @@
199 QWindowSystemInterface::registerTouchDevice(mTouchDevice);223 QWindowSystemInterface::registerTouchDevice(mTouchDevice);
200}224}
201225
202UbuntuInput::~UbuntuInput()226QMirClientInput::~QMirClientInput()
203{227{
204 // Qt will take care of deleting mTouchDevice.228 // Qt will take care of deleting mTouchDevice.
205}229}
@@ -238,14 +262,14 @@
238 Q_UNREACHABLE();262 Q_UNREACHABLE();
239}263}
240264
241void UbuntuInput::customEvent(QEvent* event)265void QMirClientInput::customEvent(QEvent* event)
242{266{
243 Q_ASSERT(QThread::currentThread() == thread());267 Q_ASSERT(QThread::currentThread() == thread());
244 UbuntuEvent* ubuntuEvent = static_cast<UbuntuEvent*>(event);268 UbuntuEvent* ubuntuEvent = static_cast<UbuntuEvent*>(event);
245 const MirEvent *nativeEvent = ubuntuEvent->nativeEvent;269 const MirEvent *nativeEvent = ubuntuEvent->nativeEvent;
246270
247 if ((ubuntuEvent->window == nullptr) || (ubuntuEvent->window->window() == nullptr)) {271 if ((ubuntuEvent->window == nullptr) || (ubuntuEvent->window->window() == nullptr)) {
248 qCWarning(ubuntumirclient) << "Attempted to deliver an event to a non-existent window, ignoring.";272 qCWarning(mirclient) << "Attempted to deliver an event to a non-existent window, ignoring.";
249 return;273 return;
250 }274 }
251275
@@ -254,11 +278,11 @@
254 if (QWindowSystemInterface::handleNativeEvent(278 if (QWindowSystemInterface::handleNativeEvent(
255 ubuntuEvent->window->window(), mEventFilterType,279 ubuntuEvent->window->window(), mEventFilterType,
256 const_cast<void *>(static_cast<const void *>(nativeEvent)), &result) == true) {280 const_cast<void *>(static_cast<const void *>(nativeEvent)), &result) == true) {
257 qCDebug(ubuntumirclient, "event filtered out by native interface");281 qCDebug(mirclient, "event filtered out by native interface");
258 return;282 return;
259 }283 }
260284
261 qCDebug(ubuntumirclientInput, "customEvent(type=%s)", nativeEventTypeToStr(mir_event_get_type(nativeEvent)));285 qCDebug(mirclientInput, "customEvent(type=%s)", nativeEventTypeToStr(mir_event_get_type(nativeEvent)));
262286
263 // Event dispatching.287 // Event dispatching.
264 switch (mir_event_get_type(nativeEvent))288 switch (mir_event_get_type(nativeEvent))
@@ -273,7 +297,7 @@
273 // Enable workaround for Screen rotation297 // Enable workaround for Screen rotation
274 auto const targetWindow = ubuntuEvent->window;298 auto const targetWindow = ubuntuEvent->window;
275 if (targetWindow) {299 if (targetWindow) {
276 auto const screen = static_cast<UbuntuScreen*>(targetWindow->screen());300 auto const screen = static_cast<QMirClientScreen*>(targetWindow->screen());
277 if (screen) {301 if (screen) {
278 screen->handleWindowSurfaceResize(302 screen->handleWindowSurfaceResize(
279 mir_resize_event_get_width(resizeEvent),303 mir_resize_event_get_width(resizeEvent),
@@ -299,11 +323,11 @@
299 QWindowSystemInterface::handleCloseEvent(ubuntuEvent->window->window());323 QWindowSystemInterface::handleCloseEvent(ubuntuEvent->window->window());
300 break;324 break;
301 default:325 default:
302 qCDebug(ubuntumirclient, "unhandled event type: %d", static_cast<int>(mir_event_get_type(nativeEvent)));326 qCDebug(mirclient, "unhandled event type: %d", static_cast<int>(mir_event_get_type(nativeEvent)));
303 }327 }
304}328}
305329
306void UbuntuInput::postEvent(UbuntuWindow *platformWindow, const MirEvent *event)330void QMirClientInput::postEvent(QMirClientWindow *platformWindow, const MirEvent *event)
307{331{
308 QWindow *window = platformWindow->window();332 QWindow *window = platformWindow->window();
309333
@@ -312,12 +336,12 @@
312336
313 if ((window->flags().testFlag(Qt::WindowTransparentForInput)) && window->parent()) {337 if ((window->flags().testFlag(Qt::WindowTransparentForInput)) && window->parent()) {
314 QCoreApplication::postEvent(this, new UbuntuEvent(338 QCoreApplication::postEvent(this, new UbuntuEvent(
315 static_cast<UbuntuWindow*>(platformWindow->QPlatformWindow::parent()),339 static_cast<QMirClientWindow*>(platformWindow->QPlatformWindow::parent()),
316 event, mEventType));340 event, mEventType));
317 }341 }
318}342}
319343
320void UbuntuInput::dispatchInputEvent(UbuntuWindow *window, const MirInputEvent *ev)344void QMirClientInput::dispatchInputEvent(QMirClientWindow *window, const MirInputEvent *ev)
321{345{
322 switch (mir_input_event_get_type(ev))346 switch (mir_input_event_get_type(ev))
323 {347 {
@@ -335,7 +359,7 @@
335 }359 }
336}360}
337361
338void UbuntuInput::dispatchTouchEvent(UbuntuWindow *window, const MirInputEvent *ev)362void QMirClientInput::dispatchTouchEvent(QMirClientWindow *window, const MirInputEvent *ev)
339{363{
340 const MirTouchEvent *tev = mir_input_event_get_touch_event(ev);364 const MirTouchEvent *tev = mir_input_event_get_touch_event(ev);
341365
@@ -433,7 +457,7 @@
433}457}
434}458}
435459
436void UbuntuInput::dispatchKeyEvent(UbuntuWindow *window, const MirInputEvent *event)460void QMirClientInput::dispatchKeyEvent(QMirClientWindow *window, const MirInputEvent *event)
437{461{
438 const MirKeyboardEvent *key_event = mir_input_event_get_keyboard_event(event);462 const MirKeyboardEvent *key_event = mir_input_event_get_keyboard_event(event);
439463
@@ -470,7 +494,7 @@
470 QKeyEvent qKeyEvent(keyType, sym, modifiers, scan_code, xk_sym, native_modifiers, text, is_auto_rep);494 QKeyEvent qKeyEvent(keyType, sym, modifiers, scan_code, xk_sym, native_modifiers, text, is_auto_rep);
471 qKeyEvent.setTimestamp(timestamp);495 qKeyEvent.setTimestamp(timestamp);
472 if (context->filterEvent(&qKeyEvent)) {496 if (context->filterEvent(&qKeyEvent)) {
473 qCDebug(ubuntumirclient, "key event filtered out by input context");497 qCDebug(mirclient, "key event filtered out by input context");
474 return;498 return;
475 }499 }
476 }500 }
@@ -498,7 +522,7 @@
498}522}
499}523}
500524
501void UbuntuInput::dispatchPointerEvent(UbuntuWindow *platformWindow, const MirInputEvent *ev)525void QMirClientInput::dispatchPointerEvent(QMirClientWindow *platformWindow, const MirInputEvent *ev)
502{526{
503 const auto window = platformWindow->window();527 const auto window = platformWindow->window();
504 const auto timestamp = mir_input_event_get_event_time(ev) / 1000000;528 const auto timestamp = mir_input_event_get_event_time(ev) / 1000000;
@@ -557,13 +581,13 @@
557 Q_UNREACHABLE();581 Q_UNREACHABLE();
558}582}
559583
560void UbuntuInput::dispatchOrientationEvent(QWindow *window, const MirOrientationEvent *event)584void QMirClientInput::dispatchOrientationEvent(QWindow *window, const MirOrientationEvent *event)
561{585{
562 MirOrientation mir_orientation = mir_orientation_event_get_direction(event);586 MirOrientation mir_orientation = mir_orientation_event_get_direction(event);
563 qCDebug(ubuntumirclientInput, "orientation direction: %s", nativeOrientationDirectionToStr(mir_orientation));587 qCDebug(mirclientInput, "orientation direction: %s", nativeOrientationDirectionToStr(mir_orientation));
564588
565 if (!window->screen()) {589 if (!window->screen()) {
566 qCDebug(ubuntumirclient, "Window has no associated screen, dropping orientation event");590 qCDebug(mirclient, "Window has no associated screen, dropping orientation event");
567 return;591 return;
568 }592 }
569593
@@ -582,7 +606,7 @@
582 orientation = OrientationChangeEvent::RightUp;606 orientation = OrientationChangeEvent::RightUp;
583 break;607 break;
584 default:608 default:
585 qCDebug(ubuntumirclient, "No such orientation %d", mir_orientation);609 qCDebug(mirclient, "No such orientation %d", mir_orientation);
586 return;610 return;
587 }611 }
588612
@@ -590,11 +614,11 @@
590 // notifying Qt of the actual orientation change - done to prevent multiple Windows each creating614 // notifying Qt of the actual orientation change - done to prevent multiple Windows each creating
591 // an identical orientation change event and passing it directly to Qt.615 // an identical orientation change event and passing it directly to Qt.
592 // [Platform]Screen can also factor in the native orientation.616 // [Platform]Screen can also factor in the native orientation.
593 QCoreApplication::postEvent(static_cast<UbuntuScreen*>(window->screen()->handle()),617 QCoreApplication::postEvent(static_cast<QMirClientScreen*>(window->screen()->handle()),
594 new OrientationChangeEvent(OrientationChangeEvent::mType, orientation));618 new OrientationChangeEvent(OrientationChangeEvent::mType, orientation));
595}619}
596620
597void UbuntuInput::handleSurfaceEvent(const QPointer<UbuntuWindow> &window, const MirSurfaceEvent *event)621void QMirClientInput::handleSurfaceEvent(const QPointer<QMirClientWindow> &window, const MirSurfaceEvent *event)
598{622{
599 auto surfaceEventAttribute = mir_surface_event_get_attribute(event);623 auto surfaceEventAttribute = mir_surface_event_get_attribute(event);
600624
@@ -604,10 +628,11 @@
604 mir_surface_event_get_attribute_value(event) == mir_surface_focused);628 mir_surface_event_get_attribute_value(event) == mir_surface_focused);
605 break;629 break;
606 }630 }
607 case mir_surface_attrib_visibility:631 case mir_surface_attrib_visibility: {
608 window->handleSurfaceExposeChange(632 window->handleSurfaceExposeChange(
609 mir_surface_event_get_attribute_value(event) == mir_surface_visibility_exposed);633 mir_surface_event_get_attribute_value(event) == mir_surface_visibility_exposed);
610 break;634 break;
635 }
611 // Remaining attributes are ones client sets for server, and server should not override them636 // Remaining attributes are ones client sets for server, and server should not override them
612 case mir_surface_attrib_state: {637 case mir_surface_attrib_state: {
613 MirSurfaceState state = static_cast<MirSurfaceState>(mir_surface_event_get_attribute_value(event));638 MirSurfaceState state = static_cast<MirSurfaceState>(mir_surface_event_get_attribute_value(event));
@@ -630,7 +655,7 @@
630 }655 }
631}656}
632657
633void UbuntuInput::handleSurfaceOutputEvent(const QPointer<UbuntuWindow> &window, const MirSurfaceOutputEvent *event)658void QMirClientInput::handleSurfaceOutputEvent(const QPointer<QMirClientWindow> &window, const MirSurfaceOutputEvent *event)
634{659{
635 const uint32_t outputId = mir_surface_output_event_get_output_id(event);660 const uint32_t outputId = mir_surface_output_event_get_output_id(event);
636 const int dpi = mir_surface_output_event_get_dpi(event);661 const int dpi = mir_surface_output_event_get_dpi(event);
@@ -638,9 +663,9 @@
638 const float scale = mir_surface_output_event_get_scale(event);663 const float scale = mir_surface_output_event_get_scale(event);
639664
640 const auto screenObserver = mIntegration->screenObserver();665 const auto screenObserver = mIntegration->screenObserver();
641 UbuntuScreen *screen = screenObserver->findScreenWithId(outputId);666 QMirClientScreen *screen = screenObserver->findScreenWithId(outputId);
642 if (!screen) {667 if (!screen) {
643 qCWarning(ubuntumirclient) << "Mir notified window" << window->window() << "on an unknown screen with id" << outputId;668 qCWarning(mirclient) << "Mir notified window" << window->window() << "on an unknown screen with id" << outputId;
644 return;669 return;
645 }670 }
646671
647672
=== renamed file 'src/ubuntumirclient/input.h' => 'src/ubuntumirclient/qmirclientinput.h'
--- src/ubuntumirclient/input.h 2016-09-21 10:25:33 +0000
+++ src/ubuntumirclient/qmirclientinput.h 2017-02-08 16:34:34 +0000
@@ -1,63 +1,86 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014-2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2014-2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTU_INPUT_H17** GNU Lesser General Public License Usage
18#define UBUNTU_INPUT_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTINPUT_H
42#define QMIRCLIENTINPUT_H
1943
20// Qt44// Qt
21#include <qpa/qwindowsysteminterface.h>45#include <qpa/qwindowsysteminterface.h>
22#include <QLoggingCategory>
2346
24#include <mir_toolkit/mir_client_library.h>47#include <mir_toolkit/mir_client_library.h>
2548
26class UbuntuClientIntegration;49class QMirClientClientIntegration;
27class UbuntuWindow;50class QMirClientWindow;
2851
29class UbuntuInput : public QObject52class QMirClientInput : public QObject
30{53{
31 Q_OBJECT54 Q_OBJECT
3255
33public:56public:
34 UbuntuInput(UbuntuClientIntegration* integration);57 QMirClientInput(QMirClientClientIntegration* integration);
35 virtual ~UbuntuInput();58 virtual ~QMirClientInput();
3659
37 // QObject methods.60 // QObject methods.
38 void customEvent(QEvent* event) override;61 void customEvent(QEvent* event) override;
3962
40 void postEvent(UbuntuWindow* window, const MirEvent *event);63 void postEvent(QMirClientWindow* window, const MirEvent *event);
41 UbuntuClientIntegration* integration() const { return mIntegration; }64 QMirClientClientIntegration* integration() const { return mIntegration; }
42 UbuntuWindow *lastInputWindow() const {return mLastInputWindow; }65 QMirClientWindow *lastInputWindow() const {return mLastInputWindow; }
4366
44protected:67protected:
45 void dispatchKeyEvent(UbuntuWindow *window, const MirInputEvent *event);68 void dispatchKeyEvent(QMirClientWindow *window, const MirInputEvent *event);
46 void dispatchPointerEvent(UbuntuWindow *window, const MirInputEvent *event);69 void dispatchPointerEvent(QMirClientWindow *window, const MirInputEvent *event);
47 void dispatchTouchEvent(UbuntuWindow *window, const MirInputEvent *event);70 void dispatchTouchEvent(QMirClientWindow *window, const MirInputEvent *event);
48 void dispatchInputEvent(UbuntuWindow *window, const MirInputEvent *event);71 void dispatchInputEvent(QMirClientWindow *window, const MirInputEvent *event);
4972
50 void dispatchOrientationEvent(QWindow* window, const MirOrientationEvent *event);73 void dispatchOrientationEvent(QWindow* window, const MirOrientationEvent *event);
51 void handleSurfaceEvent(const QPointer<UbuntuWindow> &window, const MirSurfaceEvent *event);74 void handleSurfaceEvent(const QPointer<QMirClientWindow> &window, const MirSurfaceEvent *event);
52 void handleSurfaceOutputEvent(const QPointer<UbuntuWindow> &window, const MirSurfaceOutputEvent *event);75 void handleSurfaceOutputEvent(const QPointer<QMirClientWindow> &window, const MirSurfaceOutputEvent *event);
5376
54private:77private:
55 UbuntuClientIntegration* mIntegration;78 QMirClientClientIntegration* mIntegration;
56 QTouchDevice* mTouchDevice;79 QTouchDevice* mTouchDevice;
57 const QByteArray mEventFilterType;80 const QByteArray mEventFilterType;
58 const QEvent::Type mEventType;81 const QEvent::Type mEventType;
5982
60 UbuntuWindow *mLastInputWindow;83 QMirClientWindow *mLastInputWindow;
61};84};
6285
63#endif // UBUNTU_INPUT_H86#endif // QMIRCLIENTINPUT_H
6487
=== renamed file 'src/ubuntumirclient/integration.cpp' => 'src/ubuntumirclient/qmirclientintegration.cpp'
--- src/ubuntumirclient/integration.cpp 2017-01-19 22:54:37 +0000
+++ src/ubuntumirclient/qmirclientintegration.cpp 2017-02-08 16:34:34 +0000
@@ -1,36 +1,59 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014-2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2014-2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
1640
17// Local41// Local
18#include "integration.h"42#include "qmirclientintegration.h"
19#include "backingstore.h"43#include "qmirclientbackingstore.h"
20#include "clipboard.h"44#include "qmirclientclipboard.h"
21#include "desktopwindow.h"45#include "qmirclientdebugextension.h"
22#include "debugextension.h"46#include "qmirclientdesktopwindow.h"
23#include "glcontext.h"47#include "qmirclientglcontext.h"
24#include "input.h"48#include "qmirclientinput.h"
25#include "logging.h"49#include "qmirclientlogging.h"
26#include "nativeinterface.h"50#include "qmirclientnativeinterface.h"
27#include "screen.h"51#include "qmirclientscreen.h"
28#include "window.h"52#include "qmirclientwindow.h"
2953
30// Qt54// Qt
31#include <QFileInfo>55#include <QFileInfo>
32#include <QGuiApplication>56#include <QGuiApplication>
33#include <private/qeglpbuffer_p.h>
34#include <qpa/qplatformnativeinterface.h>57#include <qpa/qplatformnativeinterface.h>
35#include <qpa/qplatforminputcontextfactory_p.h>58#include <qpa/qplatforminputcontextfactory_p.h>
36#include <qpa/qplatforminputcontext.h>59#include <qpa/qplatforminputcontext.h>
@@ -71,29 +94,29 @@
7194
72static void resumedCallback(const UApplicationOptions */*options*/, void *context)95static void resumedCallback(const UApplicationOptions */*options*/, void *context)
73{96{
74 auto integration = static_cast<UbuntuClientIntegration*>(context);97 auto integration = static_cast<QMirClientClientIntegration*>(context);
75 integration->appStateController()->setResumed();98 integration->appStateController()->setResumed();
76}99}
77100
78static void aboutToStopCallback(UApplicationArchive */*archive*/, void *context)101static void aboutToStopCallback(UApplicationArchive */*archive*/, void *context)
79{102{
80 auto integration = static_cast<UbuntuClientIntegration*>(context);103 auto integration = static_cast<QMirClientClientIntegration*>(context);
81 auto inputContext = integration->inputContext();104 auto inputContext = integration->inputContext();
82 if (inputContext) {105 if (inputContext) {
83 inputContext->hideInputPanel();106 inputContext->hideInputPanel();
84 } else {107 } else {
85 qCWarning(ubuntumirclient) << "aboutToStopCallback(): no input context";108 qCWarning(mirclient) << "aboutToStopCallback(): no input context";
86 }109 }
87 integration->appStateController()->setSuspended();110 integration->appStateController()->setSuspended();
88}111}
89112
90113
91UbuntuClientIntegration::UbuntuClientIntegration(int argc, char **argv)114QMirClientClientIntegration::QMirClientClientIntegration(int argc, char **argv)
92 : QPlatformIntegration()115 : QPlatformIntegration()
93 , mNativeInterface(new UbuntuNativeInterface(this))116 , mNativeInterface(new QMirClientNativeInterface(this))
94 , mFontDb(new QGenericUnixFontDatabase)117 , mFontDb(new QGenericUnixFontDatabase)
95 , mServices(new UbuntuPlatformServices)118 , mServices(new QMirClientPlatformServices)
96 , mAppStateController(new UbuntuAppStateController)119 , mAppStateController(new QMirClientAppStateController)
97 , mScaleFactor(1.0)120 , mScaleFactor(1.0)
98{121{
99 QByteArray sessionName;122 QByteArray sessionName;
@@ -108,7 +131,7 @@
108 mInstance = u_application_instance_new_from_description_with_options(mDesc, mOptions);131 mInstance = u_application_instance_new_from_description_with_options(mDesc, mOptions);
109132
110 if (mInstance == nullptr) {133 if (mInstance == nullptr) {
111 qCritical("[QPA] UbuntuClientIntegration: connection to Mir server failed.\n");134 qCritical("[QPA] QMirClientClientIntegration: connection to Mir server failed.\n");
112135
113 // TODO: add API to platform-api to fetch Mir's error message (bug:1655970).136 // TODO: add API to platform-api to fetch Mir's error message (bug:1655970).
114 // Workaround by retrying the connection here in order to get the message.137 // Workaround by retrying the connection here in order to get the message.
@@ -140,28 +163,28 @@
140 }163 }
141 }164 }
142 if (testability) {165 if (testability) {
143 mDebugExtension.reset(new UbuntuDebugExtension);166 mDebugExtension.reset(new QMirClientDebugExtension);
144 if (!mDebugExtension->isEnabled()) {167 if (!mDebugExtension->isEnabled()) {
145 mDebugExtension.reset();168 mDebugExtension.reset();
146 }169 }
147 }170 }
148}171}
149172
150void UbuntuClientIntegration::initialize()173void QMirClientClientIntegration::initialize()
151{174{
152 // Init the ScreenObserver175 // Init the ScreenObserver
153 mScreenObserver.reset(new UbuntuScreenObserver(mMirConnection));176 mScreenObserver.reset(new QMirClientScreenObserver(mMirConnection));
154 connect(mScreenObserver.data(), &UbuntuScreenObserver::screenAdded,177 connect(mScreenObserver.data(), &QMirClientScreenObserver::screenAdded,
155 [this](UbuntuScreen *screen) { this->screenAdded(screen); });178 [this](QMirClientScreen *screen) { this->screenAdded(screen); });
156 connect(mScreenObserver.data(), &UbuntuScreenObserver::screenRemoved,179 connect(mScreenObserver.data(), &QMirClientScreenObserver::screenRemoved,
157 this, &UbuntuClientIntegration::destroyScreen);180 this, &QMirClientClientIntegration::destroyScreen);
158181
159 Q_FOREACH(auto screen, mScreenObserver->screens()) {182 Q_FOREACH (auto screen, mScreenObserver->screens()) {
160 screenAdded(screen);183 screenAdded(screen);
161 }184 }
162185
163 // Initialize input.186 // Initialize input.
164 mInput = new UbuntuInput(this);187 mInput = new QMirClientInput(this);
165 mInputContext = QPlatformInputContextFactory::create();188 mInputContext = QPlatformInputContextFactory::create();
166189
167 // compute the scale factor190 // compute the scale factor
@@ -178,7 +201,7 @@
178 mScaleFactor = static_cast<qreal>(gridUnit) / defaultGridUnit;201 mScaleFactor = static_cast<qreal>(gridUnit) / defaultGridUnit;
179}202}
180203
181UbuntuClientIntegration::~UbuntuClientIntegration()204QMirClientClientIntegration::~QMirClientClientIntegration()
182{205{
183 eglTerminate(mEglDisplay);206 eglTerminate(mEglDisplay);
184 delete mInput;207 delete mInput;
@@ -186,12 +209,12 @@
186 delete mServices;209 delete mServices;
187}210}
188211
189QPlatformServices *UbuntuClientIntegration::services() const212QPlatformServices *QMirClientClientIntegration::services() const
190{213{
191 return mServices;214 return mServices;
192}215}
193216
194void UbuntuClientIntegration::setupOptions(QStringList &args)217void QMirClientClientIntegration::setupOptions(QStringList &args)
195{218{
196 int argc = args.size() + 1;219 int argc = args.size() + 1;
197 char **argv = new char*[argc];220 char **argv = new char*[argc];
@@ -206,7 +229,7 @@
206 delete [] argv;229 delete [] argv;
207}230}
208231
209void UbuntuClientIntegration::setupDescription(QByteArray &sessionName)232void QMirClientClientIntegration::setupDescription(QByteArray &sessionName)
210{233{
211 mDesc = u_application_description_new();234 mDesc = u_application_description_new();
212235
@@ -220,7 +243,7 @@
220 u_application_description_set_application_lifecycle_delegate(mDesc, delegate);243 u_application_description_set_application_lifecycle_delegate(mDesc, delegate);
221}244}
222245
223QByteArray UbuntuClientIntegration::generateSessionName(QStringList &args)246QByteArray QMirClientClientIntegration::generateSessionName(QStringList &args)
224{247{
225 // Try to come up with some meaningful session name to uniquely identify this session,248 // Try to come up with some meaningful session name to uniquely identify this session,
226 // helping with shell debugging249 // helping with shell debugging
@@ -236,7 +259,7 @@
236 }259 }
237}260}
238261
239QByteArray UbuntuClientIntegration::generateSessionNameFromQmlFile(QStringList &args)262QByteArray QMirClientClientIntegration::generateSessionNameFromQmlFile(QStringList &args)
240{263{
241 Q_FOREACH (QString arg, args) {264 Q_FOREACH (QString arg, args) {
242 if (arg.endsWith(".qml")) {265 if (arg.endsWith(".qml")) {
@@ -249,25 +272,25 @@
249 return "qmlscene";272 return "qmlscene";
250}273}
251274
252QPlatformWindow* UbuntuClientIntegration::createPlatformWindow(QWindow* window) const275QPlatformWindow* QMirClientClientIntegration::createPlatformWindow(QWindow* window) const
253{276{
254 if (window->type() == Qt::Desktop) {277 if (window->type() == Qt::Desktop) {
255 // Desktop windows should not be backed up by a mir surface as they don't draw anything (nor should).278 // Desktop windows should not be backed up by a mir surface as they don't draw anything (nor should).
256 return new UbuntuDesktopWindow(window);279 return new QMirClientDesktopWindow(window);
257 } else {280 } else {
258 return new UbuntuWindow(window, mInput, mNativeInterface, mAppStateController.data(),281 return new QMirClientWindow(window, mInput, mNativeInterface, mAppStateController.data(),
259 mEglDisplay, mMirConnection, mDebugExtension.data());282 mEglDisplay, mMirConnection, mDebugExtension.data());
260 }283 }
261}284}
262285
263bool UbuntuClientIntegration::hasCapability(QPlatformIntegration::Capability cap) const286bool QMirClientClientIntegration::hasCapability(QPlatformIntegration::Capability cap) const
264{287{
265 switch (cap) {288 switch (cap) {
266 case ThreadedOpenGL:289 case ThreadedOpenGL:
267 if (qEnvironmentVariableIsEmpty("QTUBUNTU_NO_THREADED_OPENGL")) {290 if (qEnvironmentVariableIsEmpty("QTUBUNTU_NO_THREADED_OPENGL")) {
268 return true;291 return true;
269 } else {292 } else {
270 qCDebug(ubuntumirclient, "disabled threaded OpenGL");293 qCDebug(mirclient, "disabled threaded OpenGL");
271 return false;294 return false;
272 }295 }
273296
@@ -286,52 +309,52 @@
286 }309 }
287}310}
288311
289QAbstractEventDispatcher *UbuntuClientIntegration::createEventDispatcher() const312QAbstractEventDispatcher *QMirClientClientIntegration::createEventDispatcher() const
290{313{
291 return createUnixEventDispatcher();314 return createUnixEventDispatcher();
292}315}
293316
294QPlatformBackingStore* UbuntuClientIntegration::createPlatformBackingStore(QWindow* window) const317QPlatformBackingStore* QMirClientClientIntegration::createPlatformBackingStore(QWindow* window) const
295{318{
296 return new UbuntuBackingStore(window);319 return new QMirClientBackingStore(window);
297}320}
298321
299QPlatformOpenGLContext* UbuntuClientIntegration::createPlatformOpenGLContext(322QPlatformOpenGLContext* QMirClientClientIntegration::createPlatformOpenGLContext(
300 QOpenGLContext* context) const323 QOpenGLContext* context) const
301{324{
302 QSurfaceFormat format(context->format());325 QSurfaceFormat format(context->format());
303326
304 auto platformContext = new UbuntuOpenGLContext(format, context->shareHandle(), mEglDisplay);327 auto platformContext = new QMirClientOpenGLContext(format, context->shareHandle(), mEglDisplay);
305 if (!platformContext->isValid()) {328 if (!platformContext->isValid()) {
306 // Older Intel Atom-based devices only support OpenGL 1.4 compatibility profile but by default329 // Older Intel Atom-based devices only support OpenGL 1.4 compatibility profile but by default
307 // QML asks for at least OpenGL 2.0. The XCB GLX backend ignores this request and returns a330 // QML asks for at least OpenGL 2.0. The XCB GLX backend ignores this request and returns a
308 // 1.4 context, but the XCB EGL backend tries to honour it, and fails. The 1.4 context appears to331 // 1.4 context, but the XCB EGL backend tries to honor it, and fails. The 1.4 context appears to
309 // have sufficient capabilities on MESA (i915) to render correctly however. So reduce the default332 // have sufficient capabilities on MESA (i915) to render correctly however. So reduce the default
310 // requested OpenGL version to 1.0 to ensure EGL will give us a working context (lp:1549455).333 // requested OpenGL version to 1.0 to ensure EGL will give us a working context (lp:1549455).
311 static const bool isMesa = QString(eglQueryString(mEglDisplay, EGL_VENDOR)).contains(QStringLiteral("Mesa"));334 static const bool isMesa = QString(eglQueryString(mEglDisplay, EGL_VENDOR)).contains(QStringLiteral("Mesa"));
312 if (isMesa) {335 if (isMesa) {
313 qCDebug(ubuntumirclientGraphics, "Attempting to choose OpenGL 1.4 context which may suit Mesa");336 qCDebug(mirclientGraphics, "Attempting to choose OpenGL 1.4 context which may suit Mesa");
314 format.setMajorVersion(1);337 format.setMajorVersion(1);
315 format.setMinorVersion(4);338 format.setMinorVersion(4);
316 delete platformContext;339 delete platformContext;
317 platformContext = new UbuntuOpenGLContext(format, context->shareHandle(), mEglDisplay);340 platformContext = new QMirClientOpenGLContext(format, context->shareHandle(), mEglDisplay);
318 }341 }
319 }342 }
320 return platformContext;343 return platformContext;
321}344}
322345
323QStringList UbuntuClientIntegration::themeNames() const346QStringList QMirClientClientIntegration::themeNames() const
324{347{
325 return QStringList(QStringLiteral("ubuntuappmenu"));348 return QStringList(QStringLiteral("ubuntuappmenu"));
326}349}
327350
328QPlatformTheme* UbuntuClientIntegration::createPlatformTheme(const QString& name) const351QPlatformTheme* QMirClientClientIntegration::createPlatformTheme(const QString& name) const
329{352{
330 Q_UNUSED(name);353 Q_UNUSED(name);
331 return new UbuntuIconTheme;354 return new UbuntuIconTheme;
332}355}
333356
334QVariant UbuntuClientIntegration::styleHint(StyleHint hint) const357QVariant QMirClientClientIntegration::styleHint(StyleHint hint) const
335{358{
336 switch (hint) {359 switch (hint) {
337 case QPlatformIntegration::StartDragDistance: {360 case QPlatformIntegration::StartDragDistance: {
@@ -348,27 +371,27 @@
348 return QPlatformIntegration::styleHint(hint);371 return QPlatformIntegration::styleHint(hint);
349}372}
350373
351QPlatformClipboard* UbuntuClientIntegration::clipboard() const374QPlatformClipboard* QMirClientClientIntegration::clipboard() const
352{375{
353 static QPlatformClipboard *clipboard = nullptr;376 static QPlatformClipboard *clipboard = nullptr;
354 if (!clipboard) {377 if (!clipboard) {
355 clipboard = new UbuntuClipboard;378 clipboard = new QMirClientClipboard;
356 }379 }
357 return clipboard;380 return clipboard;
358}381}
359382
360QPlatformNativeInterface* UbuntuClientIntegration::nativeInterface() const383QPlatformNativeInterface* QMirClientClientIntegration::nativeInterface() const
361{384{
362 return mNativeInterface;385 return mNativeInterface;
363}386}
364387
365QPlatformOffscreenSurface *UbuntuClientIntegration::createPlatformOffscreenSurface(388QPlatformOffscreenSurface *QMirClientClientIntegration::createPlatformOffscreenSurface(
366 QOffscreenSurface *surface) const389 QOffscreenSurface *surface) const
367{390{
368 return new QEGLPbuffer(mEglDisplay, surface->requestedFormat(), surface);391 return new QEGLPbuffer(mEglDisplay, surface->requestedFormat(), surface);
369}392}
370393
371void UbuntuClientIntegration::destroyScreen(UbuntuScreen *screen)394void QMirClientClientIntegration::destroyScreen(QMirClientScreen *screen)
372{395{
373 // FIXME: on deleting a screen while a Window is on it, Qt will automatically396 // FIXME: on deleting a screen while a Window is on it, Qt will automatically
374 // move the window to the primaryScreen(). This will trigger a screenChanged397 // move the window to the primaryScreen(). This will trigger a screenChanged
@@ -391,7 +414,7 @@
391 }414 }
392 }415 }
393416
394 qCDebug(ubuntumirclient) << "Removing Screen with id" << screen->mirOutputId() << "and geometry" << screen->geometry();417 qCDebug(mirclient) << "Removing Screen with id" << screen->mirOutputId() << "and geometry" << screen->geometry();
395#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)418#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
396 delete screen;419 delete screen;
397#else420#else
@@ -399,7 +422,7 @@
399#endif422#endif
400}423}
401424
402QPlatformAccessibility *UbuntuClientIntegration::accessibility() const425QPlatformAccessibility *QMirClientClientIntegration::accessibility() const
403{426{
404 if (!mAccessibility) {427 if (!mAccessibility) {
405 mAccessibility.reset(new QSpiAccessibleBridge());428 mAccessibility.reset(new QSpiAccessibleBridge());
406429
=== renamed file 'src/ubuntumirclient/integration.h' => 'src/ubuntumirclient/qmirclientintegration.h'
--- src/ubuntumirclient/integration.h 2016-12-09 17:02:57 +0000
+++ src/ubuntumirclient/qmirclientintegration.h 2017-02-08 16:34:34 +0000
@@ -1,28 +1,52 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014,2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTU_CLIENT_INTEGRATION_H17** GNU Lesser General Public License Usage
18#define UBUNTU_CLIENT_INTEGRATION_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTINTEGRATION_H
42#define QMIRCLIENTINTEGRATION_H
1943
20#include <qpa/qplatformintegration.h>44#include <qpa/qplatformintegration.h>
21#include <QSharedPointer>45#include <QSharedPointer>
2246
23#include "appstatecontroller.h"47#include "qmirclientappstatecontroller.h"
24#include "platformservices.h"48#include "qmirclientplatformservices.h"
25#include "screenobserver.h"49#include "qmirclientscreenobserver.h"
2650
27// platform-api51// platform-api
28#include <ubuntu/application/description.h>52#include <ubuntu/application/description.h>
@@ -30,19 +54,19 @@
3054
31#include <EGL/egl.h>55#include <EGL/egl.h>
3256
33class UbuntuDebugExtension;57class QMirClientDebugExtension;
34class UbuntuInput;58class QMirClientInput;
35class UbuntuNativeInterface;59class QMirClientNativeInterface;
36class UbuntuScreen;60class QMirClientScreen;
37class MirConnection;61class MirConnection;
3862
39class UbuntuClientIntegration : public QObject, public QPlatformIntegration63class QMirClientClientIntegration : public QObject, public QPlatformIntegration
40{64{
41 Q_OBJECT65 Q_OBJECT
4266
43public:67public:
44 UbuntuClientIntegration(int argc, char **argv);68 QMirClientClientIntegration(int argc, char **argv);
45 virtual ~UbuntuClientIntegration();69 virtual ~QMirClientClientIntegration();
4670
47 // QPlatformIntegration methods.71 // QPlatformIntegration methods.
48 bool hasCapability(QPlatformIntegration::Capability cap) const override;72 bool hasCapability(QPlatformIntegration::Capability cap) const override;
@@ -66,12 +90,12 @@
66 MirConnection *mirConnection() const { return mMirConnection; }90 MirConnection *mirConnection() const { return mMirConnection; }
67 EGLDisplay eglDisplay() const { return mEglDisplay; }91 EGLDisplay eglDisplay() const { return mEglDisplay; }
68 EGLNativeDisplayType eglNativeDisplay() const { return mEglNativeDisplay; }92 EGLNativeDisplayType eglNativeDisplay() const { return mEglNativeDisplay; }
69 UbuntuAppStateController *appStateController() const { return mAppStateController.data(); }93 QMirClientAppStateController *appStateController() const { return mAppStateController.data(); }
70 UbuntuScreenObserver *screenObserver() const { return mScreenObserver.data(); }94 QMirClientScreenObserver *screenObserver() const { return mScreenObserver.data(); }
71 UbuntuDebugExtension *debugExtension() const { return mDebugExtension.data(); }95 QMirClientDebugExtension *debugExtension() const { return mDebugExtension.data(); }
7296
73private Q_SLOTS:97private Q_SLOTS:
74 void destroyScreen(UbuntuScreen *screen);98 void destroyScreen(QMirClientScreen *screen);
7599
76private:100private:
77 void setupOptions(QStringList &args);101 void setupOptions(QStringList &args);
@@ -79,17 +103,17 @@
79 static QByteArray generateSessionName(QStringList &args);103 static QByteArray generateSessionName(QStringList &args);
80 static QByteArray generateSessionNameFromQmlFile(QStringList &args);104 static QByteArray generateSessionNameFromQmlFile(QStringList &args);
81105
82 UbuntuNativeInterface* mNativeInterface;106 QMirClientNativeInterface* mNativeInterface;
83 QPlatformFontDatabase* mFontDb;107 QPlatformFontDatabase* mFontDb;
84108
85 UbuntuPlatformServices* mServices;109 QMirClientPlatformServices* mServices;
86110
87 UbuntuInput* mInput;111 QMirClientInput* mInput;
88 QPlatformInputContext* mInputContext;112 QPlatformInputContext* mInputContext;
89 mutable QScopedPointer<QPlatformAccessibility> mAccessibility;113 mutable QScopedPointer<QPlatformAccessibility> mAccessibility;
90 QScopedPointer<UbuntuDebugExtension> mDebugExtension;114 QScopedPointer<QMirClientDebugExtension> mDebugExtension;
91 QScopedPointer<UbuntuScreenObserver> mScreenObserver;115 QScopedPointer<QMirClientScreenObserver> mScreenObserver;
92 QScopedPointer<UbuntuAppStateController> mAppStateController;116 QScopedPointer<QMirClientAppStateController> mAppStateController;
93 qreal mScaleFactor;117 qreal mScaleFactor;
94118
95 MirConnection *mMirConnection;119 MirConnection *mMirConnection;
@@ -104,4 +128,4 @@
104 EGLNativeDisplayType mEglNativeDisplay;128 EGLNativeDisplayType mEglNativeDisplay;
105};129};
106130
107#endif // UBUNTU_CLIENT_INTEGRATION_H131#endif // QMIRCLIENTINTEGRATION_H
108132
=== renamed file 'src/ubuntumirclient/logging.h' => 'src/ubuntumirclient/qmirclientlogging.h'
--- src/ubuntumirclient/logging.h 2016-12-09 17:02:57 +0000
+++ src/ubuntumirclient/qmirclientlogging.h 2017-02-08 16:34:34 +0000
@@ -1,31 +1,55 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014-2015 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef QUBUNTULOGGING_H17** GNU Lesser General Public License Usage
18#define QUBUNTULOGGING_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTLOGGING_H
42#define QMIRCLIENTLOGGING_H
1943
20#include <QLoggingCategory>44#include <QLoggingCategory>
2145
22#define ASSERT(cond) ((!(cond)) ? qt_assert(#cond,__FILE__,__LINE__) : qt_noop())46#define ASSERT(cond) ((!(cond)) ? qt_assert(#cond,__FILE__,__LINE__) : qt_noop())
2347
24Q_DECLARE_LOGGING_CATEGORY(ubuntumirclient)48Q_DECLARE_LOGGING_CATEGORY(mirclient)
25Q_DECLARE_LOGGING_CATEGORY(ubuntumirclientBufferSwap)49Q_DECLARE_LOGGING_CATEGORY(mirclientBufferSwap)
26Q_DECLARE_LOGGING_CATEGORY(ubuntumirclientInput)50Q_DECLARE_LOGGING_CATEGORY(mirclientInput)
27Q_DECLARE_LOGGING_CATEGORY(ubuntumirclientGraphics)51Q_DECLARE_LOGGING_CATEGORY(mirclientGraphics)
28Q_DECLARE_LOGGING_CATEGORY(ubuntumirclientCursor)52Q_DECLARE_LOGGING_CATEGORY(mirclientCursor)
29Q_DECLARE_LOGGING_CATEGORY(ubuntumirclientDebug)53Q_DECLARE_LOGGING_CATEGORY(mirclientDebug)
3054
31#endif // QUBUNTULOGGING_H55#endif // QMIRCLIENTLOGGING_H
3256
=== renamed file 'src/ubuntumirclient/nativeinterface.cpp' => 'src/ubuntumirclient/qmirclientnativeinterface.cpp'
--- src/ubuntumirclient/nativeinterface.cpp 2016-08-23 17:03:35 +0000
+++ src/ubuntumirclient/qmirclientnativeinterface.cpp 2017-02-08 16:34:34 +0000
@@ -1,63 +1,87 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014,2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
1640
17// Local41// Local
18#include "nativeinterface.h"42#include "qmirclientnativeinterface.h"
19#include "screen.h"43#include "qmirclientscreen.h"
20#include "glcontext.h"44#include "qmirclientglcontext.h"
21#include "window.h"45#include "qmirclientwindow.h"
2246
23// Qt47// Qt
24#include <private/qguiapplication_p.h>48#include <QtGui/private/qguiapplication_p.h>
25#include <QtGui/qopenglcontext.h>49#include <QtGui/qopenglcontext.h>
26#include <QtGui/qscreen.h>50#include <QtGui/qscreen.h>
27#include <QtCore/QMap>51#include <QtCore/QMap>
2852
29class UbuntuResourceMap : public QMap<QByteArray, UbuntuNativeInterface::ResourceType>53class UbuntuResourceMap : public QMap<QByteArray, QMirClientNativeInterface::ResourceType>
30{54{
31public:55public:
32 UbuntuResourceMap()56 UbuntuResourceMap()
33 : QMap<QByteArray, UbuntuNativeInterface::ResourceType>() {57 : QMap<QByteArray, QMirClientNativeInterface::ResourceType>() {
34 insert("egldisplay", UbuntuNativeInterface::EglDisplay);58 insert("egldisplay", QMirClientNativeInterface::EglDisplay);
35 insert("eglcontext", UbuntuNativeInterface::EglContext);59 insert("eglcontext", QMirClientNativeInterface::EglContext);
36 insert("nativeorientation", UbuntuNativeInterface::NativeOrientation);60 insert("nativeorientation", QMirClientNativeInterface::NativeOrientation);
37 insert("display", UbuntuNativeInterface::Display);61 insert("display", QMirClientNativeInterface::Display);
38 insert("mirconnection", UbuntuNativeInterface::MirConnection);62 insert("mirconnection", QMirClientNativeInterface::MirConnection);
39 insert("mirsurface", UbuntuNativeInterface::MirSurface);63 insert("mirsurface", QMirClientNativeInterface::MirSurface);
40 insert("scale", UbuntuNativeInterface::Scale);64 insert("scale", QMirClientNativeInterface::Scale);
41 insert("formfactor", UbuntuNativeInterface::FormFactor);65 insert("formfactor", QMirClientNativeInterface::FormFactor);
42 }66 }
43};67};
4468
45Q_GLOBAL_STATIC(UbuntuResourceMap, ubuntuResourceMap)69Q_GLOBAL_STATIC(UbuntuResourceMap, ubuntuResourceMap)
4670
47UbuntuNativeInterface::UbuntuNativeInterface(const UbuntuClientIntegration *integration)71QMirClientNativeInterface::QMirClientNativeInterface(const QMirClientClientIntegration *integration)
48 : mIntegration(integration)72 : mIntegration(integration)
49 , mGenericEventFilterType(QByteArrayLiteral("Event"))73 , mGenericEventFilterType(QByteArrayLiteral("Event"))
50 , mNativeOrientation(nullptr)74 , mNativeOrientation(nullptr)
51{75{
52}76}
5377
54UbuntuNativeInterface::~UbuntuNativeInterface()78QMirClientNativeInterface::~QMirClientNativeInterface()
55{79{
56 delete mNativeOrientation;80 delete mNativeOrientation;
57 mNativeOrientation = nullptr;81 mNativeOrientation = nullptr;
58}82}
5983
60void* UbuntuNativeInterface::nativeResourceForIntegration(const QByteArray &resourceString)84void* QMirClientNativeInterface::nativeResourceForIntegration(const QByteArray &resourceString)
61{85{
62 const QByteArray lowerCaseResource = resourceString.toLower();86 const QByteArray lowerCaseResource = resourceString.toLower();
6387
@@ -67,14 +91,14 @@
6791
68 const ResourceType resourceType = ubuntuResourceMap()->value(lowerCaseResource);92 const ResourceType resourceType = ubuntuResourceMap()->value(lowerCaseResource);
6993
70 if (resourceType == UbuntuNativeInterface::MirConnection) {94 if (resourceType == QMirClientNativeInterface::MirConnection) {
71 return mIntegration->mirConnection();95 return mIntegration->mirConnection();
72 } else {96 } else {
73 return nullptr;97 return nullptr;
74 }98 }
75}99}
76100
77void* UbuntuNativeInterface::nativeResourceForContext(101void* QMirClientNativeInterface::nativeResourceForContext(
78 const QByteArray& resourceString, QOpenGLContext* context)102 const QByteArray& resourceString, QOpenGLContext* context)
79{103{
80 if (!context)104 if (!context)
@@ -87,13 +111,13 @@
87111
88 const ResourceType kResourceType = ubuntuResourceMap()->value(kLowerCaseResource);112 const ResourceType kResourceType = ubuntuResourceMap()->value(kLowerCaseResource);
89113
90 if (kResourceType == UbuntuNativeInterface::EglContext)114 if (kResourceType == QMirClientNativeInterface::EglContext)
91 return static_cast<UbuntuOpenGLContext*>(context->handle())->eglContext();115 return static_cast<QMirClientOpenGLContext*>(context->handle())->eglContext();
92 else116 else
93 return nullptr;117 return nullptr;
94}118}
95119
96void* UbuntuNativeInterface::nativeResourceForWindow(const QByteArray& resourceString, QWindow* window)120void* QMirClientNativeInterface::nativeResourceForWindow(const QByteArray& resourceString, QWindow* window)
97{121{
98 const QByteArray kLowerCaseResource = resourceString.toLower();122 const QByteArray kLowerCaseResource = resourceString.toLower();
99 if (!ubuntuResourceMap()->contains(kLowerCaseResource))123 if (!ubuntuResourceMap()->contains(kLowerCaseResource))
@@ -106,7 +130,7 @@
106 case NativeOrientation:130 case NativeOrientation:
107 // Return the device's native screen orientation.131 // Return the device's native screen orientation.
108 if (window) {132 if (window) {
109 UbuntuScreen *ubuntuScreen = static_cast<UbuntuScreen*>(window->screen()->handle());133 QMirClientScreen *ubuntuScreen = static_cast<QMirClientScreen*>(window->screen()->handle());
110 mNativeOrientation = new Qt::ScreenOrientation(ubuntuScreen->nativeOrientation());134 mNativeOrientation = new Qt::ScreenOrientation(ubuntuScreen->nativeOrientation());
111 } else {135 } else {
112 QPlatformScreen *platformScreen = QGuiApplication::primaryScreen()->handle();136 QPlatformScreen *platformScreen = QGuiApplication::primaryScreen()->handle();
@@ -115,7 +139,7 @@
115 return mNativeOrientation;139 return mNativeOrientation;
116 case MirSurface:140 case MirSurface:
117 if (window) {141 if (window) {
118 auto ubuntuWindow = static_cast<UbuntuWindow*>(window->handle());142 auto ubuntuWindow = static_cast<QMirClientWindow*>(window->handle());
119 if (ubuntuWindow) {143 if (ubuntuWindow) {
120 return ubuntuWindow->mirSurface();144 return ubuntuWindow->mirSurface();
121 } else {145 } else {
@@ -129,7 +153,7 @@
129 }153 }
130}154}
131155
132void* UbuntuNativeInterface::nativeResourceForScreen(const QByteArray& resourceString, QScreen* screen)156void* QMirClientNativeInterface::nativeResourceForScreen(const QByteArray& resourceString, QScreen* screen)
133{157{
134 const QByteArray kLowerCaseResource = resourceString.toLower();158 const QByteArray kLowerCaseResource = resourceString.toLower();
135 if (!ubuntuResourceMap()->contains(kLowerCaseResource))159 if (!ubuntuResourceMap()->contains(kLowerCaseResource))
@@ -137,28 +161,28 @@
137 const ResourceType kResourceType = ubuntuResourceMap()->value(kLowerCaseResource);161 const ResourceType kResourceType = ubuntuResourceMap()->value(kLowerCaseResource);
138 if (!screen)162 if (!screen)
139 screen = QGuiApplication::primaryScreen();163 screen = QGuiApplication::primaryScreen();
140 auto ubuntuScreen = static_cast<UbuntuScreen*>(screen->handle());164 auto ubuntuScreen = static_cast<QMirClientScreen*>(screen->handle());
141 if (kResourceType == UbuntuNativeInterface::Display) {165 if (kResourceType == QMirClientNativeInterface::Display) {
142 return mIntegration->eglNativeDisplay();166 return mIntegration->eglNativeDisplay();
143 // Changes to the following properties are emitted via the UbuntuNativeInterface::screenPropertyChanged167 // Changes to the following properties are emitted via the QMirClientNativeInterface::screenPropertyChanged
144 // signal fired by UbuntuScreen. Connect to this signal for these properties updates.168 // signal fired by QMirClientScreen. Connect to this signal for these properties updates.
145 // WARNING: code highly thread unsafe!169 // WARNING: code highly thread unsafe!
146 } else if (kResourceType == UbuntuNativeInterface::Scale) {170 } else if (kResourceType == QMirClientNativeInterface::Scale) {
147 // In application code, read with:171 // In application code, read with:
148 // float scale = *reinterpret_cast<float*>(nativeResourceForScreen("scale", screen()));172 // float scale = *reinterpret_cast<float*>(nativeResourceForScreen("scale", screen()));
149 return &ubuntuScreen->mScale;173 return &ubuntuScreen->mScale;
150 } else if (kResourceType == UbuntuNativeInterface::FormFactor) {174 } else if (kResourceType == QMirClientNativeInterface::FormFactor) {
151 return &ubuntuScreen->mFormFactor;175 return &ubuntuScreen->mFormFactor;
152 } else176 } else
153 return NULL;177 return NULL;
154}178}
155179
156// Changes to these properties are emitted via the UbuntuNativeInterface::windowPropertyChanged180// Changes to these properties are emitted via the QMirClientNativeInterface::windowPropertyChanged
157// signal fired by UbuntuWindow. Connect to this signal for these properties updates.181// signal fired by QMirClientWindow. Connect to this signal for these properties updates.
158QVariantMap UbuntuNativeInterface::windowProperties(QPlatformWindow *window) const182QVariantMap QMirClientNativeInterface::windowProperties(QPlatformWindow *window) const
159{183{
160 QVariantMap propertyMap;184 QVariantMap propertyMap;
161 auto w = static_cast<UbuntuWindow*>(window);185 auto w = static_cast<QMirClientWindow*>(window);
162 if (w) {186 if (w) {
163 propertyMap.insert("scale", w->scale());187 propertyMap.insert("scale", w->scale());
164 propertyMap.insert("formFactor", w->formFactor());188 propertyMap.insert("formFactor", w->formFactor());
@@ -167,9 +191,9 @@
167 return propertyMap;191 return propertyMap;
168}192}
169193
170QVariant UbuntuNativeInterface::windowProperty(QPlatformWindow *window, const QString &name) const194QVariant QMirClientNativeInterface::windowProperty(QPlatformWindow *window, const QString &name) const
171{195{
172 auto w = static_cast<UbuntuWindow*>(window);196 auto w = static_cast<QMirClientWindow*>(window);
173 if (!w) {197 if (!w) {
174 return QVariant();198 return QVariant();
175 }199 }
@@ -185,7 +209,7 @@
185 }209 }
186}210}
187211
188QVariant UbuntuNativeInterface::windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const212QVariant QMirClientNativeInterface::windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const
189{213{
190 QVariant returnVal = windowProperty(window, name);214 QVariant returnVal = windowProperty(window, name);
191 if (!returnVal.isValid()) {215 if (!returnVal.isValid()) {
192216
=== renamed file 'src/ubuntumirclient/nativeinterface.h' => 'src/ubuntumirclient/qmirclientnativeinterface.h'
--- src/ubuntumirclient/nativeinterface.h 2016-06-21 12:17:55 +0000
+++ src/ubuntumirclient/qmirclientnativeinterface.h 2017-02-08 16:34:34 +0000
@@ -1,35 +1,59 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014,2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTU_NATIVE_INTERFACE_H17** GNU Lesser General Public License Usage
18#define UBUNTU_NATIVE_INTERFACE_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTNATIVEINTERFACE_H
42#define QMIRCLIENTNATIVEINTERFACE_H
1943
20#include <qpa/qplatformnativeinterface.h>44#include <qpa/qplatformnativeinterface.h>
2145
22#include "integration.h"46#include "qmirclientintegration.h"
2347
24class QPlatformScreen;48class QPlatformScreen;
2549
26class UbuntuNativeInterface : public QPlatformNativeInterface {50class QMirClientNativeInterface : public QPlatformNativeInterface {
27 Q_OBJECT51 Q_OBJECT
28public:52public:
29 enum ResourceType { EglDisplay, EglContext, NativeOrientation, Display, MirConnection, MirSurface, Scale, FormFactor };53 enum ResourceType { EglDisplay, EglContext, NativeOrientation, Display, MirConnection, MirSurface, Scale, FormFactor };
3054
31 UbuntuNativeInterface(const UbuntuClientIntegration *integration);55 QMirClientNativeInterface(const QMirClientClientIntegration *integration);
32 ~UbuntuNativeInterface();56 ~QMirClientNativeInterface();
3357
34 // QPlatformNativeInterface methods.58 // QPlatformNativeInterface methods.
35 void* nativeResourceForIntegration(const QByteArray &resource) override;59 void* nativeResourceForIntegration(const QByteArray &resource) override;
@@ -51,9 +75,9 @@
51 void screenPropertyChanged(QPlatformScreen *screen, const QString &propertyName);75 void screenPropertyChanged(QPlatformScreen *screen, const QString &propertyName);
5276
53private:77private:
54 const UbuntuClientIntegration *mIntegration;78 const QMirClientClientIntegration *mIntegration;
55 const QByteArray mGenericEventFilterType;79 const QByteArray mGenericEventFilterType;
56 Qt::ScreenOrientation* mNativeOrientation;80 Qt::ScreenOrientation* mNativeOrientation;
57};81};
5882
59#endif // UBUNTU_NATIVE_INTERFACE_H83#endif // QMIRCLIENTNATIVEINTERFACE_H
6084
=== renamed file 'src/ubuntumirclient/orientationchangeevent_p.h' => 'src/ubuntumirclient/qmirclientorientationchangeevent_p.h'
--- src/ubuntumirclient/orientationchangeevent_p.h 2015-08-06 14:14:39 +0000
+++ src/ubuntumirclient/qmirclientorientationchangeevent_p.h 2017-02-08 16:34:34 +0000
@@ -1,24 +1,48 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef ORIENTATIONCHANGEEVENT_P_H17** GNU Lesser General Public License Usage
18#define ORIENTATIONCHANGEEVENT_P_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTORIENTATIONCHANGEEVENT_P_H
42#define QMIRCLIENTORIENTATIONCHANGEEVENT_P_H
1943
20#include <QEvent>44#include <QEvent>
21#include "logging.h"45#include "qmirclientlogging.h"
2246
23class OrientationChangeEvent : public QEvent {47class OrientationChangeEvent : public QEvent {
24public:48public:
@@ -34,4 +58,4 @@
34 Orientation mOrientation;58 Orientation mOrientation;
35};59};
3660
37#endif // ORIENTATIONCHANGEEVENT_P_H61#endif // QMIRCLIENTORIENTATIONCHANGEEVENT_P_H
3862
=== renamed file 'src/ubuntumirclient/platformservices.cpp' => 'src/ubuntumirclient/qmirclientplatformservices.cpp'
--- src/ubuntumirclient/platformservices.cpp 2014-06-18 23:10:00 +0000
+++ src/ubuntumirclient/qmirclientplatformservices.cpp 2017-02-08 16:34:34 +0000
@@ -1,37 +1,61 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#include "platformservices.h"17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#include "qmirclientplatformservices.h"
1842
19#include <QUrl>43#include <QUrl>
2044
21#include <ubuntu/application/url_dispatcher/service.h>45#include <ubuntu/application/url_dispatcher/service.h>
22#include <ubuntu/application/url_dispatcher/session.h>46#include <ubuntu/application/url_dispatcher/session.h>
2347
24bool UbuntuPlatformServices::openUrl(const QUrl &url)48bool QMirClientPlatformServices::openUrl(const QUrl &url)
25{49{
26 return callDispatcher(url);50 return callDispatcher(url);
27}51}
2852
29bool UbuntuPlatformServices::openDocument(const QUrl &url)53bool QMirClientPlatformServices::openDocument(const QUrl &url)
30{54{
31 return callDispatcher(url);55 return callDispatcher(url);
32}56}
3357
34bool UbuntuPlatformServices::callDispatcher(const QUrl &url)58bool QMirClientPlatformServices::callDispatcher(const QUrl &url)
35{59{
36 UAUrlDispatcherSession* session = ua_url_dispatcher_session();60 UAUrlDispatcherSession* session = ua_url_dispatcher_session();
37 if (!session)61 if (!session)
3862
=== renamed file 'src/ubuntumirclient/platformservices.h' => 'src/ubuntumirclient/qmirclientplatformservices.h'
--- src/ubuntumirclient/platformservices.h 2014-06-18 23:10:00 +0000
+++ src/ubuntumirclient/qmirclientplatformservices.h 2017-02-08 16:34:34 +0000
@@ -1,27 +1,51 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTU_PLATFORM_SERVICES_H17** GNU Lesser General Public License Usage
18#define UBUNTU_PLATFORM_SERVICES_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTPLATFORMSERVICES_H
42#define QMIRCLIENTPLATFORMSERVICES_H
1943
20#include <qpa/qplatformservices.h>44#include <qpa/qplatformservices.h>
21#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>45#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
22#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>46#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
2347
24class UbuntuPlatformServices : public QPlatformServices {48class QMirClientPlatformServices : public QPlatformServices {
25public:49public:
26 bool openUrl(const QUrl &url) override;50 bool openUrl(const QUrl &url) override;
27 bool openDocument(const QUrl &url) override;51 bool openDocument(const QUrl &url) override;
@@ -30,4 +54,4 @@
30 bool callDispatcher(const QUrl &url);54 bool callDispatcher(const QUrl &url);
31};55};
3256
33#endif // UBUNTU_PLATFORM_SERVICES_H57#endif // QMIRCLIENTPLATFORMSERVICES_H
3458
=== renamed file 'src/ubuntumirclient/plugin.cpp' => 'src/ubuntumirclient/qmirclientplugin.cpp'
--- src/ubuntumirclient/plugin.cpp 2016-12-09 17:02:57 +0000
+++ src/ubuntumirclient/qmirclientplugin.cpp 2017-02-08 16:34:34 +0000
@@ -1,39 +1,60 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014-2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#include "plugin.h"17** GNU Lesser General Public License Usage
18#include "integration.h"18** Alternatively, this file may be used under the terms of the GNU Lesser
19#include "logging.h"19** General Public License version 3 as published by the Free Software
20#include "qpa/qplatformwindow.h"20** Foundation and appearing in the file LICENSE.LGPL3 included in the
2121** packaging of this file. Please review the following information to
22Q_LOGGING_CATEGORY(ubuntumirclient, "ubuntumirclient", QtWarningMsg)22** ensure the GNU Lesser General Public License version 3 requirements
2323** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24QPlatformIntegration *UbuntuMirClientIntegrationPlugin::create(const QString &system,24**
25 const QStringList &/*paramList*/,25** GNU General Public License Usage
26 int &argc, char **argv)26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#include "qmirclientplugin.h"
42#include "qmirclientintegration.h"
43#include "qmirclientlogging.h"
44
45Q_LOGGING_CATEGORY(mirclient, "qt.qpa.mirclient", QtWarningMsg)
46
47QPlatformIntegration *QMirClientIntegrationPlugin::create(const QString &system,
48 const QStringList &/*paramList*/,
49 int &argc, char **argv)
27{50{
28 qRegisterMetaType<QPlatformWindow*>("QPlatformWindow*");
29
30 if (system.toLower() == QLatin1String("ubuntumirclient")) {51 if (system.toLower() == QLatin1String("ubuntumirclient")) {
31#ifdef PLATFORM_API_TOUCH52#ifdef PLATFORM_API_TOUCH
32 setenv("UBUNTU_PLATFORM_API_BACKEND", "touch_mirclient", 1);53 setenv("UBUNTU_PLATFORM_API_BACKEND", "touch_mirclient", 1);
33#else54#else
34 setenv("UBUNTU_PLATFORM_API_BACKEND", "desktop_mirclient", 1);55 setenv("UBUNTU_PLATFORM_API_BACKEND", "desktop_mirclient", 1);
35#endif56#endif
36 return new UbuntuClientIntegration(argc, argv);57 return new QMirClientClientIntegration(argc, argv);
37 } else {58 } else {
38 return 0;59 return 0;
39 }60 }
4061
=== renamed file 'src/ubuntumirclient/plugin.h' => 'src/ubuntumirclient/qmirclientplugin.h'
--- src/ubuntumirclient/plugin.h 2016-06-24 12:36:24 +0000
+++ src/ubuntumirclient/qmirclientplugin.h 2017-02-08 16:34:34 +0000
@@ -1,31 +1,56 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014-2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTU_CLIENT_PLUGIN_H17** GNU Lesser General Public License Usage
18#define UBUNTU_CLIENT_PLUGIN_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTPLUGIN_H
42#define QMIRCLIENTPLUGIN_H
1943
20#include <qpa/qplatformintegrationplugin.h>44#include <qpa/qplatformintegrationplugin.h>
2145
22class UbuntuMirClientIntegrationPlugin : public QPlatformIntegrationPlugin46class QMirClientIntegrationPlugin : public QPlatformIntegrationPlugin
23{47{
24 Q_OBJECT48 Q_OBJECT
25 Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "ubuntumirclient.json")49 Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "ubuntumirclient.json")
2650
27public:51public:
28 QPlatformIntegration *create(const QString &system, const QStringList &paramList, int &argc, char **argv) override;52 QPlatformIntegration *create(const QString &system, const QStringList &paramList,
53 int &argc, char **argv) override;
29};54};
3055
31#endif // UBUNTU_CLIENT_PLUGIN_H56#endif // QMIRCLIENTPLUGIN_H
3257
=== renamed file 'src/ubuntumirclient/screen.cpp' => 'src/ubuntumirclient/qmirclientscreen.cpp'
--- src/ubuntumirclient/screen.cpp 2016-09-14 14:43:12 +0000
+++ src/ubuntumirclient/qmirclientscreen.cpp 2017-02-08 16:34:34 +0000
@@ -1,24 +1,48 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014-2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2014-2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
1640
17// local41// local
18#include "screen.h"42#include "qmirclientscreen.h"
19#include "logging.h"43#include "qmirclientlogging.h"
20#include "orientationchangeevent_p.h"44#include "qmirclientorientationchangeevent_p.h"
21#include "nativeinterface.h"45#include "qmirclientnativeinterface.h"
2246
23#include <mir_toolkit/mir_client_library.h>47#include <mir_toolkit/mir_client_library.h>
2448
@@ -54,7 +78,7 @@
54 static_cast<QEvent::Type>(QEvent::registerEventType());78 static_cast<QEvent::Type>(QEvent::registerEventType());
5579
5680
57UbuntuScreen::UbuntuScreen(const MirOutput *output, MirConnection *connection)81QMirClientScreen::QMirClientScreen(const MirOutput *output, MirConnection *connection)
58 : mDevicePixelRatio(1.0)82 : mDevicePixelRatio(1.0)
59 , mFormat(QImage::Format_RGB32)83 , mFormat(QImage::Format_RGB32)
60 , mDepth(32)84 , mDepth(32)
@@ -67,11 +91,11 @@
67 setMirOutput(output);91 setMirOutput(output);
68}92}
6993
70UbuntuScreen::~UbuntuScreen()94QMirClientScreen::~QMirClientScreen()
71{95{
72}96}
7397
74void UbuntuScreen::customEvent(QEvent* event) {98void QMirClientScreen::customEvent(QEvent* event) {
75 Q_ASSERT(QThread::currentThread() == thread());99 Q_ASSERT(QThread::currentThread() == thread());
76100
77 OrientationChangeEvent* oReadingEvent = static_cast<OrientationChangeEvent*>(event);101 OrientationChangeEvent* oReadingEvent = static_cast<OrientationChangeEvent*>(event);
@@ -99,11 +123,11 @@
99 }123 }
100124
101 // Raise the event signal so that client apps know the orientation changed125 // Raise the event signal so that client apps know the orientation changed
102 qCDebug(ubuntumirclient, "UbuntuScreen::customEvent - handling orientation change to %s", orientationToStr(mCurrentOrientation));126 qCDebug(mirclient, "QMirClientScreen::customEvent - handling orientation change to %s", orientationToStr(mCurrentOrientation));
103 QWindowSystemInterface::handleScreenOrientationChange(screen(), mCurrentOrientation);127 QWindowSystemInterface::handleScreenOrientationChange(screen(), mCurrentOrientation);
104}128}
105129
106void UbuntuScreen::handleWindowSurfaceResize(int windowWidth, int windowHeight)130void QMirClientScreen::handleWindowSurfaceResize(int windowWidth, int windowHeight)
107{131{
108 if ((windowWidth > windowHeight && mGeometry.width() < mGeometry.height())132 if ((windowWidth > windowHeight && mGeometry.width() < mGeometry.height())
109 || (windowWidth < windowHeight && mGeometry.width() > mGeometry.height())) {133 || (windowWidth < windowHeight && mGeometry.width() > mGeometry.height())) {
@@ -120,7 +144,7 @@
120 mGeometry.setWidth(currGeometry.height());144 mGeometry.setWidth(currGeometry.height());
121 mGeometry.setHeight(currGeometry.width());145 mGeometry.setHeight(currGeometry.width());
122146
123 qCDebug(ubuntumirclient, "UbuntuScreen::handleWindowSurfaceResize - new screen geometry (w=%d, h=%d)",147 qCDebug(mirclient, "QMirClientScreen::handleWindowSurfaceResize - new screen geometry (w=%d, h=%d)",
124 mGeometry.width(), mGeometry.height());148 mGeometry.width(), mGeometry.height());
125 QWindowSystemInterface::handleScreenGeometryChange(screen(),149 QWindowSystemInterface::handleScreenGeometryChange(screen(),
126 mGeometry /* newGeometry */,150 mGeometry /* newGeometry */,
@@ -131,12 +155,12 @@
131 } else {155 } else {
132 mCurrentOrientation = Qt::LandscapeOrientation;156 mCurrentOrientation = Qt::LandscapeOrientation;
133 }157 }
134 qCDebug(ubuntumirclient, "UbuntuScreen::handleWindowSurfaceResize - new orientation %s",orientationToStr(mCurrentOrientation));158 qCDebug(mirclient, "QMirClientScreen::handleWindowSurfaceResize - new orientation %s",orientationToStr(mCurrentOrientation));
135 QWindowSystemInterface::handleScreenOrientationChange(screen(), mCurrentOrientation);159 QWindowSystemInterface::handleScreenOrientationChange(screen(), mCurrentOrientation);
136 }160 }
137}161}
138162
139void UbuntuScreen::setMirOutput(const MirOutput *output)163void QMirClientScreen::setMirOutput(const MirOutput *output)
140{164{
141 // Physical screen size (in mm)165 // Physical screen size (in mm)
142 mPhysicalSize.setWidth(mir_output_get_physical_width_mm(output));166 mPhysicalSize.setWidth(mir_output_get_physical_width_mm(output));
@@ -181,7 +205,7 @@
181 mCurrentOrientation = (mNativeOrientation == Qt::LandscapeOrientation) ? Qt::LandscapeOrientation : Qt::PortraitOrientation;205 mCurrentOrientation = (mNativeOrientation == Qt::LandscapeOrientation) ? Qt::LandscapeOrientation : Qt::PortraitOrientation;
182}206}
183207
184void UbuntuScreen::updateMirOutput(const MirOutput *output)208void QMirClientScreen::updateMirOutput(const MirOutput *output)
185{209{
186 auto oldRefreshRate = mRefreshRate;210 auto oldRefreshRate = mRefreshRate;
187 auto oldScale = mScale;211 auto oldScale = mScale;
@@ -201,7 +225,7 @@
201 QWindowSystemInterface::handleScreenRefreshRateChange(screen(), mRefreshRate);225 QWindowSystemInterface::handleScreenRefreshRateChange(screen(), mRefreshRate);
202 }226 }
203227
204 auto nativeInterface = static_cast<UbuntuNativeInterface *>(qGuiApp->platformNativeInterface());228 auto nativeInterface = static_cast<QMirClientNativeInterface *>(qGuiApp->platformNativeInterface());
205 if (!qFuzzyCompare(mScale, oldScale)) {229 if (!qFuzzyCompare(mScale, oldScale)) {
206 nativeInterface->screenPropertyChanged(this, QStringLiteral("scale"));230 nativeInterface->screenPropertyChanged(this, QStringLiteral("scale"));
207 }231 }
@@ -210,14 +234,14 @@
210 }234 }
211}235}
212236
213void UbuntuScreen::setAdditionalMirDisplayProperties(float scale, MirFormFactor formFactor, int dpi)237void QMirClientScreen::setAdditionalMirDisplayProperties(float scale, MirFormFactor formFactor, int dpi)
214{238{
215 if (mDpi != dpi) {239 if (mDpi != dpi) {
216 mDpi = dpi;240 mDpi = dpi;
217 QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(), dpi, dpi);241 QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(), dpi, dpi);
218 }242 }
219243
220 auto nativeInterface = static_cast<UbuntuNativeInterface *>(qGuiApp->platformNativeInterface());244 auto nativeInterface = static_cast<QMirClientNativeInterface *>(qGuiApp->platformNativeInterface());
221 if (!qFuzzyCompare(mScale, scale)) {245 if (!qFuzzyCompare(mScale, scale)) {
222 mScale = scale;246 mScale = scale;
223 nativeInterface->screenPropertyChanged(this, QStringLiteral("scale"));247 nativeInterface->screenPropertyChanged(this, QStringLiteral("scale"));
@@ -228,7 +252,7 @@
228 }252 }
229}253}
230254
231QDpi UbuntuScreen::logicalDpi() const255QDpi QMirClientScreen::logicalDpi() const
232{256{
233 if (mDpi > 0) {257 if (mDpi > 0) {
234 return QDpi(mDpi, mDpi);258 return QDpi(mDpi, mDpi);
235259
=== renamed file 'src/ubuntumirclient/screen.h' => 'src/ubuntumirclient/qmirclientscreen.h'
--- src/ubuntumirclient/screen.h 2016-12-19 10:16:55 +0000
+++ src/ubuntumirclient/qmirclientscreen.h 2017-02-08 16:34:34 +0000
@@ -1,38 +1,62 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014-2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2014-2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTU_SCREEN_H17** GNU Lesser General Public License Usage
18#define UBUNTU_SCREEN_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTSCREEN_H
42#define QMIRCLIENTSCREEN_H
1943
20#include <qpa/qplatformscreen.h>44#include <qpa/qplatformscreen.h>
21#include <QSurfaceFormat>45#include <QSurfaceFormat>
2246
23#include <mir_toolkit/common.h> // just for MirFormFactor enum47#include <mir_toolkit/common.h> // just for MirFormFactor enum
2448
25#include "cursor.h"49#include "qmirclientcursor.h"
2650
27struct MirConnection;51struct MirConnection;
28struct MirOutput;52struct MirOutput;
2953
30class UbuntuScreen : public QObject, public QPlatformScreen54class QMirClientScreen : public QObject, public QPlatformScreen
31{55{
32 Q_OBJECT56 Q_OBJECT
33public:57public:
34 UbuntuScreen(const MirOutput *output, MirConnection *connection);58 QMirClientScreen(const MirOutput *output, MirConnection *connection);
35 virtual ~UbuntuScreen();59 virtual ~QMirClientScreen();
3660
37 // QPlatformScreen methods.61 // QPlatformScreen methods.
38 QImage::Format format() const override { return mFormat; }62 QImage::Format format() const override { return mFormat; }
@@ -44,7 +68,7 @@
44 QDpi logicalDpi() const override;68 QDpi logicalDpi() const override;
45 Qt::ScreenOrientation nativeOrientation() const override { return mNativeOrientation; }69 Qt::ScreenOrientation nativeOrientation() const override { return mNativeOrientation; }
46 Qt::ScreenOrientation orientation() const override { return mNativeOrientation; }70 Qt::ScreenOrientation orientation() const override { return mNativeOrientation; }
47 QPlatformCursor *cursor() const override { return const_cast<UbuntuCursor*>(&mCursor); }71 QPlatformCursor *cursor() const override { return const_cast<QMirClientCursor*>(&mCursor); }
4872
49 // Additional Screen properties from Mir73 // Additional Screen properties from Mir
50 int mirOutputId() const { return mOutputId; }74 int mirOutputId() const { return mOutputId; }
@@ -74,9 +98,9 @@
74 MirFormFactor mFormFactor;98 MirFormFactor mFormFactor;
75 float mScale;99 float mScale;
76 int mOutputId;100 int mOutputId;
77 UbuntuCursor mCursor;101 QMirClientCursor mCursor;
78102
79 friend class UbuntuNativeInterface;103 friend class QMirClientNativeInterface;
80};104};
81105
82#endif // UBUNTU_SCREEN_H106#endif // QMIRCLIENTSCREEN_H
83107
=== renamed file 'src/ubuntumirclient/screenobserver.cpp' => 'src/ubuntumirclient/qmirclientscreenobserver.cpp'
--- src/ubuntumirclient/screenobserver.cpp 2016-09-14 14:43:12 +0000
+++ src/ubuntumirclient/qmirclientscreenobserver.cpp 2017-02-08 16:34:34 +0000
@@ -1,23 +1,47 @@
1/*1/****************************************************************************
2 * Copyright (C) 2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#include "screenobserver.h"17** GNU Lesser General Public License Usage
18#include "screen.h"18** Alternatively, this file may be used under the terms of the GNU Lesser
19#include "window.h"19** General Public License version 3 as published by the Free Software
20#include "logging.h"20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#include "qmirclientscreenobserver.h"
42#include "qmirclientscreen.h"
43#include "qmirclientwindow.h"
44#include "qmirclientlogging.h"
2145
22// Qt46// Qt
23#include <QMetaObject>47#include <QMetaObject>
@@ -33,7 +57,7 @@
33 static void displayConfigurationChangedCallback(MirConnection */*connection*/, void* context)57 static void displayConfigurationChangedCallback(MirConnection */*connection*/, void* context)
34 {58 {
35 ASSERT(context != NULL);59 ASSERT(context != NULL);
36 UbuntuScreenObserver *observer = static_cast<UbuntuScreenObserver *>(context);60 QMirClientScreenObserver *observer = static_cast<QMirClientScreenObserver *>(context);
37 QMetaObject::invokeMethod(observer, "update");61 QMetaObject::invokeMethod(observer, "update");
38 }62 }
3963
@@ -51,14 +75,14 @@
51 }75 }
52} // anonymous namespace76} // anonymous namespace
5377
54UbuntuScreenObserver::UbuntuScreenObserver(MirConnection *mirConnection)78QMirClientScreenObserver::QMirClientScreenObserver(MirConnection *mirConnection)
55 : mMirConnection(mirConnection)79 : mMirConnection(mirConnection)
56{80{
57 mir_connection_set_display_config_change_callback(mirConnection, ::displayConfigurationChangedCallback, this);81 mir_connection_set_display_config_change_callback(mirConnection, ::displayConfigurationChangedCallback, this);
58 update();82 update();
59}83}
6084
61void UbuntuScreenObserver::update()85void QMirClientScreenObserver::update()
62{86{
63 // Wrap MirDisplayConfiguration to always delete when out of scope87 // Wrap MirDisplayConfiguration to always delete when out of scope
64 auto configDeleter = [](MirDisplayConfig *config) { mir_display_config_release(config); };88 auto configDeleter = [](MirDisplayConfig *config) { mir_display_config_release(config); };
@@ -66,22 +90,22 @@
66 configUp displayConfig(mir_connection_create_display_configuration(mMirConnection), configDeleter);90 configUp displayConfig(mir_connection_create_display_configuration(mMirConnection), configDeleter);
6791
68 // Mir only tells us something changed, it is up to us to figure out what.92 // Mir only tells us something changed, it is up to us to figure out what.
69 QList<UbuntuScreen*> newScreenList;93 QList<QMirClientScreen*> newScreenList;
70 QList<UbuntuScreen*> oldScreenList = mScreenList;94 QList<QMirClientScreen*> oldScreenList = mScreenList;
71 mScreenList.clear();95 mScreenList.clear();
7296
73 for (int i = 0; i < mir_display_config_get_num_outputs(displayConfig.get()); i++) {97 for (int i = 0; i < mir_display_config_get_num_outputs(displayConfig.get()); i++) {
74 const MirOutput *output = mir_display_config_get_output(displayConfig.get(), i);98 const MirOutput *output = mir_display_config_get_output(displayConfig.get(), i);
75 if (mir_output_is_enabled(output)) {99 if (mir_output_is_enabled(output)) {
76 UbuntuScreen *screen = findScreenWithId(oldScreenList, mir_output_get_id(output));100 QMirClientScreen *screen = findScreenWithId(oldScreenList, mir_output_get_id(output));
77 if (screen) { // we've already set up this display before101 if (screen) { // we've already set up this display before
78 screen->updateMirOutput(output);102 screen->updateMirOutput(output);
79 oldScreenList.removeAll(screen);103 oldScreenList.removeAll(screen);
80 } else {104 } else {
81 // new display, so create UbuntuScreen for it105 // new display, so create QMirClientScreen for it
82 screen = new UbuntuScreen(output, mMirConnection);106 screen = new QMirClientScreen(output, mMirConnection);
83 newScreenList.append(screen);107 newScreenList.append(screen);
84 qCDebug(ubuntumirclient) << "Added Screen with id" << mir_output_get_id(output)108 qCDebug(mirclient) << "Added Screen with id" << mir_output_get_id(output)
85 << "and geometry" << screen->geometry();109 << "and geometry" << screen->geometry();
86 }110 }
87 mScreenList.append(screen);111 mScreenList.append(screen);
@@ -104,22 +128,22 @@
104 Q_EMIT screenAdded(screen);128 Q_EMIT screenAdded(screen);
105 }129 }
106130
107 qCDebug(ubuntumirclient) << "=======================================";131 qCDebug(mirclient) << "=======================================";
108 for (auto screen: mScreenList) {132 for (auto screen: mScreenList) {
109 qCDebug(ubuntumirclient) << screen << "- id:" << screen->mirOutputId()133 qCDebug(mirclient) << screen << "- id:" << screen->mirOutputId()
110 << "geometry:" << screen->geometry()134 << "geometry:" << screen->geometry()
111 << "form factor:" << mirFormFactorToStr(screen->formFactor())135 << "form factor:" << mirFormFactorToStr(screen->formFactor())
112 << "scale:" << screen->scale();136 << "scale:" << screen->scale();
113 }137 }
114 qCDebug(ubuntumirclient) << "=======================================";138 qCDebug(mirclient) << "=======================================";
115}139}
116140
117UbuntuScreen *UbuntuScreenObserver::findScreenWithId(int id)141QMirClientScreen *QMirClientScreenObserver::findScreenWithId(int id)
118{142{
119 return findScreenWithId(mScreenList, id);143 return findScreenWithId(mScreenList, id);
120}144}
121145
122UbuntuScreen *UbuntuScreenObserver::findScreenWithId(const QList<UbuntuScreen *> &list, int id)146QMirClientScreen *QMirClientScreenObserver::findScreenWithId(const QList<QMirClientScreen *> &list, int id)
123{147{
124 Q_FOREACH (const auto screen, list) {148 Q_FOREACH (const auto screen, list) {
125 if (screen->mirOutputId() == id) {149 if (screen->mirOutputId() == id) {
@@ -129,7 +153,7 @@
129 return nullptr;153 return nullptr;
130}154}
131155
132void UbuntuScreenObserver::handleScreenPropertiesChange(UbuntuScreen *screen, int dpi,156void QMirClientScreenObserver::handleScreenPropertiesChange(QMirClientScreen *screen, int dpi,
133 MirFormFactor formFactor, float scale)157 MirFormFactor formFactor, float scale)
134{158{
135 screen->setAdditionalMirDisplayProperties(scale, formFactor, dpi);159 screen->setAdditionalMirDisplayProperties(scale, formFactor, dpi);
136160
=== renamed file 'src/ubuntumirclient/screenobserver.h' => 'src/ubuntumirclient/qmirclientscreenobserver.h'
--- src/ubuntumirclient/screenobserver.h 2016-04-25 09:39:59 +0000
+++ src/ubuntumirclient/qmirclientscreenobserver.h 2017-02-08 16:34:34 +0000
@@ -1,54 +1,78 @@
1/*1/****************************************************************************
2 * Copyright (C) 2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTU_SCREEN_OBSERVER_H17** GNU Lesser General Public License Usage
18#define UBUNTU_SCREEN_OBSERVER_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTSCREENOBSERVER_H
42#define QMIRCLIENTSCREENOBSERVER_H
1943
20#include <QObject>44#include <QObject>
2145
22#include <mir_toolkit/mir_connection.h>46#include <mir_toolkit/mir_connection.h>
2347
24class UbuntuScreen;48class QMirClientScreen;
2549
26class UbuntuScreenObserver : public QObject50class QMirClientScreenObserver : public QObject
27{51{
28 Q_OBJECT52 Q_OBJECT
2953
30public:54public:
31 UbuntuScreenObserver(MirConnection *connection);55 QMirClientScreenObserver(MirConnection *connection);
3256
33 QList<UbuntuScreen*> screens() const { return mScreenList; }57 QList<QMirClientScreen*> screens() const { return mScreenList; }
34 UbuntuScreen *findScreenWithId(int id);58 QMirClientScreen *findScreenWithId(int id);
3559
36 void handleScreenPropertiesChange(UbuntuScreen *screen, int dpi,60 void handleScreenPropertiesChange(QMirClientScreen *screen, int dpi,
37 MirFormFactor formFactor, float scale);61 MirFormFactor formFactor, float scale);
3862
39Q_SIGNALS:63Q_SIGNALS:
40 void screenAdded(UbuntuScreen *screen);64 void screenAdded(QMirClientScreen *screen);
41 void screenRemoved(UbuntuScreen *screen);65 void screenRemoved(QMirClientScreen *screen);
4266
43private Q_SLOTS:67private Q_SLOTS:
44 void update();68 void update();
4569
46private:70private:
47 UbuntuScreen *findScreenWithId(const QList<UbuntuScreen *> &list, int id);71 QMirClientScreen *findScreenWithId(const QList<QMirClientScreen *> &list, int id);
48 void removeScreen(UbuntuScreen *screen);72 void removeScreen(QMirClientScreen *screen);
4973
50 MirConnection *mMirConnection;74 MirConnection *mMirConnection;
51 QList<UbuntuScreen*> mScreenList;75 QList<QMirClientScreen*> mScreenList;
52};76};
5377
54#endif // UBUNTU_SCREEN_OBSERVER_H78#endif // QMIRCLIENTSCREENOBSERVER_H
5579
=== renamed file 'src/ubuntumirclient/window.cpp' => 'src/ubuntumirclient/qmirclientwindow.cpp'
--- src/ubuntumirclient/window.cpp 2017-01-19 18:27:29 +0000
+++ src/ubuntumirclient/qmirclientwindow.cpp 2017-02-08 16:34:34 +0000
@@ -1,27 +1,51 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014-2017 Canonical, Ltd.2**
3 *3** Copyright (C) 2014-2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
1640
17// Local41// Local
18#include "window.h"42#include "qmirclientwindow.h"
19#include "debugextension.h"43#include "qmirclientdebugextension.h"
20#include "nativeinterface.h"44#include "qmirclientnativeinterface.h"
21#include "input.h"45#include "qmirclientinput.h"
22#include "integration.h"46#include "qmirclientintegration.h"
23#include "screen.h"47#include "qmirclientscreen.h"
24#include "logging.h"48#include "qmirclientlogging.h"
2549
26#include <mir_toolkit/mir_client_library.h>50#include <mir_toolkit/mir_client_library.h>
27#include <mir_toolkit/version.h>51#include <mir_toolkit/version.h>
@@ -31,21 +55,20 @@
31#include <QMutexLocker>55#include <QMutexLocker>
32#include <QSize>56#include <QSize>
33#include <QtMath>57#include <QtMath>
34#include <private/qeglconvenience_p.h>58#include <QtGui/private/qguiapplication_p.h>
35#include <private/qguiapplication_p.h>59#include <QtPlatformSupport/private/qeglconvenience_p.h>
3660
37// Platform API61// Platform API
38#include <ubuntu/application/instance.h>62#include <ubuntu/application/instance.h>
3963
40#include <EGL/egl.h>64#include <EGL/egl.h>
4165
42Q_LOGGING_CATEGORY(ubuntumirclientBufferSwap, "ubuntumirclient.bufferSwap", QtWarningMsg)66Q_LOGGING_CATEGORY(mirclientBufferSwap, "qt.qpa.mirclient.bufferSwap", QtWarningMsg)
4367
68namespace
69{
44const Qt::WindowType LowChromeWindowHint = (Qt::WindowType)0x00800000;70const Qt::WindowType LowChromeWindowHint = (Qt::WindowType)0x00800000;
4571
46namespace
47{
48
49// FIXME: this used to be defined by platform-api, but it's been removed in v3. Change ubuntu-keyboard to use72// FIXME: this used to be defined by platform-api, but it's been removed in v3. Change ubuntu-keyboard to use
50// a different enum for window roles.73// a different enum for window roles.
51enum UAUiWindowRole {74enum UAUiWindowRole {
@@ -196,10 +219,10 @@
196 return static_cast<UAUiWindowRole>(role);219 return static_cast<UAUiWindowRole>(role);
197}220}
198221
199UbuntuWindow *transientParentFor(QWindow *window)222QMirClientWindow *transientParentFor(QWindow *window)
200{223{
201 QWindow *parent = window->transientParent();224 QWindow *parent = window->transientParent();
202 return parent ? static_cast<UbuntuWindow *>(parent->handle()) : nullptr;225 return parent ? static_cast<QMirClientWindow *>(parent->handle()) : nullptr;
203}226}
204227
205bool requiresParent(const MirSurfaceType type)228bool requiresParent(const MirSurfaceType type)
@@ -222,7 +245,7 @@
222 return requiresParent(qtWindowTypeToMirSurfaceType(type));245 return requiresParent(qtWindowTypeToMirSurfaceType(type));
223}246}
224247
225Spec makeSurfaceSpec(QWindow *window, MirPixelFormat pixelFormat, UbuntuWindow *parentWindowHandle,248Spec makeSurfaceSpec(QWindow *window, MirPixelFormat pixelFormat, QMirClientWindow *parentWindowHandle,
226 MirConnection *connection)249 MirConnection *connection)
227{250{
228 const auto geometry = window->geometry();251 const auto geometry = window->geometry();
@@ -273,7 +296,7 @@
273 break;296 break;
274 }297 }
275298
276 qCDebug(ubuntumirclient, "makeSurfaceSpec(window=%p): %s spec (type=0x%x, position=(%d, %d)px, size=(%dx%d)px)",299 qCDebug(mirclient, "makeSurfaceSpec(window=%p): %s spec (type=0x%x, position=(%d, %d)px, size=(%dx%d)px)",
277 window, mirSurfaceTypeToStr(type), window->type(), location.left, location.top, width, height);300 window, mirSurfaceTypeToStr(type), window->type(), location.left, location.top, width, height);
278301
279 return std::move(spec);302 return std::move(spec);
@@ -297,7 +320,7 @@
297 }320 }
298}321}
299322
300MirSurface *createMirSurface(QWindow *window, int mirOutputId, UbuntuWindow *parentWindowHandle,323MirSurface *createMirSurface(QWindow *window, int mirOutputId, QMirClientWindow *parentWindowHandle,
301 MirPixelFormat pixelFormat, MirConnection *connection,324 MirPixelFormat pixelFormat, MirConnection *connection,
302 mir_surface_event_callback inputCallback, void *inputContext)325 mir_surface_event_callback inputCallback, void *inputContext)
303{326{
@@ -328,9 +351,9 @@
328 return surface;351 return surface;
329}352}
330353
331UbuntuWindow *getParentIfNecessary(QWindow *window, UbuntuInput *input)354QMirClientWindow *getParentIfNecessary(QWindow *window, QMirClientInput *input)
332{355{
333 UbuntuWindow *parentWindowHandle = nullptr;356 QMirClientWindow *parentWindowHandle = nullptr;
334 if (requiresParent(window->type())) {357 if (requiresParent(window->type())) {
335 parentWindowHandle = transientParentFor(window);358 parentWindowHandle = transientParentFor(window);
336 if (parentWindowHandle == nullptr) {359 if (parentWindowHandle == nullptr) {
@@ -344,7 +367,7 @@
344367
345MirPixelFormat disableAlphaBufferIfPossible(MirPixelFormat pixelFormat)368MirPixelFormat disableAlphaBufferIfPossible(MirPixelFormat pixelFormat)
346{369{
347 switch(pixelFormat) {370 switch (pixelFormat) {
348 case mir_pixel_format_abgr_8888:371 case mir_pixel_format_abgr_8888:
349 return mir_pixel_format_xbgr_8888;372 return mir_pixel_format_xbgr_8888;
350 case mir_pixel_format_argb_8888:373 case mir_pixel_format_argb_8888:
@@ -378,7 +401,7 @@
378class UbuntuSurface401class UbuntuSurface
379{402{
380public:403public:
381 UbuntuSurface(UbuntuWindow *platformWindow, EGLDisplay display, UbuntuInput *input, MirConnection *connection);404 UbuntuSurface(QMirClientWindow *platformWindow, EGLDisplay display, QMirClientInput *input, MirConnection *connection);
382 ~UbuntuSurface();405 ~UbuntuSurface();
383406
384 UbuntuSurface(const UbuntuSurface &) = delete;407 UbuntuSurface(const UbuntuSurface &) = delete;
@@ -416,10 +439,10 @@
416 void postEvent(const MirEvent *event);439 void postEvent(const MirEvent *event);
417440
418 QWindow * const mWindow;441 QWindow * const mWindow;
419 UbuntuWindow * const mPlatformWindow;442 QMirClientWindow * const mPlatformWindow;
420 UbuntuInput * const mInput;443 QMirClientInput * const mInput;
421 MirConnection * const mConnection;444 MirConnection * const mConnection;
422 UbuntuWindow * mParentWindowHandle{nullptr};445 QMirClientWindow * mParentWindowHandle{nullptr};
423446
424 MirSurface* mMirSurface;447 MirSurface* mMirSurface;
425 const EGLDisplay mEglDisplay;448 const EGLDisplay mEglDisplay;
@@ -437,7 +460,7 @@
437 QString mPersistentIdStr;460 QString mPersistentIdStr;
438};461};
439462
440UbuntuSurface::UbuntuSurface(UbuntuWindow *platformWindow, EGLDisplay display, UbuntuInput *input, MirConnection *connection)463UbuntuSurface::UbuntuSurface(QMirClientWindow *platformWindow, EGLDisplay display, QMirClientInput *input, MirConnection *connection)
441 : mWindow(platformWindow->window())464 : mWindow(platformWindow->window())
442 , mPlatformWindow(platformWindow)465 , mPlatformWindow(platformWindow)
443 , mInput(input)466 , mInput(input)
@@ -453,12 +476,12 @@
453 if (config == 0) {476 if (config == 0) {
454 // Older Intel Atom-based devices only support OpenGL 1.4 compatibility profile but by default477 // Older Intel Atom-based devices only support OpenGL 1.4 compatibility profile but by default
455 // QML asks for at least OpenGL 2.0. The XCB GLX backend ignores this request and returns a478 // QML asks for at least OpenGL 2.0. The XCB GLX backend ignores this request and returns a
456 // 1.4 context, but the XCB EGL backend tries to honour it, and fails. The 1.4 context appears to479 // 1.4 context, but the XCB EGL backend tries to honor it, and fails. The 1.4 context appears to
457 // have sufficient capabilities on MESA (i915) to render correctly however. So reduce the default480 // have sufficient capabilities on MESA (i915) to render correctly however. So reduce the default
458 // requested OpenGL version to 1.0 to ensure EGL will give us a working context (lp:1549455).481 // requested OpenGL version to 1.0 to ensure EGL will give us a working context (lp:1549455).
459 static const bool isMesa = QString(eglQueryString(display, EGL_VENDOR)).contains(QStringLiteral("Mesa"));482 static const bool isMesa = QString(eglQueryString(display, EGL_VENDOR)).contains(QStringLiteral("Mesa"));
460 if (isMesa) {483 if (isMesa) {
461 qCDebug(ubuntumirclientGraphics, "Attempting to choose OpenGL 1.4 context which may suit Mesa");484 qCDebug(mirclientGraphics, "Attempting to choose OpenGL 1.4 context which may suit Mesa");
462 mFormat.setMajorVersion(1);485 mFormat.setMajorVersion(1);
463 mFormat.setMinorVersion(4);486 mFormat.setMinorVersion(4);
464 config = q_configFromGLFormat(display, mFormat, true);487 config = q_configFromGLFormat(display, mFormat, true);
@@ -475,12 +498,12 @@
475 mPixelFormat = mir_connection_get_egl_pixel_format(connection, display, config);498 mPixelFormat = mir_connection_get_egl_pixel_format(connection, display, config);
476 // But the chosen EGLConfig might have an alpha buffer enabled, even if not requested by the client.499 // But the chosen EGLConfig might have an alpha buffer enabled, even if not requested by the client.
477 // If that's the case, try to edit the chosen pixel format in order to disable the alpha buffer.500 // If that's the case, try to edit the chosen pixel format in order to disable the alpha buffer.
478 // This is an optimisation for the compositor, as it can avoid blending this surface.501 // This is an optimization for the compositor, as it can avoid blending this surface.
479 if (mWindow->requestedFormat().alphaBufferSize() < 0) {502 if (mWindow->requestedFormat().alphaBufferSize() < 0) {
480 mPixelFormat = disableAlphaBufferIfPossible(mPixelFormat);503 mPixelFormat = disableAlphaBufferIfPossible(mPixelFormat);
481 }504 }
482505
483 const auto outputId = static_cast<UbuntuScreen *>(mWindow->screen()->handle())->mirOutputId();506 const auto outputId = static_cast<QMirClientScreen *>(mWindow->screen()->handle())->mirOutputId();
484507
485 mParentWindowHandle = getParentIfNecessary(mWindow, input);508 mParentWindowHandle = getParentIfNecessary(mWindow, input);
486509
@@ -503,12 +526,12 @@
503 platformWindow->QPlatformWindow::setGeometry(geom);526 platformWindow->QPlatformWindow::setGeometry(geom);
504 QWindowSystemInterface::handleGeometryChange(mWindow, geom);527 QWindowSystemInterface::handleGeometryChange(mWindow, geom);
505528
506 qCDebug(ubuntumirclient) << "Created surface with geometry:" << geom << "title:" << mWindow->title()529 qCDebug(mirclient) << "Created surface with geometry:" << geom << "title:" << mWindow->title()
507 << "role:" << roleFor(mWindow);530 << "role:" << roleFor(mWindow);
508 qCDebug(ubuntumirclientGraphics)531 qCDebug(mirclientGraphics)
509 << "Requested format:" << mWindow->requestedFormat()532 << "Requested format:" << mWindow->requestedFormat()
510 << "\nActual format:" << mFormat533 << "\nActual format:" << mFormat
511 << "with associated Mir pixel format:" << mirPixelFormatToStr(mPixelFormat);534 << "with associated Mir pixel format:" << mirPixelFormatToStr(mPixelFormat);
512}535}
513536
514UbuntuSurface::~UbuntuSurface()537UbuntuSurface::~UbuntuSurface()
@@ -531,14 +554,14 @@
531 MirRectangle mirRect {0,0,0,0};554 MirRectangle mirRect {0,0,0,0};
532555
533 if (mParentWindowHandle) {556 if (mParentWindowHandle) {
534 qCDebug(ubuntumirclient,"updateGeometry(window=%p, x=%d, y=%d, width=%d, height=%d, child)", mWindow,557 qCDebug(mirclient,"updateGeometry(window=%p, x=%d, y=%d, width=%d, height=%d, child)", mWindow,
535 newGeometry.x(), newGeometry.y(), newGeometry.width(), newGeometry.height());558 newGeometry.x(), newGeometry.y(), newGeometry.width(), newGeometry.height());
536559
537 mirRect.left = newGeometry.x() - mParentWindowHandle->window()->x();560 mirRect.left = newGeometry.x() - mParentWindowHandle->window()->x();
538 mirRect.top = newGeometry.y() - mParentWindowHandle->window()->y();561 mirRect.top = newGeometry.y() - mParentWindowHandle->window()->y();
539562
540 } else {563 } else {
541 qCDebug(ubuntumirclient,"updateGeometry(window=%p, x=%d, y=%d, width=%d, height=%d, top-level)", mWindow,564 qCDebug(mirclient,"updateGeometry(window=%p, x=%d, y=%d, width=%d, height=%d, top-level)", mWindow,
542 newGeometry.x(), newGeometry.y(), newGeometry.width(), newGeometry.height());565 newGeometry.x(), newGeometry.y(), newGeometry.width(), newGeometry.height());
543566
544 mirRect.left = newGeometry.x();567 mirRect.left = newGeometry.x();
@@ -627,7 +650,7 @@
627650
628 if (validSize && (mBufferSize.width() != eglSurfaceWidth || mBufferSize.height() != eglSurfaceHeight)) {651 if (validSize && (mBufferSize.width() != eglSurfaceWidth || mBufferSize.height() != eglSurfaceHeight)) {
629652
630 qCDebug(ubuntumirclientBufferSwap, "onSwapBuffersDone(window=%p) [%d] - size changed (%d, %d) => (%d, %d)",653 qCDebug(mirclientBufferSwap, "onSwapBuffersDone(window=%p) [%d] - size changed (%d, %d) => (%d, %d)",
631 mWindow, sFrameNumber, mBufferSize.width(), mBufferSize.height(), eglSurfaceWidth, eglSurfaceHeight);654 mWindow, sFrameNumber, mBufferSize.width(), mBufferSize.height(), eglSurfaceWidth, eglSurfaceHeight);
632655
633 mBufferSize.rwidth() = eglSurfaceWidth;656 mBufferSize.rwidth() = eglSurfaceWidth;
@@ -639,7 +662,7 @@
639 mPlatformWindow->QPlatformWindow::setGeometry(newGeometry);662 mPlatformWindow->QPlatformWindow::setGeometry(newGeometry);
640 QWindowSystemInterface::handleGeometryChange(mWindow, newGeometry);663 QWindowSystemInterface::handleGeometryChange(mWindow, newGeometry);
641 } else {664 } else {
642 qCDebug(ubuntumirclientBufferSwap, "onSwapBuffersDone(window=%p) [%d] - buffer size (%d,%d)",665 qCDebug(mirclientBufferSwap, "onSwapBuffersDone(window=%p) [%d] - buffer size (%d,%d)",
643 mWindow, sFrameNumber, mBufferSize.width(), mBufferSize.height());666 mWindow, sFrameNumber, mBufferSize.width(), mBufferSize.height());
644 }667 }
645}668}
@@ -664,7 +687,7 @@
664 const auto resizeEvent = mir_event_get_resize_event(event);687 const auto resizeEvent = mir_event_get_resize_event(event);
665 const auto width = mir_resize_event_get_width(resizeEvent);688 const auto width = mir_resize_event_get_width(resizeEvent);
666 const auto height = mir_resize_event_get_height(resizeEvent);689 const auto height = mir_resize_event_get_height(resizeEvent);
667 qCDebug(ubuntumirclient, "resizeEvent(window=%p, width=%d, height=%d)", mWindow, width, height);690 qCDebug(mirclient, "resizeEvent(window=%p, width=%d, height=%d)", mWindow, width, height);
668691
669 QMutexLocker lock(&mTargetSizeMutex);692 QMutexLocker lock(&mTargetSizeMutex);
670 mTargetSize.rwidth() = width;693 mTargetSize.rwidth() = width;
@@ -676,7 +699,7 @@
676699
677void UbuntuSurface::setSurfaceParent(MirSurface* parent)700void UbuntuSurface::setSurfaceParent(MirSurface* parent)
678{701{
679 qCDebug(ubuntumirclient, "setSurfaceParent(window=%p)", mWindow);702 qCDebug(mirclient, "setSurfaceParent(window=%p)", mWindow);
680703
681 mParented = true;704 mParented = true;
682 Spec spec{mir_connection_create_spec_for_changes(mConnection)};705 Spec spec{mir_connection_create_spec_for_changes(mConnection)};
@@ -694,25 +717,25 @@
694 return mPersistentIdStr;717 return mPersistentIdStr;
695}718}
696719
697UbuntuWindow::UbuntuWindow(QWindow *w, UbuntuInput *input, UbuntuNativeInterface *native,720QMirClientWindow::QMirClientWindow(QWindow *w, QMirClientInput *input, QMirClientNativeInterface *native,
698 UbuntuAppStateController *appState, EGLDisplay eglDisplay,721 QMirClientAppStateController *appState, EGLDisplay eglDisplay,
699 MirConnection *mirConnection, UbuntuDebugExtension *debugExt)722 MirConnection *mirConnection, QMirClientDebugExtension *debugExt)
700 : QObject(nullptr)723 : QObject(nullptr)
701 , QPlatformWindow(w)724 , QPlatformWindow(w)
702 , mId(makeId())725 , mId(makeId())
703 , mWindowState(w->windowState())726 , mWindowState(w->windowState())
704 , mWindowFlags(w->flags())727 , mWindowFlags(w->flags())
705 , mWindowVisible(false)728 , mWindowVisible(false)
729 , mAppStateController(appState)
706 , mDebugExtention(debugExt)730 , mDebugExtention(debugExt)
707 , mNativeInterface(native)731 , mNativeInterface(native)
708 , mAppStateController(appState)
709 , mSurface(new UbuntuSurface{this, eglDisplay, input, mirConnection})732 , mSurface(new UbuntuSurface{this, eglDisplay, input, mirConnection})
710 , mScale(1.0)733 , mScale(1.0)
711 , mFormFactor(mir_form_factor_unknown)734 , mFormFactor(mir_form_factor_unknown)
712{735{
713 mWindowExposed = mSurface->mNeedsExposeCatchup == false;736 mWindowExposed = mSurface->mNeedsExposeCatchup == false;
714737
715 qCDebug(ubuntumirclient, "UbuntuWindow(window=%p, screen=%p, input=%p, surf=%p) with title '%s', role: '%d'",738 qCDebug(mirclient, "QMirClientWindow(window=%p, screen=%p, input=%p, surf=%p) with title '%s', role: '%d'",
716 w, w->screen()->handle(), input, mSurface.get(), qPrintable(window()->title()), roleFor(window()));739 w, w->screen()->handle(), input, mSurface.get(), qPrintable(window()->title()), roleFor(window()));
717740
718 updatePanelHeightHack(mSurface->state() != mir_surface_state_fullscreen);741 updatePanelHeightHack(mSurface->state() != mir_surface_state_fullscreen);
@@ -723,15 +746,15 @@
723 Q_ARG(QString, "persistentSurfaceId"));746 Q_ARG(QString, "persistentSurfaceId"));
724}747}
725748
726UbuntuWindow::~UbuntuWindow()749QMirClientWindow::~QMirClientWindow()
727{750{
728 qCDebug(ubuntumirclient, "~UbuntuWindow(window=%p)", this);751 qCDebug(mirclient, "~QMirClientWindow(window=%p)", this);
729}752}
730753
731void UbuntuWindow::handleSurfaceResized(int width, int height)754void QMirClientWindow::handleSurfaceResized(int width, int height)
732{755{
733 QMutexLocker lock(&mMutex);756 QMutexLocker lock(&mMutex);
734 qCDebug(ubuntumirclient, "handleSurfaceResize(window=%p, size=(%dx%d)px", window(), width, height);757 qCDebug(mirclient, "handleSurfaceResize(window=%p, size=(%dx%d)px", window(), width, height);
735758
736 mSurface->handleSurfaceResized(width, height);759 mSurface->handleSurfaceResized(width, height);
737760
@@ -742,17 +765,17 @@
742 // A mir API to drop the currently held buffer would help here, so that we wouldn't have to redraw twice765 // A mir API to drop the currently held buffer would help here, so that we wouldn't have to redraw twice
743 auto const numRepaints = mSurface->needsRepaint();766 auto const numRepaints = mSurface->needsRepaint();
744 lock.unlock();767 lock.unlock();
745 qCDebug(ubuntumirclient, "handleSurfaceResize(window=%p) redraw %d times", window(), numRepaints);768 qCDebug(mirclient, "handleSurfaceResize(window=%p) redraw %d times", window(), numRepaints);
746 for (int i = 0; i < numRepaints; i++) {769 for (int i = 0; i < numRepaints; i++) {
747 qCDebug(ubuntumirclient, "handleSurfaceResize(window=%p) repainting size=(%dx%d)dp", window(), geometry().size().width(), geometry().size().height());770 qCDebug(mirclient, "handleSurfaceResize(window=%p) repainting size=(%dx%d)dp", window(), geometry().size().width(), geometry().size().height());
748 QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));771 QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));
749 }772 }
750}773}
751774
752void UbuntuWindow::handleSurfaceExposeChange(bool exposed)775void QMirClientWindow::handleSurfaceExposeChange(bool exposed)
753{776{
754 QMutexLocker lock(&mMutex);777 QMutexLocker lock(&mMutex);
755 qCDebug(ubuntumirclient, "handleSurfaceExposeChange(window=%p, exposed=%s)", window(), exposed ? "true" : "false");778 qCDebug(mirclient, "handleSurfaceExposeChange(window=%p, exposed=%s)", window(), exposed ? "true" : "false");
756779
757 mSurface->mNeedsExposeCatchup = false;780 mSurface->mNeedsExposeCatchup = false;
758 if (mWindowExposed == exposed) return;781 if (mWindowExposed == exposed) return;
@@ -762,22 +785,27 @@
762 QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));785 QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));
763}786}
764787
765void UbuntuWindow::handleSurfaceFocusChanged(bool focused)788void QMirClientWindow::handleSurfaceFocusChanged(bool focused)
766{789{
767 qCDebug(ubuntumirclient, "handleSurfaceFocusChanged(window=%p, focused=%d)", window(), focused);790 qCDebug(mirclient, "handleSurfaceFocusChanged(window=%p, focused=%d)", window(), focused);
768791
769 if (focused) {792 if (focused) {
770 mAppStateController->setWindowFocused(true);793 mAppStateController->setWindowFocused(true);
771 QWindowSystemInterface::handleWindowActivated(window(), Qt::ActiveWindowFocusReason);794 QWindowSystemInterface::handleWindowActivated(window(), Qt::ActiveWindowFocusReason);
772 } else {795 } else {
773 QWindowSystemInterface::handleWindowActivated(nullptr, Qt::ActiveWindowFocusReason);796 // Flush events so that we update QGuiApplicationPrivate::focus_window first
774 mAppStateController->setWindowFocused(false);797 QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
798
799 if (window() == QGuiApplicationPrivate::focus_window) { // don't handle unfocus if this window wasn't currently focused.
800 QWindowSystemInterface::handleWindowActivated(nullptr, Qt::ActiveWindowFocusReason);
801 mAppStateController->setWindowFocused(false);
802 }
775 }803 }
776}804}
777805
778void UbuntuWindow::handleSurfaceVisibilityChanged(bool visible)806void QMirClientWindow::handleSurfaceVisibilityChanged(bool visible)
779{807{
780 qCDebug(ubuntumirclient, "handleSurfaceVisibilityChanged(window=%p, visible=%d)", window(), visible);808 qCDebug(mirclient, "handleSurfaceVisibilityChanged(window=%p, visible=%d)", window(), visible);
781809
782 if (mWindowVisible == visible) return;810 if (mWindowVisible == visible) return;
783 mWindowVisible = visible;811 mWindowVisible = visible;
@@ -785,9 +813,9 @@
785 QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));813 QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));
786}814}
787815
788void UbuntuWindow::handleSurfaceStateChanged(Qt::WindowState state)816void QMirClientWindow::handleSurfaceStateChanged(Qt::WindowState state)
789{817{
790 qCDebug(ubuntumirclient, "handleSurfaceStateChanged(window=%p, %s)", window(), qtWindowStateToStr(state));818 qCDebug(mirclient, "handleSurfaceStateChanged(window=%p, %s)", window(), qtWindowStateToStr(state));
791819
792 if (mWindowState == state) return;820 if (mWindowState == state) return;
793 mWindowState = state;821 mWindowState = state;
@@ -795,10 +823,10 @@
795 QWindowSystemInterface::handleWindowStateChanged(window(), state);823 QWindowSystemInterface::handleWindowStateChanged(window(), state);
796}824}
797825
798void UbuntuWindow::setWindowState(Qt::WindowState state)826void QMirClientWindow::setWindowState(Qt::WindowState state)
799{827{
800 QMutexLocker lock(&mMutex);828 QMutexLocker lock(&mMutex);
801 qCDebug(ubuntumirclient, "setWindowState(window=%p, %s)", this, qtWindowStateToStr(state));829 qCDebug(mirclient, "setWindowState(window=%p, %s)", this, qtWindowStateToStr(state));
802830
803 if (mWindowState == state) return;831 if (mWindowState == state) return;
804 mWindowState = state;832 mWindowState = state;
@@ -807,10 +835,10 @@
807 updateSurfaceState();835 updateSurfaceState();
808}836}
809837
810void UbuntuWindow::setWindowFlags(Qt::WindowFlags flags)838void QMirClientWindow::setWindowFlags(Qt::WindowFlags flags)
811{839{
812 QMutexLocker lock(&mMutex);840 QMutexLocker lock(&mMutex);
813 qCDebug(ubuntumirclient, "setWindowFlags(window=%p, 0x%x)", this, (int)flags);841 qCDebug(mirclient, "setWindowFlags(window=%p, 0x%x)", this, (int)flags);
814842
815 if (mWindowFlags == flags) return;843 if (mWindowFlags == flags) return;
816 mWindowFlags = flags;844 mWindowFlags = flags;
@@ -824,7 +852,7 @@
824 window is always on the top-left corner, right below the indicators panel if not852 window is always on the top-left corner, right below the indicators panel if not
825 in fullscreen.853 in fullscreen.
826 */854 */
827void UbuntuWindow::updatePanelHeightHack(bool enable)855void QMirClientWindow::updatePanelHeightHack(bool enable)
828{856{
829 if ((window()->type() & Qt::WindowType_Mask) != Qt::Window) { // only plain windows get the hack857 if ((window()->type() & Qt::WindowType_Mask) != Qt::Window) { // only plain windows get the hack
830 return;858 return;
@@ -846,7 +874,7 @@
846 }874 }
847}875}
848876
849QRect UbuntuWindow::geometry() const877QRect QMirClientWindow::geometry() const
850{878{
851 if (mDebugExtention) {879 if (mDebugExtention) {
852 auto geom = QPlatformWindow::geometry();880 auto geom = QPlatformWindow::geometry();
@@ -857,16 +885,16 @@
857 }885 }
858}886}
859887
860void UbuntuWindow::setGeometry(const QRect &rect)888void QMirClientWindow::setGeometry(const QRect &rect)
861{889{
862 QMutexLocker lock(&mMutex);890 QMutexLocker lock(&mMutex);
863891
864 if (window()->windowState() == Qt::WindowFullScreen || window()->windowState() == Qt::WindowMaximized) {892 if (window()->windowState() == Qt::WindowFullScreen || window()->windowState() == Qt::WindowMaximized) {
865 qCDebug(ubuntumirclient, "setGeometry(window=%p) - not resizing, window is maximized or fullscreen", window());893 qCDebug(mirclient, "setGeometry(window=%p) - not resizing, window is maximized or fullscreen", window());
866 return;894 return;
867 }895 }
868896
869 qCDebug(ubuntumirclient, "setGeometry (window=%p, position=(%d, %d)dp, size=(%dx%d)dp)",897 qCDebug(mirclient, "setGeometry (window=%p, position=(%d, %d)dp, size=(%dx%d)dp)",
870 window(), rect.x(), rect.y(), rect.width(), rect.height());898 window(), rect.x(), rect.y(), rect.width(), rect.height());
871 // Immediately update internal geometry so Qt believes position updated899 // Immediately update internal geometry so Qt believes position updated
872 QRect newPosition(geometry());900 QRect newPosition(geometry());
@@ -877,10 +905,10 @@
877 // Note: don't call handleGeometryChange here, wait to see what Mir replies with.905 // Note: don't call handleGeometryChange here, wait to see what Mir replies with.
878}906}
879907
880void UbuntuWindow::setVisible(bool visible)908void QMirClientWindow::setVisible(bool visible)
881{909{
882 QMutexLocker lock(&mMutex);910 QMutexLocker lock(&mMutex);
883 qCDebug(ubuntumirclient, "setVisible (window=%p, visible=%s)", window(), visible ? "true" : "false");911 qCDebug(mirclient, "setVisible (window=%p, visible=%s)", window(), visible ? "true" : "false");
884912
885 if (mWindowVisible == visible) return;913 if (mWindowVisible == visible) return;
886 mWindowVisible = visible;914 mWindowVisible = visible;
@@ -901,36 +929,36 @@
901 QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));929 QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));
902}930}
903931
904void UbuntuWindow::setWindowTitle(const QString& title)932void QMirClientWindow::setWindowTitle(const QString& title)
905{933{
906 QMutexLocker lock(&mMutex);934 QMutexLocker lock(&mMutex);
907 qCDebug(ubuntumirclient, "setWindowTitle(window=%p) title=%s)", window(), title.toUtf8().constData());935 qCDebug(mirclient, "setWindowTitle(window=%p) title=%s)", window(), title.toUtf8().constData());
908 mSurface->updateTitle(title);936 mSurface->updateTitle(title);
909}937}
910938
911void UbuntuWindow::propagateSizeHints()939void QMirClientWindow::propagateSizeHints()
912{940{
913 QMutexLocker lock(&mMutex);941 QMutexLocker lock(&mMutex);
914 const auto win = window();942 const auto win = window();
915 qCDebug(ubuntumirclient, "propagateSizeHints(window=%p) min(%d,%d), max(%d,%d) increment(%d, %d)",943 qCDebug(mirclient, "propagateSizeHints(window=%p) min(%d,%d), max(%d,%d) increment(%d, %d)",
916 win, win->minimumSize().width(), win->minimumSize().height(),944 win, win->minimumSize().width(), win->minimumSize().height(),
917 win->maximumSize().width(), win->maximumSize().height(),945 win->maximumSize().width(), win->maximumSize().height(),
918 win->sizeIncrement().width(), win->sizeIncrement().height());946 win->sizeIncrement().width(), win->sizeIncrement().height());
919 mSurface->setSizingConstraints(win->minimumSize(), win->maximumSize(), win->sizeIncrement());947 mSurface->setSizingConstraints(win->minimumSize(), win->maximumSize(), win->sizeIncrement());
920}948}
921949
922bool UbuntuWindow::isExposed() const950bool QMirClientWindow::isExposed() const
923{951{
924 // mNeedsExposeCatchup because we need to render a frame to get the expose surface event from mir.952 // mNeedsExposeCatchup because we need to render a frame to get the expose surface event from mir.
925 return mWindowVisible && (mWindowExposed || (mSurface && mSurface->mNeedsExposeCatchup));953 return mWindowVisible && (mWindowExposed || (mSurface && mSurface->mNeedsExposeCatchup));
926}954}
927955
928QSurfaceFormat UbuntuWindow::format() const956QSurfaceFormat QMirClientWindow::format() const
929{957{
930 return mSurface->format();958 return mSurface->format();
931}959}
932960
933QPoint UbuntuWindow::mapToGlobal(const QPoint &pos) const961QPoint QMirClientWindow::mapToGlobal(const QPoint &pos) const
934{962{
935 if (mDebugExtention) {963 if (mDebugExtention) {
936 return mDebugExtention->mapSurfacePointToScreen(mSurface->mirSurface(), pos);964 return mDebugExtention->mapSurfacePointToScreen(mSurface->mirSurface(), pos);
@@ -939,22 +967,22 @@
939 }967 }
940}968}
941969
942void* UbuntuWindow::eglSurface() const970void* QMirClientWindow::eglSurface() const
943{971{
944 return mSurface->eglSurface();972 return mSurface->eglSurface();
945}973}
946974
947MirSurface *UbuntuWindow::mirSurface() const975MirSurface *QMirClientWindow::mirSurface() const
948{976{
949 return mSurface->mirSurface();977 return mSurface->mirSurface();
950}978}
951979
952WId UbuntuWindow::winId() const980WId QMirClientWindow::winId() const
953{981{
954 return mId;982 return mId;
955}983}
956984
957void UbuntuWindow::onSwapBuffersDone()985void QMirClientWindow::onSwapBuffersDone()
958{986{
959 QMutexLocker lock(&mMutex);987 QMutexLocker lock(&mMutex);
960 mSurface->onSwapBuffersDone();988 mSurface->onSwapBuffersDone();
@@ -968,7 +996,7 @@
968 }996 }
969}997}
970998
971void UbuntuWindow::handleScreenPropertiesChange(MirFormFactor formFactor, float scale)999void QMirClientWindow::handleScreenPropertiesChange(MirFormFactor formFactor, float scale)
972{1000{
973 // Update the scale & form factor native-interface properties for the windows affected1001 // Update the scale & form factor native-interface properties for the windows affected
974 // as there is no convenient way to emit signals for those custom properties on a QScreen1002 // as there is no convenient way to emit signals for those custom properties on a QScreen
@@ -986,12 +1014,12 @@
986 }1014 }
987}1015}
9881016
989void UbuntuWindow::updateSurfaceState()1017void QMirClientWindow::updateSurfaceState()
990{1018{
991 QMutexLocker lock(&mMutex);1019 QMutexLocker lock(&mMutex);
992 MirSurfaceState newState = mWindowVisible ? qtWindowStateToMirSurfaceState(mWindowState) :1020 MirSurfaceState newState = mWindowVisible ? qtWindowStateToMirSurfaceState(mWindowState) :
993 mir_surface_state_hidden;1021 mir_surface_state_hidden;
994 qCDebug(ubuntumirclient, "updateSurfaceState (window=%p, surfaceState=%s)", window(), mirSurfaceStateToStr(newState));1022 qCDebug(mirclient, "updateSurfaceState (window=%p, surfaceState=%s)", window(), mirSurfaceStateToStr(newState));
995 if (newState != mSurface->state()) {1023 if (newState != mSurface->state()) {
996 mSurface->setState(newState);1024 mSurface->setState(newState);
9971025
@@ -1000,7 +1028,7 @@
1000 }1028 }
1001}1029}
10021030
1003QString UbuntuWindow::persistentSurfaceId()1031QString QMirClientWindow::persistentSurfaceId()
1004{1032{
1005 return mSurface->persistentSurfaceId();1033 return mSurface->persistentSurfaceId();
1006}1034}
10071035
=== renamed file 'src/ubuntumirclient/window.h' => 'src/ubuntumirclient/qmirclientwindow.h'
--- src/ubuntumirclient/window.h 2016-12-09 17:02:57 +0000
+++ src/ubuntumirclient/qmirclientwindow.h 2017-02-08 16:34:34 +0000
@@ -1,21 +1,45 @@
1/*1/****************************************************************************
2 * Copyright (C) 2014-2016 Canonical, Ltd.2**
3 *3** Copyright (C) 2014-2016 Canonical, Ltd.
4 * This program is free software: you can redistribute it and/or modify it under4** Contact: https://www.qt.io/licensing/
5 * the terms of the GNU Lesser General Public License version 3, as published by5**
6 * the Free Software Foundation.6** This file is part of the plugins of the Qt Toolkit.
7 *7**
8 * This program is distributed in the hope that it will be useful, but WITHOUT8** $QT_BEGIN_LICENSE:LGPL$
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,9** Commercial License Usage
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10** Licensees holding valid commercial Qt licenses may use this file in
11 * Lesser General Public License for more details.11** accordance with the commercial license agreement provided with the
12 *12** Software or, alternatively, in accordance with the terms contained in
13 * You should have received a copy of the GNU Lesser General Public License13** a written agreement between you and The Qt Company. For licensing terms
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14** and conditions see https://www.qt.io/terms-conditions. For further
15 */15** information use the contact form at https://www.qt.io/contact-us.
1616**
17#ifndef UBUNTU_WINDOW_H17** GNU Lesser General Public License Usage
18#define UBUNTU_WINDOW_H18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef QMIRCLIENTWINDOW_H
42#define QMIRCLIENTWINDOW_H
1943
20#include <qpa/qplatformwindow.h>44#include <qpa/qplatformwindow.h>
21#include <QSharedPointer>45#include <QSharedPointer>
@@ -27,23 +51,23 @@
2751
28#include <EGL/egl.h>52#include <EGL/egl.h>
2953
30class UbuntuAppStateController;54class QMirClientAppStateController;
31class UbuntuDebugExtension;55class QMirClientDebugExtension;
32class UbuntuNativeInterface;56class QMirClientNativeInterface;
33class UbuntuInput;57class QMirClientInput;
34class UbuntuScreen;58class QMirClientScreen;
35class UbuntuSurface;59class UbuntuSurface;
36struct MirSurface;60struct MirSurface;
37class MirConnection;61class MirConnection;
3862
39class UbuntuWindow : public QObject, public QPlatformWindow63class QMirClientWindow : public QObject, public QPlatformWindow
40{64{
41 Q_OBJECT65 Q_OBJECT
42public:66public:
43 UbuntuWindow(QWindow *w, UbuntuInput *input, UbuntuNativeInterface *native,67 QMirClientWindow(QWindow *w, QMirClientInput *input, QMirClientNativeInterface *native,
44 UbuntuAppStateController *appState, EGLDisplay eglDisplay,68 QMirClientAppStateController *appState, EGLDisplay eglDisplay,
45 MirConnection *mirConnection, UbuntuDebugExtension *debugExt);69 MirConnection *mirConnection, QMirClientDebugExtension *debugExt);
46 virtual ~UbuntuWindow();70 virtual ~QMirClientWindow();
4771
48 // QPlatformWindow methods.72 // QPlatformWindow methods.
49 WId winId() const override;73 WId winId() const override;
@@ -84,14 +108,12 @@
84 Qt::WindowFlags mWindowFlags;108 Qt::WindowFlags mWindowFlags;
85 bool mWindowVisible;109 bool mWindowVisible;
86 bool mWindowExposed;110 bool mWindowExposed;
87 UbuntuDebugExtension *mDebugExtention;111 QMirClientAppStateController *mAppStateController;
88 UbuntuNativeInterface *mNativeInterface;112 QMirClientDebugExtension *mDebugExtention;
89 UbuntuAppStateController *mAppStateController;113 QMirClientNativeInterface *mNativeInterface;
90 std::unique_ptr<UbuntuSurface> mSurface;114 std::unique_ptr<UbuntuSurface> mSurface;
91 float mScale;115 float mScale;
92 MirFormFactor mFormFactor;116 MirFormFactor mFormFactor;
93};117};
94118
95Q_DECLARE_METATYPE(QPlatformWindow*);119#endif // QMIRCLIENTWINDOW_H
96
97#endif // UBUNTU_WINDOW_H
98120
=== modified file 'src/ubuntumirclient/ubuntumirclient.pro'
--- src/ubuntumirclient/ubuntumirclient.pro 2016-12-09 17:02:57 +0000
+++ src/ubuntumirclient/ubuntumirclient.pro 2017-02-08 16:34:34 +0000
@@ -15,40 +15,40 @@
15PKGCONFIG += egl mirclient ubuntu-platform-api xkbcommon libcontent-hub15PKGCONFIG += egl mirclient ubuntu-platform-api xkbcommon libcontent-hub
1616
17SOURCES = \17SOURCES = \
18 backingstore.cpp \18 qmirclientbackingstore.cpp \
19 clipboard.cpp \19 qmirclientclipboard.cpp \
20 cursor.cpp \20 qmirclientcursor.cpp \
21 debugextension.cpp \21 qmirclientdebugextension.cpp \
22 desktopwindow.cpp \22 qmirclientdesktopwindow.cpp \
23 glcontext.cpp \23 qmirclientglcontext.cpp \
24 input.cpp \24 qmirclientinput.cpp \
25 integration.cpp \25 qmirclientintegration.cpp \
26 nativeinterface.cpp \26 qmirclientnativeinterface.cpp \
27 platformservices.cpp \27 qmirclientplatformservices.cpp \
28 plugin.cpp \28 qmirclientplugin.cpp \
29 screen.cpp \29 qmirclientscreen.cpp \
30 screenobserver.cpp \30 qmirclientscreenobserver.cpp \
31 window.cpp \31 qmirclientwindow.cpp \
32 appstatecontroller.cpp32 qmirclientappstatecontroller.cpp
3333
34HEADERS = \34HEADERS = \
35 backingstore.h \35 qmirclientbackingstore.h \
36 clipboard.h \36 qmirclientclipboard.h \
37 cursor.h \37 qmirclientcursor.h \
38 debugextension.h \38 qmirclientdebugextension.h \
39 desktopwindow.h \39 qmirclientdesktopwindow.h \
40 glcontext.h \40 qmirclientglcontext.h \
41 input.h \41 qmirclientinput.h \
42 integration.h \42 qmirclientintegration.h \
43 nativeinterface.h \43 qmirclientnativeinterface.h \
44 orientationchangeevent_p.h \44 qmirclientorientationchangeevent_p.h \
45 platformservices.h \45 qmirclientplatformservices.h \
46 plugin.h \46 qmirclientplugin.h \
47 screenobserver.h \47 qmirclientscreenobserver.h \
48 screen.h \48 qmirclientscreen.h \
49 window.h \49 qmirclientwindow.h \
50 logging.h \50 qmirclientlogging.h \
51 appstatecontroller.h51 qmirclientappstatecontroller.h
5252
53OTHER_FILES += \53OTHER_FILES += \
54 ubuntumirclient.json54 ubuntumirclient.json

Subscribers

People subscribed via source and target branches