Merge lp:~mir-team/qtubuntu/ubuntumirclient-only into lp:qtubuntu

Proposed by Gerry Boland
Status: Merged
Approved by: Ricardo Mendoza
Approved revision: 244
Merged at revision: 234
Proposed branch: lp:~mir-team/qtubuntu/ubuntumirclient-only
Merge into: lp:qtubuntu
Diff against target: 6556 lines (+2200/-3743)
72 files modified
README (+4/-42)
TODO (+0/-4)
debian/changelog (+7/-0)
debian/control (+1/-4)
debian/copyright (+2/-2)
debian/docs (+0/-1)
debian/rules (+2/-2)
deploy.sh (+0/-16)
qtubuntu.pro (+1/-6)
src/platforms/platforms.pro (+0/-5)
src/platforms/ubuntu/ubuntu.pro (+0/-14)
src/platforms/ubuntu/ubuntu/main.cc (+0/-67)
src/platforms/ubuntu/ubuntu/ubuntu.json (+0/-3)
src/platforms/ubuntu/ubuntu/ubuntu.pro (+0/-25)
src/platforms/ubuntu/ubuntucommon/clipboard.cc (+0/-126)
src/platforms/ubuntu/ubuntucommon/clipboard.h (+0/-34)
src/platforms/ubuntu/ubuntucommon/input.cc (+0/-51)
src/platforms/ubuntu/ubuntucommon/input.h (+0/-38)
src/platforms/ubuntu/ubuntucommon/input_adaptor_factory.h (+0/-32)
src/platforms/ubuntu/ubuntucommon/integration.cc (+0/-177)
src/platforms/ubuntu/ubuntucommon/integration.h (+0/-55)
src/platforms/ubuntu/ubuntucommon/screen.cc (+0/-192)
src/platforms/ubuntu/ubuntucommon/screen.h (+0/-59)
src/platforms/ubuntu/ubuntucommon/ubuntucommon.pro (+0/-30)
src/platforms/ubuntu/ubuntucommon/window.cc (+0/-230)
src/platforms/ubuntu/ubuntucommon/window.h (+0/-58)
src/platforms/ubuntu/ubuntumir/ubuntumir.pro (+0/-16)
src/platforms/ubuntu/ubuntumir/ubuntumirclient/ubuntumirclient.pro (+0/-25)
src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.cc (+0/-184)
src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.h (+0/-31)
src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.cc (+0/-43)
src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.h (+0/-27)
src/platforms/ubuntu/ubuntumir/ubuntumircommon/ubuntumircommon.pro (+0/-21)
src/platforms/ubuntu/ubuntumir/ubuntumirserver/main.cc (+0/-53)
src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.json (+0/-3)
src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.pro (+0/-25)
src/platforms/ubuntulegacy/input.cc (+0/-56)
src/platforms/ubuntulegacy/input.h (+0/-37)
src/platforms/ubuntulegacy/integration.cc (+0/-75)
src/platforms/ubuntulegacy/integration.h (+0/-53)
src/platforms/ubuntulegacy/main.cc (+0/-47)
src/platforms/ubuntulegacy/screen.cc (+0/-34)
src/platforms/ubuntulegacy/screen.h (+0/-39)
src/platforms/ubuntulegacy/ubuntulegacy.json (+0/-3)
src/platforms/ubuntulegacy/ubuntulegacy.pro (+0/-35)
src/platforms/ubuntulegacy/window.cc (+0/-120)
src/platforms/ubuntulegacy/window.h (+0/-47)
src/src.pro (+1/-1)
src/ubuntumirclient/backingstore.cpp (+58/-52)
src/ubuntumirclient/backingstore.h (+34/-32)
src/ubuntumirclient/clipboard.cpp (+135/-33)
src/ubuntumirclient/clipboard.h (+32/-27)
src/ubuntumirclient/glcontext.cpp (+107/-91)
src/ubuntumirclient/glcontext.h (+38/-36)
src/ubuntumirclient/input.cpp (+385/-502)
src/ubuntumirclient/input.h (+47/-49)
src/ubuntumirclient/integration.cpp (+202/-99)
src/ubuntumirclient/integration.h (+72/-47)
src/ubuntumirclient/logging.h (+15/-14)
src/ubuntumirclient/nativeinterface.cpp (+105/-106)
src/ubuntumirclient/nativeinterface.h (+39/-35)
src/ubuntumirclient/platformservices.cpp (+26/-25)
src/ubuntumirclient/platformservices.h (+23/-20)
src/ubuntumirclient/plugin.cpp (+32/-45)
src/ubuntumirclient/plugin.h (+32/-0)
src/ubuntumirclient/screen.cpp (+180/-70)
src/ubuntumirclient/screen.h (+61/-39)
src/ubuntumirclient/theme.cpp (+36/-36)
src/ubuntumirclient/theme.h (+26/-23)
src/ubuntumirclient/ubuntumirclient.pro (+45/-35)
src/ubuntumirclient/window.cpp (+393/-41)
src/ubuntumirclient/window.h (+59/-38)
To merge this branch: bzr merge lp:~mir-team/qtubuntu/ubuntumirclient-only
Reviewer Review Type Date Requested Status
Ricardo Mendoza (community) Approve
Michael Terry debian-packaging Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+224978@code.launchpad.net

Commit message

Major refactor: remove SurfaceFlinger & Mir in-server-process-client support, flatten class hierarchy. Only Mir client QPA remains

Description of the change

Major refactor: remove SF support, remove mir in-server-process-client support, flatten class hierarchy

NOTE: Do not merge independently, must land as part of QtCompositor work only!!!

Depends:
https://code.launchpad.net/~unity-team/platform-api/devel-for-qtmircompositor/+merge/225320

 * Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
Y
 * Did you build your software in a clean sbuild/pbuilder chroot or ppa?
Y - has been in silo6 for >1 week now
 * Did you build your software in a clean sbuild/pbuilder armhf chroot or ppa?
Y - has been in silo6 for >1 week now
 * Has your component "TestPlan” been executed successfully on emulator, N4?
Y
 * Has a 5 minute exploratory testing run been executed on N4?
Oh more than 5 mins.
 * If you changed the packaging (debian), did you subscribe a core-dev to this MP?
Y
 * What components might get impacted by your changes?
All apps.
 * Have you requested review by the teams of these owning components?
Was a call for testing announced, some bugs were found and have been fixed:
https://bugs.launchpad.net/unity8/+bugs?field.tag=qtcomp

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ricardo Mendoza (ricmm) wrote :

This looks generally fine to me, I will however mark it as needs information due to the API changes required in the platform-api MR.

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
244. By Daniel d'Andrada

Adapt to latest platform-api API

- The new papi Event struct is called WindowEvent
- WindowEvent types have WEVENT instead of EVENT prefixes
- WindowEvent struct is simpler: It does not have the "details" member.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Terry (mterry) wrote :

From a packaging point of view, this is fine, sure. I might have left the copyright lines as "2013,2014" instead of just "2014" though.

review: Approve (debian-packaging)
Revision history for this message
Ricardo Mendoza (ricmm) :
review: Approve
245. By Gerry Boland

HACK: implement hackish Window::mapToGlobal and isExposed to work around Autopilot relying on QWindow::mapToGlobal for coordinates in screen space

Revision history for this message
Ricardo Mendoza (ricmm) wrote :

Blessing the hack.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README'
2--- README 2013-02-12 16:56:42 +0000
3+++ README 2014-07-21 23:47:35 +0000
4@@ -8,11 +8,8 @@
5 1. Description
6 --------------
7
8- QtUbuntu is a set of Qt5 components for the Ubuntu Platform API. It
9- contains a QPA (Qt Platform Abstraction) plugin based on the Ubuntu
10- Platform API and a legacy QPA plugin based on the compatibility
11- layers. It also provides Qt bindings for Ubuntu Platform API
12- features that are not exposed through the QPA plugins.
13+ QtUbuntu contains a QPA (Qt Platform Abstraction) plugin based on the Ubuntu
14+ Platform API
15
16
17 2 Running
18@@ -23,13 +20,8 @@
19 "-platformpluginpath" command line switch, the following commands
20 can be used to run with the Ubuntu QPA plugin:
21
22- $ qmlscene -platform ubuntu Foo.qml
23- $ QT_QPA_PLATFORM=ubuntu qmlscene Foo.qml
24-
25- and the following ones to run with the Ubuntu legacy QPA plugin:
26-
27- $ qmlscene -platform ubuntulegacy Foo.qml
28- $ QT_QPA_PLATFORM=ubuntulegacy qmlscene Foo.qml
29+ $ qmlscene -platform ubuntumirclient Foo.qml
30+ $ QT_QPA_PLATFORM=ubuntumirclient qmlscene Foo.qml
31
32 The QPA plugins expose the following environment variables:
33
34@@ -44,9 +36,6 @@
35
36 QTUBUNTU_NO_INPUT: Disables touchscreen and buttons.
37
38- QTUBUNTU_INPUT_DELAY: Specifies a delay in milliseconds for input
39- initialization (ubuntulegacy plugin only).
40-
41 QTUBUNTU_ICON_THEME: Specifies the default icon theme name.
42
43
44@@ -97,30 +86,3 @@
45 [1] http://doc-snapshot.qt-project.org/5.0/qabstractnativeeventfilter.html
46 [2] http://doc-snapshot.qt-project.org/5.0/qcoreapplication.html#installNativeEventFilter
47
48-
49-5. QPA properties
50------------------
51-
52- The QPA plugin for Ubuntu looks for a "session" dynamic property on
53- the QPlatformNativeInterface object in order to know the session
54- type to request. That property can be set to an integer representing
55- a SessionType specified in the Ubuntu Platform API before the first
56- window is shown. In order to request a system session type, the
57- following code can be used:
58-
59- #include <qpa/qplatformnativeinterface.h>
60- ...
61- QPlatformNativeInterface* native = QGuiApplication::platformNativeInterface();
62- native->setProperty("session", static_cast<int>(USER_SESSION_TYPE));
63-
64- The plugin also looks for "role" and "opaque" dynamic properties on
65- the QWindow object. The "role" property can be set to an integer
66- representing a SurfaceRole and the "opaque" property can be set to 0
67- or 1 to specify whether or not the surface shoud be considered
68- opaque by the compositor. Note that these properties must be set
69- before the window is shown. In order to request a launcher role and
70- an opaque window, the following code can be used:
71-
72- QQuickView* view = new QQuickView();
73- view->setProperty("role", static_cast<int>(LAUNCHER_ACTOR_ROLE));
74- view->setProperty("opaque", 1);
75
76=== removed file 'TODO'
77--- TODO 2012-10-16 15:41:36 +0000
78+++ TODO 1970-01-01 00:00:00 +0000
79@@ -1,4 +0,0 @@
80-To do
81------
82-
83- Empty!
84
85=== modified file 'debian/changelog'
86--- debian/changelog 2014-06-13 05:37:53 +0000
87+++ debian/changelog 2014-07-21 23:47:35 +0000
88@@ -1,3 +1,10 @@
89+qtubuntu (0.60) UNRELEASED; urgency=medium
90+
91+ * Major refactor: remove SurfaceFlinger & Mir in-server-process-client support,
92+ flatten class hierarchy. Only Mir client QPA remains
93+
94+ -- Gerry Boland <gerry.boland@canonical.com> Mon, 30 Jun 2014 12:05:37 +0100
95+
96 qtubuntu (0.54+14.10.20140613-0ubuntu1) utopic; urgency=low
97
98 [ Ubuntu daily release ]
99
100=== modified file 'debian/control'
101--- debian/control 2014-05-29 10:28:33 +0000
102+++ debian/control 2014-07-21 23:47:35 +0000
103@@ -3,14 +3,12 @@
104 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
105 Build-Depends: debhelper (>= 9),
106 libatspi2.0-dev,
107- libdbus-1-dev,
108 libegl1-mesa-dev,
109 libfontconfig1-dev,
110 libfreetype6-dev,
111 libgles2-mesa-dev,
112 libglib2.0-dev,
113- libhybris-dev,
114- libubuntu-application-api-dev (>= 2.0.0),
115+ libubuntu-application-api-dev (>= 2.2.0),
116 libudev-dev,
117 libxrender-dev,
118 libxkbcommon-dev,
119@@ -18,7 +16,6 @@
120 qtbase5-private-dev,
121 qtdeclarative5-dev,
122 libqt5sensors5-dev,
123- zlib1g-dev,
124 # if you don't have have commit access to this branch but would like to upload
125 # directly to Ubuntu, don't worry: your changes will be merged back into the
126 # upstream branch
127
128=== modified file 'debian/copyright'
129--- debian/copyright 2013-03-13 02:30:19 +0000
130+++ debian/copyright 2014-07-21 23:47:35 +0000
131@@ -2,11 +2,11 @@
132 Upstream-Name: qtubuntu
133
134 Files: *
135-Copyright: 2013 Canonical Ltd.
136+Copyright: 2014 Canonical Ltd.
137 License: LGPL-3
138
139 Files: debian/*
140-Copyright: 2013 Canonical Ltd.
141+Copyright: 2014 Canonical Ltd.
142 License: GPL-3
143
144 Files: tests/*
145
146=== modified file 'debian/docs'
147--- debian/docs 2012-10-03 16:16:07 +0000
148+++ debian/docs 2014-07-21 23:47:35 +0000
149@@ -1,2 +1,1 @@
150 README
151-TODO
152
153=== modified file 'debian/rules' (properties changed: -x to +x)
154--- debian/rules 2014-05-29 10:26:54 +0000
155+++ debian/rules 2014-07-21 23:47:35 +0000
156@@ -24,9 +24,9 @@
157
158 override_dh_auto_configure:
159 ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(gles2_architectures)))
160- mkdir -p $(ANDROID_DIR) && dh_auto_configure -B$(ANDROID_DIR) -- "CONFIG+=mirserver" "CONFIG+=mirclient" "CONFIG+=hybris" "QMAKE_CXXFLAGS=-DPLATFORM_API_TOUCH" $(CURDIR)
161+ mkdir -p $(ANDROID_DIR) && dh_auto_configure -B$(ANDROID_DIR) -- "QMAKE_CXXFLAGS=-DPLATFORM_API_TOUCH" $(CURDIR)
162 endif
163- mkdir -p $(DESKTOP_DIR) && dh_auto_configure -B$(DESKTOP_DIR) -- "CONFIG+=mirserver" "CONFIG+=mirclient" "QMAKE_CXXFLAGS=-DQTUBUNTU_USE_OPENGL" $(CURDIR)
164+ mkdir -p $(DESKTOP_DIR) && dh_auto_configure -B$(DESKTOP_DIR) -- "QMAKE_CXXFLAGS=-DQTUBUNTU_USE_OPENGL" $(CURDIR)
165
166 override_dh_auto_build:
167 ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(gles2_architectures)))
168
169=== removed file 'deploy.sh'
170--- deploy.sh 2014-03-25 17:42:14 +0000
171+++ deploy.sh 1970-01-01 00:00:00 +0000
172@@ -1,16 +0,0 @@
173-#!/bin/bash -i
174-
175-adb push src/platforms/ubuntu/libqubuntu.so /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/plugins/platforms
176-adb push src/platforms/ubuntu/libqubuntumir.so /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/plugins/platforms
177-adb push src/platforms/ubuntu/libqubuntumirserver.so /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/plugins/platforms
178-adb push src/platforms/ubuntulegacy/libqubuntulegacy.so /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/plugins/platforms
179-adb push tests/qmlscene_ubuntu/qmlscene-ubuntu /data/ubuntu/usr/bin
180-adb push tests/clipboard/clipboard /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/tests
181-adb push tests/Logo.qml /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/tests
182-adb push tests/MovingLogo.qml /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/tests
183-adb push tests/WarpingLogo.qml /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/tests
184-adb push tests/Input.qml /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/tests
185-adb push tests/Application.qml /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/tests
186-adb push tests/Fullscreen.qml /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/tests
187-adb push tests/logo.png /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/tests
188-adb push tests/noise.png /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/tests
189
190=== modified file 'qtubuntu.pro'
191--- qtubuntu.pro 2013-02-05 02:05:42 +0000
192+++ qtubuntu.pro 2014-07-21 23:47:35 +0000
193@@ -1,7 +1,2 @@
194-load(configure)
195-load(qt_parts)
196-
197-# FIXME(loicm) I don't get why qmake automatically detects src/ but not
198-# tests/. Doing it that way makes make warn about the generated Makefile.
199 TEMPLATE = subdirs
200-SUBDIRS += tests
201+SUBDIRS += src tests
202
203=== removed directory 'src/platforms'
204=== removed file 'src/platforms/platforms.pro'
205--- src/platforms/platforms.pro 2013-06-21 17:23:48 +0000
206+++ src/platforms/platforms.pro 1970-01-01 00:00:00 +0000
207@@ -1,5 +0,0 @@
208-TEMPLATE = subdirs
209-
210-SUBDIRS += base ubuntu
211-
212-ubuntu.depends = base
213
214=== removed directory 'src/platforms/ubuntu'
215=== removed directory 'src/platforms/ubuntu/ubuntu'
216=== removed file 'src/platforms/ubuntu/ubuntu.pro'
217--- src/platforms/ubuntu/ubuntu.pro 2013-06-21 18:04:03 +0000
218+++ src/platforms/ubuntu/ubuntu.pro 1970-01-01 00:00:00 +0000
219@@ -1,14 +0,0 @@
220-TEMPLATE = subdirs
221-
222-!mirclient:!mirserver {
223-CONFIG += hybris
224-}
225-
226-hybris {
227-SUBDIRS += ubuntu
228-}
229-
230-SUBDIRS += ubuntucommon ubuntumir
231-
232-ubuntu.depends = ubuntucommon
233-ubuntumir.depends = ubuntucommon
234
235=== removed file 'src/platforms/ubuntu/ubuntu/main.cc'
236--- src/platforms/ubuntu/ubuntu/main.cc 2013-11-19 09:00:47 +0000
237+++ src/platforms/ubuntu/ubuntu/main.cc 1970-01-01 00:00:00 +0000
238@@ -1,67 +0,0 @@
239-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
240-// Copyright © 2013 Canonical Ltd.
241-//
242-// This program is free software: you can redistribute it and/or modify it under
243-// the terms of the GNU Lesser General Public License version 3, as published by
244-// the Free Software Foundation.
245-//
246-// This program is distributed in the hope that it will be useful, but WITHOUT
247-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
248-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
249-// Lesser General Public License for more details.
250-//
251-// You should have received a copy of the GNU Lesser General Public License
252-// along with this program. If not, see <http://www.gnu.org/licenses/>.
253-
254-#include <qpa/qplatformintegrationplugin.h>
255-#include "ubuntucommon/integration.h"
256-#include "ubuntucommon/input.h"
257-#include "ubuntucommon/input_adaptor_factory.h"
258-
259-namespace
260-{
261-struct InputAdaptorFactory : public QUbuntuInputAdaptorFactory {
262- InputAdaptorFactory() {}
263- ~InputAdaptorFactory() {}
264-
265- QUbuntuInput* create_input_adaptor(QUbuntuIntegration *integration){
266- return new QUbuntuInput(integration);
267- }
268-
269- static InputAdaptorFactory* instance(){
270- static InputAdaptorFactory global_instance;
271- return &global_instance;
272- }
273-};
274-}
275-
276-
277-QT_BEGIN_NAMESPACE
278-
279-class QUbuntuIntegrationPlugin : public QPlatformIntegrationPlugin {
280- Q_OBJECT
281- Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid
282- FILE "ubuntu.json")
283-
284- public:
285- QStringList keys() const;
286- QPlatformIntegration* create(const QString&, const QStringList&);
287-};
288-
289-QStringList QUbuntuIntegrationPlugin::keys() const {
290- QStringList list;
291- list << "ubuntu";
292- return list;
293-}
294-
295-QPlatformIntegration* QUbuntuIntegrationPlugin::create(
296- const QString& system, const QStringList& paramList) {
297- Q_UNUSED(paramList);
298- if (system.toLower() == "ubuntu")
299- return new QUbuntuIntegration(InputAdaptorFactory::instance());
300- return 0;
301-}
302-
303-QT_END_NAMESPACE
304-
305-#include "main.moc"
306
307=== removed file 'src/platforms/ubuntu/ubuntu/ubuntu.json'
308--- src/platforms/ubuntu/ubuntu/ubuntu.json 2013-06-10 20:48:03 +0000
309+++ src/platforms/ubuntu/ubuntu/ubuntu.json 1970-01-01 00:00:00 +0000
310@@ -1,3 +0,0 @@
311-{
312- "Keys": [ "ubuntu" ]
313-}
314
315=== removed file 'src/platforms/ubuntu/ubuntu/ubuntu.pro'
316--- src/platforms/ubuntu/ubuntu/ubuntu.pro 2013-11-22 15:30:14 +0000
317+++ src/platforms/ubuntu/ubuntu/ubuntu.pro 1970-01-01 00:00:00 +0000
318@@ -1,25 +0,0 @@
319-TARGET = qubuntu
320-TEMPLATE = lib
321-
322-QT += gui-private platformsupport-private sensors
323-
324-DEFINES += MESA_EGL_NO_X11_HEADERS
325-QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
326-QMAKE_LFLAGS += -Wl,-no-undefined
327-
328-CONFIG(debug) {
329- QMAKE_CXXFLAGS_DEBUG += -Werror
330-}
331-
332-SOURCES = main.cc
333-
334-CONFIG += plugin link_prl link_pkgconfig
335-
336-PKGCONFIG += egl
337-INCLUDEPATH += ../../ ../
338-LIBS += -L../ubuntucommon -lqubuntucommon -lubuntu_application_api -L../../base -lubuntubase
339-
340-OTHER_FILES += ubuntu.json
341-
342-target.path += $$[QT_INSTALL_PLUGINS]/platforms
343-INSTALLS += target
344
345=== removed directory 'src/platforms/ubuntu/ubuntucommon'
346=== removed file 'src/platforms/ubuntu/ubuntucommon/clipboard.cc'
347--- src/platforms/ubuntu/ubuntucommon/clipboard.cc 2013-05-21 22:11:57 +0000
348+++ src/platforms/ubuntu/ubuntucommon/clipboard.cc 1970-01-01 00:00:00 +0000
349@@ -1,126 +0,0 @@
350-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
351-// Copyright © 2013 Canonical Ltd.
352-//
353-// This program is free software: you can redistribute it and/or modify it under
354-// the terms of the GNU Lesser General Public License version 3, as published by
355-// the Free Software Foundation.
356-//
357-// This program is distributed in the hope that it will be useful, but WITHOUT
358-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
359-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
360-// Lesser General Public License for more details.
361-//
362-// You should have received a copy of the GNU Lesser General Public License
363-// along with this program. If not, see <http://www.gnu.org/licenses/>.
364-
365-// FIXME(loicm) The clipboard data format is not defined by Ubuntu Platform API
366-// which makes it impossible to have non-Qt applications communicate with Qt
367-// applications through the clipboard API. The solution would be to have
368-// Ubuntu Platform define the data format or propose an API that supports
369-// embedding different mime types in the clipboard.
370-
371-// Data format:
372-// number of mime types (4 bytes)
373-// data layout (16 bytes * number of mime types)
374-// mime type string offset (4 bytes)
375-// mime type string size (4 bytes)
376-// data offset (4 bytes)
377-// data size (4 bytes)
378-// data (n bytes)
379-
380-#include "clipboard.h"
381-#include "base/logging.h"
382-#include <QtCore/QMimeData>
383-#include <QtCore/QStringList>
384-#include <ubuntu/application/ui/clipboard.h>
385-
386-const int maxFormatsCount = 16;
387-const int maxBufferSize = 4 * 1024 * 1024; // 4 Mb
388-
389-QUbuntuClipboard::QUbuntuClipboard()
390- : QUbuntuBaseClipboard()
391- , mimeData_(new QMimeData()) {
392- DLOG("QUbuntuClipboard::QUbuntuClipboard (this=%p)", this);
393-}
394-
395-QUbuntuClipboard::~QUbuntuClipboard() {
396- DLOG("QUbuntuClipboard::~QUbuntuClipboard");
397- delete mimeData_;
398-}
399-
400-QMimeData* QUbuntuClipboard::mimeData(QClipboard::Mode mode) {
401- Q_UNUSED(mode);
402- DLOG("QUbuntuClipboard::mimeData (this=%p, mode=%d)", this, static_cast<int>(mode));
403- // Get clipboard data.
404- void* data = NULL;
405- size_t size = 0;
406- ua_ui_get_clipboard_content(&data, &size);
407-
408- // Deserialize, update and return mime data taking care of incorrectly
409- // formatted input.
410- mimeData_->clear();
411- if (static_cast<size_t>(size) > sizeof(int) // Should be at least that big to read the count.
412- && data != NULL) {
413- const char* const buffer = reinterpret_cast<char*>(data);
414- const int* const header = reinterpret_cast<int*>(data);
415- const int count = qMin(header[0], maxFormatsCount);
416- for (int i = 0; i < count; i++) {
417- const unsigned int formatOffset = header[i*4+1];
418- const unsigned int formatSize = header[i*4+2];
419- const unsigned int dataOffset = header[i*4+3];
420- const unsigned int dataSize = header[i*4+4];
421- if (formatOffset + formatSize <= size && dataOffset + dataSize <= size) {
422- mimeData_->setData(QString(&buffer[formatOffset]),
423- QByteArray(&buffer[dataOffset], dataSize));
424- }
425- }
426- }
427- return mimeData_;
428-}
429-
430-void QUbuntuClipboard::setMimeData(QMimeData* mimeData, QClipboard::Mode mode) {
431- Q_UNUSED(mode);
432- DLOG("QUbuntuClipboard::setMimeData (this=%p, data=%p, mode=%d)", this, mimeData,
433- static_cast<int>(mode));
434- if (mimeData == NULL) {
435- ua_ui_set_clipboard_content(NULL, 0);
436- return;
437- }
438-
439- const QStringList formats = mimeData->formats();
440- const int count = qMin(formats.size(), maxFormatsCount);
441- const int headerSize = sizeof(int) + count * 4 * sizeof(int);
442- int bufferSize = headerSize;
443- char* buffer;
444-
445- // Get the buffer size considering the header size, the NULL-terminated
446- // formats and the non NULL-terminated data.
447- for (int i = 0; i < count; i++)
448- bufferSize += formats[i].size() + 1 + mimeData->data(formats[i]).size();
449- // FIXME(loicm) Implement max buffer size limitation.
450- // FIXME(loicm) Remove ASSERT before release.
451- ASSERT(bufferSize <= maxBufferSize);
452-
453- // Serialize data.
454- buffer = new char[bufferSize];
455- int* header = reinterpret_cast<int*>(buffer);
456- int offset = headerSize;
457- header[0] = count;
458- for (int i = 0; i < count; i++) {
459- const int formatOffset = offset;
460- const int formatSize = formats[i].size() + 1;
461- const int dataOffset = offset + formatSize;
462- const int dataSize = mimeData->data(formats[i]).size();
463- memcpy(&buffer[formatOffset], formats[i].toLatin1().data(), formatSize);
464- memcpy(&buffer[dataOffset], mimeData->data(formats[i]).data(), dataSize);
465- header[i*4+1] = formatOffset;
466- header[i*4+2] = formatSize;
467- header[i*4+3] = dataOffset;
468- header[i*4+4] = dataSize;
469- offset += formatSize + dataSize;
470- }
471-
472- // Set clipboard content.
473- ua_ui_set_clipboard_content(reinterpret_cast<void*>(buffer), bufferSize);
474- delete [] buffer;
475-}
476
477=== removed file 'src/platforms/ubuntu/ubuntucommon/clipboard.h'
478--- src/platforms/ubuntu/ubuntucommon/clipboard.h 2013-02-05 02:05:42 +0000
479+++ src/platforms/ubuntu/ubuntucommon/clipboard.h 1970-01-01 00:00:00 +0000
480@@ -1,34 +0,0 @@
481-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
482-// Copyright © 2013 Canonical Ltd.
483-//
484-// This program is free software: you can redistribute it and/or modify it under
485-// the terms of the GNU Lesser General Public License version 3, as published by
486-// the Free Software Foundation.
487-//
488-// This program is distributed in the hope that it will be useful, but WITHOUT
489-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
490-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
491-// Lesser General Public License for more details.
492-//
493-// You should have received a copy of the GNU Lesser General Public License
494-// along with this program. If not, see <http://www.gnu.org/licenses/>.
495-
496-#ifndef QUBUNTUCLIPBOARD_H
497-#define QUBUNTUCLIPBOARD_H
498-
499-#include "base/clipboard.h"
500-
501-class QUbuntuClipboard : public QUbuntuBaseClipboard {
502- public:
503- QUbuntuClipboard();
504- ~QUbuntuClipboard();
505-
506- // QUbuntuBaseClipboard methods.
507- QMimeData* mimeData(QClipboard::Mode mode = QClipboard::Clipboard);
508- void setMimeData(QMimeData* data, QClipboard::Mode mode = QClipboard::Clipboard);
509-
510- private:
511- QMimeData* mimeData_;
512-};
513-
514-#endif // QUBUNTUCLIPBOARD_H
515
516=== removed file 'src/platforms/ubuntu/ubuntucommon/input.cc'
517--- src/platforms/ubuntu/ubuntucommon/input.cc 2013-10-17 18:38:03 +0000
518+++ src/platforms/ubuntu/ubuntucommon/input.cc 1970-01-01 00:00:00 +0000
519@@ -1,51 +0,0 @@
520-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
521-// Copyright © 2013 Canonical Ltd.
522-//
523-// This program is free software: you can redistribute it and/or modify it under
524-// the terms of the GNU Lesser General Public License version 3, as published by
525-// the Free Software Foundation.
526-//
527-// This program is distributed in the hope that it will be useful, but WITHOUT
528-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
529-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
530-// Lesser General Public License for more details.
531-//
532-// You should have received a copy of the GNU Lesser General Public License
533-// along with this program. If not, see <http://www.gnu.org/licenses/>.
534-
535-#include "input.h"
536-#include "integration.h"
537-#include "base/logging.h"
538-#include <ubuntu/application/ui/input/event.h>
539-
540-QUbuntuInput::QUbuntuInput(QUbuntuIntegration* integration)
541- : QUbuntuBaseInput(integration)
542- , sessionType_(0) {
543- DLOG("QUbuntuInput::QUbuntuInput (this=%p integration=%p)", this, integration);
544-}
545-
546-QUbuntuInput::~QUbuntuInput() {
547- DLOG("QUbuntuInput::~QUbuntuInput");
548-}
549-
550-void QUbuntuInput::handleTouchEvent(
551- QWindow* window, ulong timestamp, QTouchDevice* device,
552- const QList<struct QWindowSystemInterface::TouchPoint> &points) {
553- DLOG("QUbuntuInput::handleTouchEvent (this=%p, window=%p, timestamp=%lu, device=%p)",
554- this, window, timestamp, device);
555- if (sessionType_ != 1) {
556- QUbuntuBaseInput::handleTouchEvent(window, timestamp, device, points);
557- } else {
558- // Ubuntu platform API creates an input handler per window. Since system sessions have
559- // fullscreen input handlers, the last created window has an input handler that takes precedence
560- // over the others. Because of that, only the last created window receives touch input. In order
561- // to fix that issue for system sessions, we pass the NULL pointer to the Qt handler as window
562- // argument so that it pushes the event to the window that's located at the touch point.
563- QUbuntuBaseInput::handleTouchEvent(NULL, timestamp, device, points);
564- }
565-}
566-
567-void QUbuntuInput::setSessionType(uint sessionType) {
568- DLOG("QUbuntuInput::setSessionType (this=%p, window=%u)", this, sessionType);
569- sessionType_ = sessionType;
570-}
571
572=== removed file 'src/platforms/ubuntu/ubuntucommon/input.h'
573--- src/platforms/ubuntu/ubuntucommon/input.h 2013-02-14 16:31:33 +0000
574+++ src/platforms/ubuntu/ubuntucommon/input.h 1970-01-01 00:00:00 +0000
575@@ -1,38 +0,0 @@
576-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
577-// Copyright © 2013 Canonical Ltd.
578-//
579-// This program is free software: you can redistribute it and/or modify it under
580-// the terms of the GNU Lesser General Public License version 3, as published by
581-// the Free Software Foundation.
582-//
583-// This program is distributed in the hope that it will be useful, but WITHOUT
584-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
585-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
586-// Lesser General Public License for more details.
587-//
588-// You should have received a copy of the GNU Lesser General Public License
589-// along with this program. If not, see <http://www.gnu.org/licenses/>.
590-
591-#ifndef QUBUNTUINPUT_H
592-#define QUBUNTUINPUT_H
593-
594-#include "base/input.h"
595-
596-class QUbuntuIntegration;
597-
598-class QUbuntuInput : public QUbuntuBaseInput {
599- public:
600- QUbuntuInput(QUbuntuIntegration* integration);
601- ~QUbuntuInput();
602-
603- // QUbuntuBaseInput methods.
604- void handleTouchEvent(QWindow* window, ulong timestamp, QTouchDevice* device,
605- const QList<struct QWindowSystemInterface::TouchPoint> &points);
606-
607- void setSessionType(uint sessionType);
608-
609- private:
610- uint sessionType_;
611-};
612-
613-#endif // QUBUNTUINPUT_H
614
615=== removed file 'src/platforms/ubuntu/ubuntucommon/input_adaptor_factory.h'
616--- src/platforms/ubuntu/ubuntucommon/input_adaptor_factory.h 2013-06-24 17:52:59 +0000
617+++ src/platforms/ubuntu/ubuntucommon/input_adaptor_factory.h 1970-01-01 00:00:00 +0000
618@@ -1,32 +0,0 @@
619-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
620-// Copyright © 2013 Canonical Ltd.
621-//
622-// This program is free software: you can redistribute it and/or modify it under
623-// the terms of the GNU Lesser General Public License version 3, as published by
624-// the Free Software Foundation.
625-//
626-// This program is distributed in the hope that it will be useful, but WITHOUT
627-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
628-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
629-// Lesser General Public License for more details.
630-//
631-// You should have received a copy of the GNU Lesser General Public License
632-// along with this program. If not, see <http://www.gnu.org/licenses/>.
633-
634-#ifndef QUBUNTU_INPUT_ADAPTOR_FACTORY_H_
635-#define QUBUNTU_INPUT_ADAPTOR_FACTORY_H_
636-
637-class QUbuntuInput;
638-class QUbuntuIntegration;
639-
640-class QUbuntuInputAdaptorFactory {
641- public:
642- virtual ~QUbuntuInputAdaptorFactory() {}
643-
644- virtual QUbuntuInput* create_input_adaptor(QUbuntuIntegration* integration) = 0;
645-
646- protected:
647- QUbuntuInputAdaptorFactory() {}
648-};
649-
650-#endif
651
652=== removed file 'src/platforms/ubuntu/ubuntucommon/integration.cc'
653--- src/platforms/ubuntu/ubuntucommon/integration.cc 2014-05-22 01:25:21 +0000
654+++ src/platforms/ubuntu/ubuntucommon/integration.cc 1970-01-01 00:00:00 +0000
655@@ -1,177 +0,0 @@
656-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
657-// Copyright © 2013 Canonical Ltd.
658-//
659-// This program is free software: you can redistribute it and/or modify it under
660-// the terms of the GNU Lesser General Public License version 3, as published by
661-// the Free Software Foundation.
662-//
663-// This program is distributed in the hope that it will be useful, but WITHOUT
664-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
665-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
666-// Lesser General Public License for more details.
667-//
668-// You should have received a copy of the GNU Lesser General Public License
669-// along with this program. If not, see <http://www.gnu.org/licenses/>.
670-
671-#include "integration.h"
672-#include "window.h"
673-#include "input.h"
674-#include "clipboard.h"
675-#include "input_adaptor_factory.h"
676-#include "base/logging.h"
677-#include <QGuiApplication>
678-#include <qpa/qplatformnativeinterface.h>
679-#include <qpa/qplatforminputcontextfactory_p.h>
680-#include <qpa/qplatforminputcontext.h>
681-#include <ubuntu/application/lifecycle_delegate.h>
682-#include <ubuntu/application/id.h>
683-#include <ubuntu/application/options.h>
684-#include <ubuntu/application/ui/options.h>
685-#include <ubuntu/application/ui/session.h>
686-
687-static void resumedCallback(const UApplicationOptions *options, void* context) {
688- DLOG("resumedCallback (options=%p, context=%p)", options, context);
689- DASSERT(context != NULL);
690- QUbuntuIntegration* integration = static_cast<QUbuntuIntegration*>(context);
691- integration->screen()->toggleSensors(true);
692- QCoreApplication::postEvent(QCoreApplication::instance(), new QEvent(QEvent::ApplicationActivate));
693-
694- Q_FOREACH(QWindow *window, QGuiApplication::allWindows()) {
695- QGuiApplication::postEvent(window, new QExposeEvent( window->geometry() ));
696- }
697-}
698-
699-static void aboutToStopCallback(UApplicationArchive *archive, void* context) {
700- DLOG("aboutToStopCallback (archive=%p, context=%p)", archive, context);
701- DASSERT(context != NULL);
702- QUbuntuIntegration* integration = static_cast<QUbuntuIntegration*>(context);
703- integration->screen()->toggleSensors(false);
704- integration->inputContext()->hideInputPanel();
705-
706- Q_FOREACH(QWindow *window, QGuiApplication::allWindows()) {
707- QGuiApplication::postEvent(window, new QExposeEvent( QRegion() ));
708- }
709-
710- QCoreApplication::postEvent(QCoreApplication::instance(), new QEvent(QEvent::ApplicationDeactivate));
711-}
712-
713-QUbuntuIntegration::QUbuntuIntegration(QUbuntuInputAdaptorFactory *input_factory)
714- : clipboard_(new QUbuntuClipboard()) {
715- // Init Ubuntu Platform library.
716- QStringList args = QCoreApplication::arguments();
717- argc_ = args.size() + 1;
718- argv_ = new char*[argc_];
719- for (int i = 0; i < argc_ - 1; i++)
720- argv_[i] = qstrdup(args.at(i).toLocal8Bit());
721- argv_[argc_ - 1] = NULL;
722- // Setup options
723- options_ = u_application_options_new_from_cmd_line(argc_ - 1, argv_);
724-
725- // Setup application description
726- desc_ = u_application_description_new();
727- UApplicationId* id = u_application_id_new_from_stringn("QtUbuntu", 8);
728- u_application_description_set_application_id(desc_, id);
729- UApplicationLifecycleDelegate* delegate = u_application_lifecycle_delegate_new();
730- u_application_lifecycle_delegate_set_application_resumed_cb(delegate, &resumedCallback);
731- u_application_lifecycle_delegate_set_application_about_to_stop_cb(delegate, &aboutToStopCallback);
732- u_application_lifecycle_delegate_set_context(delegate, this);
733- u_application_description_set_application_lifecycle_delegate(desc_, delegate);
734-
735- // Create new application instance
736- instance_ = u_application_instance_new_from_description_with_options(desc_, options_);
737-
738- if (instance_ == NULL)
739- qFatal("QUbuntu: Could not create application instance");
740-
741- // Create default screen.
742- screen_ = new QUbuntuScreen(options_);
743- screenAdded(screen_);
744-
745- // FIXME (ricmm) We shouldn't disable sensors for the shell process
746- // it is only valid right now because the shell doesnt use them
747- screen_->toggleSensors(false);
748- isShell_ = false;
749- if (args.contains("unity8") || args.contains("/usr/bin/unity8") ||
750- args.contains("unity8-greeter") || args.contains("/usr/bin/unity8-greeter"))
751- isShell_ = true;
752-
753- // Initialize input.
754- if (qEnvironmentVariableIsEmpty("QTUBUNTU_NO_INPUT")) {
755- input_ = input_factory->create_input_adaptor(this);
756- inputContext_ = QPlatformInputContextFactory::create();
757- } else {
758- input_ = NULL;
759- inputContext_ = NULL;
760- }
761-
762- DLOG("QUbuntuIntegration::QUbuntuIntegration (this=%p)", this);
763-}
764-
765-QUbuntuIntegration::~QUbuntuIntegration() {
766- DLOG("QUbuntuIntegration::~QUbuntuIntegration");
767- delete clipboard_;
768- delete input_;
769- delete inputContext_;
770- delete screen_;
771- for (int i = 0; i < argc_; i++)
772- delete [] argv_[i];
773- delete [] argv_;
774-}
775-
776-QPlatformWindow* QUbuntuIntegration::createPlatformWindow(QWindow* window) const {
777- DLOG("QUbuntuIntegration::createPlatformWindow const (this=%p, window=%p)", this, window);
778- return const_cast<QUbuntuIntegration*>(this)->createPlatformWindow(window);
779-}
780-
781-QPlatformWindow* QUbuntuIntegration::createPlatformWindow(QWindow* window) {
782- DLOG("QUbuntuIntegration::createPlatformWindow (this=%p, window=%p)", this, window);
783- static uint sessionType;
784-
785- // Start a session before creating the first window.
786- static bool once = false;
787- if (!once) {
788- sessionType = nativeInterface()->property("session").toUInt();
789- // FIXME(loicm) Remove that once all system applications have been ported to the new property.
790- if (sessionType == 0) {
791- sessionType = nativeInterface()->property("ubuntuSessionType").toUInt();
792- }
793-#if !defined(QT_NO_DEBUG)
794- ASSERT(sessionType <= U_SYSTEM_SESSION);
795- const char* const sessionTypeString[] = {
796- "User", "System"
797- };
798- const char* const stageHintString[] = {
799- "Main", "Integration", "Share", "Content picking", "Side", "Configuration",
800- };
801- const char* const formFactorHintString[] = {
802- "Desktop", "Phone", "Tablet"
803- };
804- LOG("ubuntu session type: '%s'", sessionTypeString[sessionType]);
805- LOG("ubuntu application stage hint: '%s'",
806- stageHintString[u_application_options_get_stage(options_)]);
807- LOG("ubuntu application form factor: '%s'",
808- formFactorHintString[u_application_options_get_form_factor(options_)]);
809-#endif
810-
811- LOG("callbacks %p %p", &resumedCallback, &aboutToStopCallback);
812-
813- props_ = ua_ui_session_properties_new();
814- ua_ui_session_properties_set_type(props_, static_cast<UAUiSessionType>(sessionType));
815-
816- ua_ui_session_properties_set_remote_pid(props_,
817- static_cast<uint32_t>(QCoreApplication::applicationPid()));
818-
819- session_ = ua_ui_session_new_with_properties(props_);
820-
821- input_->setSessionType(sessionType);
822- once = true;
823- }
824-
825- QStringList args = QCoreApplication::arguments();
826-
827- // Create the window.
828- QPlatformWindow* platformWindow = new QUbuntuWindow(
829- window, static_cast<QUbuntuScreen*>(screen_), input_, static_cast<bool>(sessionType), instance_, isShell_);
830- platformWindow->requestActivateWindow();
831- return platformWindow;
832-}
833
834=== removed file 'src/platforms/ubuntu/ubuntucommon/integration.h'
835--- src/platforms/ubuntu/ubuntucommon/integration.h 2013-08-08 15:29:08 +0000
836+++ src/platforms/ubuntu/ubuntucommon/integration.h 1970-01-01 00:00:00 +0000
837@@ -1,55 +0,0 @@
838-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
839-// Copyright © 2013 Canonical Ltd.
840-//
841-// This program is free software: you can redistribute it and/or modify it under
842-// the terms of the GNU Lesser General Public License version 3, as published by
843-// the Free Software Foundation.
844-//
845-// This program is distributed in the hope that it will be useful, but WITHOUT
846-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
847-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
848-// Lesser General Public License for more details.
849-//
850-// You should have received a copy of the GNU Lesser General Public License
851-// along with this program. If not, see <http://www.gnu.org/licenses/>.
852-
853-#ifndef QUBUNTUINTEGRATION_H
854-#define QUBUNTUINTEGRATION_H
855-
856-#include "base/integration.h"
857-#include "screen.h"
858-#include <ubuntu/application/instance.h>
859-#include <ubuntu/application/ui/session.h>
860-
861-class QUbuntuInputAdaptorFactory;
862-class QUbuntuInput;
863-
864-class QUbuntuIntegration : public QUbuntuBaseIntegration {
865- public:
866- QUbuntuIntegration(QUbuntuInputAdaptorFactory* input_factory);
867- ~QUbuntuIntegration();
868-
869- // QPlatformIntegration methods.
870- QPlatformWindow* createPlatformWindow(QWindow* window) const;
871- QPlatformWindow* createPlatformWindow(QWindow* window);
872- QPlatformInputContext* inputContext() const { return inputContext_; }
873- QPlatformClipboard* clipboard() const { return clipboard_; }
874- QUbuntuScreen* screen() const { return screen_; }
875-
876- private:
877- int argc_;
878- char** argv_;
879- QUbuntuScreen* screen_;
880- QUbuntuInput* input_;
881- QPlatformInputContext* inputContext_;
882- QPlatformClipboard* clipboard_;
883- bool isShell_;
884-
885- UApplicationOptions* options_;
886- UApplicationDescription* desc_;
887- UApplicationInstance* instance_;
888- UAUiSessionProperties* props_;
889- UAUiSession* session_;
890-};
891-
892-#endif // QUBUNTUINTEGRATION_H
893
894=== removed file 'src/platforms/ubuntu/ubuntucommon/screen.cc'
895--- src/platforms/ubuntu/ubuntucommon/screen.cc 2014-02-20 23:03:54 +0000
896+++ src/platforms/ubuntu/ubuntucommon/screen.cc 1970-01-01 00:00:00 +0000
897@@ -1,192 +0,0 @@
898-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
899-// Copyright © 2013 Canonical Ltd.
900-//
901-// This program is free software: you can redistribute it and/or modify it under
902-// the terms of the GNU Lesser General Public License version 3, as published by
903-// the Free Software Foundation.
904-//
905-// This program is distributed in the hope that it will be useful, but WITHOUT
906-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
907-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
908-// Lesser General Public License for more details.
909-//
910-// You should have received a copy of the GNU Lesser General Public License
911-// along with this program. If not, see <http://www.gnu.org/licenses/>.
912-
913-// Unit conversion code has been extracted from the Ubuntu UI toolkit.
914-
915-#include "screen.h"
916-#include "base/logging.h"
917-#include <QtCore/QCoreApplication>
918-#include <QtCore/qmath.h>
919-#include <QtSensors/QOrientationSensor>
920-#include <QtSensors/QOrientationReading>
921-#include <QtGui/QScreen>
922-#include <QtCore/QThread>
923-#include <qpa/qwindowsysteminterface.h>
924-#include <ubuntu/application/ui/options.h>
925-#include <ubuntu/application/ui/display.h>
926-
927-class OrientationReadingEvent : public QEvent {
928- public:
929- OrientationReadingEvent(QEvent::Type type, QOrientationReading::Orientation orientation)
930- : QEvent(type)
931- , orientation_(orientation) {
932- DLOG("OrientationReadingEvent::OrientationReadingEvent()");
933- }
934- ~OrientationReadingEvent() {
935- DLOG("OrientationReadingEvent::~OrientationReadingEvent()");
936- }
937- static const QEvent::Type type_;
938- QOrientationReading::Orientation orientation_;
939-};
940-
941-const QEvent::Type OrientationReadingEvent::type_ =
942- static_cast<QEvent::Type>(QEvent::registerEventType());
943-
944-// Grid unit used if GRID_UNIT_PX is not in the environment.
945-const int kDefaultGridUnit = 8;
946-
947-// Size of the side stage in grid units.
948-// FIXME(loicm) Hard-coded to 40 grid units for now.
949-const int kSideStageWidth = 40;
950-
951-// Lifted from shell to determine form factor
952-const int kTabletMinSize = 100;
953-
954-QUbuntuScreen::QUbuntuScreen(UApplicationOptions *options) {
955- // Retrieve units from the environment.
956- int gridUnit = kDefaultGridUnit;
957- QByteArray gridUnitString = qgetenv("GRID_UNIT_PX");
958- if (!gridUnitString.isEmpty()) {
959- bool ok;
960- gridUnit = gridUnitString.toInt(&ok);
961- if (!ok) {
962- gridUnit = kDefaultGridUnit;
963- }
964- }
965- gridUnit_ = gridUnit;
966- densityPixelRatio_ = static_cast<float>(gridUnit) / kDefaultGridUnit;
967- DLOG("grid unit is %d", gridUnit);
968- DLOG("density pixel ratio is %.2f", densityPixelRatio_);
969-
970- // Compute menubar strut.
971- // FIXME(loicm) Hard-coded to 3 grid units plus 2 density independent pixels for now.
972- struct { int left; int right; int top; int bottom; } strut = {
973- 0, 0, gridUnitToPixel(3) + densityPixelToPixel(2), 0
974- };
975- DLOG("menu bar height is %d pixels", strut.top);
976-
977- // Get screen resolution.
978- UAUiDisplay* display = ua_ui_display_new_with_index(0);
979- const int kScreenWidth = ua_ui_display_query_horizontal_res(display);
980- const int kScreenHeight = ua_ui_display_query_vertical_res(display);
981- ASSERT(kScreenWidth > 0 && kScreenHeight > 0);
982- DLOG("screen resolution: %dx%d", kScreenWidth, kScreenHeight);
983- ua_ui_display_destroy(display);
984-
985- // Store geometries depending on the stage hint.
986- UAUiStage kStageHint = static_cast<UAUiStage>(u_application_options_get_stage(options));
987- if (kScreenWidth/gridUnit < kTabletMinSize)
988- kStageHint = U_MAIN_STAGE;
989-
990- DASSERT(kStageHint == U_MAIN_STAGE || kStageHint == U_SIDE_STAGE);
991- if (kStageHint != U_SIDE_STAGE) {
992- geometry_ = QRect(0, 0, kScreenWidth, kScreenHeight);
993- availableGeometry_ = QRect(
994- strut.left, strut.top, kScreenWidth - strut.left - strut.right,
995- kScreenHeight - strut.top - strut.bottom);
996- } else {
997- const int kSideStageWidthPixels = gridUnitToPixel(kSideStageWidth);
998- geometry_ = QRect(kScreenWidth - kSideStageWidthPixels, 0, kSideStageWidthPixels,
999- kScreenHeight);
1000- availableGeometry_ = QRect(
1001- kScreenWidth - kSideStageWidthPixels + strut.left, strut.top,
1002- kSideStageWidthPixels - strut.left - strut.right, kScreenHeight - strut.top - strut.bottom);
1003- }
1004-
1005- DLOG("QUbuntuScreen::QUbuntuScreen (this=%p)", this);
1006-
1007- // Set the default orientation based on the initial screen dimmensions.
1008- nativeOrientation_ = (availableGeometry_.width() >= availableGeometry_.height()) ? Qt::LandscapeOrientation : Qt::PortraitOrientation;
1009-
1010- // If it's a landscape device (i.e. some tablets), start in landscape, otherwise portrait
1011- currentOrientation_ = (nativeOrientation_ == Qt::LandscapeOrientation) ? Qt::LandscapeOrientation : Qt::PortraitOrientation;
1012-
1013- orientationSensor_ = new QOrientationSensor();
1014- QObject::connect(orientationSensor_, SIGNAL(readingChanged()), this, SLOT(onOrientationReadingChanged()));
1015- orientationSensor_->start();
1016-}
1017-
1018-QUbuntuScreen::~QUbuntuScreen() {
1019- DLOG("QUbuntuScreen::~QUbuntuScreen");
1020-
1021- delete orientationSensor_;
1022-}
1023-
1024-void QUbuntuScreen::toggleSensors(bool enable) const {
1025- DLOG("QUbuntuScreen::toggleSensors (this=%p, enable=%d)", this, enable);
1026- if (enable)
1027- orientationSensor_->start();
1028- else
1029- orientationSensor_->stop();
1030-}
1031-
1032-int QUbuntuScreen::gridUnitToPixel(int value) const {
1033- DLOG("QUbuntuScreen::gridUnitToPixel (this=%p, value=%d)", this, value);
1034- return value * gridUnit_;
1035-}
1036-
1037-int QUbuntuScreen::densityPixelToPixel(int value) const {
1038- DLOG("QUbuntuScreen::densityPixelToPixel (this=%p, value=%d)", this, value);
1039- if (value <= 2) {
1040- // For values under 2dp, return only multiples of the value.
1041- return static_cast<int>(value * qFloor(densityPixelRatio_));
1042- } else {
1043- return static_cast<int>(qRound(value * densityPixelRatio_));
1044- }
1045-}
1046-
1047-void QUbuntuScreen::customEvent(QEvent* event) {
1048- DLOG("QUbuntuScreen::customEvent (event: %p)", event);
1049- DASSERT(QThread::currentThread() == thread());
1050-
1051- OrientationReadingEvent* oReadingEvent = static_cast<OrientationReadingEvent*>(event);
1052- switch (oReadingEvent->orientation_) {
1053- case QOrientationReading::LeftUp: {
1054- currentOrientation_ = (nativeOrientation_ == Qt::LandscapeOrientation) ?
1055- Qt::InvertedPortraitOrientation : Qt::LandscapeOrientation;
1056- break;
1057- }
1058- case QOrientationReading::TopUp: {
1059- currentOrientation_ = (nativeOrientation_ == Qt::LandscapeOrientation) ?
1060- Qt::LandscapeOrientation : Qt::PortraitOrientation;
1061- break;
1062- }
1063- case QOrientationReading::RightUp: {
1064- currentOrientation_ = (nativeOrientation_ == Qt::LandscapeOrientation) ?
1065- Qt::PortraitOrientation : Qt::InvertedLandscapeOrientation;
1066- break;
1067- }
1068- case QOrientationReading::TopDown: {
1069- currentOrientation_ = (nativeOrientation_ == Qt::LandscapeOrientation) ?
1070- Qt::InvertedLandscapeOrientation : Qt::InvertedPortraitOrientation;
1071- break;
1072- }
1073- default: {
1074- DLOG("Unknown orientation.");
1075- }
1076- }
1077-
1078- // Raise the event signal so that client apps know the orientation changed
1079- QWindowSystemInterface::handleScreenOrientationChange(screen(), currentOrientation_);
1080-}
1081-
1082-void QUbuntuScreen::onOrientationReadingChanged() {
1083- DLOG("QUbuntuScreen::onOrientationReadingChanged");
1084- DASSERT(orientationSensor_ != NULL);
1085-
1086- // Make sure to switch to the main Qt thread context
1087- QCoreApplication::postEvent(this, new OrientationReadingEvent(
1088- OrientationReadingEvent::type_, orientationSensor_->reading()->orientation()));
1089-}
1090
1091=== removed file 'src/platforms/ubuntu/ubuntucommon/screen.h'
1092--- src/platforms/ubuntu/ubuntucommon/screen.h 2013-08-02 16:34:13 +0000
1093+++ src/platforms/ubuntu/ubuntucommon/screen.h 1970-01-01 00:00:00 +0000
1094@@ -1,59 +0,0 @@
1095-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
1096-// Copyright © 2013 Canonical Ltd.
1097-//
1098-// This program is free software: you can redistribute it and/or modify it under
1099-// the terms of the GNU Lesser General Public License version 3, as published by
1100-// the Free Software Foundation.
1101-//
1102-// This program is distributed in the hope that it will be useful, but WITHOUT
1103-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1104-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1105-// Lesser General Public License for more details.
1106-//
1107-// You should have received a copy of the GNU Lesser General Public License
1108-// along with this program. If not, see <http://www.gnu.org/licenses/>.
1109-
1110-#ifndef QUBUNTUSCREEN_H
1111-#define QUBUNTUSCREEN_H
1112-
1113-#include "base/screen.h"
1114-#include <ubuntu/application/ui/options.h>
1115-
1116-#include <QObject>
1117-
1118-class QOrientationSensor;
1119-
1120-class QUbuntuScreen : public QObject, public QUbuntuBaseScreen {
1121- Q_OBJECT
1122- public:
1123- QUbuntuScreen(UApplicationOptions *options);
1124- ~QUbuntuScreen();
1125-
1126- // QPlatformScreen methods.
1127- QRect geometry() const { return geometry_; }
1128- QRect availableGeometry() const { return availableGeometry_; }
1129-
1130- Qt::ScreenOrientation nativeOrientation() const { return nativeOrientation_; }
1131- Qt::ScreenOrientation orientation() const { return currentOrientation_; }
1132- int gridUnitToPixel(int value) const;
1133- int densityPixelToPixel(int value) const;
1134-
1135- void toggleSensors(bool enable) const;
1136-
1137- // QObject methods.
1138- void customEvent(QEvent* event);
1139-
1140- public Q_SLOTS:
1141- void onOrientationReadingChanged();
1142-
1143- private:
1144- QRect geometry_;
1145- QRect availableGeometry_;
1146- int gridUnit_;
1147- float densityPixelRatio_;
1148- Qt::ScreenOrientation nativeOrientation_;
1149- Qt::ScreenOrientation currentOrientation_;
1150- QOrientationSensor* orientationSensor_;
1151-};
1152-
1153-#endif // QUBUNTUSCREEN_H
1154
1155=== removed file 'src/platforms/ubuntu/ubuntucommon/ubuntucommon.pro'
1156--- src/platforms/ubuntu/ubuntucommon/ubuntucommon.pro 2013-11-22 15:24:44 +0000
1157+++ src/platforms/ubuntu/ubuntucommon/ubuntucommon.pro 1970-01-01 00:00:00 +0000
1158@@ -1,30 +0,0 @@
1159-TARGET = qubuntucommon
1160-TEMPLATE = lib
1161-
1162-QT += gui-private
1163-
1164-DEFINES += MESA_EGL_NO_X11_HEADERS
1165-QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
1166-QMAKE_LFLAGS += -Wl,-no-undefined
1167-
1168-CONFIG(debug) {
1169- QMAKE_CXXFLAGS_DEBUG += -Werror
1170-}
1171-
1172-SOURCES = integration.cc \
1173- window.cc \
1174- screen.cc \
1175- input.cc \
1176- clipboard.cc
1177-
1178-HEADERS = integration.h \
1179- window.h \
1180- screen.h \
1181- input.h \
1182- clipboard.h \
1183- input_adaptor_factory.h
1184-
1185-CONFIG += static plugin create_prl link_prl
1186-
1187-INCLUDEPATH += ../../
1188-LIBS += -L../base -Wl,--whole-archive -lubuntubase -Wl,--no-whole-archive
1189
1190=== removed file 'src/platforms/ubuntu/ubuntucommon/window.cc'
1191--- src/platforms/ubuntu/ubuntucommon/window.cc 2014-04-16 16:27:37 +0000
1192+++ src/platforms/ubuntu/ubuntucommon/window.cc 1970-01-01 00:00:00 +0000
1193@@ -1,230 +0,0 @@
1194-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
1195-// Copyright © 2013 Canonical Ltd.
1196-//
1197-// This program is free software: you can redistribute it and/or modify it under
1198-// the terms of the GNU Lesser General Public License version 3, as published by
1199-// the Free Software Foundation.
1200-//
1201-// This program is distributed in the hope that it will be useful, but WITHOUT
1202-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1203-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1204-// Lesser General Public License for more details.
1205-//
1206-// You should have received a copy of the GNU Lesser General Public License
1207-// along with this program. If not, see <http://www.gnu.org/licenses/>.
1208-
1209-// FIXME(loicm) The fullscreen API from Ubuntu Platform isn't good enough as we can't leave
1210-// fullscreen. The current Ubuntu Platform fullscreen call allows the application manager to
1211-// know the fullscreen state of an application, it's still the application responsibility to set
1212-// the right surface geometry.
1213-
1214-#include "window.h"
1215-#include "screen.h"
1216-#include "input.h"
1217-#include "base/logging.h"
1218-#include <qpa/qwindowsysteminterface.h>
1219-#include <ubuntu/application/ui/window.h>
1220-#include <QRegion>
1221-
1222-static void eventCallback(void* context, const Event* event) {
1223- DLOG("eventCallback (context=%p, event=%p)", context, event);
1224- DASSERT(context != NULL);
1225- QUbuntuWindow* window = static_cast<QUbuntuWindow*>(context);
1226- window->input_->postEvent(window->window(), event);
1227-}
1228-
1229-QUbuntuWindow::QUbuntuWindow(
1230- QWindow* w, QUbuntuScreen* screen, QUbuntuInput* input,
1231- bool systemSession, UApplicationInstance* instance, bool isShell)
1232- : QUbuntuBaseWindow(w, screen)
1233- , input_(input)
1234- , state_(window()->windowState())
1235- , systemSession_(systemSession)
1236- , uainstance_(instance)
1237- , screen_(screen)
1238- , isShell_(isShell)
1239- , exposed_(false)
1240-{
1241- if (!systemSession) {
1242- // Non-system sessions can't resize the window geometry.
1243- geometry_ = screen->availableGeometry();
1244- } else {
1245- // Use client geometry if set explicitly, use available screen geometry otherwise.
1246- geometry_ = window()->geometry() != screen->geometry() ?
1247- window()->geometry() : screen->availableGeometry();
1248- }
1249- createWindow();
1250- DLOG("QUbuntuWindow::QUbuntuWindow (this=%p, w=%p, screen=%p, input=%p)", this, w, screen, input);
1251-}
1252-
1253-QUbuntuWindow::~QUbuntuWindow() {
1254- DLOG("QUbuntuWindow::~QUbuntuWindow");
1255- destroyEGLSurface();
1256- ua_ui_window_destroy(window_);
1257-}
1258-
1259-void QUbuntuWindow::createWindow() {
1260- DLOG("QUbuntuWindow::createWindow (this=%p)", this);
1261-
1262- // Get surface role and flags.
1263- QVariant roleVariant = window()->property("role");
1264- int role = roleVariant.isValid() ? roleVariant.toUInt() : 1; // 1 is the default role for apps.
1265- QVariant opaqueVariant = window()->property("opaque");
1266- uint flags = opaqueVariant.isValid() ?
1267- opaqueVariant.toUInt() ? static_cast<uint>(IS_OPAQUE_FLAG) : 0 : 0;
1268- if (!systemSession_) {
1269- // FIXME(loicm) Opaque flag is forced for now for non-system sessions (applications) for
1270- // performance reasons.
1271- flags |= static_cast<uint>(IS_OPAQUE_FLAG);
1272- }
1273-
1274- const QByteArray title = (!window()->title().isNull()) ? window()->title().toUtf8() : "Window 1"; // legacy title
1275-
1276-#if !defined(QT_NO_DEBUG)
1277- //ASSERT(role <= ON_SCREEN_KEYBOARD_ACTOR_ROLE);
1278- const char* const roleString[] = {
1279- "Dash", "Default", "Indicator", "Notifications", "Greeter", "Launcher", "OSK", "ShutdownDialog"
1280- };
1281- LOG("role: '%s'", roleString[role]);
1282- LOG("flags: '%s'", (flags & static_cast<uint>(1)) ? "Opaque" : "NotOpaque");
1283- LOG("title: '%s'", title.constData());
1284-#endif
1285-
1286- // Get surface geometry.
1287- QRect geometry;
1288- if (state_ == Qt::WindowFullScreen) {
1289- geometry = screen()->geometry();
1290- } else if (state_ == Qt::WindowMaximized) {
1291- geometry = screen()->availableGeometry();
1292- } else {
1293- geometry = geometry_;
1294- }
1295-
1296- fprintf(stderr, "creating surface at (%d, %d) with size (%d, %d) with title '%s'", geometry.x(), geometry.y(),
1297- geometry.width(), geometry.height(), title.data());
1298-
1299- // Setup platform window creation properties
1300- wprops_ = ua_ui_window_properties_new_for_normal_window();
1301- ua_ui_window_properties_set_titlen(wprops_, title.data(), title.size());
1302- ua_ui_window_properties_set_role(wprops_, static_cast<UAUiWindowRole>(role));
1303- ua_ui_window_properties_set_input_cb_and_ctx(wprops_, &eventCallback, this);
1304- ua_ui_window_properties_set_dimensions(wprops_, geometry.width(), geometry.height());
1305-
1306- // Create platform window
1307- window_ = ua_ui_window_new_for_application_with_properties(uainstance_, wprops_);
1308-
1309- if (geometry.width() != 0 || geometry.height() != 0)
1310- ua_ui_window_resize(window_, geometry.width(), geometry.height());
1311-
1312- if (geometry.x() != 0 || geometry.y() != 0)
1313- ua_ui_window_move(window_, geometry.x(), geometry.y());
1314-
1315- ASSERT(window_ != NULL);
1316- createEGLSurface(ua_ui_window_get_native_type(window_));
1317- if (state_ == Qt::WindowFullScreen) {
1318- ua_ui_window_request_fullscreen(window_);
1319- }
1320-
1321- // Tell Qt about the geometry.
1322- QWindowSystemInterface::handleGeometryChange(window(), geometry);
1323- QPlatformWindow::setGeometry(geometry);
1324-}
1325-
1326-void QUbuntuWindow::moveResize(const QRect& rect) {
1327- fprintf(stderr, "\nQUbuntuWindow::moveResize (this=%p, x=%d, y=%d, w=%d, h=%d)\n", this, rect.x(), rect.y(),
1328- rect.width(), rect.height());
1329- ua_ui_window_move(window_, rect.x(), rect.y());
1330- ua_ui_window_resize(window_, rect.width(), rect.height());
1331- QWindowSystemInterface::handleGeometryChange(window(), rect);
1332- QPlatformWindow::setGeometry(rect);
1333-}
1334-
1335-void QUbuntuWindow::setWindowState(Qt::WindowState state) {
1336- DLOG("QUbuntuWindow::setWindowState (this=%p, state=%d)", this, state);
1337- if (state == state_)
1338- return;
1339-
1340- switch (state) {
1341- case Qt::WindowNoState: {
1342- DLOG("setting window state: 'NoState'");
1343- moveResize(geometry_);
1344- state_ = Qt::WindowNoState;
1345- break;
1346- }
1347- case Qt::WindowFullScreen: {
1348- DLOG("setting window state: 'FullScreen'");
1349- ua_ui_window_request_fullscreen(window_);
1350- moveResize(screen()->geometry());
1351- state_ = Qt::WindowFullScreen;
1352- break;
1353- }
1354- case Qt::WindowMaximized: {
1355- DLOG("setting window state: 'Maximized'");
1356- moveResize(screen()->availableGeometry());
1357- state_ = Qt::WindowMaximized;
1358- break;
1359- }
1360- case Qt::WindowActive:
1361- case Qt::WindowMinimized:
1362- default: {
1363- DLOG("setting window state: 'Active|Minimized'");
1364- break;
1365- }
1366- }
1367-}
1368-
1369-void QUbuntuWindow::setGeometry(const QRect& rect) {
1370- fprintf(stderr, "QUbuntuWindow::setGeometry (this=%p)", this);
1371- if (systemSession_) {
1372- // Non-system sessions can't resize the window geometry.
1373- geometry_ = rect;
1374- if (state_ != Qt::WindowFullScreen && state_ != Qt::WindowMaximized)
1375- moveResize(rect);
1376- }
1377-}
1378-
1379-void QUbuntuWindow::setVisible(bool visible) {
1380- DLOG("QUbuntuWindow::setVisible (this=%p, visible=%s)", this, visible ? "true" : "false");
1381- if (isShell_ == false)
1382- screen_->toggleSensors(visible);
1383-
1384- setExposed(visible);
1385-
1386- if (visible) {
1387- ua_ui_window_show(window_);
1388- } else {
1389- ua_ui_window_hide(window_);
1390- }
1391-}
1392-
1393-bool QUbuntuWindow::isExposed() const {
1394- return exposed_;
1395-}
1396-
1397-void QUbuntuWindow::setExposed(const bool exposed) {
1398- DLOG("QUbuntuWindow::setExposed (this=%p, exposed=%s)", this, exposed ? "true" : "false");
1399-
1400- if (exposed_ == exposed)
1401- return;
1402-
1403- exposed_ = exposed;
1404- if (exposed_) {
1405- QWindowSystemInterface::handleExposeEvent(window(), geometry());
1406- } else {
1407- QWindowSystemInterface::handleExposeEvent(window(), QRect());
1408- }
1409-}
1410-
1411-void QUbuntuWindow::windowEvent(QEvent *event) {
1412- if (event->type() == QEvent::Expose) {
1413- QRegion region = static_cast<QExposeEvent *>(event)->region();
1414-
1415- if (region.isEmpty()) {
1416- // hiding window causes Qt to release the GL context and its resources, which is a bit severe
1417- // Instead can use the exposure system to stop the rendering loop, but hold onto the resources
1418- setExposed(false);
1419- } else {
1420- setExposed(true);
1421- }
1422- }
1423-}
1424
1425=== removed file 'src/platforms/ubuntu/ubuntucommon/window.h'
1426--- src/platforms/ubuntu/ubuntucommon/window.h 2014-04-16 11:32:13 +0000
1427+++ src/platforms/ubuntu/ubuntucommon/window.h 1970-01-01 00:00:00 +0000
1428@@ -1,58 +0,0 @@
1429-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
1430-// Copyright © 2013 Canonical Ltd.
1431-//
1432-// This program is free software: you can redistribute it and/or modify it under
1433-// the terms of the GNU Lesser General Public License version 3, as published by
1434-// the Free Software Foundation.
1435-//
1436-// This program is distributed in the hope that it will be useful, but WITHOUT
1437-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1438-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1439-// Lesser General Public License for more details.
1440-//
1441-// You should have received a copy of the GNU Lesser General Public License
1442-// along with this program. If not, see <http://www.gnu.org/licenses/>.
1443-
1444-#ifndef QUBUNTUWINDOW_H
1445-#define QUBUNTUWINDOW_H
1446-
1447-#include "base/window.h"
1448-#include <ubuntu/application/instance.h>
1449-#include <ubuntu/application/ui/window.h>
1450-
1451-#define IS_OPAQUE_FLAG 1
1452-
1453-class QUbuntuScreen;
1454-class QUbuntuInput;
1455-
1456-class QUbuntuWindow : public QUbuntuBaseWindow {
1457- public:
1458- QUbuntuWindow(QWindow* w, QUbuntuScreen* screen, QUbuntuInput* input, bool systemSession, UApplicationInstance* instance, bool isShell);
1459- ~QUbuntuWindow();
1460-
1461- // QPlatformWindow methods.
1462- void setGeometry(const QRect&);
1463- void setWindowState(Qt::WindowState state);
1464- void setVisible(bool visible);
1465- bool isExposed() const;
1466- void windowEvent(QEvent *event);
1467-
1468- QUbuntuInput* input_;
1469-
1470- private:
1471- void createWindow();
1472- void moveResize(const QRect& rect);
1473- void setExposed(const bool exposed);
1474-
1475- UAUiWindow* window_;
1476- Qt::WindowState state_;
1477- QRect geometry_;
1478- bool systemSession_;
1479- UApplicationInstance* uainstance_;
1480- UAUiWindowProperties* wprops_;
1481- QUbuntuScreen* screen_;
1482- bool isShell_;
1483- bool exposed_;
1484-};
1485-
1486-#endif // QUBUNTUWINDOW_H
1487
1488=== removed directory 'src/platforms/ubuntu/ubuntumir'
1489=== removed file 'src/platforms/ubuntu/ubuntumir/ubuntumir.pro'
1490--- src/platforms/ubuntu/ubuntumir/ubuntumir.pro 2013-06-21 17:48:36 +0000
1491+++ src/platforms/ubuntu/ubuntumir/ubuntumir.pro 1970-01-01 00:00:00 +0000
1492@@ -1,16 +0,0 @@
1493-TEMPLATE = subdirs
1494-
1495-mirclient|mirserver{
1496-SUBDIRS += ubuntumircommon
1497-}
1498-
1499-mirclient {
1500-SUBDIRS += ubuntumirclient
1501-}
1502-mirserver {
1503-SUBDIRS += ubuntumirserver
1504-}
1505-
1506-ubuntumirclient.depends = ubuntumircommon
1507-ubuntumirserver.depends = ubuntumircommon
1508-
1509
1510=== removed directory 'src/platforms/ubuntu/ubuntumir/ubuntumirclient'
1511=== removed file 'src/platforms/ubuntu/ubuntumir/ubuntumirclient/ubuntumirclient.pro'
1512--- src/platforms/ubuntu/ubuntumir/ubuntumirclient/ubuntumirclient.pro 2014-05-29 10:28:33 +0000
1513+++ src/platforms/ubuntu/ubuntumir/ubuntumirclient/ubuntumirclient.pro 1970-01-01 00:00:00 +0000
1514@@ -1,25 +0,0 @@
1515-TARGET = qubuntumirclient
1516-TEMPLATE = lib
1517-
1518-QT += gui-private platformsupport-private sensors
1519-
1520-DEFINES += MESA_EGL_NO_X11_HEADERS
1521-QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
1522-QMAKE_LFLAGS += -Wl,-no-undefined
1523-
1524-CONFIG(debug) {
1525- QMAKE_CXXFLAGS_DEBUG += -Werror
1526-}
1527-
1528-SOURCES = main.cc
1529-
1530-CONFIG += plugin link_prl link_pkgconfig
1531-
1532-PKGCONFIG += egl
1533-INCLUDEPATH += ../../../ ../../ ../
1534-LIBS += -Wl,--whole-archive -L../../../base -lubuntubase -L../../ubuntucommon -lqubuntucommon -L../ubuntumircommon -lqubuntumircommon -Wl,--no-whole-archive -lubuntu_application_api
1535-
1536-OTHER_FILES += ubuntumirclient.json
1537-
1538-target.path += $$[QT_INSTALL_PLUGINS]/platforms
1539-INSTALLS += target
1540
1541=== removed directory 'src/platforms/ubuntu/ubuntumir/ubuntumircommon'
1542=== removed file 'src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.cc'
1543--- src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.cc 2013-10-15 21:50:17 +0000
1544+++ src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.cc 1970-01-01 00:00:00 +0000
1545@@ -1,184 +0,0 @@
1546-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
1547-// Copyright © 2013 Canonical Ltd.
1548-//
1549-// This program is free software: you can redistribute it and/or modify it under
1550-// the terms of the GNU Lesser General Public License version 3, as published by
1551-// the Free Software Foundation.
1552-//
1553-// This program is distributed in the hope that it will be useful, but WITHOUT
1554-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1555-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1556-// Lesser General Public License for more details.
1557-//
1558-// You should have received a copy of the GNU Lesser General Public License
1559-// along with this program. If not, see <http://www.gnu.org/licenses/>.
1560-
1561-#include "input.h"
1562-#include "integration.h"
1563-#include "base/logging.h"
1564-
1565-#include <QtCore/qglobal.h>
1566-#include <QtCore/QCoreApplication>
1567-#include <private/qguiapplication_p.h>
1568-#include <qpa/qplatforminputcontext.h>
1569-#include <qpa/qwindowsysteminterface.h>
1570-
1571-#include <xkbcommon/xkbcommon.h>
1572-#include <xkbcommon/xkbcommon-keysyms.h>
1573-
1574-#include <ubuntu/application/ui/input/event.h>
1575-
1576-// XKB Keysyms which do not map directly to Qt types (i.e. Unicode points)
1577-static const uint32_t KeyTable[] = {
1578- XKB_KEY_Escape, Qt::Key_Escape,
1579- XKB_KEY_Tab, Qt::Key_Tab,
1580- XKB_KEY_ISO_Left_Tab, Qt::Key_Backtab,
1581- XKB_KEY_BackSpace, Qt::Key_Backspace,
1582- XKB_KEY_Return, Qt::Key_Return,
1583- XKB_KEY_Insert, Qt::Key_Insert,
1584- XKB_KEY_Delete, Qt::Key_Delete,
1585- XKB_KEY_Clear, Qt::Key_Delete,
1586- XKB_KEY_Pause, Qt::Key_Pause,
1587- XKB_KEY_Print, Qt::Key_Print,
1588-
1589- XKB_KEY_Home, Qt::Key_Home,
1590- XKB_KEY_End, Qt::Key_End,
1591- XKB_KEY_Left, Qt::Key_Left,
1592- XKB_KEY_Up, Qt::Key_Up,
1593- XKB_KEY_Right, Qt::Key_Right,
1594- XKB_KEY_Down, Qt::Key_Down,
1595- XKB_KEY_Prior, Qt::Key_PageUp,
1596- XKB_KEY_Next, Qt::Key_PageDown,
1597-
1598- XKB_KEY_Shift_L, Qt::Key_Shift,
1599- XKB_KEY_Shift_R, Qt::Key_Shift,
1600- XKB_KEY_Shift_Lock, Qt::Key_Shift,
1601- XKB_KEY_Control_L, Qt::Key_Control,
1602- XKB_KEY_Control_R, Qt::Key_Control,
1603- XKB_KEY_Meta_L, Qt::Key_Meta,
1604- XKB_KEY_Meta_R, Qt::Key_Meta,
1605- XKB_KEY_Alt_L, Qt::Key_Alt,
1606- XKB_KEY_Alt_R, Qt::Key_Alt,
1607- XKB_KEY_Caps_Lock, Qt::Key_CapsLock,
1608- XKB_KEY_Num_Lock, Qt::Key_NumLock,
1609- XKB_KEY_Scroll_Lock, Qt::Key_ScrollLock,
1610- XKB_KEY_Super_L, Qt::Key_Super_L,
1611- XKB_KEY_Super_R, Qt::Key_Super_R,
1612- XKB_KEY_Menu, Qt::Key_Menu,
1613- XKB_KEY_Hyper_L, Qt::Key_Hyper_L,
1614- XKB_KEY_Hyper_R, Qt::Key_Hyper_R,
1615- XKB_KEY_Help, Qt::Key_Help,
1616-
1617- XKB_KEY_KP_Space, Qt::Key_Space,
1618- XKB_KEY_KP_Tab, Qt::Key_Tab,
1619- XKB_KEY_KP_Enter, Qt::Key_Enter,
1620- XKB_KEY_KP_Home, Qt::Key_Home,
1621- XKB_KEY_KP_Left, Qt::Key_Left,
1622- XKB_KEY_KP_Up, Qt::Key_Up,
1623- XKB_KEY_KP_Right, Qt::Key_Right,
1624- XKB_KEY_KP_Down, Qt::Key_Down,
1625- XKB_KEY_KP_Prior, Qt::Key_PageUp,
1626- XKB_KEY_KP_Next, Qt::Key_PageDown,
1627- XKB_KEY_KP_End, Qt::Key_End,
1628- XKB_KEY_KP_Begin, Qt::Key_Clear,
1629- XKB_KEY_KP_Insert, Qt::Key_Insert,
1630- XKB_KEY_KP_Delete, Qt::Key_Delete,
1631- XKB_KEY_KP_Equal, Qt::Key_Equal,
1632- XKB_KEY_KP_Multiply, Qt::Key_Asterisk,
1633- XKB_KEY_KP_Add, Qt::Key_Plus,
1634- XKB_KEY_KP_Separator, Qt::Key_Comma,
1635- XKB_KEY_KP_Subtract, Qt::Key_Minus,
1636- XKB_KEY_KP_Decimal, Qt::Key_Period,
1637- XKB_KEY_KP_Divide, Qt::Key_Slash,
1638-
1639- XKB_KEY_ISO_Level3_Shift, Qt::Key_AltGr,
1640- XKB_KEY_Multi_key, Qt::Key_Multi_key,
1641- XKB_KEY_Codeinput, Qt::Key_Codeinput,
1642- XKB_KEY_SingleCandidate, Qt::Key_SingleCandidate,
1643- XKB_KEY_MultipleCandidate, Qt::Key_MultipleCandidate,
1644- XKB_KEY_PreviousCandidate, Qt::Key_PreviousCandidate,
1645-
1646- XKB_KEY_Mode_switch, Qt::Key_Mode_switch,
1647- XKB_KEY_script_switch, Qt::Key_Mode_switch,
1648- XKB_KEY_XF86AudioRaiseVolume, Qt::Key_VolumeUp,
1649- XKB_KEY_XF86AudioLowerVolume, Qt::Key_VolumeDown,
1650- XKB_KEY_XF86PowerOff, Qt::Key_PowerOff,
1651- XKB_KEY_XF86PowerDown, Qt::Key_PowerDown,
1652-
1653- 0, 0
1654-};
1655-
1656-QUbuntuMirInput::QUbuntuMirInput(QUbuntuIntegration* integration)
1657- : QUbuntuInput(integration) {
1658-}
1659-
1660-QUbuntuMirInput::~QUbuntuMirInput() {
1661-}
1662-
1663-static uint32_t translateKeysym(uint32_t sym, char *string, size_t size) {
1664- Q_UNUSED(size);
1665- string[0] = '\0';
1666-
1667- if (sym >= XKB_KEY_F1 && sym <= XKB_KEY_F35)
1668- return Qt::Key_F1 + (int(sym) - XKB_KEY_F1);
1669-
1670- for (int i = 0; KeyTable[i]; i += 2)
1671- if (sym == KeyTable[i])
1672- return KeyTable[i + 1];
1673-
1674- string[0] = sym;
1675- string[1] = '\0';
1676- return toupper(sym);
1677-}
1678-
1679-void QUbuntuMirInput::dispatchKeyEvent(QWindow* window, const void* ev) {
1680- DLOG("QUbuntuBaseInput::dispatchKeyEvent (this=%p, window=%p, event=%p)", this, window, ev);
1681- const Event* event = reinterpret_cast<const Event*>(ev);
1682-
1683-#if (LOG_EVENTS != 0)
1684- // Key event logging.
1685- LOG("KEY device_id:%d source_id:%d action:%d flags:%d meta_state:%d key_code:%d "
1686- "scan_code:%d repeat_count:%d down_time:%lld event_time:%lld is_system_key:%d",
1687- event->device_id, event->source_id, event->action, event->flags, event->meta_state,
1688- event->details.key.key_code, event->details.key.scan_code,
1689- event->details.key.repeat_count, event->details.key.down_time,
1690- event->details.key.event_time, event->details.key.is_system_key);
1691-#endif
1692-
1693- ulong timestamp = event->details.key.event_time / 1000000;
1694- xkb_keysym_t xk_sym = (xkb_keysym_t)event->details.key.key_code;
1695-
1696- // Key modifier and unicode index mapping.
1697- const int kMetaState = event->meta_state;
1698- Qt::KeyboardModifiers modifiers = Qt::NoModifier;
1699- if (kMetaState & U_KEY_MODIFIER_SHIFT) {
1700- modifiers |= Qt::ShiftModifier;
1701- }
1702- if (kMetaState & U_KEY_MODIFIER_CTRL) {
1703- modifiers |= Qt::ControlModifier;
1704- }
1705- if (kMetaState & U_KEY_MODIFIER_ALT) {
1706- modifiers |= Qt::AltModifier;
1707- }
1708- if (kMetaState & U_KEY_MODIFIER_META) {
1709- modifiers |= Qt::MetaModifier;
1710- }
1711-
1712- QEvent::Type keyType = event->action == U_KEY_ACTION_DOWN ? QEvent::KeyPress : QEvent::KeyRelease;
1713-
1714- char s[2];
1715- int sym = translateKeysym(xk_sym, s, sizeof(s));
1716- QString text = QString::fromLatin1(s);
1717-
1718- QPlatformInputContext* context = QGuiApplicationPrivate::platformIntegration()->inputContext();
1719- if (context) {
1720- QKeyEvent qKeyEvent(keyType, sym, modifiers, text);
1721- qKeyEvent.setTimestamp(timestamp);
1722- if (context->filterEvent(&qKeyEvent)) {
1723- DLOG("key event filtered out by input context");
1724- return;
1725- }
1726- }
1727-
1728- handleKeyEvent(window, timestamp, keyType, sym, modifiers, text);
1729-}
1730
1731=== removed file 'src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.h'
1732--- src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.h 2013-06-24 15:58:01 +0000
1733+++ src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.h 1970-01-01 00:00:00 +0000
1734@@ -1,31 +0,0 @@
1735-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
1736-// Copyright © 2013 Canonical Ltd.
1737-//
1738-// This program is free software: you can redistribute it and/or modify it under
1739-// the terms of the GNU Lesser General Public License version 3, as published by
1740-// the Free Software Foundation.
1741-//
1742-// This program is distributed in the hope that it will be useful, but WITHOUT
1743-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1744-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1745-// Lesser General Public License for more details.
1746-//
1747-// You should have received a copy of the GNU Lesser General Public License
1748-// along with this program. If not, see <http://www.gnu.org/licenses/>.
1749-
1750-#ifndef QUBUNTU_MIR_INPUT_H
1751-#define QUBUNTU_MIR_INPUT_H
1752-
1753-#include "ubuntucommon/input.h"
1754-
1755-class QUbuntuIntegration;
1756-
1757-class QUbuntuMirInput : public QUbuntuInput {
1758-public:
1759- QUbuntuMirInput(QUbuntuIntegration* integration);
1760- ~QUbuntuMirInput();
1761-
1762- virtual void dispatchKeyEvent(QWindow* window, const void* event);
1763-};
1764-
1765-#endif // QUBUNTU_MIR_INPUT_H
1766
1767=== removed file 'src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.cc'
1768--- src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.cc 2013-06-24 17:52:59 +0000
1769+++ src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.cc 1970-01-01 00:00:00 +0000
1770@@ -1,43 +0,0 @@
1771-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
1772-// Copyright © 2013 Canonical Ltd.
1773-//
1774-// This program is free software: you can redistribute it and/or modify it under
1775-// the terms of the GNU Lesser General Public License version 3, as published by
1776-// the Free Software Foundation.
1777-//
1778-// This program is distributed in the hope that it will be useful, but WITHOUT
1779-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1780-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1781-// Lesser General Public License for more details.
1782-//
1783-// You should have received a copy of the GNU Lesser General Public License
1784-// along with this program. If not, see <http://www.gnu.org/licenses/>.
1785-
1786-#include "input.h"
1787-#include "integration.h"
1788-#include "ubuntucommon/input_adaptor_factory.h"
1789-
1790-namespace
1791-{
1792-struct InputAdaptorFactory : public QUbuntuInputAdaptorFactory {
1793- InputAdaptorFactory() {}
1794- ~InputAdaptorFactory() {}
1795-
1796- QUbuntuInput *create_input_adaptor(QUbuntuIntegration* integration)
1797- {
1798- return new QUbuntuMirInput(integration);
1799- }
1800- static InputAdaptorFactory* instance()
1801- {
1802- static InputAdaptorFactory global_instance;
1803- return &global_instance;
1804- }
1805-};
1806-}
1807-
1808-QUbuntuMirIntegration::QUbuntuMirIntegration()
1809- : QUbuntuIntegration(InputAdaptorFactory::instance()) {
1810-}
1811-
1812-QUbuntuMirIntegration::~QUbuntuMirIntegration() {
1813-}
1814
1815=== removed file 'src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.h'
1816--- src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.h 2013-06-21 20:46:06 +0000
1817+++ src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.h 1970-01-01 00:00:00 +0000
1818@@ -1,27 +0,0 @@
1819-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
1820-// Copyright © 2013 Canonical Ltd.
1821-//
1822-// This program is free software: you can redistribute it and/or modify it under
1823-// the terms of the GNU Lesser General Public License version 3, as published by
1824-// the Free Software Foundation.
1825-//
1826-// This program is distributed in the hope that it will be useful, but WITHOUT
1827-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1828-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1829-// Lesser General Public License for more details.
1830-//
1831-// You should have received a copy of the GNU Lesser General Public License
1832-// along with this program. If not, see <http://www.gnu.org/licenses/>.
1833-
1834-#ifndef QUBUNTU_MIR_INTEGRATION_H
1835-#define QUBUNTU_MIR_INTEGRATION_H
1836-
1837-#include "ubuntucommon/integration.h"
1838-
1839-class QUbuntuMirIntegration : public QUbuntuIntegration {
1840-public:
1841- QUbuntuMirIntegration();
1842- ~QUbuntuMirIntegration();
1843-};
1844-
1845-#endif // QUBUNTU_MIR_INTEGRATION_H
1846
1847=== removed file 'src/platforms/ubuntu/ubuntumir/ubuntumircommon/ubuntumircommon.pro'
1848--- src/platforms/ubuntu/ubuntumir/ubuntumircommon/ubuntumircommon.pro 2013-11-22 15:24:44 +0000
1849+++ src/platforms/ubuntu/ubuntumir/ubuntumircommon/ubuntumircommon.pro 1970-01-01 00:00:00 +0000
1850@@ -1,21 +0,0 @@
1851-TARGET = qubuntumircommon
1852-TEMPLATE = lib
1853-
1854-QT += core-private gui-private
1855-
1856-DEFINES += MESA_EGL_NO_X11_HEADERS
1857-QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
1858-QMAKE_LFLAGS += -Wl,-no-undefined -L../ubuntucommon
1859-
1860-CONFIG(debug) {
1861- QMAKE_CXXFLAGS_DEBUG += -Werror
1862-}
1863-
1864-SOURCES = input.cc integration.cc
1865-
1866-HEADERS = input.h integration.h
1867-
1868-CONFIG += static plugin create_prl link_prl
1869-
1870-INCLUDEPATH += ../../../ ../../
1871-LIBS += -Wl,--whole-archive -lqubuntucommon -Wl,--no-whole-archive
1872
1873=== removed directory 'src/platforms/ubuntu/ubuntumir/ubuntumirserver'
1874=== removed file 'src/platforms/ubuntu/ubuntumir/ubuntumirserver/main.cc'
1875--- src/platforms/ubuntu/ubuntumir/ubuntumirserver/main.cc 2014-05-29 10:28:33 +0000
1876+++ src/platforms/ubuntu/ubuntumir/ubuntumirserver/main.cc 1970-01-01 00:00:00 +0000
1877@@ -1,53 +0,0 @@
1878-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
1879-// Copyright © 2013 Canonical Ltd.
1880-//
1881-// This program is free software: you can redistribute it and/or modify it under
1882-// the terms of the GNU Lesser General Public License version 3, as published by
1883-// the Free Software Foundation.
1884-//
1885-// This program is distributed in the hope that it will be useful, but WITHOUT
1886-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1887-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1888-// Lesser General Public License for more details.
1889-//
1890-// You should have received a copy of the GNU Lesser General Public License
1891-// along with this program. If not, see <http://www.gnu.org/licenses/>.
1892-
1893-#include <qpa/qplatformintegrationplugin.h>
1894-#include "ubuntumircommon/integration.h"
1895-
1896-QT_BEGIN_NAMESPACE
1897-
1898-class QUbuntuMirServerIntegrationPlugin : public QPlatformIntegrationPlugin {
1899- Q_OBJECT
1900- Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid
1901- FILE "ubuntumirserver.json")
1902-
1903- public:
1904- QStringList keys() const;
1905- QPlatformIntegration* create(const QString&, const QStringList&);
1906-};
1907-
1908-QStringList QUbuntuMirServerIntegrationPlugin::keys() const {
1909- QStringList list;
1910- list << "ubuntumirserver";
1911- return list;
1912-}
1913-
1914-QPlatformIntegration* QUbuntuMirServerIntegrationPlugin::create(
1915- const QString& system, const QStringList& paramList) {
1916- Q_UNUSED(paramList);
1917- if (system.toLower() == "ubuntumirserver") {
1918-#ifdef PLATFORM_API_TOUCH
1919- setenv("UBUNTU_PLATFORM_API_BACKEND", "touch_mirserver", 1);
1920-#else
1921- setenv("UBUNTU_PLATFORM_API_BACKEND", "desktop_mirserver", 1);
1922-#endif
1923- return new QUbuntuMirIntegration();
1924- }
1925- return 0;
1926-}
1927-
1928-QT_END_NAMESPACE
1929-
1930-#include "main.moc"
1931
1932=== removed file 'src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.json'
1933--- src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.json 2013-06-10 20:48:03 +0000
1934+++ src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.json 1970-01-01 00:00:00 +0000
1935@@ -1,3 +0,0 @@
1936-{
1937- "Keys": [ "ubuntumirserver" ]
1938-}
1939
1940=== removed file 'src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.pro'
1941--- src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.pro 2014-05-29 10:28:33 +0000
1942+++ src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.pro 1970-01-01 00:00:00 +0000
1943@@ -1,25 +0,0 @@
1944-TARGET = qubuntumirserver
1945-TEMPLATE = lib
1946-
1947-QT += gui-private platformsupport-private sensors
1948-
1949-DEFINES += MESA_EGL_NO_X11_HEADERS
1950-QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
1951-QMAKE_LFLAGS += -Wl,-no-undefined
1952-
1953-CONFIG(debug) {
1954- QMAKE_CXXFLAGS_DEBUG += -Werror
1955-}
1956-
1957-SOURCES = main.cc
1958-
1959-CONFIG += plugin link_prl link_pkgconfig
1960-
1961-PKGCONFIG += egl
1962-INCLUDEPATH += ../../../ ../../ ../
1963-LIBS += -Wl,--whole-archive -L../../../base -lubuntubase -L../../ubuntucommon -lqubuntucommon -L../ubuntumircommon -lqubuntumircommon -Wl,--no-whole-archive -lubuntu_application_api
1964-
1965-OTHER_FILES += ubuntu.json
1966-
1967-target.path += $$[QT_INSTALL_PLUGINS]/platforms
1968-INSTALLS += target
1969
1970=== removed directory 'src/platforms/ubuntulegacy'
1971=== removed file 'src/platforms/ubuntulegacy/input.cc'
1972--- src/platforms/ubuntulegacy/input.cc 2013-10-17 18:38:03 +0000
1973+++ src/platforms/ubuntulegacy/input.cc 1970-01-01 00:00:00 +0000
1974@@ -1,56 +0,0 @@
1975-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
1976-// Copyright © 2013 Canonical Ltd.
1977-//
1978-// This program is free software: you can redistribute it and/or modify it under
1979-// the terms of the GNU Lesser General Public License version 3, as published by
1980-// the Free Software Foundation.
1981-//
1982-// This program is distributed in the hope that it will be useful, but WITHOUT
1983-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1984-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1985-// Lesser General Public License for more details.
1986-//
1987-// You should have received a copy of the GNU Lesser General Public License
1988-// along with this program. If not, see <http://www.gnu.org/licenses/>.
1989-
1990-#include "input.h"
1991-#include "integration.h"
1992-#include "base/logging.h"
1993-#include <qpa/qplatformwindow.h>
1994-
1995-static void eventCallback(Event* event, void* context) {
1996- DLOG("eventCallback (event=%p, context=%p)", event, context);
1997- QUbuntuLegacyInput* input = static_cast<QUbuntuLegacyInput*>(context);
1998- if (!input->stopping_.testAndSetRelease(1, 1)) {
1999- // FIXME(loicm) We need to be able to retrieve the window from an event in order to support
2000- // multiple surfaces.
2001- QPlatformWindow* window = static_cast<QUbuntuLegacyIntegration*>(
2002- input->integration())->platformWindow();
2003- if (window) {
2004- input->postEvent(window->window(), event);
2005- }
2006- }
2007-}
2008-
2009-QUbuntuLegacyInput::QUbuntuLegacyInput(QUbuntuLegacyIntegration* integration)
2010- : QUbuntuBaseInput(integration)
2011- , stopping_(0) {
2012- config_.enable_touch_point_visualization = false;
2013- config_.default_layer_for_touch_point_visualization = 1;
2014- listener_.on_new_event = eventCallback;
2015- listener_.context = this;
2016- DLOG("initializing input stack");
2017- android_input_stack_initialize(&listener_, &config_);
2018- DLOG("starting input stack");
2019- android_input_stack_start();
2020- DLOG("QUbuntuLegacyInput::QUbuntuLegacyInput (this=%p, integration=%p)", this, integration);
2021-}
2022-
2023-QUbuntuLegacyInput::~QUbuntuLegacyInput() {
2024- DLOG("QUbuntuLegacyInput::~QUbuntuLegacyInput");
2025- stopping_.fetchAndStoreRelease(1);
2026- DLOG("stopping input stack");
2027- android_input_stack_stop();
2028- DLOG("shutting down input stack");
2029- android_input_stack_shutdown();
2030-}
2031
2032=== removed file 'src/platforms/ubuntulegacy/input.h'
2033--- src/platforms/ubuntulegacy/input.h 2013-02-14 16:31:33 +0000
2034+++ src/platforms/ubuntulegacy/input.h 1970-01-01 00:00:00 +0000
2035@@ -1,37 +0,0 @@
2036-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
2037-// Copyright © 2013 Canonical Ltd.
2038-//
2039-// This program is free software: you can redistribute it and/or modify it under
2040-// the terms of the GNU Lesser General Public License version 3, as published by
2041-// the Free Software Foundation.
2042-//
2043-// This program is distributed in the hope that it will be useful, but WITHOUT
2044-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2045-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2046-// Lesser General Public License for more details.
2047-//
2048-// You should have received a copy of the GNU Lesser General Public License
2049-// along with this program. If not, see <http://www.gnu.org/licenses/>.
2050-
2051-#ifndef QUBUNTULEGACYINPUT_H
2052-#define QUBUNTULEGACYINPUT_H
2053-
2054-#include "base/input.h"
2055-#include <cstring> // input_stack_compatibility_layer.h needs this for size_t.
2056-#include <input/input_stack_compatibility_layer.h>
2057-
2058-class QUbuntuLegacyIntegration;
2059-
2060-class QUbuntuLegacyInput : public QUbuntuBaseInput {
2061- public:
2062- QUbuntuLegacyInput(QUbuntuLegacyIntegration* integration);
2063- ~QUbuntuLegacyInput();
2064-
2065- QAtomicInt stopping_;
2066-
2067- private:
2068- InputStackConfiguration config_;
2069- AndroidEventListener listener_;
2070-};
2071-
2072-#endif // QUBUNTULEGACYINPUT_H
2073
2074=== removed file 'src/platforms/ubuntulegacy/integration.cc'
2075--- src/platforms/ubuntulegacy/integration.cc 2013-02-14 16:31:33 +0000
2076+++ src/platforms/ubuntulegacy/integration.cc 1970-01-01 00:00:00 +0000
2077@@ -1,75 +0,0 @@
2078-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
2079-// Copyright © 2013 Canonical Ltd.
2080-//
2081-// This program is free software: you can redistribute it and/or modify it under
2082-// the terms of the GNU Lesser General Public License version 3, as published by
2083-// the Free Software Foundation.
2084-//
2085-// This program is distributed in the hope that it will be useful, but WITHOUT
2086-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2087-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2088-// Lesser General Public License for more details.
2089-//
2090-// You should have received a copy of the GNU Lesser General Public License
2091-// along with this program. If not, see <http://www.gnu.org/licenses/>.
2092-
2093-#include "integration.h"
2094-#include "window.h"
2095-#include "input.h"
2096-#include "base/clipboard.h"
2097-#include "base/logging.h"
2098-#include <qpa/qplatforminputcontextfactory_p.h>
2099-#include <qpa/qplatforminputcontext.h>
2100-#include <QTimer>
2101-
2102-// That value seems to work on every systems and applications tested so far.
2103-static const int kInputDelay = 1000;
2104-
2105-QUbuntuLegacyIntegration::QUbuntuLegacyIntegration()
2106- : window_(NULL)
2107- , screen_(new QUbuntuLegacyScreen())
2108- , input_(NULL)
2109- , clipboard_(new QUbuntuBaseClipboard()) {
2110- screenAdded(screen_);
2111- if (qEnvironmentVariableIsEmpty("QTUBUNTU_NO_INPUT")) {
2112- // Input initialization needs to be delayed in order to avoid crashes in the input stack.
2113- int delay = kInputDelay;
2114- QByteArray swapIntervalString = qgetenv("QTUBUNTU_INPUT_DELAY");
2115- if (!swapIntervalString.isEmpty()) {
2116- bool valid;
2117- delay = qMax(1, swapIntervalString.toInt(&valid));
2118- if (!valid)
2119- delay = kInputDelay;
2120- }
2121- DLOG("delaying input initialization for %d ms", delay);
2122- QTimer::singleShot(delay, this, SLOT(initInput()));
2123- }
2124- DLOG("QUbuntuLegacyIntegration::QUbuntuLegacyIntegration (this=%p)", this);
2125-}
2126-
2127-QUbuntuLegacyIntegration::~QUbuntuLegacyIntegration() {
2128- DLOG("QUbuntuLegacyIntegration::~QUbuntuLegacyIntegration");
2129- delete clipboard_;
2130- delete input_;
2131- delete inputContext_;
2132- delete screen_;
2133-}
2134-
2135-void QUbuntuLegacyIntegration::initInput() {
2136- DLOG("QUbuntuLegacyIntegration::initInput (this=%p)", this);
2137- input_ = new QUbuntuLegacyInput(this);
2138- inputContext_ = QPlatformInputContextFactory::create();
2139-}
2140-
2141-QPlatformWindow* QUbuntuLegacyIntegration::createPlatformWindow(QWindow* window) const {
2142- DLOG("QUbuntuLegacyIntegration::createPlatformWindow const (this=%p, window=%p)", this, window);
2143- return const_cast<QUbuntuLegacyIntegration*>(this)->createPlatformWindow(window);
2144-}
2145-
2146-QPlatformWindow* QUbuntuLegacyIntegration::createPlatformWindow(QWindow* window) {
2147- DLOG("QUbuntuLegacyIntegration::createPlatformWindow (this=%p, window=%p)", this, window);
2148- ASSERT(window_ == NULL); // FIXME(loicm) Multiple windows are not supported yet.
2149- window_ = new QUbuntuLegacyWindow(window, static_cast<QUbuntuLegacyScreen*>(screen_));
2150- window_->requestActivateWindow();
2151- return window_;
2152-}
2153
2154=== removed file 'src/platforms/ubuntulegacy/integration.h'
2155--- src/platforms/ubuntulegacy/integration.h 2013-02-14 16:31:33 +0000
2156+++ src/platforms/ubuntulegacy/integration.h 1970-01-01 00:00:00 +0000
2157@@ -1,53 +0,0 @@
2158-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
2159-// Copyright © 2013 Canonical Ltd.
2160-//
2161-// This program is free software: you can redistribute it and/or modify it under
2162-// the terms of the GNU Lesser General Public License version 3, as published by
2163-// the Free Software Foundation.
2164-//
2165-// This program is distributed in the hope that it will be useful, but WITHOUT
2166-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2167-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2168-// Lesser General Public License for more details.
2169-//
2170-// You should have received a copy of the GNU Lesser General Public License
2171-// along with this program. If not, see <http://www.gnu.org/licenses/>.
2172-
2173-#ifndef QUBUNTULEGACYINTEGRATION_H
2174-#define QUBUNTULEGACYINTEGRATION_H
2175-
2176-#include "base/integration.h"
2177-#include "screen.h"
2178-
2179-class QUbuntuLegacyInput;
2180-
2181-class QUbuntuLegacyIntegration : public QObject, public QUbuntuBaseIntegration {
2182- Q_OBJECT
2183-
2184- public:
2185- QUbuntuLegacyIntegration();
2186- ~QUbuntuLegacyIntegration();
2187-
2188- // QPlatformIntegration methods.
2189- QPlatformWindow* createPlatformWindow(QWindow* window) const;
2190- QPlatformWindow* createPlatformWindow(QWindow* window);
2191- QPlatformInputContext* inputContext() const { return inputContext_; }
2192- QPlatformClipboard* clipboard() const { return clipboard_; }
2193-
2194- // New methods.
2195- // FIXME(loicm) Only one window can be created for now, remove that function when adding support
2196- // for multiple windows.
2197- QPlatformWindow* platformWindow() const { return window_; }
2198-
2199- private slots:
2200- void initInput();
2201-
2202- private:
2203- QPlatformWindow* window_;
2204- QPlatformScreen* screen_;
2205- QUbuntuLegacyInput* input_;
2206- QPlatformInputContext* inputContext_;
2207- QPlatformClipboard* clipboard_;
2208-};
2209-
2210-#endif // QUBUNTULEGACYINTEGRATION_H
2211
2212=== removed file 'src/platforms/ubuntulegacy/main.cc'
2213--- src/platforms/ubuntulegacy/main.cc 2013-11-19 09:00:47 +0000
2214+++ src/platforms/ubuntulegacy/main.cc 1970-01-01 00:00:00 +0000
2215@@ -1,47 +0,0 @@
2216-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
2217-// Copyright © 2013 Canonical Ltd.
2218-//
2219-// This program is free software: you can redistribute it and/or modify it under
2220-// the terms of the GNU Lesser General Public License version 3, as published by
2221-// the Free Software Foundation.
2222-//
2223-// This program is distributed in the hope that it will be useful, but WITHOUT
2224-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2225-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2226-// Lesser General Public License for more details.
2227-//
2228-// You should have received a copy of the GNU Lesser General Public License
2229-// along with this program. If not, see <http://www.gnu.org/licenses/>.
2230-
2231-#include <qpa/qplatformintegrationplugin.h>
2232-#include "integration.h"
2233-
2234-QT_BEGIN_NAMESPACE
2235-
2236-class QUbuntuLegacyIntegrationPlugin : public QPlatformIntegrationPlugin {
2237- Q_OBJECT
2238- Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid
2239- FILE "ubuntulegacy.json")
2240-
2241- public:
2242- QStringList keys() const;
2243- QPlatformIntegration* create(const QString&, const QStringList&);
2244-};
2245-
2246-QStringList QUbuntuLegacyIntegrationPlugin::keys() const {
2247- QStringList list;
2248- list << "ubuntulegacy";
2249- return list;
2250-}
2251-
2252-QPlatformIntegration* QUbuntuLegacyIntegrationPlugin::create(
2253- const QString& system, const QStringList& paramList) {
2254- Q_UNUSED(paramList);
2255- if (system.toLower() == "ubuntulegacy")
2256- return new QUbuntuLegacyIntegration();
2257- return 0;
2258-}
2259-
2260-QT_END_NAMESPACE
2261-
2262-#include "main.moc"
2263
2264=== removed file 'src/platforms/ubuntulegacy/screen.cc'
2265--- src/platforms/ubuntulegacy/screen.cc 2013-02-14 16:31:33 +0000
2266+++ src/platforms/ubuntulegacy/screen.cc 1970-01-01 00:00:00 +0000
2267@@ -1,34 +0,0 @@
2268-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
2269-// Copyright © 2013 Canonical Ltd.
2270-//
2271-// This program is free software: you can redistribute it and/or modify it under
2272-// the terms of the GNU Lesser General Public License version 3, as published by
2273-// the Free Software Foundation.
2274-//
2275-// This program is distributed in the hope that it will be useful, but WITHOUT
2276-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2277-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2278-// Lesser General Public License for more details.
2279-//
2280-// You should have received a copy of the GNU Lesser General Public License
2281-// along with this program. If not, see <http://www.gnu.org/licenses/>.
2282-
2283-#include "screen.h"
2284-#include "base/logging.h"
2285-#include <surface_flinger/surface_flinger_compatibility_layer.h>
2286-
2287-QUbuntuLegacyScreen::QUbuntuLegacyScreen() {
2288- const int kScreenWidth = sf_get_display_width(SURFACE_FLINGER_DEFAULT_DISPLAY_ID);
2289- const int kScreenHeight = sf_get_display_height(SURFACE_FLINGER_DEFAULT_DISPLAY_ID);
2290- ASSERT(kScreenWidth > 0 && kScreenHeight > 0);
2291- geometry_ = QRect(0, 0, kScreenWidth, kScreenHeight);
2292- ASSERT((sfClient_ = sf_client_create_full(false)) != NULL);
2293- DLOG("QUbuntuLegacyScreen::QUbuntuLegacyScreen (this=%p)", this);
2294-}
2295-
2296-QUbuntuLegacyScreen::~QUbuntuLegacyScreen() {
2297- DLOG("QUbuntuLegacyScreen::~QUbuntuLegacyScreen");
2298- // FIXME(loicm) Invalid because the struct is forward declarated, we need a way to clean the
2299- // handle correctly.
2300- // delete sfClient_;
2301-}
2302
2303=== removed file 'src/platforms/ubuntulegacy/screen.h'
2304--- src/platforms/ubuntulegacy/screen.h 2013-02-14 16:31:33 +0000
2305+++ src/platforms/ubuntulegacy/screen.h 1970-01-01 00:00:00 +0000
2306@@ -1,39 +0,0 @@
2307-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
2308-// Copyright © 2013 Canonical Ltd.
2309-//
2310-// This program is free software: you can redistribute it and/or modify it under
2311-// the terms of the GNU Lesser General Public License version 3, as published by
2312-// the Free Software Foundation.
2313-//
2314-// This program is distributed in the hope that it will be useful, but WITHOUT
2315-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2316-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2317-// Lesser General Public License for more details.
2318-//
2319-// You should have received a copy of the GNU Lesser General Public License
2320-// along with this program. If not, see <http://www.gnu.org/licenses/>.
2321-
2322-#ifndef QUBUNTULEGACYSCREEN_H
2323-#define QUBUNTULEGACYSCREEN_H
2324-
2325-#include "base/screen.h"
2326-
2327-struct SfClient;
2328-
2329-class QUbuntuLegacyScreen : public QUbuntuBaseScreen {
2330- public:
2331- QUbuntuLegacyScreen();
2332- ~QUbuntuLegacyScreen();
2333-
2334- // QPlatformScreen methods.
2335- QRect geometry() const { return geometry_; }
2336-
2337- // New methods.
2338- SfClient* sfClient() const { return sfClient_; }
2339-
2340- private:
2341- QRect geometry_;
2342- SfClient* sfClient_;
2343-};
2344-
2345-#endif // QUBUNTULEGACYSCREEN_H
2346
2347=== removed file 'src/platforms/ubuntulegacy/ubuntulegacy.json'
2348--- src/platforms/ubuntulegacy/ubuntulegacy.json 2013-01-17 19:51:06 +0000
2349+++ src/platforms/ubuntulegacy/ubuntulegacy.json 1970-01-01 00:00:00 +0000
2350@@ -1,3 +0,0 @@
2351-{
2352- "Keys": [ "ubuntulegacy" ]
2353-}
2354
2355=== removed file 'src/platforms/ubuntulegacy/ubuntulegacy.pro'
2356--- src/platforms/ubuntulegacy/ubuntulegacy.pro 2013-01-17 19:51:06 +0000
2357+++ src/platforms/ubuntulegacy/ubuntulegacy.pro 1970-01-01 00:00:00 +0000
2358@@ -1,35 +0,0 @@
2359-TARGET = qubuntulegacy
2360-TEMPLATE = lib
2361-
2362-QT += core-private gui-private platformsupport-private
2363-
2364-DEFINES += MESA_EGL_NO_X11_HEADERS
2365-QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
2366-QMAKE_LFLAGS += -Wl,-no-undefined
2367-
2368-CONFIG(debug) {
2369- QMAKE_CXXFLAGS_DEBUG += -Werror
2370-}
2371-
2372-SOURCES = main.cc \
2373- integration.cc \
2374- window.cc \
2375- screen.cc \
2376- input.cc
2377-
2378-HEADERS = integration.h \
2379- window.h \
2380- screen.h \
2381- input.h
2382-
2383-CONFIG += plugin link_prl
2384-
2385-PRE_TARGETDEPS = ../base/libubuntubase.a
2386-
2387-INCLUDEPATH += .. /usr/include/hybris
2388-LIBS += -L../base -lubuntubase -lhybris_ics -lsf -lis
2389-
2390-OTHER_FILES += ubuntulegacy.json
2391-
2392-target.path += $$[QT_INSTALL_PLUGINS]/platforms
2393-INSTALLS += target
2394
2395=== removed file 'src/platforms/ubuntulegacy/window.cc'
2396--- src/platforms/ubuntulegacy/window.cc 2013-10-09 12:11:20 +0000
2397+++ src/platforms/ubuntulegacy/window.cc 1970-01-01 00:00:00 +0000
2398@@ -1,120 +0,0 @@
2399-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
2400-// Copyright © 2013 Canonical Ltd.
2401-//
2402-// This program is free software: you can redistribute it and/or modify it under
2403-// the terms of the GNU Lesser General Public License version 3, as published by
2404-// the Free Software Foundation.
2405-//
2406-// This program is distributed in the hope that it will be useful, but WITHOUT
2407-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2408-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2409-// Lesser General Public License for more details.
2410-//
2411-// You should have received a copy of the GNU Lesser General Public License
2412-// along with this program. If not, see <http://www.gnu.org/licenses/>.
2413-
2414-#include "window.h"
2415-#include "screen.h"
2416-#include "base/logging.h"
2417-#include <qpa/qwindowsysteminterface.h>
2418-#include <surface_flinger/surface_flinger_compatibility_layer.h>
2419-
2420-QUbuntuLegacyWindow::QUbuntuLegacyWindow(QWindow* w, QUbuntuLegacyScreen* screen)
2421- : QUbuntuBaseWindow(w, screen)
2422- , geometry_(window()->geometry())
2423- , layer_((INT_MAX / 2) + winId()) {
2424- // FIXME(loicm) SF compat set_size() function doesn't seem to work as expected, surfaces are
2425- // created fullscreen and never resized for now.
2426- QRect screenGeometry(screen->availableGeometry());
2427- SfSurfaceCreationParameters parameters = {
2428- screenGeometry.x(), screenGeometry.y(), screenGeometry.width(), screenGeometry.height(), -1,
2429- layer_, 1.0f, false, "QUbuntuLegacyWindow"
2430- };
2431- // SfSurfaceCreationParameters parameters = {
2432- // geometry_.x(), geometry_.y(), geometry_.width(), geometry_.height(), -1, layer_, 1.0f, false,
2433- // "QUbuntuLegacyWindow"
2434- // };
2435- ASSERT((sfSurface_ = sf_surface_create(screen->sfClient(), &parameters)) != NULL);
2436- createEGLSurface(sf_surface_get_egl_native_window(sfSurface_));
2437- setWindowState(window()->windowState());
2438- DLOG("QUbuntuLegacyWindow::QUbuntuLegacyWindow (this=%p, w=%p, screen=%p)", this, w, screen);
2439-}
2440-
2441-QUbuntuLegacyWindow::~QUbuntuLegacyWindow() {
2442- DLOG("QUbuntuLegacyWindow::~QUbuntuLegacyWindow");
2443- destroyEGLSurface();
2444- // FIXME(loicm) Invalid because the struct is forward declarated, we need a way to clean the
2445- // handle correctly.
2446- // delete sfSurface_;
2447-}
2448-
2449-void QUbuntuLegacyWindow::setWindowState(Qt::WindowState state) {
2450- if (state == state_)
2451- return;
2452-
2453- switch (state) {
2454- case Qt::WindowNoState: {
2455- DLOG("QUbuntuLegacyWindow::setWindowState (this=%p, state='NoState')", this);
2456- moveResize(geometry_);
2457- state_ = Qt::WindowNoState;
2458- break;
2459- }
2460- case Qt::WindowFullScreen: {
2461- DLOG("QUbuntuLegacyWindow::setWindowState (this=%p, state='FullScreen')", this);
2462- QRect screenGeometry(screen()->availableGeometry());
2463- moveResize(screenGeometry);
2464- state_ = Qt::WindowFullScreen;
2465- break;
2466- }
2467- case Qt::WindowActive:
2468- case Qt::WindowMinimized:
2469- case Qt::WindowMaximized:
2470- default: {
2471- DLOG("QUbuntuLegacyWindow::setWindowState (this=%p, state='Active|Minimized|Maximized')", this);
2472- break;
2473- }
2474- }
2475-}
2476-
2477-void QUbuntuLegacyWindow::setGeometry(const QRect& rect) {
2478- DLOG("QUbuntuLegacyWindow::setGeometry (this=%p)", this);
2479- geometry_ = rect;
2480- if (state_ != Qt::WindowFullScreen)
2481- moveResize(rect);
2482-}
2483-
2484-void QUbuntuLegacyWindow::setOpacity(qreal level) {
2485- DLOG("QUbuntuLegacyWindow::setOpacity (this=%p, level=%.2f)", this, level);
2486- sf_client_begin_transaction(screen_->sfClient());
2487- sf_surface_set_alpha(sfSurface_, level);
2488- sf_client_end_transaction(screen_->sfClient());
2489-}
2490-
2491-void QUbuntuLegacyWindow::raise() {
2492- DLOG("QUbuntuLegacyWindow::raise (this=%p)", this);
2493- layer_ = qMax(0, qMin(layer_ + 1, INT_MAX));
2494- sf_client_begin_transaction(screen_->sfClient());
2495- sf_surface_set_layer(sfSurface_, layer_);
2496- sf_client_end_transaction(screen_->sfClient());
2497-}
2498-
2499-void QUbuntuLegacyWindow::lower() {
2500- DLOG("QUbuntuLegacyWindow::lower (this=%p)", this);
2501- layer_ = qMax(0, qMin(layer_ - 1, INT_MAX));
2502- sf_client_begin_transaction(screen_->sfClient());
2503- sf_surface_set_alpha(sfSurface_, layer_);
2504- sf_client_end_transaction(screen_->sfClient());
2505-}
2506-
2507-void QUbuntuLegacyWindow::moveResize(const QRect& rect) {
2508- DLOG("QUbuntuLegacyWindow::moveResize (this=%p, x=%d, y=%d, w=%d, h=%d)", this, rect.x(),
2509- rect.y(), rect.width(), rect.height());
2510- // FIXME(loicm) SF compat set_size() function doesn't seem to work as expected, surfaces are
2511- // created fullscreen and never moved nor resized for now.
2512- // sf_client_begin_transaction(screen_->sfClient());
2513- // sf_surface_move_to(sfSurface_, rect.x(), rect.y());
2514- // sf_surface_set_size(sfSurface_, rect.width(), rect.height());
2515- // sf_client_end_transaction(screen_->sfClient());
2516- QWindowSystemInterface::handleGeometryChange(window(), rect);
2517- QPlatformWindow::setGeometry(rect);
2518-}
2519
2520=== removed file 'src/platforms/ubuntulegacy/window.h'
2521--- src/platforms/ubuntulegacy/window.h 2013-02-14 16:31:33 +0000
2522+++ src/platforms/ubuntulegacy/window.h 1970-01-01 00:00:00 +0000
2523@@ -1,47 +0,0 @@
2524-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
2525-// Copyright © 2013 Canonical Ltd.
2526-//
2527-// This program is free software: you can redistribute it and/or modify it under
2528-// the terms of the GNU Lesser General Public License version 3, as published by
2529-// the Free Software Foundation.
2530-//
2531-// This program is distributed in the hope that it will be useful, but WITHOUT
2532-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2533-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2534-// Lesser General Public License for more details.
2535-//
2536-// You should have received a copy of the GNU Lesser General Public License
2537-// along with this program. If not, see <http://www.gnu.org/licenses/>.
2538-
2539-#ifndef QUBUNTULEGACYWINDOW_H
2540-#define QUBUNTULEGACYWINDOW_H
2541-
2542-#include "base/window.h"
2543-
2544-struct SfClient;
2545-struct SfSurface;
2546-class QUbuntuLegacyScreen;
2547-
2548-class QUbuntuLegacyWindow : public QUbuntuBaseWindow {
2549- public:
2550- QUbuntuLegacyWindow(QWindow* w, QUbuntuLegacyScreen* screen);
2551- ~QUbuntuLegacyWindow();
2552-
2553- // QPlatformWindow methods.
2554- void setGeometry(const QRect&);
2555- void setWindowState(Qt::WindowState state);
2556- void setOpacity(qreal level);
2557- void raise();
2558- void lower();
2559-
2560- private:
2561- void moveResize(const QRect& rect);
2562-
2563- QUbuntuLegacyScreen* screen_;
2564- SfSurface* sfSurface_;
2565- Qt::WindowState state_;
2566- QRect geometry_;
2567- int layer_;
2568-};
2569-
2570-#endif // QUBUNTULEGACYWINDOW_H
2571
2572=== modified file 'src/src.pro'
2573--- src/src.pro 2014-03-25 17:42:14 +0000
2574+++ src/src.pro 2014-07-21 23:47:35 +0000
2575@@ -1,3 +1,3 @@
2576 TEMPLATE = subdirs
2577
2578-SUBDIRS += platforms
2579+SUBDIRS += ubuntumirclient
2580
2581=== renamed directory 'src/platforms/base' => 'src/ubuntumirclient'
2582=== renamed file 'src/platforms/base/backing_store.cc' => 'src/ubuntumirclient/backingstore.cpp'
2583--- src/platforms/base/backing_store.cc 2013-02-14 16:31:33 +0000
2584+++ src/ubuntumirclient/backingstore.cpp 2014-07-21 23:47:35 +0000
2585@@ -1,59 +1,65 @@
2586-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
2587-// Copyright © 2013 Canonical Ltd.
2588-//
2589-// This program is free software: you can redistribute it and/or modify it under
2590-// the terms of the GNU Lesser General Public License version 3, as published by
2591-// the Free Software Foundation.
2592-//
2593-// This program is distributed in the hope that it will be useful, but WITHOUT
2594-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2595-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2596-// Lesser General Public License for more details.
2597-//
2598-// You should have received a copy of the GNU Lesser General Public License
2599-// along with this program. If not, see <http://www.gnu.org/licenses/>.
2600+/*
2601+ * Copyright (C) 2014 Canonical, Ltd.
2602+ *
2603+ * This program is free software: you can redistribute it and/or modify it under
2604+ * the terms of the GNU Lesser General Public License version 3, as published by
2605+ * the Free Software Foundation.
2606+ *
2607+ * This program is distributed in the hope that it will be useful, but WITHOUT
2608+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2609+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2610+ * Lesser General Public License for more details.
2611+ *
2612+ * You should have received a copy of the GNU Lesser General Public License
2613+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2614+ */
2615
2616-#include "backing_store.h"
2617+#include "backingstore.h"
2618 #include "logging.h"
2619 #include <QtGui/QOpenGLContext>
2620 #include <QtGui/QOpenGLPaintDevice>
2621
2622-QUbuntuBaseBackingStore::QUbuntuBaseBackingStore(QWindow* window)
2623+UbuntuBackingStore::UbuntuBackingStore(QWindow* window)
2624 : QPlatformBackingStore(window)
2625- , context_(new QOpenGLContext) {
2626- context_->setFormat(window->requestedFormat());
2627- context_->setScreen(window->screen());
2628- context_->create();
2629- DLOG("QUbuntuBaseBackingStore::QUbuntuBaseBackingStore (this=%p, window=%p)", this, window);
2630-}
2631-
2632-QUbuntuBaseBackingStore::~QUbuntuBaseBackingStore() {
2633- DLOG("QUbuntuBaseBackingStore::~QUbuntuBaseBackingStore");
2634- delete context_;
2635-}
2636-
2637-void QUbuntuBaseBackingStore::flush(QWindow* window, const QRegion& region, const QPoint& offset) {
2638- Q_UNUSED(region);
2639- Q_UNUSED(offset);
2640- DLOG("QUbuntuBaseBackingStore::flush (this=%p, window=%p)", this, window);
2641- context_->swapBuffers(window);
2642-}
2643-
2644-void QUbuntuBaseBackingStore::beginPaint(const QRegion& region) {
2645- Q_UNUSED(region);
2646- DLOG("QUbuntuBaseBackingStore::beginPaint (this=%p)", this);
2647- window()->setSurfaceType(QSurface::OpenGLSurface);
2648- context_->makeCurrent(window());
2649- device_ = new QOpenGLPaintDevice(window()->size());
2650-}
2651-
2652-void QUbuntuBaseBackingStore::endPaint() {
2653- DLOG("QUbuntuBaseBackingStore::endPaint (this=%p)", this);
2654- delete device_;
2655-}
2656-
2657-void QUbuntuBaseBackingStore::resize(const QSize& size, const QRegion& staticContents) {
2658- Q_UNUSED(size);
2659- Q_UNUSED(staticContents);
2660- DLOG("QUbuntuBaseBackingStore::resize (this=%p)", this);
2661+ , mContext(new QOpenGLContext)
2662+{
2663+ mContext->setFormat(window->requestedFormat());
2664+ mContext->setScreen(window->screen());
2665+ mContext->create();
2666+}
2667+
2668+UbuntuBackingStore::~UbuntuBackingStore()
2669+{
2670+ delete mContext;
2671+}
2672+
2673+void UbuntuBackingStore::flush(QWindow* window, const QRegion& region, const QPoint& offset)
2674+{
2675+ Q_UNUSED(region);
2676+ Q_UNUSED(offset);
2677+ mContext->swapBuffers(window);
2678+}
2679+
2680+void UbuntuBackingStore::beginPaint(const QRegion& region)
2681+{
2682+ Q_UNUSED(region);
2683+ window()->setSurfaceType(QSurface::OpenGLSurface);
2684+ mContext->makeCurrent(window());
2685+ mDevice = new QOpenGLPaintDevice(window()->size());
2686+}
2687+
2688+void UbuntuBackingStore::endPaint()
2689+{
2690+ delete mDevice;
2691+}
2692+
2693+void UbuntuBackingStore::resize(const QSize& size, const QRegion& staticContents)
2694+{
2695+ Q_UNUSED(size);
2696+ Q_UNUSED(staticContents);
2697+}
2698+
2699+QPaintDevice* UbuntuBackingStore::paintDevice()
2700+{
2701+ return reinterpret_cast<QPaintDevice*>(mDevice);
2702 }
2703
2704=== renamed file 'src/platforms/base/backing_store.h' => 'src/ubuntumirclient/backingstore.h'
2705--- src/platforms/base/backing_store.h 2013-02-14 16:31:33 +0000
2706+++ src/ubuntumirclient/backingstore.h 2014-07-21 23:47:35 +0000
2707@@ -1,41 +1,43 @@
2708-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
2709-// Copyright © 2013 Canonical Ltd.
2710-//
2711-// This program is free software: you can redistribute it and/or modify it under
2712-// the terms of the GNU Lesser General Public License version 3, as published by
2713-// the Free Software Foundation.
2714-//
2715-// This program is distributed in the hope that it will be useful, but WITHOUT
2716-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2717-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2718-// Lesser General Public License for more details.
2719-//
2720-// You should have received a copy of the GNU Lesser General Public License
2721-// along with this program. If not, see <http://www.gnu.org/licenses/>.
2722+/*
2723+ * Copyright (C) 2014 Canonical, Ltd.
2724+ *
2725+ * This program is free software: you can redistribute it and/or modify it under
2726+ * the terms of the GNU Lesser General Public License version 3, as published by
2727+ * the Free Software Foundation.
2728+ *
2729+ * This program is distributed in the hope that it will be useful, but WITHOUT
2730+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2731+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2732+ * Lesser General Public License for more details.
2733+ *
2734+ * You should have received a copy of the GNU Lesser General Public License
2735+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2736+ */
2737
2738-#ifndef QUBUNTUBASEBACKINGSTORE_H
2739-#define QUBUNTUBASEBACKINGSTORE_H
2740+#ifndef UBUNTU_BACKING_STORE_H
2741+#define UBUNTU_BACKING_STORE_H
2742
2743 #include <qpa/qplatformbackingstore.h>
2744
2745 class QOpenGLContext;
2746 class QOpenGLPaintDevice;
2747
2748-class QUbuntuBaseBackingStore : public QPlatformBackingStore {
2749- public:
2750- QUbuntuBaseBackingStore(QWindow* window);
2751- ~QUbuntuBaseBackingStore();
2752-
2753- // QPlatformBackingStore methods.
2754- void beginPaint(const QRegion&);
2755- void endPaint();
2756- void flush(QWindow* window, const QRegion& region, const QPoint& offset);
2757- void resize(const QSize& size, const QRegion& staticContents);
2758- QPaintDevice* paintDevice() { return reinterpret_cast<QPaintDevice*>(device_); }
2759-
2760- private:
2761- QOpenGLContext* context_;
2762- QOpenGLPaintDevice* device_;
2763+class UbuntuBackingStore : public QPlatformBackingStore
2764+{
2765+public:
2766+ UbuntuBackingStore(QWindow* window);
2767+ virtual ~UbuntuBackingStore();
2768+
2769+ // QPlatformBackingStore methods.
2770+ void beginPaint(const QRegion&) override;
2771+ void endPaint() override;
2772+ void flush(QWindow* window, const QRegion& region, const QPoint& offset) override;
2773+ void resize(const QSize& size, const QRegion& staticContents) override;
2774+ QPaintDevice* paintDevice() override;
2775+
2776+private:
2777+ QOpenGLContext* mContext;
2778+ QOpenGLPaintDevice* mDevice;
2779 };
2780
2781-#endif // QUBUNTUBASEBACKINGSTORE_H
2782+#endif // UBUNTU_BACKING_STORE_H
2783
2784=== renamed file 'src/platforms/base/clipboard.cc' => 'src/ubuntumirclient/clipboard.cpp'
2785--- src/platforms/base/clipboard.cc 2013-02-05 02:05:42 +0000
2786+++ src/ubuntumirclient/clipboard.cpp 2014-07-21 23:47:35 +0000
2787@@ -1,36 +1,138 @@
2788-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
2789-// Copyright © 2013 Canonical Ltd.
2790-//
2791-// This program is free software: you can redistribute it and/or modify it under
2792-// the terms of the GNU Lesser General Public License version 3, as published by
2793-// the Free Software Foundation.
2794-//
2795-// This program is distributed in the hope that it will be useful, but WITHOUT
2796-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2797-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2798-// Lesser General Public License for more details.
2799-//
2800-// You should have received a copy of the GNU Lesser General Public License
2801-// along with this program. If not, see <http://www.gnu.org/licenses/>.
2802+/*
2803+ * Copyright (C) 2014 Canonical, Ltd.
2804+ *
2805+ * This program is free software: you can redistribute it and/or modify it under
2806+ * the terms of the GNU Lesser General Public License version 3, as published by
2807+ * the Free Software Foundation.
2808+ *
2809+ * This program is distributed in the hope that it will be useful, but WITHOUT
2810+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2811+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2812+ * Lesser General Public License for more details.
2813+ *
2814+ * You should have received a copy of the GNU Lesser General Public License
2815+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2816+ */
2817
2818 #include "clipboard.h"
2819-#include "logging.h"
2820-
2821-QUbuntuBaseClipboard::QUbuntuBaseClipboard() {
2822- DLOG("QUbuntuBaseClipboard::QUbuntuBaseClipboard (this=%p)", this);
2823-}
2824-
2825-QUbuntuBaseClipboard::~QUbuntuBaseClipboard() {
2826- DLOG("QUbuntuBaseClipboard::~QUbuntuBaseClipboard");
2827-}
2828-
2829-QMimeData* QUbuntuBaseClipboard::mimeData(QClipboard::Mode mode) {
2830- DLOG("QUbuntuBaseClipboard::mimeData (this=%p, mode=%d)", this, static_cast<int>(mode));
2831- return QPlatformClipboard::mimeData(mode);
2832-}
2833-
2834-void QUbuntuBaseClipboard::setMimeData(QMimeData* data, QClipboard::Mode mode) {
2835- DLOG("QUbuntuBaseClipboard::setMimeData (this=%p, data=%p, mode=%d)", this, data,
2836- static_cast<int>(mode));
2837- QPlatformClipboard::setMimeData(data, mode);
2838+
2839+#include <QtCore/QMimeData>
2840+#include <QtCore/QStringList>
2841+
2842+// Platform API
2843+#include <ubuntu/application/ui/clipboard.h>
2844+
2845+// FIXME(loicm) The clipboard data format is not defined by Ubuntu Platform API
2846+// which makes it impossible to have non-Qt applications communicate with Qt
2847+// applications through the clipboard API. The solution would be to have
2848+// Ubuntu Platform define the data format or propose an API that supports
2849+// embedding different mime types in the clipboard.
2850+
2851+// Data format:
2852+// number of mime types (4 bytes)
2853+// data layout (16 bytes * number of mime types)
2854+// mime type string offset (4 bytes)
2855+// mime type string size (4 bytes)
2856+// data offset (4 bytes)
2857+// data size (4 bytes)
2858+// data (n bytes)
2859+
2860+const int maxFormatsCount = 16;
2861+const int maxBufferSize = 4 * 1024 * 1024; // 4 Mb
2862+
2863+UbuntuClipboard::UbuntuClipboard()
2864+ : mMimeData(new QMimeData)
2865+{
2866+}
2867+
2868+UbuntuClipboard::~UbuntuClipboard()
2869+{
2870+ delete mMimeData;
2871+}
2872+
2873+QMimeData* UbuntuClipboard::mimeData(QClipboard::Mode mode)
2874+{
2875+ Q_UNUSED(mode);
2876+ // Get clipboard data.
2877+ void* data = NULL;
2878+ size_t size = 0;
2879+ ua_ui_get_clipboard_content(&data, &size);
2880+
2881+ // Deserialize, update and return mime data taking care of incorrectly
2882+ // formatted input.
2883+ mMimeData->clear();
2884+ if (static_cast<size_t>(size) > sizeof(int) // Should be at least that big to read the count.
2885+ && data != NULL) {
2886+ const char* const buffer = reinterpret_cast<char*>(data);
2887+ const int* const header = reinterpret_cast<int*>(data);
2888+ const int count = qMin(header[0], maxFormatsCount);
2889+ for (int i = 0; i < count; i++) {
2890+ const unsigned int formatOffset = header[i*4+1];
2891+ const unsigned int formatSize = header[i*4+2];
2892+ const unsigned int dataOffset = header[i*4+3];
2893+ const unsigned int dataSize = header[i*4+4];
2894+ if (formatOffset + formatSize <= size && dataOffset + dataSize <= size) {
2895+ mMimeData->setData(QString(&buffer[formatOffset]),
2896+ QByteArray(&buffer[dataOffset], dataSize));
2897+ }
2898+ }
2899+ }
2900+ return mMimeData;
2901+}
2902+
2903+void UbuntuClipboard::setMimeData(QMimeData* mimeData, QClipboard::Mode mode)
2904+{
2905+ Q_UNUSED(mode);
2906+ if (mimeData == NULL) {
2907+ ua_ui_set_clipboard_content(NULL, 0);
2908+ return;
2909+ }
2910+
2911+ const QStringList formats = mimeData->formats();
2912+ const int count = qMin(formats.size(), maxFormatsCount);
2913+ const int headerSize = sizeof(int) + count * 4 * sizeof(int);
2914+ int bufferSize = headerSize;
2915+ char* buffer;
2916+
2917+ // Get the buffer size considering the header size, the NULL-terminated
2918+ // formats and the non NULL-terminated data.
2919+ for (int i = 0; i < count; i++)
2920+ bufferSize += formats[i].size() + 1 + mimeData->data(formats[i]).size();
2921+ // FIXME(loicm) Implement max buffer size limitation.
2922+ // FIXME(loicm) Remove ASSERT before release.
2923+ Q_ASSERT(bufferSize <= maxBufferSize);
2924+
2925+ // Serialize data.
2926+ buffer = new char[bufferSize];
2927+ int* header = reinterpret_cast<int*>(buffer);
2928+ int offset = headerSize;
2929+ header[0] = count;
2930+ for (int i = 0; i < count; i++) {
2931+ const int formatOffset = offset;
2932+ const int formatSize = formats[i].size() + 1;
2933+ const int dataOffset = offset + formatSize;
2934+ const int dataSize = mimeData->data(formats[i]).size();
2935+ memcpy(&buffer[formatOffset], formats[i].toLatin1().data(), formatSize);
2936+ memcpy(&buffer[dataOffset], mimeData->data(formats[i]).data(), dataSize);
2937+ header[i*4+1] = formatOffset;
2938+ header[i*4+2] = formatSize;
2939+ header[i*4+3] = dataOffset;
2940+ header[i*4+4] = dataSize;
2941+ offset += formatSize + dataSize;
2942+ }
2943+
2944+ // Set clipboard content.
2945+ ua_ui_set_clipboard_content(reinterpret_cast<void*>(buffer), bufferSize);
2946+ delete [] buffer;
2947+}
2948+
2949+bool UbuntuClipboard::supportsMode(QClipboard::Mode mode) const
2950+{
2951+ return mode == QClipboard::Clipboard;
2952+}
2953+
2954+bool UbuntuClipboard::ownsMode(QClipboard::Mode mode) const
2955+{
2956+ Q_UNUSED(mode);
2957+ return false;
2958 }
2959
2960=== modified file 'src/ubuntumirclient/clipboard.h'
2961--- src/platforms/base/clipboard.h 2013-02-05 02:05:42 +0000
2962+++ src/ubuntumirclient/clipboard.h 2014-07-21 23:47:35 +0000
2963@@ -1,33 +1,38 @@
2964-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
2965-// Copyright © 2013 Canonical Ltd.
2966-//
2967-// This program is free software: you can redistribute it and/or modify it under
2968-// the terms of the GNU Lesser General Public License version 3, as published by
2969-// the Free Software Foundation.
2970-//
2971-// This program is distributed in the hope that it will be useful, but WITHOUT
2972-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2973-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2974-// Lesser General Public License for more details.
2975-//
2976-// You should have received a copy of the GNU Lesser General Public License
2977-// along with this program. If not, see <http://www.gnu.org/licenses/>.
2978+/*
2979+ * Copyright (C) 2014 Canonical, Ltd.
2980+ *
2981+ * This program is free software: you can redistribute it and/or modify it under
2982+ * the terms of the GNU Lesser General Public License version 3, as published by
2983+ * the Free Software Foundation.
2984+ *
2985+ * This program is distributed in the hope that it will be useful, but WITHOUT
2986+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2987+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2988+ * Lesser General Public License for more details.
2989+ *
2990+ * You should have received a copy of the GNU Lesser General Public License
2991+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2992+ */
2993
2994-#ifndef QUBUNTUBASECLIPBOARD_H
2995-#define QUBUNTUBASECLIPBOARD_H
2996+#ifndef UBUNTU_CLIPBOARD_H
2997+#define UBUNTU_CLIPBOARD_H
2998
2999 #include <qpa/qplatformclipboard.h>
3000
3001-class QUbuntuBaseClipboard : public QPlatformClipboard {
3002- public:
3003- QUbuntuBaseClipboard();
3004- ~QUbuntuBaseClipboard();
3005-
3006- // QPlatformClipboard methods.
3007- virtual QMimeData* mimeData(QClipboard::Mode mode = QClipboard::Clipboard);
3008- virtual void setMimeData(QMimeData* data, QClipboard::Mode mode = QClipboard::Clipboard);
3009- virtual bool supportsMode(QClipboard::Mode mode) const { return mode == QClipboard::Clipboard; }
3010- virtual bool ownsMode(QClipboard::Mode mode) const { Q_UNUSED(mode); return false; }
3011+class UbuntuClipboard : public QPlatformClipboard
3012+{
3013+public:
3014+ UbuntuClipboard();
3015+ virtual ~UbuntuClipboard();
3016+
3017+ // QPlatformClipboard methods.
3018+ QMimeData* mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override;
3019+ void setMimeData(QMimeData* data, QClipboard::Mode mode = QClipboard::Clipboard) override;
3020+ bool supportsMode(QClipboard::Mode mode) const override;
3021+ bool ownsMode(QClipboard::Mode mode) const override;
3022+
3023+private:
3024+ QMimeData* mMimeData;
3025 };
3026
3027-#endif // QUBUNTUBASECLIPBOARD_H
3028+#endif // UBUNTU_CLIPBOARD_H
3029
3030=== renamed file 'src/platforms/base/context.cc' => 'src/ubuntumirclient/glcontext.cpp'
3031--- src/platforms/base/context.cc 2014-03-18 16:38:52 +0000
3032+++ src/ubuntumirclient/glcontext.cpp 2014-07-21 23:47:35 +0000
3033@@ -1,19 +1,20 @@
3034-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
3035-// Copyright © 2013 Canonical Ltd.
3036-//
3037-// This program is free software: you can redistribute it and/or modify it under
3038-// the terms of the GNU Lesser General Public License version 3, as published by
3039-// the Free Software Foundation.
3040-//
3041-// This program is distributed in the hope that it will be useful, but WITHOUT
3042-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
3043-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3044-// Lesser General Public License for more details.
3045-//
3046-// You should have received a copy of the GNU Lesser General Public License
3047-// along with this program. If not, see <http://www.gnu.org/licenses/>.
3048+/*
3049+ * Copyright (C) 2014 Canonical, Ltd.
3050+ *
3051+ * This program is free software: you can redistribute it and/or modify it under
3052+ * the terms of the GNU Lesser General Public License version 3, as published by
3053+ * the Free Software Foundation.
3054+ *
3055+ * This program is distributed in the hope that it will be useful, but WITHOUT
3056+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
3057+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3058+ * Lesser General Public License for more details.
3059+ *
3060+ * You should have received a copy of the GNU Lesser General Public License
3061+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3062+ */
3063
3064-#include "context.h"
3065+#include "glcontext.h"
3066 #include "window.h"
3067 #include "logging.h"
3068 #include <QtPlatformSupport/private/qeglconvenience_p.h>
3069@@ -40,80 +41,95 @@
3070 static EGLenum api_in_use()
3071 {
3072 #ifdef QTUBUNTU_USE_OPENGL
3073- return EGL_OPENGL_API;
3074-#else
3075- return EGL_OPENGL_ES_API;
3076-#endif
3077-}
3078-
3079-QUbuntuBaseContext::QUbuntuBaseContext(QUbuntuBaseScreen* screen,
3080- QUbuntuBaseContext* share) {
3081- DASSERT(screen != NULL);
3082- eglDisplay_ = screen->eglDisplay();
3083- screen_ = screen;
3084-
3085- // Create an OpenGL ES 2 context.
3086- QVector<EGLint> attribs;
3087- attribs.append(EGL_CONTEXT_CLIENT_VERSION);
3088- attribs.append(2);
3089- attribs.append(EGL_NONE);
3090- ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE);
3091- ASSERT((eglContext_ = eglCreateContext(
3092- eglDisplay_, screen->eglConfig(), share ? share->eglContext() : EGL_NO_CONTEXT,
3093- attribs.constData())) != EGL_NO_CONTEXT);
3094-
3095- DLOG("QUbuntuBaseContext::QUbuntuBaseContext (this=%p, screen=%p)", this, screen);
3096-}
3097-
3098-QUbuntuBaseContext::~QUbuntuBaseContext() {
3099- DLOG("QUbuntuBaseContext::~QUbuntuBaseContext");
3100- ASSERT(eglDestroyContext(eglDisplay_, eglContext_) == EGL_TRUE);
3101-}
3102-
3103-bool QUbuntuBaseContext::makeCurrent(QPlatformSurface* surface) {
3104- // DLOG("QUbuntuBaseContext::makeCurrent (this=%p, surface=%p)", this, surface);
3105- DASSERT(surface->surface()->surfaceType() == QSurface::OpenGLSurface);
3106- EGLSurface eglSurface = static_cast<QUbuntuBaseWindow*>(surface)->eglSurface();
3107-#if defined(QT_NO_DEBUG)
3108- eglBindAPI(api_in_use());
3109- eglMakeCurrent(eglDisplay_, eglSurface, eglSurface, eglContext_);
3110-#else
3111- ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE);
3112- ASSERT(eglMakeCurrent(eglDisplay_, eglSurface, eglSurface, eglContext_) == EGL_TRUE);
3113- printOpenGLESConfig();
3114-#endif
3115- return true;
3116-}
3117-
3118-void QUbuntuBaseContext::doneCurrent() {
3119- DLOG("QUbuntuBaseContext::doneCurrent (this=%p)", this);
3120-#if defined(QT_NO_DEBUG)
3121- eglBindAPI(api_in_use());
3122- eglMakeCurrent(eglDisplay_, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
3123-#else
3124- ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE);
3125- ASSERT(eglMakeCurrent(eglDisplay_, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) == EGL_TRUE);
3126-#endif
3127-}
3128-
3129-void QUbuntuBaseContext::swapBuffers(QPlatformSurface* surface) {
3130- // DLOG("QUbuntuBaseContext::swapBuffers (this=%p, surface=%p)", this, surface);
3131- EGLSurface eglSurface = static_cast<QUbuntuBaseWindow*>(surface)->eglSurface();
3132-#if defined(QT_NO_DEBUG)
3133- eglBindAPI(api_in_use());
3134- eglSwapBuffers(eglDisplay_, eglSurface);
3135-#else
3136- ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE);
3137- ASSERT(eglSwapBuffers(eglDisplay_, eglSurface) == EGL_TRUE);
3138-#endif
3139-}
3140-
3141-void (*QUbuntuBaseContext::getProcAddress(const QByteArray& procName)) () {
3142- DLOG("QUbuntuBaseContext::getProcAddress (this=%p, procName=%s)", this, procName.constData());
3143-#if defined(QT_NO_DEBUG)
3144- eglBindAPI(api_in_use());
3145-#else
3146- ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE);
3147-#endif
3148- return eglGetProcAddress(procName.constData());
3149+ return EGL_OPENGL_API;
3150+#else
3151+ return EGL_OPENGL_ES_API;
3152+#endif
3153+}
3154+
3155+UbuntuOpenGLContext::UbuntuOpenGLContext(UbuntuScreen* screen, UbuntuOpenGLContext* share)
3156+{
3157+ ASSERT(screen != NULL);
3158+ mEglDisplay = screen->eglDisplay();
3159+ mScreen = screen;
3160+
3161+ // Create an OpenGL ES 2 context.
3162+ QVector<EGLint> attribs;
3163+ attribs.append(EGL_CONTEXT_CLIENT_VERSION);
3164+ attribs.append(2);
3165+ attribs.append(EGL_NONE);
3166+ ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE);
3167+
3168+ mEglContext = eglCreateContext(mEglDisplay, screen->eglConfig(), share ? share->eglContext() : EGL_NO_CONTEXT,
3169+ attribs.constData());
3170+ DASSERT(mEglContext != EGL_NO_CONTEXT);
3171+}
3172+
3173+UbuntuOpenGLContext::~UbuntuOpenGLContext()
3174+{
3175+ ASSERT(eglDestroyContext(mEglDisplay, mEglContext) == EGL_TRUE);
3176+}
3177+
3178+bool UbuntuOpenGLContext::makeCurrent(QPlatformSurface* surface)
3179+{
3180+ DASSERT(surface->surface()->surfaceType() == QSurface::OpenGLSurface);
3181+ EGLSurface eglSurface = static_cast<UbuntuWindow*>(surface)->eglSurface();
3182+#if defined(QT_NO_DEBUG)
3183+ eglBindAPI(api_in_use());
3184+ eglMakeCurrent(mEglDisplay, eglSurface, eglSurface, mEglContext);
3185+#else
3186+ ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE);
3187+ ASSERT(eglMakeCurrent(mEglDisplay, eglSurface, eglSurface, mEglContext) == EGL_TRUE);
3188+ printOpenGLESConfig();
3189+#endif
3190+ return true;
3191+}
3192+
3193+void UbuntuOpenGLContext::doneCurrent()
3194+{
3195+#if defined(QT_NO_DEBUG)
3196+ eglBindAPI(api_in_use());
3197+ eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
3198+#else
3199+ ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE);
3200+ ASSERT(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) == EGL_TRUE);
3201+#endif
3202+}
3203+
3204+void UbuntuOpenGLContext::swapBuffers(QPlatformSurface* surface)
3205+{
3206+ UbuntuWindow *ubuntuWindow = static_cast<UbuntuWindow*>(surface);
3207+
3208+ EGLSurface eglSurface = ubuntuWindow->eglSurface();
3209+#if defined(QT_NO_DEBUG)
3210+ eglBindAPI(api_in_use());
3211+ eglSwapBuffers(mEglDisplay, eglSurface);
3212+#else
3213+ ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE);
3214+ ASSERT(eglSwapBuffers(mEglDisplay, eglSurface) == EGL_TRUE);
3215+#endif
3216+
3217+ // "Technique" copied from mir, in examples/eglapp.c around line 96
3218+ EGLint newBufferWidth = -1;
3219+ EGLint newBufferHeight = -1;
3220+ /*
3221+ * Querying the surface (actually the current buffer) dimensions here is
3222+ * the only truly safe way to be sure that the dimensions we think we
3223+ * have are those of the buffer being rendered to. But this should be
3224+ * improved in future; https://bugs.launchpad.net/mir/+bug/1194384
3225+ */
3226+ eglQuerySurface(mEglDisplay, eglSurface, EGL_WIDTH, &newBufferWidth);
3227+ eglQuerySurface(mEglDisplay, eglSurface, EGL_HEIGHT, &newBufferHeight);
3228+
3229+ ubuntuWindow->onBuffersSwapped_threadSafe(newBufferWidth, newBufferHeight);
3230+}
3231+
3232+void (*UbuntuOpenGLContext::getProcAddress(const QByteArray& procName)) ()
3233+{
3234+#if defined(QT_NO_DEBUG)
3235+ eglBindAPI(api_in_use());
3236+#else
3237+ ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE);
3238+#endif
3239+ return eglGetProcAddress(procName.constData());
3240 }
3241
3242=== renamed file 'src/platforms/base/context.h' => 'src/ubuntumirclient/glcontext.h'
3243--- src/platforms/base/context.h 2014-02-10 15:26:25 +0000
3244+++ src/ubuntumirclient/glcontext.h 2014-07-21 23:47:35 +0000
3245@@ -1,43 +1,45 @@
3246-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
3247-// Copyright © 2013 Canonical Ltd.
3248-//
3249-// This program is free software: you can redistribute it and/or modify it under
3250-// the terms of the GNU Lesser General Public License version 3, as published by
3251-// the Free Software Foundation.
3252-//
3253-// This program is distributed in the hope that it will be useful, but WITHOUT
3254-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
3255-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3256-// Lesser General Public License for more details.
3257-//
3258-// You should have received a copy of the GNU Lesser General Public License
3259-// along with this program. If not, see <http://www.gnu.org/licenses/>.
3260+/*
3261+ * Copyright (C) 2014 Canonical, Ltd.
3262+ *
3263+ * This program is free software: you can redistribute it and/or modify it under
3264+ * the terms of the GNU Lesser General Public License version 3, as published by
3265+ * the Free Software Foundation.
3266+ *
3267+ * This program is distributed in the hope that it will be useful, but WITHOUT
3268+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
3269+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3270+ * Lesser General Public License for more details.
3271+ *
3272+ * You should have received a copy of the GNU Lesser General Public License
3273+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3274+ */
3275
3276-#ifndef QUBUNTUBASECONTEXT_H
3277-#define QUBUNTUBASECONTEXT_H
3278+#ifndef UBUNTU_OPENGL_CONTEXT_H
3279+#define UBUNTU_OPENGL_CONTEXT_H
3280
3281 #include <qpa/qplatformopenglcontext.h>
3282 #include "screen.h"
3283
3284-class QUbuntuBaseContext : public QPlatformOpenGLContext {
3285- public:
3286- QUbuntuBaseContext(QUbuntuBaseScreen* screen,
3287- QUbuntuBaseContext* share);
3288- ~QUbuntuBaseContext();
3289-
3290- // QPlatformOpenGLContext methods.
3291- QSurfaceFormat format() const { return screen_->surfaceFormat(); }
3292- void swapBuffers(QPlatformSurface* surface);
3293- bool makeCurrent(QPlatformSurface* surface);
3294- void doneCurrent();
3295- bool isValid() const { return eglContext_ != EGL_NO_CONTEXT; }
3296- void (*getProcAddress(const QByteArray& procName)) ();
3297- EGLContext eglContext() const { return eglContext_; }
3298-
3299- private:
3300- QUbuntuBaseScreen* screen_;
3301- EGLContext eglContext_;
3302- EGLDisplay eglDisplay_;
3303+class UbuntuOpenGLContext : public QPlatformOpenGLContext
3304+{
3305+public:
3306+ UbuntuOpenGLContext(UbuntuScreen* screen, UbuntuOpenGLContext* share);
3307+ virtual ~UbuntuOpenGLContext();
3308+
3309+ // QPlatformOpenGLContext methods.
3310+ QSurfaceFormat format() const override { return mScreen->surfaceFormat(); }
3311+ void swapBuffers(QPlatformSurface* surface) override;
3312+ bool makeCurrent(QPlatformSurface* surface) override;
3313+ void doneCurrent() override;
3314+ bool isValid() const override { return mEglContext != EGL_NO_CONTEXT; }
3315+ void (*getProcAddress(const QByteArray& procName)) ();
3316+
3317+ EGLContext eglContext() const { return mEglContext; }
3318+
3319+private:
3320+ UbuntuScreen* mScreen;
3321+ EGLContext mEglContext;
3322+ EGLDisplay mEglDisplay;
3323 };
3324
3325-#endif //QUBUNTUBASECONTEXT_H
3326+#endif // UBUNTU_OPENGL_CONTEXT_H
3327
3328=== renamed file 'src/platforms/base/input.cc' => 'src/ubuntumirclient/input.cpp'
3329--- src/platforms/base/input.cc 2013-10-17 18:38:03 +0000
3330+++ src/ubuntumirclient/input.cpp 2014-07-21 23:47:35 +0000
3331@@ -1,22 +1,27 @@
3332-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
3333-// Copyright © 2013 Canonical Ltd.
3334-//
3335-// This program is free software: you can redistribute it and/or modify it under
3336-// the terms of the GNU Lesser General Public License version 3, as published by
3337-// the Free Software Foundation.
3338-//
3339-// This program is distributed in the hope that it will be useful, but WITHOUT
3340-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
3341-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3342-// Lesser General Public License for more details.
3343-//
3344-// You should have received a copy of the GNU Lesser General Public License
3345-// along with this program. If not, see <http://www.gnu.org/licenses/>.
3346+/*
3347+ * Copyright (C) 2014 Canonical, Ltd.
3348+ *
3349+ * This program is free software: you can redistribute it and/or modify it under
3350+ * the terms of the GNU Lesser General Public License version 3, as published by
3351+ * the Free Software Foundation.
3352+ *
3353+ * This program is distributed in the hope that it will be useful, but WITHOUT
3354+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
3355+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3356+ * Lesser General Public License for more details.
3357+ *
3358+ * You should have received a copy of the GNU Lesser General Public License
3359+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3360+ */
3361
3362+// Local
3363 #include "input.h"
3364 #include "integration.h"
3365-#include "native_interface.h"
3366+#include "nativeinterface.h"
3367+#include "window.h"
3368 #include "logging.h"
3369+
3370+// Qt
3371 #if !defined(QT_NO_DEBUG)
3372 #include <QtCore/QThread>
3373 #endif
3374@@ -24,499 +29,377 @@
3375 #include <QtCore/QCoreApplication>
3376 #include <private/qguiapplication_p.h>
3377 #include <qpa/qplatforminputcontext.h>
3378+#include <qpa/qwindowsysteminterface.h>
3379+
3380+#include <xkbcommon/xkbcommon.h>
3381+#include <xkbcommon/xkbcommon-keysyms.h>
3382+
3383+// Platform API
3384 #include <ubuntu/application/ui/input/event.h>
3385-#include <input/input_stack_compatibility_layer_flags.h>
3386
3387 #define LOG_EVENTS 0
3388
3389+// XKB Keysyms which do not map directly to Qt types (i.e. Unicode points)
3390+static const uint32_t KeyTable[] = {
3391+ XKB_KEY_Escape, Qt::Key_Escape,
3392+ XKB_KEY_Tab, Qt::Key_Tab,
3393+ XKB_KEY_ISO_Left_Tab, Qt::Key_Backtab,
3394+ XKB_KEY_BackSpace, Qt::Key_Backspace,
3395+ XKB_KEY_Return, Qt::Key_Return,
3396+ XKB_KEY_Insert, Qt::Key_Insert,
3397+ XKB_KEY_Delete, Qt::Key_Delete,
3398+ XKB_KEY_Clear, Qt::Key_Delete,
3399+ XKB_KEY_Pause, Qt::Key_Pause,
3400+ XKB_KEY_Print, Qt::Key_Print,
3401+
3402+ XKB_KEY_Home, Qt::Key_Home,
3403+ XKB_KEY_End, Qt::Key_End,
3404+ XKB_KEY_Left, Qt::Key_Left,
3405+ XKB_KEY_Up, Qt::Key_Up,
3406+ XKB_KEY_Right, Qt::Key_Right,
3407+ XKB_KEY_Down, Qt::Key_Down,
3408+ XKB_KEY_Prior, Qt::Key_PageUp,
3409+ XKB_KEY_Next, Qt::Key_PageDown,
3410+
3411+ XKB_KEY_Shift_L, Qt::Key_Shift,
3412+ XKB_KEY_Shift_R, Qt::Key_Shift,
3413+ XKB_KEY_Shift_Lock, Qt::Key_Shift,
3414+ XKB_KEY_Control_L, Qt::Key_Control,
3415+ XKB_KEY_Control_R, Qt::Key_Control,
3416+ XKB_KEY_Meta_L, Qt::Key_Meta,
3417+ XKB_KEY_Meta_R, Qt::Key_Meta,
3418+ XKB_KEY_Alt_L, Qt::Key_Alt,
3419+ XKB_KEY_Alt_R, Qt::Key_Alt,
3420+ XKB_KEY_Caps_Lock, Qt::Key_CapsLock,
3421+ XKB_KEY_Num_Lock, Qt::Key_NumLock,
3422+ XKB_KEY_Scroll_Lock, Qt::Key_ScrollLock,
3423+ XKB_KEY_Super_L, Qt::Key_Super_L,
3424+ XKB_KEY_Super_R, Qt::Key_Super_R,
3425+ XKB_KEY_Menu, Qt::Key_Menu,
3426+ XKB_KEY_Hyper_L, Qt::Key_Hyper_L,
3427+ XKB_KEY_Hyper_R, Qt::Key_Hyper_R,
3428+ XKB_KEY_Help, Qt::Key_Help,
3429+
3430+ XKB_KEY_KP_Space, Qt::Key_Space,
3431+ XKB_KEY_KP_Tab, Qt::Key_Tab,
3432+ XKB_KEY_KP_Enter, Qt::Key_Enter,
3433+ XKB_KEY_KP_Home, Qt::Key_Home,
3434+ XKB_KEY_KP_Left, Qt::Key_Left,
3435+ XKB_KEY_KP_Up, Qt::Key_Up,
3436+ XKB_KEY_KP_Right, Qt::Key_Right,
3437+ XKB_KEY_KP_Down, Qt::Key_Down,
3438+ XKB_KEY_KP_Prior, Qt::Key_PageUp,
3439+ XKB_KEY_KP_Next, Qt::Key_PageDown,
3440+ XKB_KEY_KP_End, Qt::Key_End,
3441+ XKB_KEY_KP_Begin, Qt::Key_Clear,
3442+ XKB_KEY_KP_Insert, Qt::Key_Insert,
3443+ XKB_KEY_KP_Delete, Qt::Key_Delete,
3444+ XKB_KEY_KP_Equal, Qt::Key_Equal,
3445+ XKB_KEY_KP_Multiply, Qt::Key_Asterisk,
3446+ XKB_KEY_KP_Add, Qt::Key_Plus,
3447+ XKB_KEY_KP_Separator, Qt::Key_Comma,
3448+ XKB_KEY_KP_Subtract, Qt::Key_Minus,
3449+ XKB_KEY_KP_Decimal, Qt::Key_Period,
3450+ XKB_KEY_KP_Divide, Qt::Key_Slash,
3451+
3452+ XKB_KEY_ISO_Level3_Shift, Qt::Key_AltGr,
3453+ XKB_KEY_Multi_key, Qt::Key_Multi_key,
3454+ XKB_KEY_Codeinput, Qt::Key_Codeinput,
3455+ XKB_KEY_SingleCandidate, Qt::Key_SingleCandidate,
3456+ XKB_KEY_MultipleCandidate, Qt::Key_MultipleCandidate,
3457+ XKB_KEY_PreviousCandidate, Qt::Key_PreviousCandidate,
3458+
3459+ XKB_KEY_Mode_switch, Qt::Key_Mode_switch,
3460+ XKB_KEY_script_switch, Qt::Key_Mode_switch,
3461+ XKB_KEY_XF86AudioRaiseVolume, Qt::Key_VolumeUp,
3462+ XKB_KEY_XF86AudioLowerVolume, Qt::Key_VolumeDown,
3463+ XKB_KEY_XF86PowerOff, Qt::Key_PowerOff,
3464+ XKB_KEY_XF86PowerDown, Qt::Key_PowerDown,
3465+
3466+ 0, 0
3467+};
3468+
3469 // Lookup table for the key types.
3470 // FIXME(loicm) Not sure what to do with that multiple thing.
3471 static const QEvent::Type kEventType[] = {
3472- QEvent::KeyPress, // ISCL_KEY_EVENT_ACTION_DOWN = 0
3473- QEvent::KeyRelease, // ISCL_KEY_EVENT_ACTION_UP = 1
3474- QEvent::KeyPress // ISCL_KEY_EVENT_ACTION_MULTIPLE = 2
3475-};
3476-
3477-// Lookup table for the key codes and unicode values.
3478-static const struct {
3479- const quint32 keycode;
3480- const quint16 unicode[3]; // { no modifier, shift modifier, other modifiers }
3481-} kKeyCode[] = {
3482- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_UNKNOWN = 0
3483- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_SOFT_LEFT = 1
3484- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_SOFT_RIGHT = 2
3485- { Qt::Key_Home, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_HOME = 3
3486- { Qt::Key_Back, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BACK = 4
3487- { Qt::Key_Call, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_CALL = 5
3488- { Qt::Key_Hangup, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_ENDCALL = 6
3489- { Qt::Key_0, { 0x0030, 0x0029, 0xffff } }, // ISCL_KEYCODE_0 = 7
3490- { Qt::Key_1, { 0x0031, 0xffff, 0xffff } }, // ISCL_KEYCODE_1 = 8
3491- { Qt::Key_2, { 0x0032, 0xffff, 0xffff } }, // ISCL_KEYCODE_2 = 9
3492- { Qt::Key_3, { 0x0033, 0xffff, 0xffff } }, // ISCL_KEYCODE_3 = 10
3493- { Qt::Key_4, { 0x0034, 0xffff, 0xffff } }, // ISCL_KEYCODE_4 = 11
3494- { Qt::Key_5, { 0x0035, 0xffff, 0xffff } }, // ISCL_KEYCODE_5 = 12
3495- { Qt::Key_6, { 0x0036, 0xffff, 0xffff } }, // ISCL_KEYCODE_6 = 13
3496- { Qt::Key_7, { 0x0037, 0xffff, 0xffff } }, // ISCL_KEYCODE_7 = 14
3497- { Qt::Key_8, { 0x0038, 0xffff, 0xffff } }, // ISCL_KEYCODE_8 = 15
3498- { Qt::Key_9, { 0x0039, 0x0028, 0xffff } }, // ISCL_KEYCODE_9 = 16
3499- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_STAR = 17
3500- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_POUND = 18
3501- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_DPAD_UP = 19
3502- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_DPAD_DOWN = 20
3503- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_DPAD_LEFT = 21
3504- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_DPAD_RIGHT = 22
3505- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_DPAD_CENTER = 23
3506- { Qt::Key_VolumeUp, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_VOLUME_UP = 24
3507- { Qt::Key_VolumeDown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_VOLUME_DOWN = 25
3508- { Qt::Key_PowerOff, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_POWER = 26
3509- { Qt::Key_Camera, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_CAMERA = 27
3510- { Qt::Key_Clear, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_CLEAR = 28
3511- { Qt::Key_A, { 0x0061, 0x0041, 0xffff } }, // ISCL_KEYCODE_A = 29
3512- { Qt::Key_B, { 0x0062, 0x0042, 0xffff } }, // ISCL_KEYCODE_B = 30
3513- { Qt::Key_C, { 0x0063, 0x0043, 0xffff } }, // ISCL_KEYCODE_C = 31
3514- { Qt::Key_D, { 0x0064, 0x0044, 0xffff } }, // ISCL_KEYCODE_D = 32
3515- { Qt::Key_E, { 0x0065, 0x0045, 0xffff } }, // ISCL_KEYCODE_E = 33
3516- { Qt::Key_F, { 0x0066, 0x0046, 0xffff } }, // ISCL_KEYCODE_F = 34
3517- { Qt::Key_G, { 0x0067, 0x0047, 0xffff } }, // ISCL_KEYCODE_G = 35
3518- { Qt::Key_H, { 0x0068, 0x0048, 0xffff } }, // ISCL_KEYCODE_H = 36
3519- { Qt::Key_I, { 0x0069, 0x0049, 0xffff } }, // ISCL_KEYCODE_I = 37
3520- { Qt::Key_J, { 0x006a, 0x004a, 0xffff } }, // ISCL_KEYCODE_J = 38
3521- { Qt::Key_K, { 0x006b, 0x004b, 0xffff } }, // ISCL_KEYCODE_K = 39
3522- { Qt::Key_L, { 0x006c, 0x004c, 0xffff } }, // ISCL_KEYCODE_L = 40
3523- { Qt::Key_M, { 0x006d, 0x004d, 0xffff } }, // ISCL_KEYCODE_M = 41
3524- { Qt::Key_N, { 0x006e, 0x004e, 0xffff } }, // ISCL_KEYCODE_N = 42
3525- { Qt::Key_O, { 0x006f, 0x004f, 0xffff } }, // ISCL_KEYCODE_O = 43
3526- { Qt::Key_P, { 0x0070, 0x0050, 0xffff } }, // ISCL_KEYCODE_P = 44
3527- { Qt::Key_Q, { 0x0071, 0x0051, 0xffff } }, // ISCL_KEYCODE_Q = 45
3528- { Qt::Key_R, { 0x0072, 0x0052, 0xffff } }, // ISCL_KEYCODE_R = 46
3529- { Qt::Key_S, { 0x0073, 0x0053, 0xffff } }, // ISCL_KEYCODE_S = 47
3530- { Qt::Key_T, { 0x0074, 0x0054, 0xffff } }, // ISCL_KEYCODE_T = 48
3531- { Qt::Key_U, { 0x0075, 0x0055, 0xffff } }, // ISCL_KEYCODE_U = 49
3532- { Qt::Key_V, { 0x0076, 0x0056, 0xffff } }, // ISCL_KEYCODE_V = 50
3533- { Qt::Key_W, { 0x0077, 0x0057, 0xffff } }, // ISCL_KEYCODE_W = 51
3534- { Qt::Key_X, { 0x0078, 0x0058, 0xffff } }, // ISCL_KEYCODE_X = 52
3535- { Qt::Key_Y, { 0x0079, 0x0059, 0xffff } }, // ISCL_KEYCODE_Y = 53
3536- { Qt::Key_Z, { 0x007a, 0x005a, 0xffff } }, // ISCL_KEYCODE_Z = 54
3537- { Qt::Key_Comma, { 0x002c, 0xffff, 0xffff } }, // ISCL_KEYCODE_COMMA = 55
3538- { Qt::Key_Period, { 0x002e, 0xffff, 0xffff } }, // ISCL_KEYCODE_PERIOD = 56
3539- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_ALT_LEFT = 57
3540- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_ALT_RIGHT = 58
3541- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_SHIFT_LEFT = 59
3542- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_SHIFT_RIGHT = 60
3543- { Qt::Key_Tab, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_TAB = 61
3544- { Qt::Key_Space, { 0x0020, 0xffff, 0xffff } }, // ISCL_KEYCODE_SPACE = 62
3545- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_SYM = 63
3546- { Qt::Key_Explorer, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_EXPLORER = 64
3547- { Qt::Key_LaunchMail, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_ENVELOPE = 65
3548- { Qt::Key_Enter, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_ENTER = 66
3549- { Qt::Key_Delete, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_DEL = 67
3550- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_GRAVE = 68
3551- { Qt::Key_Minus, { 0x002d, 0x005f, 0xffff } }, // ISCL_KEYCODE_MINUS = 69
3552- { Qt::Key_Equal, { 0x003d, 0xffff, 0xffff } }, // ISCL_KEYCODE_EQUALS = 70
3553- { Qt::Key_BracketLeft, { 0x005b, 0xffff, 0xffff } }, // ISCL_KEYCODE_LEFT_BRACKET = 71
3554- { Qt::Key_BracketRight, { 0x005d, 0xffff, 0xffff } }, // ISCL_KEYCODE_RIGHT_BRACKET = 72
3555- { Qt::Key_Backslash, { 0x005c, 0xffff, 0xffff } }, // ISCL_KEYCODE_BACKSLASH = 73
3556- { Qt::Key_Semicolon, { 0x003b, 0x003a, 0xffff } }, // ISCL_KEYCODE_SEMICOLON = 74
3557- { Qt::Key_Apostrophe, { 0x0027, 0xffff, 0xffff } }, // ISCL_KEYCODE_APOSTROPHE = 75
3558- { Qt::Key_Slash, { 0x002f, 0xffff, 0xffff } }, // ISCL_KEYCODE_SLASH = 76
3559- { Qt::Key_At, { 0x0040, 0xffff, 0xffff } }, // ISCL_KEYCODE_AT = 77
3560- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUM = 78
3561- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_HEADSETHOOK = 79
3562- { Qt::Key_CameraFocus, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_FOCUS = 80 // *Camera* focus
3563- { Qt::Key_Plus, { 0x002b, 0xffff, 0xffff } }, // ISCL_KEYCODE_PLUS = 81
3564- { Qt::Key_Menu, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MENU = 82
3565- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_NOTIFICATION = 83
3566- { Qt::Key_Search, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_SEARCH = 84
3567- { Qt::Key_MediaTogglePlayPause, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MEDIA_PLAY_PAUSE= 85
3568- { Qt::Key_MediaStop, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MEDIA_STOP = 86
3569- { Qt::Key_MediaNext, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MEDIA_NEXT = 87
3570- { Qt::Key_MediaPrevious, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MEDIA_PREVIOUS = 88
3571- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MEDIA_REWIND = 89
3572- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MEDIA_FAST_FORWARD = 90
3573- { Qt::Key_VolumeMute, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MUTE = 91
3574- { Qt::Key_PageUp, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_PAGE_UP = 92
3575- { Qt::Key_PageDown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_PAGE_DOWN = 93
3576- { Qt::Key_Pictures, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_PICTSYMBOLS = 94
3577- { Qt::Key_Mode_switch, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_SWITCH_CHARSET = 95
3578- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_A = 96
3579- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_B = 97
3580- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_C = 98
3581- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_X = 99
3582- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_Y = 100
3583- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_Z = 101
3584- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_L1 = 102
3585- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_R1 = 103
3586- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_L2 = 104
3587- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_R2 = 105
3588- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_THUMBL = 106
3589- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_THUMBR = 107
3590- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_START = 108
3591- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_SELECT = 109
3592- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_MODE = 110
3593- { Qt::Key_Escape, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_ESCAPE = 111
3594- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_FORWARD_DEL = 112
3595- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_CTRL_LEFT = 113
3596- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_CTRL_RIGHT = 114
3597- { Qt::Key_CapsLock, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_CAPS_LOCK = 115
3598- { Qt::Key_ScrollLock, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_SCROLL_LOCK = 116
3599- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_META_LEFT = 117
3600- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_META_RIGHT = 118
3601- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_FUNCTION = 119
3602- { Qt::Key_SysReq, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_SYSRQ = 120
3603- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BREAK = 121
3604- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MOVE_HOME = 122
3605- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MOVE_END = 123
3606- { Qt::Key_Insert, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_INSERT = 124
3607- { Qt::Key_Forward, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_FORWARD = 125
3608- { Qt::Key_MediaPlay, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MEDIA_PLAY = 126
3609- { Qt::Key_MediaPause, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MEDIA_PAUSE = 127
3610- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MEDIA_CLOSE = 128
3611- { Qt::Key_Eject, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MEDIA_EJECT = 129
3612- { Qt::Key_MediaRecord, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MEDIA_RECORD = 130
3613- { Qt::Key_F1, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_F1 = 131
3614- { Qt::Key_F2, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_F2 = 132
3615- { Qt::Key_F3, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_F3 = 133
3616- { Qt::Key_F4, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_F4 = 134
3617- { Qt::Key_F5, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_F5 = 135
3618- { Qt::Key_F6, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_F6 = 136
3619- { Qt::Key_F7, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_F7 = 137
3620- { Qt::Key_F8, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_F8 = 138
3621- { Qt::Key_F9, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_F9 = 139
3622- { Qt::Key_F10, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_F10 = 140
3623- { Qt::Key_F11, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_F11 = 141
3624- { Qt::Key_F12, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_F12 = 142
3625- { Qt::Key_NumLock, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUM_LOCK = 143
3626- { Qt::Key_0, { 0x0030, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_0 = 144
3627- { Qt::Key_1, { 0x0031, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_1 = 145
3628- { Qt::Key_2, { 0x0032, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_2 = 146
3629- { Qt::Key_3, { 0x0033, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_3 = 147
3630- { Qt::Key_4, { 0x0034, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_4 = 148
3631- { Qt::Key_5, { 0x0035, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_5 = 149
3632- { Qt::Key_6, { 0x0036, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_6 = 150
3633- { Qt::Key_7, { 0x0037, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_7 = 151
3634- { Qt::Key_8, { 0x0038, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_8 = 152
3635- { Qt::Key_9, { 0x0039, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_9 = 153
3636- { Qt::Key_Slash, { 0x002f, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_DIVIDE = 154
3637- { Qt::Key_Asterisk, { 0x002a, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_MULTIPLY = 155
3638- { Qt::Key_Minus, { 0x002d, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_SUBTRACT = 156
3639- { Qt::Key_Plus, { 0x002b, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_ADD = 157
3640- { Qt::Key_Period, { 0x002e, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_DOT = 158
3641- { Qt::Key_Comma, { 0x002c, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_COMMA = 159
3642- { Qt::Key_Enter, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_ENTER = 160
3643- { Qt::Key_Equal, { 0x003d, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_EQUALS = 161
3644- { Qt::Key_ParenLeft, { 0x0028, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_LEFT_PAREN = 162
3645- { Qt::Key_ParenRight, { 0x0029, 0xffff, 0xffff } }, // ISCL_KEYCODE_NUMPAD_RIGHT_PAREN = 163
3646- { Qt::Key_VolumeMute, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_VOLUME_MUTE = 164
3647- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_INFO = 165
3648- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_CHANNEL_UP = 166
3649- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_CHANNEL_DOWN = 167
3650- { Qt::Key_ZoomIn, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_ZOOM_IN = 168
3651- { Qt::Key_ZoomOut, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_ZOOM_OUT = 169
3652- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_TV = 170
3653- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_WINDOW = 171
3654- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_GUIDE = 172
3655- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_DVR = 173
3656- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BOOKMARK = 174
3657- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_CAPTIONS = 175
3658- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_SETTINGS = 176
3659- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_TV_POWER = 177
3660- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_TV_INPUT = 178
3661- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_STB_POWER = 179
3662- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_STB_INPUT = 180
3663- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_AVR_POWER = 181
3664- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_AVR_INPUT = 182
3665- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_PROG_RED = 183
3666- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_PROG_GREEN = 184
3667- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_PROG_YELLOW = 185
3668- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_PROG_BLUE = 186
3669- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_APP_SWITCH = 187
3670- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_1 = 188
3671- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_2 = 189
3672- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_3 = 190
3673- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_4 = 191
3674- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_5 = 192
3675- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_6 = 193
3676- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_7 = 194
3677- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_8 = 195
3678- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_9 = 196
3679- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_10 = 197
3680- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_11 = 198
3681- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_12 = 199
3682- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_13 = 200
3683- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_14 = 201
3684- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_15 = 202
3685- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_BUTTON_16 = 203
3686- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_LANGUAGE_SWITCH = 204
3687- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MANNER_MODE = 205
3688- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_3D_MODE = 206
3689- { Qt::Key_unknown, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_CONTACTS = 207
3690- { Qt::Key_Calendar, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_CALENDAR = 208
3691- { Qt::Key_Music, { 0xffff, 0xffff, 0xffff } }, // ISCL_KEYCODE_MUSIC = 209
3692- { Qt::Key_Calculator, { 0xffff, 0xffff, 0xffff } } // ISCL_KEYCODE_CALCULATOR = 210
3693-};
3694-
3695-class QUbuntuBaseEvent : public QEvent {
3696- public:
3697- QUbuntuBaseEvent(QWindow* window, const Event* event, QEvent::Type type)
3698- : QEvent(type)
3699- , window_(window) {
3700- memcpy(&nativeEvent_, event, sizeof(Event));
3701- }
3702- QWindow* window_;
3703- Event nativeEvent_;
3704-};
3705-
3706-QUbuntuBaseInput::QUbuntuBaseInput(QUbuntuBaseIntegration* integration)
3707- : integration_(integration)
3708- , eventFilterType_(static_cast<QUbuntuBaseNativeInterface*>(
3709+ QEvent::KeyPress, // U_KEY_ACTION_DOWN = 0
3710+ QEvent::KeyRelease, // U_KEY_ACTION_UP = 1
3711+ QEvent::KeyPress // U_KEY_ACTION_MULTIPLE = 2
3712+};
3713+
3714+class UbuntuEvent : public QEvent
3715+{
3716+public:
3717+ UbuntuEvent(UbuntuWindow* window, const WindowEvent* event, QEvent::Type type)
3718+ : QEvent(type), window(window) {
3719+ memcpy(&nativeEvent, event, sizeof(WindowEvent));
3720+ }
3721+ UbuntuWindow* window;
3722+ WindowEvent nativeEvent;
3723+};
3724+
3725+UbuntuInput::UbuntuInput(UbuntuClientIntegration* integration)
3726+ : QObject(nullptr)
3727+ , mIntegration(integration)
3728+ , mEventFilterType(static_cast<UbuntuNativeInterface*>(
3729 integration->nativeInterface())->genericEventFilterType())
3730- , eventType_(static_cast<QEvent::Type>(QEvent::registerEventType())) {
3731-
3732- // Initialize touch device.
3733- touchDevice_ = new QTouchDevice();
3734- touchDevice_->setType(QTouchDevice::TouchScreen);
3735- touchDevice_->setCapabilities(
3736- QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::Pressure |
3737- QTouchDevice::NormalizedPosition);
3738- QWindowSystemInterface::registerTouchDevice(touchDevice_);
3739-
3740- DLOG("QUbuntuBaseInput::QUbuntuBaseInput (this=%p, integration=%p)", this, integration);
3741-}
3742-
3743-QUbuntuBaseInput::~QUbuntuBaseInput() {
3744- DLOG("QUbuntuBaseInput::~QUbuntuBaseInput");
3745- // touchDevice_ isn't cleaned up on purpose as it crashes or asserts on "Bus Error".
3746-}
3747-
3748-void QUbuntuBaseInput::customEvent(QEvent* event) {
3749- DLOG("QUbuntuBaseInput::customEvent (this=%p, event=%p)", this, event);
3750- DASSERT(QThread::currentThread() == thread());
3751- QUbuntuBaseEvent* ubuntuEvent = static_cast<QUbuntuBaseEvent*>(event);
3752-
3753- // Event filtering.
3754- long result;
3755- if (QWindowSystemInterface::handleNativeEvent(
3756- ubuntuEvent->window_, eventFilterType_, &ubuntuEvent->nativeEvent_, &result) == true) {
3757- DLOG("event filtered out by native interface");
3758- return;
3759- }
3760-
3761- // Event dispatching.
3762- switch (ubuntuEvent->nativeEvent_.type) {
3763- case MOTION_EVENT_TYPE: {
3764- dispatchMotionEvent(ubuntuEvent->window_, &ubuntuEvent->nativeEvent_);
3765- break;
3766- }
3767- case KEY_EVENT_TYPE: {
3768- dispatchKeyEvent(ubuntuEvent->window_, &ubuntuEvent->nativeEvent_);
3769- break;
3770- }
3771- case HW_SWITCH_EVENT_TYPE: {
3772- dispatchHWSwitchEvent(ubuntuEvent->window_, &ubuntuEvent->nativeEvent_);
3773- break;
3774- }
3775- default: {
3776- DLOG("unhandled event type %d", ubuntuEvent->nativeEvent_.type);
3777- }
3778- }
3779-}
3780-
3781-void QUbuntuBaseInput::postEvent(QWindow* window, const void* event) {
3782- DLOG("QUbuntuBaseInput::postEvent (this=%p, window=%p, event=%p)", this, window, event);
3783- QCoreApplication::postEvent(this, new QUbuntuBaseEvent(
3784- window, reinterpret_cast<const Event*>(event), eventType_));
3785-
3786- if ((window->flags() && Qt::WindowTransparentForInput) && window->parent()) {
3787- DLOG("QUbuntuBaseInput::postEvent (this=%p, window=%p, event=%p)", this, window->parent(), event);
3788- QCoreApplication::postEvent(this, new QUbuntuBaseEvent(
3789- window->parent(), reinterpret_cast<const Event*>(event), eventType_));
3790- }
3791-}
3792-
3793-void QUbuntuBaseInput::dispatchMotionEvent(QWindow* window, const void* ev) {
3794- DLOG("QUbuntuBaseInput::dispatchMotionEvent (this=%p, window=%p, event=%p)", this, window, ev);
3795- const Event* event = reinterpret_cast<const Event*>(ev);
3796-
3797-#if (LOG_EVENTS != 0)
3798- // Motion event logging.
3799- LOG("MOTION device_id:%d source_id:%d action:%d flags:%d meta_state:%d edge_flags:%d "
3800- "button_state:%d x_offset:%.2f y_offset:%.2f x_precision:%.2f y_precision:%.2f "
3801- "down_time:%lld event_time:%lld pointer_count:%d {", event->device_id,
3802- event->source_id, event->action, event->flags, event->meta_state,
3803- event->details.motion.edge_flags, event->details.motion.button_state,
3804- event->details.motion.x_offset, event->details.motion.y_offset,
3805- event->details.motion.x_precision, event->details.motion.y_precision,
3806- event->details.motion.down_time, event->details.motion.event_time,
3807- event->details.motion.pointer_count);
3808- for (size_t i = 0; i < event->details.motion.pointer_count; i++) {
3809- LOG(" id:%d x:%.2f y:%.2f rx:%.2f ry:%.2f maj:%.2f min:%.2f sz:%.2f press:%.2f",
3810- event->details.motion.pointer_coordinates[i].id,
3811- event->details.motion.pointer_coordinates[i].x,
3812- event->details.motion.pointer_coordinates[i].y,
3813- event->details.motion.pointer_coordinates[i].raw_x,
3814- event->details.motion.pointer_coordinates[i].raw_y,
3815- event->details.motion.pointer_coordinates[i].touch_major,
3816- event->details.motion.pointer_coordinates[i].touch_minor,
3817- event->details.motion.pointer_coordinates[i].size,
3818- event->details.motion.pointer_coordinates[i].pressure
3819- // event->details.motion.pointer_coordinates[i].orientation -> Always 0.0.
3820- );
3821- }
3822- LOG("}");
3823-#endif
3824-
3825- // FIXME(loicm) Max pressure is device specific. That one is for the Samsung Galaxy Nexus. That
3826- // needs to be fixed as soon as the compat input lib adds query support.
3827- const float kMaxPressure = 1.28;
3828- const QRect kWindowGeometry = window->geometry();
3829- QList<QWindowSystemInterface::TouchPoint> touchPoints;
3830-
3831-
3832- // TODO: Is it worth setting the Qt::TouchPointStationary ones? Currently they are left
3833- // as Qt::TouchPointMoved
3834- const int kPointerCount = event->details.motion.pointer_count;
3835- for (int i = 0; i < kPointerCount; ++i) {
3836- QWindowSystemInterface::TouchPoint touchPoint;
3837-
3838- const float kX = event->details.motion.pointer_coordinates[i].raw_x;
3839- const float kY = event->details.motion.pointer_coordinates[i].raw_y;
3840- const float kW = event->details.motion.pointer_coordinates[i].touch_major;
3841- const float kH = event->details.motion.pointer_coordinates[i].touch_minor;
3842- const float kP = event->details.motion.pointer_coordinates[i].pressure;
3843- touchPoint.id = event->details.motion.pointer_coordinates[i].id;
3844- touchPoint.normalPosition = QPointF(kX / kWindowGeometry.width(), kY / kWindowGeometry.height());
3845- touchPoint.area = QRectF(kX - (kW / 2.0), kY - (kH / 2.0), kW, kH);
3846- touchPoint.pressure = kP / kMaxPressure;
3847- touchPoint.state = Qt::TouchPointMoved;
3848-
3849- touchPoints.append(touchPoint);
3850- }
3851-
3852- switch (event->action & ISCL_MOTION_EVENT_ACTION_MASK) {
3853- case ISCL_MOTION_EVENT_ACTION_MOVE:
3854- // No extra work needed.
3855- break;
3856-
3857- case ISCL_MOTION_EVENT_ACTION_DOWN:
3858- touchPoints[0].state = Qt::TouchPointPressed;
3859- break;
3860-
3861- case ISCL_MOTION_EVENT_ACTION_UP:
3862- touchPoints[0].state = Qt::TouchPointReleased;
3863- break;
3864-
3865- case ISCL_MOTION_EVENT_ACTION_POINTER_DOWN: {
3866- const int index = (event->action & ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_MASK) >>
3867- ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
3868- touchPoints[index].state = Qt::TouchPointPressed;
3869- break;
3870- }
3871-
3872- case ISCL_MOTION_EVENT_ACTION_CANCEL:
3873- case ISCL_MOTION_EVENT_ACTION_POINTER_UP: {
3874- const int index = (event->action & ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_MASK) >>
3875- ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
3876- touchPoints[index].state = Qt::TouchPointReleased;
3877- break;
3878- }
3879-
3880- case ISCL_MOTION_EVENT_ACTION_OUTSIDE:
3881- case ISCL_MOTION_EVENT_ACTION_HOVER_MOVE:
3882- case ISCL_MOTION_EVENT_ACTION_SCROLL:
3883- case ISCL_MOTION_EVENT_ACTION_HOVER_ENTER:
3884- case ISCL_MOTION_EVENT_ACTION_HOVER_EXIT:
3885- default:
3886- DLOG("unhandled motion event action %d", event->action & ISCL_MOTION_EVENT_ACTION_MASK);
3887- }
3888-
3889- // Touch event propagation.
3890- handleTouchEvent(window, event->details.motion.event_time / 1000000, touchDevice_, touchPoints);
3891-}
3892-
3893-void QUbuntuBaseInput::handleTouchEvent(
3894- QWindow* window, ulong timestamp, QTouchDevice* device,
3895- const QList<struct QWindowSystemInterface::TouchPoint> &points) {
3896- DLOG("QUbuntuBaseInput::handleTouchEvent (this=%p, window=%p, timestamp=%lu, device=%p)",
3897- this, window, timestamp, device);
3898- QWindowSystemInterface::handleTouchEvent(window, timestamp, device, points);
3899-}
3900-
3901-void QUbuntuBaseInput::dispatchKeyEvent(QWindow* window, const void* ev) {
3902- DLOG("QUbuntuBaseInput::dispatchKeyEvent (this=%p, window=%p, event=%p)", this, window, ev);
3903- const Event* event = reinterpret_cast<const Event*>(ev);
3904-
3905-#if (LOG_EVENTS != 0)
3906- // Key event logging.
3907- LOG("KEY device_id:%d source_id:%d action:%d flags:%d meta_state:%d key_code:%d "
3908- "scan_code:%d repeat_count:%d down_time:%lld event_time:%lld is_system_key:%d",
3909- event->device_id, event->source_id, event->action, event->flags, event->meta_state,
3910- event->details.key.key_code, event->details.key.scan_code,
3911- event->details.key.repeat_count, event->details.key.down_time,
3912- event->details.key.event_time, event->details.key.is_system_key);
3913-#endif
3914-
3915- // Key modifier and unicode index mapping.
3916- const int kMetaState = event->meta_state;
3917- Qt::KeyboardModifiers modifiers = Qt::NoModifier;
3918- int unicodeIndex = 0;
3919- if (kMetaState & ISCL_META_SHIFT_ON) {
3920- modifiers |= Qt::ShiftModifier;
3921- unicodeIndex = 1;
3922- }
3923- if (kMetaState & ISCL_META_CTRL_ON) {
3924- modifiers |= Qt::ControlModifier;
3925- unicodeIndex = 2;
3926- }
3927- if (kMetaState & ISCL_META_ALT_ON) {
3928- modifiers |= Qt::AltModifier;
3929- unicodeIndex = 2;
3930- }
3931- if (kMetaState & ISCL_META_META_ON) {
3932- modifiers |= Qt::MetaModifier;
3933- unicodeIndex = 2;
3934- }
3935-
3936- // Key event propagation.
3937- QEvent::Type keyType = kEventType[event->action];
3938- quint32 keyCode = kKeyCode[event->details.key.key_code].keycode;
3939- QString text(kKeyCode[event->details.key.key_code].unicode[unicodeIndex]);
3940- ulong timestamp = event->details.key.event_time / 1000000;
3941- QPlatformInputContext* context = QGuiApplicationPrivate::platformIntegration()->inputContext();
3942- if (context) {
3943- QKeyEvent qKeyEvent(keyType, keyCode, modifiers, text);
3944- qKeyEvent.setTimestamp(timestamp);
3945- if (context->filterEvent(&qKeyEvent)) {
3946- DLOG("key event filtered out by input context");
3947- return;
3948- }
3949- }
3950- handleKeyEvent(window, timestamp, keyType, keyCode, modifiers, text);
3951-}
3952-
3953-void QUbuntuBaseInput::handleKeyEvent(
3954- QWindow* window, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
3955- const QString& text) {
3956- DLOG("QUbuntuBaseInput::handleKeyEvent (this=%p window=%p, timestamp=%lu, type=%d, key=%d, "
3957- "modifiers=%d, text='%s')", this, window, timestamp, static_cast<int>(type), key,
3958- static_cast<int>(modifiers), text.toUtf8().data());
3959- QWindowSystemInterface::handleKeyEvent(window, timestamp, type, key, modifiers, text);
3960-}
3961-
3962-void QUbuntuBaseInput::dispatchHWSwitchEvent(QWindow* window, const void* ev) {
3963- Q_UNUSED(window);
3964- Q_UNUSED(ev);
3965- DLOG("QUbuntuBaseInput::dispatchSwitchEvent (this=%p, window=%p, event=%p)", this, window, ev);
3966-
3967-#if (LOG_EVENTS != 0)
3968- // HW switch event logging.
3969- const Event* event = reinterpret_cast<const Event*>(ev);
3970- LOG("HWSWITCH device_id:%d source_id:%d action:%d flags:%d meta_state:%d event_time:%lld "
3971- "policy_flags:%u switch_values:%d switch_mask:%d", event->device_id, event->source_id,
3972- event->action, event->flags, event->meta_state, event->details.hw_switch.event_time,
3973- event->details.hw_switch.policy_flags, event->details.hw_switch.switch_values,
3974- event->details.hw_switch.switch_mask);
3975-#endif
3976-
3977- // FIXME(loicm) Not sure how to interpret that kind of event.
3978- DLOG("hw switch events are not handled");
3979+ , mEventType(static_cast<QEvent::Type>(QEvent::registerEventType()))
3980+{
3981+ // Initialize touch device.
3982+ mTouchDevice = new QTouchDevice;
3983+ mTouchDevice->setType(QTouchDevice::TouchScreen);
3984+ mTouchDevice->setCapabilities(
3985+ QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::Pressure |
3986+ QTouchDevice::NormalizedPosition);
3987+ QWindowSystemInterface::registerTouchDevice(mTouchDevice);
3988+}
3989+
3990+UbuntuInput::~UbuntuInput()
3991+{
3992+ // Qt will take care of deleting mTouchDevice.
3993+}
3994+
3995+#ifndef QT_NO_DEBUG
3996+static const char* nativeEventTypeToStr(int eventType)
3997+{
3998+ switch (eventType) {
3999+ case MOTION_WEVENT_TYPE:
4000+ return "MOTION_WEVENT_TYPE";
4001+ break;
4002+ case KEY_WEVENT_TYPE:
4003+ return "KEY_WEVENT_TYPE";
4004+ break;
4005+ case RESIZE_WEVENT_TYPE:
4006+ return "RESIZE_WEVENT_TYPE";
4007+ break;
4008+ case SURFACE_WEVENT_TYPE:
4009+ return "SURFACE_WEVENT_TYPE";
4010+ default:
4011+ return "INVALID!";
4012+ }
4013+}
4014+#endif
4015+
4016+void UbuntuInput::customEvent(QEvent* event)
4017+{
4018+ DASSERT(QThread::currentThread() == thread());
4019+ UbuntuEvent* ubuntuEvent = static_cast<UbuntuEvent*>(event);
4020+ WindowEvent *nativeEvent = &ubuntuEvent->nativeEvent;
4021+
4022+ // Event filtering.
4023+ long result;
4024+ if (QWindowSystemInterface::handleNativeEvent(
4025+ ubuntuEvent->window->window(), mEventFilterType, nativeEvent, &result) == true) {
4026+ DLOG("event filtered out by native interface");
4027+ return;
4028+ }
4029+
4030+ DLOG("UbuntuInput::customEvent(type=%s)", nativeEventTypeToStr(nativeEvent->type));
4031+
4032+ // Event dispatching.
4033+ switch (nativeEvent->type) {
4034+ case MOTION_WEVENT_TYPE:
4035+ dispatchMotionEvent(ubuntuEvent->window->window(), nativeEvent);
4036+ break;
4037+ case KEY_WEVENT_TYPE:
4038+ dispatchKeyEvent(ubuntuEvent->window->window(), nativeEvent);
4039+ break;
4040+ case RESIZE_WEVENT_TYPE:
4041+ ubuntuEvent->window->handleSurfaceResize(nativeEvent->resize.width,
4042+ nativeEvent->resize.height);
4043+ break;
4044+ case SURFACE_WEVENT_TYPE:
4045+ if (nativeEvent->surface.attribute == SURFACE_ATTRIBUTE_FOCUS) {
4046+ ubuntuEvent->window->handleSurfaceFocusChange(nativeEvent->surface.value == 1);
4047+ }
4048+ break;
4049+ default:
4050+ DLOG("unhandled event type %d", nativeEvent->type);
4051+ }
4052+}
4053+
4054+void UbuntuInput::postEvent(UbuntuWindow* platformWindow, const void* event)
4055+{
4056+ QWindow *window = platformWindow->window();
4057+
4058+ QCoreApplication::postEvent(this, new UbuntuEvent(
4059+ platformWindow, reinterpret_cast<const WindowEvent*>(event), mEventType));
4060+
4061+ if ((window->flags() && Qt::WindowTransparentForInput) && window->parent()) {
4062+ QCoreApplication::postEvent(this, new UbuntuEvent(
4063+ static_cast<UbuntuWindow*>(platformWindow->QPlatformWindow::parent()),
4064+ reinterpret_cast<const WindowEvent*>(event), mEventType));
4065+ }
4066+}
4067+
4068+void UbuntuInput::dispatchMotionEvent(QWindow* window, const void* ev)
4069+{
4070+ const WindowEvent* event = reinterpret_cast<const WindowEvent*>(ev);
4071+
4072+ #if (LOG_EVENTS != 0)
4073+ // Motion event logging.
4074+ LOG("MOTION device_id:%d source_id:%d action:%d flags:%d meta_state:%d edge_flags:%d "
4075+ "button_state:%d x_offset:%.2f y_offset:%.2f x_precision:%.2f y_precision:%.2f "
4076+ "down_time:%lld event_time:%lld pointer_count:%d {", event->motion.device_id,
4077+ event->motion.source_id, event->motion.action,
4078+ event->motion.flags, event->motion.meta_state,
4079+ event->motion.edge_flags, event->motion.button_state,
4080+ event->motion.x_offset, event->motion.y_offset,
4081+ event->motion.x_precision, event->motion.y_precision,
4082+ event->motion.down_time, event->motion.event_time,
4083+ event->motion.pointer_count);
4084+ for (size_t i = 0; i < event->motion.pointer_count; i++) {
4085+ LOG(" id:%d x:%.2f y:%.2f rx:%.2f ry:%.2f maj:%.2f min:%.2f sz:%.2f press:%.2f",
4086+ event->motion.pointer_coordinates[i].id,
4087+ event->motion.pointer_coordinates[i].x,
4088+ event->motion.pointer_coordinates[i].y,
4089+ event->motion.pointer_coordinates[i].raw_x,
4090+ event->motion.pointer_coordinates[i].raw_y,
4091+ event->motion.pointer_coordinates[i].touch_major,
4092+ event->motion.pointer_coordinates[i].touch_minor,
4093+ event->motion.pointer_coordinates[i].size,
4094+ event->motion.pointer_coordinates[i].pressure
4095+ // event->motion.pointer_coordinates[i].orientation -> Always 0.0.
4096+ );
4097+ }
4098+ LOG("}");
4099+ #endif
4100+
4101+ // FIXME(loicm) Max pressure is device specific. That one is for the Samsung Galaxy Nexus. That
4102+ // needs to be fixed as soon as the compat input lib adds query support.
4103+ const float kMaxPressure = 1.28;
4104+ const QRect kWindowGeometry = window->geometry();
4105+ QList<QWindowSystemInterface::TouchPoint> touchPoints;
4106+
4107+
4108+ // TODO: Is it worth setting the Qt::TouchPointStationary ones? Currently they are left
4109+ // as Qt::TouchPointMoved
4110+ const int kPointerCount = event->motion.pointer_count;
4111+ for (int i = 0; i < kPointerCount; ++i) {
4112+ QWindowSystemInterface::TouchPoint touchPoint;
4113+
4114+ const float kX = event->motion.pointer_coordinates[i].raw_x;
4115+ const float kY = event->motion.pointer_coordinates[i].raw_y;
4116+ const float kW = event->motion.pointer_coordinates[i].touch_major;
4117+ const float kH = event->motion.pointer_coordinates[i].touch_minor;
4118+ const float kP = event->motion.pointer_coordinates[i].pressure;
4119+ touchPoint.id = event->motion.pointer_coordinates[i].id;
4120+ touchPoint.normalPosition = QPointF(kX / kWindowGeometry.width(), kY / kWindowGeometry.height());
4121+ touchPoint.area = QRectF(kX - (kW / 2.0), kY - (kH / 2.0), kW, kH);
4122+ touchPoint.pressure = kP / kMaxPressure;
4123+ touchPoint.state = Qt::TouchPointMoved;
4124+
4125+ touchPoints.append(touchPoint);
4126+ }
4127+
4128+ switch (event->motion.action & U_MOTION_ACTION_MASK) {
4129+ case U_MOTION_ACTION_MOVE:
4130+ // No extra work needed.
4131+ break;
4132+
4133+ case U_MOTION_ACTION_DOWN:
4134+ touchPoints[0].state = Qt::TouchPointPressed;
4135+ break;
4136+
4137+ case U_MOTION_ACTION_UP:
4138+ touchPoints[0].state = Qt::TouchPointReleased;
4139+ break;
4140+
4141+ case U_MOTION_ACTION_POINTER_DOWN: {
4142+ const int index = (event->motion.action & U_MOTION_ACTION_POINTER_INDEX_MASK) >>
4143+ U_MOTION_ACTION_POINTER_INDEX_SHIFT;
4144+ touchPoints[index].state = Qt::TouchPointPressed;
4145+ break;
4146+ }
4147+
4148+ case U_MOTION_ACTION_CANCEL:
4149+ case U_MOTION_ACTION_POINTER_UP: {
4150+ const int index = (event->motion.action & U_MOTION_ACTION_POINTER_INDEX_MASK) >>
4151+ U_MOTION_ACTION_POINTER_INDEX_SHIFT;
4152+ touchPoints[index].state = Qt::TouchPointReleased;
4153+ break;
4154+ }
4155+
4156+ case U_MOTION_ACTION_OUTSIDE:
4157+ case U_MOTION_ACTION_HOVER_MOVE:
4158+ case U_MOTION_ACTION_SCROLL:
4159+ case U_MOTION_ACTION_HOVER_ENTER:
4160+ case U_MOTION_ACTION_HOVER_EXIT:
4161+ default:
4162+ DLOG("unhandled motion event action %d", event->motion.action & U_MOTION_ACTION_MASK);
4163+ }
4164+
4165+ QWindowSystemInterface::handleTouchEvent(window, event->motion.event_time / 1000000,
4166+ mTouchDevice, touchPoints);
4167+}
4168+
4169+static uint32_t translateKeysym(uint32_t sym, char *string, size_t size)
4170+{
4171+ Q_UNUSED(size);
4172+ string[0] = '\0';
4173+
4174+ if (sym >= XKB_KEY_F1 && sym <= XKB_KEY_F35)
4175+ return Qt::Key_F1 + (int(sym) - XKB_KEY_F1);
4176+
4177+ for (int i = 0; KeyTable[i]; i += 2) {
4178+ if (sym == KeyTable[i])
4179+ return KeyTable[i + 1];
4180+ }
4181+
4182+ string[0] = sym;
4183+ string[1] = '\0';
4184+ return toupper(sym);
4185+}
4186+
4187+void UbuntuInput::dispatchKeyEvent(QWindow* window, const void* ev)
4188+{
4189+ const WindowEvent* event = reinterpret_cast<const WindowEvent*>(ev);
4190+
4191+ #if (LOG_EVENTS != 0)
4192+ // Key event logging.
4193+ LOG("KEY device_id:%d source_id:%d action:%d flags:%d meta_state:%d key_code:%d "
4194+ "scan_code:%d repeat_count:%d down_time:%lld event_time:%lld is_system_key:%d",
4195+ event->key.device_id, event->key.source_id,
4196+ event->key.action, event->key.flags, event->key.meta_state,
4197+ event->key.key_code, event->key.scan_code,
4198+ event->key.repeat_count, event->key.down_time,
4199+ event->key.event_time, event->key.is_system_key);
4200+ #endif
4201+
4202+ ulong timestamp = event->key.event_time / 1000000;
4203+ xkb_keysym_t xk_sym = (xkb_keysym_t)event->key.key_code;
4204+
4205+ // Key modifier and unicode index mapping.
4206+ const int kMetaState = event->key.meta_state;
4207+ Qt::KeyboardModifiers modifiers = Qt::NoModifier;
4208+ if (kMetaState & U_KEY_MODIFIER_SHIFT) {
4209+ modifiers |= Qt::ShiftModifier;
4210+ }
4211+ if (kMetaState & U_KEY_MODIFIER_CTRL) {
4212+ modifiers |= Qt::ControlModifier;
4213+ }
4214+ if (kMetaState & U_KEY_MODIFIER_ALT) {
4215+ modifiers |= Qt::AltModifier;
4216+ }
4217+ if (kMetaState & U_KEY_MODIFIER_META) {
4218+ modifiers |= Qt::MetaModifier;
4219+ }
4220+
4221+ QEvent::Type keyType = event->key.action == U_KEY_ACTION_DOWN ? QEvent::KeyPress : QEvent::KeyRelease;
4222+
4223+ char s[2];
4224+ int sym = translateKeysym(xk_sym, s, sizeof(s));
4225+ QString text = QString::fromLatin1(s);
4226+
4227+ QPlatformInputContext* context = QGuiApplicationPrivate::platformIntegration()->inputContext();
4228+ if (context) {
4229+ QKeyEvent qKeyEvent(keyType, sym, modifiers, text);
4230+ qKeyEvent.setTimestamp(timestamp);
4231+ if (context->filterEvent(&qKeyEvent)) {
4232+ DLOG("key event filtered out by input context");
4233+ return;
4234+ }
4235+ }
4236+
4237+ QWindowSystemInterface::handleKeyEvent(window, timestamp, keyType, sym, modifiers, text);
4238 }
4239
4240=== modified file 'src/ubuntumirclient/input.h'
4241--- src/platforms/base/input.h 2013-10-17 18:38:03 +0000
4242+++ src/ubuntumirclient/input.h 2014-07-21 23:47:35 +0000
4243@@ -1,53 +1,51 @@
4244-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
4245-// Copyright © 2013 Canonical Ltd.
4246-//
4247-// This program is free software: you can redistribute it and/or modify it under
4248-// the terms of the GNU Lesser General Public License version 3, as published by
4249-// the Free Software Foundation.
4250-//
4251-// This program is distributed in the hope that it will be useful, but WITHOUT
4252-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
4253-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4254-// Lesser General Public License for more details.
4255-//
4256-// You should have received a copy of the GNU Lesser General Public License
4257-// along with this program. If not, see <http://www.gnu.org/licenses/>.
4258-
4259-#ifndef QUBUNTUBASEINPUT_H
4260-#define QUBUNTUBASEINPUT_H
4261-
4262+/*
4263+ * Copyright (C) 2014 Canonical, Ltd.
4264+ *
4265+ * This program is free software: you can redistribute it and/or modify it under
4266+ * the terms of the GNU Lesser General Public License version 3, as published by
4267+ * the Free Software Foundation.
4268+ *
4269+ * This program is distributed in the hope that it will be useful, but WITHOUT
4270+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
4271+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4272+ * Lesser General Public License for more details.
4273+ *
4274+ * You should have received a copy of the GNU Lesser General Public License
4275+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4276+ */
4277+
4278+#ifndef UBUNTU_INPUT_H
4279+#define UBUNTU_INPUT_H
4280+
4281+// Qt
4282 #include <qpa/qwindowsysteminterface.h>
4283
4284-class QUbuntuBaseIntegration;
4285-
4286-class QUbuntuBaseInput : public QObject {
4287- Q_OBJECT
4288-
4289- public:
4290- QUbuntuBaseInput(QUbuntuBaseIntegration* integration);
4291- ~QUbuntuBaseInput();
4292-
4293- // QObject methods.
4294- void customEvent(QEvent* event);
4295-
4296- virtual void handleTouchEvent(QWindow* window, ulong timestamp, QTouchDevice* device,
4297- const QList<struct QWindowSystemInterface::TouchPoint> &points);
4298- virtual void handleKeyEvent(QWindow* window, ulong timestamp, QEvent::Type type, int key,
4299- Qt::KeyboardModifiers modifiers, const QString& text);
4300-
4301- void postEvent(QWindow* window, const void* event);
4302- QUbuntuBaseIntegration* integration() const { return integration_; }
4303-
4304- protected:
4305- virtual void dispatchKeyEvent(QWindow* window, const void* event);
4306- void dispatchMotionEvent(QWindow* window, const void* event);
4307- void dispatchHWSwitchEvent(QWindow* window, const void* event);
4308-
4309- private:
4310- QUbuntuBaseIntegration* integration_;
4311- QTouchDevice* touchDevice_;
4312- const QByteArray eventFilterType_;
4313- const QEvent::Type eventType_;
4314+class UbuntuClientIntegration;
4315+class UbuntuWindow;
4316+
4317+class UbuntuInput : public QObject
4318+{
4319+ Q_OBJECT
4320+
4321+public:
4322+ UbuntuInput(UbuntuClientIntegration* integration);
4323+ virtual ~UbuntuInput();
4324+
4325+ // QObject methods.
4326+ void customEvent(QEvent* event) override;
4327+
4328+ void postEvent(UbuntuWindow* window, const void* event);
4329+ UbuntuClientIntegration* integration() const { return mIntegration; }
4330+
4331+protected:
4332+ void dispatchKeyEvent(QWindow* window, const void* event);
4333+ void dispatchMotionEvent(QWindow* window, const void* event);
4334+
4335+private:
4336+ UbuntuClientIntegration* mIntegration;
4337+ QTouchDevice* mTouchDevice;
4338+ const QByteArray mEventFilterType;
4339+ const QEvent::Type mEventType;
4340 };
4341
4342-#endif // QUBUNTUBASEINPUT_H
4343+#endif // UBUNTU_INPUT_H
4344
4345=== renamed file 'src/platforms/base/integration.cc' => 'src/ubuntumirclient/integration.cpp'
4346--- src/platforms/base/integration.cc 2014-02-10 15:26:25 +0000
4347+++ src/ubuntumirclient/integration.cpp 2014-07-21 23:47:35 +0000
4348@@ -1,105 +1,208 @@
4349-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
4350-// Copyright © 2013 Canonical Ltd.
4351-//
4352-// This program is free software: you can redistribute it and/or modify it under
4353-// the terms of the GNU Lesser General Public License version 3, as published by
4354-// the Free Software Foundation.
4355-//
4356-// This program is distributed in the hope that it will be useful, but WITHOUT
4357-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
4358-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4359-// Lesser General Public License for more details.
4360-//
4361-// You should have received a copy of the GNU Lesser General Public License
4362-// along with this program. If not, see <http://www.gnu.org/licenses/>.
4363-
4364+/*
4365+ * Copyright (C) 2014 Canonical, Ltd.
4366+ *
4367+ * This program is free software: you can redistribute it and/or modify it under
4368+ * the terms of the GNU Lesser General Public License version 3, as published by
4369+ * the Free Software Foundation.
4370+ *
4371+ * This program is distributed in the hope that it will be useful, but WITHOUT
4372+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
4373+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4374+ * Lesser General Public License for more details.
4375+ *
4376+ * You should have received a copy of the GNU Lesser General Public License
4377+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4378+ */
4379+
4380+// Qt
4381+#include <QGuiApplication>
4382+#include <private/qguiapplication_p.h>
4383+#include <qpa/qplatformnativeinterface.h>
4384+#include <qpa/qplatforminputcontextfactory_p.h>
4385+#include <qpa/qplatforminputcontext.h>
4386+#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
4387+#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
4388+#include <QOpenGLContext>
4389+
4390+// Local
4391+#include "backingstore.h"
4392+#include "clipboard.h"
4393+#include "glcontext.h"
4394+#include "input.h"
4395 #include "integration.h"
4396-#include "native_interface.h"
4397-#include "backing_store.h"
4398+#include "logging.h"
4399+#include "nativeinterface.h"
4400 #include "screen.h"
4401-#include "context.h"
4402-#include "logging.h"
4403 #include "theme.h"
4404-#include "platformservices.h"
4405-#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
4406-#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
4407-#include <QtGui/private/qguiapplication_p.h>
4408-#include <QtGui/QOpenGLContext>
4409-
4410-QUbuntuBaseIntegration::QUbuntuBaseIntegration()
4411- : nativeInterface_(new QUbuntuBaseNativeInterface())
4412-#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
4413- , eventDispatcher_(createUnixEventDispatcher())
4414-#endif
4415- , fontDb_(new QGenericUnixFontDatabase())
4416- , platformServices_(new QUbuntuBasePlatformServices()) {
4417-#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
4418- QGuiApplicationPrivate::instance()->setEventDispatcher(eventDispatcher_);
4419-#endif
4420- DLOG("QUbuntuBaseIntegration::QUbuntuBaseIntegration (this=%p)", this);
4421-}
4422-
4423-QUbuntuBaseIntegration::~QUbuntuBaseIntegration() {
4424- DLOG("QUbuntuBaseIntegration::~QUbuntuBaseIntegration");
4425- delete fontDb_;
4426- delete nativeInterface_;
4427-}
4428-
4429-bool QUbuntuBaseIntegration::hasCapability(QPlatformIntegration::Capability cap) const {
4430- DLOG("QUbuntuBaseIntegration::hasCapability (this=%p)", this);
4431- switch (cap) {
4432- case ThreadedPixmaps: {
4433- return true;
4434- } case OpenGL: {
4435- return true;
4436- }
4437- case ThreadedOpenGL: {
4438- if (qEnvironmentVariableIsEmpty("QTUBUNTU_NO_THREADED_OPENGL")) {
4439- return true;
4440- } else {
4441- DLOG("disabled threaded OpenGL");
4442- return false;
4443- }
4444- }
4445- default: {
4446- return QPlatformIntegration::hasCapability(cap);
4447- }
4448- }
4449-}
4450-
4451-#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
4452-QAbstractEventDispatcher *QUbuntuBaseIntegration::createEventDispatcher() const {
4453+#include "window.h"
4454+
4455+// platform-api
4456+#include <ubuntu/application/lifecycle_delegate.h>
4457+#include <ubuntu/application/id.h>
4458+#include <ubuntu/application/options.h>
4459+
4460+static void resumedCallback(const UApplicationOptions *options, void* context)
4461+{
4462+ Q_UNUSED(options)
4463+ Q_UNUSED(context)
4464+ DASSERT(context != NULL);
4465+ QCoreApplication::postEvent(QCoreApplication::instance(),
4466+ new QEvent(QEvent::ApplicationActivate));
4467+}
4468+
4469+static void aboutToStopCallback(UApplicationArchive *archive, void* context)
4470+{
4471+ Q_UNUSED(archive)
4472+ DASSERT(context != NULL);
4473+ UbuntuClientIntegration* integration = static_cast<UbuntuClientIntegration*>(context);
4474+ integration->inputContext()->hideInputPanel();
4475+ QCoreApplication::postEvent(QCoreApplication::instance(),
4476+ new QEvent(QEvent::ApplicationDeactivate));
4477+}
4478+
4479+UbuntuClientIntegration::UbuntuClientIntegration()
4480+ : QPlatformIntegration()
4481+ , mNativeInterface(new UbuntuNativeInterface)
4482+ , mFontDb(new QGenericUnixFontDatabase)
4483+ , mServices(new UbuntuPlatformServices)
4484+ , mClipboard(new UbuntuClipboard)
4485+{
4486+ setupOptions();
4487+ setupDescription();
4488+
4489+ // Create new application instance
4490+ mInstance = u_application_instance_new_from_description_with_options(mDesc, mOptions);
4491+
4492+ if (mInstance == nullptr)
4493+ qFatal("UbuntuClientIntegration: connection to Mir server failed. Check that a Mir server is\n"
4494+ "running, and the correct socket is being used and is accessible. The shell may have\n"
4495+ "rejected the incoming connection, so check its log file");
4496+
4497+ // Create default screen.
4498+ mScreen = new UbuntuScreen;
4499+ screenAdded(mScreen);
4500+
4501+ // Initialize input.
4502+ if (qEnvironmentVariableIsEmpty("QTUBUNTU_NO_INPUT")) {
4503+ mInput = new UbuntuInput(this);
4504+ mInputContext = QPlatformInputContextFactory::create();
4505+ } else {
4506+ mInput = nullptr;
4507+ mInputContext = nullptr;
4508+ }
4509+}
4510+
4511+UbuntuClientIntegration::~UbuntuClientIntegration()
4512+{
4513+ delete mClipboard;
4514+ delete mInput;
4515+ delete mInputContext;
4516+ delete mScreen;
4517+ delete mServices;
4518+}
4519+
4520+QPlatformServices *UbuntuClientIntegration::services() const
4521+{
4522+ return mServices;
4523+}
4524+
4525+void UbuntuClientIntegration::setupOptions()
4526+{
4527+ QStringList args = QCoreApplication::arguments();
4528+ int argc = args.size() + 1;
4529+ char **argv = new char*[argc];
4530+ for (int i = 0; i < argc - 1; i++)
4531+ argv[i] = qstrdup(args.at(i).toLocal8Bit());
4532+ argv[argc - 1] = nullptr;
4533+
4534+ mOptions = u_application_options_new_from_cmd_line(argc - 1, argv);
4535+
4536+ for (int i = 0; i < argc; i++)
4537+ delete [] argv[i];
4538+ delete [] argv;
4539+}
4540+
4541+void UbuntuClientIntegration::setupDescription()
4542+{
4543+ mDesc = u_application_description_new();
4544+ UApplicationId* id = u_application_id_new_from_stringn("QtUbuntu", 8);
4545+ u_application_description_set_application_id(mDesc, id);
4546+
4547+ UApplicationLifecycleDelegate* delegate = u_application_lifecycle_delegate_new();
4548+ u_application_lifecycle_delegate_set_application_resumed_cb(delegate, &resumedCallback);
4549+ u_application_lifecycle_delegate_set_application_about_to_stop_cb(delegate, &aboutToStopCallback);
4550+ u_application_lifecycle_delegate_set_context(delegate, this);
4551+ u_application_description_set_application_lifecycle_delegate(mDesc, delegate);
4552+}
4553+
4554+QPlatformWindow* UbuntuClientIntegration::createPlatformWindow(QWindow* window) const
4555+{
4556+ return const_cast<UbuntuClientIntegration*>(this)->createPlatformWindow(window);
4557+}
4558+
4559+QPlatformWindow* UbuntuClientIntegration::createPlatformWindow(QWindow* window)
4560+{
4561+ QPlatformWindow* platformWindow = new UbuntuWindow(
4562+ window, static_cast<UbuntuScreen*>(mScreen), mInput, mInstance);
4563+ platformWindow->requestActivateWindow();
4564+ return platformWindow;
4565+}
4566+
4567+bool UbuntuClientIntegration::hasCapability(QPlatformIntegration::Capability cap) const
4568+{
4569+ switch (cap) {
4570+ case ThreadedPixmaps:
4571+ return true;
4572+ break;
4573+
4574+ case OpenGL:
4575+ return true;
4576+ break;
4577+
4578+ case ThreadedOpenGL:
4579+ if (qEnvironmentVariableIsEmpty("QTUBUNTU_NO_THREADED_OPENGL")) {
4580+ return true;
4581+ } else {
4582+ DLOG("ubuntumirclient: disabled threaded OpenGL");
4583+ return false;
4584+ }
4585+ break;
4586+
4587+ default:
4588+ return QPlatformIntegration::hasCapability(cap);
4589+ }
4590+}
4591+
4592+QAbstractEventDispatcher *UbuntuClientIntegration::createEventDispatcher() const
4593+{
4594 return createUnixEventDispatcher();
4595 }
4596-#endif
4597-
4598-QPlatformBackingStore* QUbuntuBaseIntegration::createPlatformBackingStore(QWindow* window) const {
4599- DLOG("QUbuntuBaseIntegration::createPlatformBackingStore (this=%p, window=%p)", this, window);
4600- return new QUbuntuBaseBackingStore(window);
4601-}
4602-
4603-QPlatformOpenGLContext* QUbuntuBaseIntegration::createPlatformOpenGLContext(
4604- QOpenGLContext* context) const {
4605- DLOG("QUbuntuBaseIntegration::createPlatformOpenGLContext const (this=%p, context=%p)", this,
4606- context);
4607- return const_cast<QUbuntuBaseIntegration*>(this)->createPlatformOpenGLContext(context);
4608-}
4609-
4610-QPlatformOpenGLContext* QUbuntuBaseIntegration::createPlatformOpenGLContext(
4611- QOpenGLContext* context) {
4612- DLOG("QUbuntuBaseIntegration::createPlatformOpenGLContext (this=%p, context=%p)", this, context);
4613- return new QUbuntuBaseContext(
4614- static_cast<QUbuntuBaseScreen*>(context->screen()->handle()),
4615- static_cast<QUbuntuBaseContext*>(context->shareHandle()));
4616-}
4617-
4618-QStringList QUbuntuBaseIntegration::themeNames() const {
4619- DLOG("QUbuntuBaseIntegration::themeNames (this=%p)", this);
4620- return QStringList(QUbuntuTheme::name);
4621-}
4622-
4623-QPlatformTheme* QUbuntuBaseIntegration::createPlatformTheme(const QString& name) const {
4624- Q_UNUSED(name);
4625- DLOG("QUbuntuBaseIntegration::createPlatformTheme (this=%p)", this);
4626- return new QUbuntuTheme();
4627+
4628+QPlatformBackingStore* UbuntuClientIntegration::createPlatformBackingStore(QWindow* window) const
4629+{
4630+ return new UbuntuBackingStore(window);
4631+}
4632+
4633+QPlatformOpenGLContext* UbuntuClientIntegration::createPlatformOpenGLContext(
4634+ QOpenGLContext* context) const
4635+{
4636+ return const_cast<UbuntuClientIntegration*>(this)->createPlatformOpenGLContext(context);
4637+}
4638+
4639+QPlatformOpenGLContext* UbuntuClientIntegration::createPlatformOpenGLContext(
4640+ QOpenGLContext* context)
4641+{
4642+ return new UbuntuOpenGLContext(static_cast<UbuntuScreen*>(context->screen()->handle()),
4643+ static_cast<UbuntuOpenGLContext*>(context->shareHandle()));
4644+}
4645+
4646+QStringList UbuntuClientIntegration::themeNames() const
4647+{
4648+ return QStringList(UbuntuTheme::name);
4649+}
4650+
4651+QPlatformTheme* UbuntuClientIntegration::createPlatformTheme(const QString& name) const
4652+{
4653+ Q_UNUSED(name);
4654+ return new UbuntuTheme;
4655 }
4656
4657=== modified file 'src/ubuntumirclient/integration.h'
4658--- src/platforms/base/integration.h 2013-11-06 12:39:51 +0000
4659+++ src/ubuntumirclient/integration.h 2014-07-21 23:47:35 +0000
4660@@ -1,53 +1,78 @@
4661-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
4662-// Copyright © 2013 Canonical Ltd.
4663-//
4664-// This program is free software: you can redistribute it and/or modify it under
4665-// the terms of the GNU Lesser General Public License version 3, as published by
4666-// the Free Software Foundation.
4667-//
4668-// This program is distributed in the hope that it will be useful, but WITHOUT
4669-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
4670-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4671-// Lesser General Public License for more details.
4672-//
4673-// You should have received a copy of the GNU Lesser General Public License
4674-// along with this program. If not, see <http://www.gnu.org/licenses/>.
4675+/*
4676+ * Copyright (C) 2014 Canonical, Ltd.
4677+ *
4678+ * This program is free software: you can redistribute it and/or modify it under
4679+ * the terms of the GNU Lesser General Public License version 3, as published by
4680+ * the Free Software Foundation.
4681+ *
4682+ * This program is distributed in the hope that it will be useful, but WITHOUT
4683+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
4684+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4685+ * Lesser General Public License for more details.
4686+ *
4687+ * You should have received a copy of the GNU Lesser General Public License
4688+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4689+ */
4690
4691-#ifndef QUBUNTUBASEINTEGRATION_H
4692-#define QUBUNTUBASEINTEGRATION_H
4693+#ifndef UBUNTU_CLIENT_INTEGRATION_H
4694+#define UBUNTU_CLIENT_INTEGRATION_H
4695
4696 #include <qpa/qplatformintegration.h>
4697
4698-class QAbstractEventDispatcher;
4699-
4700-class QUbuntuBaseIntegration : public QPlatformIntegration {
4701- public:
4702- QUbuntuBaseIntegration();
4703- ~QUbuntuBaseIntegration();
4704-
4705- // QPlatformIntegration methods.
4706- bool hasCapability(QPlatformIntegration::Capability cap) const;
4707-#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
4708- QAbstractEventDispatcher* guiThreadEventDispatcher() const { return eventDispatcher_; }
4709-#else
4710- QAbstractEventDispatcher *createEventDispatcher() const;
4711-#endif
4712- QPlatformNativeInterface* nativeInterface() const { return nativeInterface_; }
4713- QPlatformServices *services() const { return platformServices_; }
4714- QPlatformBackingStore* createPlatformBackingStore(QWindow* window) const;
4715- QPlatformOpenGLContext* createPlatformOpenGLContext(QOpenGLContext* context) const;
4716- QPlatformOpenGLContext* createPlatformOpenGLContext(QOpenGLContext* context);
4717- QPlatformFontDatabase* fontDatabase() const { return fontDb_; }
4718- QStringList themeNames() const;
4719- QPlatformTheme* createPlatformTheme(const QString& name) const;
4720-
4721- private:
4722- QPlatformNativeInterface* nativeInterface_;
4723-#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
4724- QAbstractEventDispatcher* eventDispatcher_;
4725-#endif
4726- QPlatformFontDatabase* fontDb_;
4727- QPlatformServices* platformServices_;
4728+#include "platformservices.h"
4729+
4730+// platform-api
4731+#include <ubuntu/application/description.h>
4732+#include <ubuntu/application/instance.h>
4733+#include <ubuntu/application/ui/options.h>
4734+#include <ubuntu/application/ui/session.h>
4735+
4736+class UbuntuInput;
4737+class UbuntuScreen;
4738+
4739+class UbuntuClientIntegration : public QPlatformIntegration {
4740+public:
4741+ UbuntuClientIntegration();
4742+ virtual ~UbuntuClientIntegration();
4743+
4744+ // QPlatformIntegration methods.
4745+ bool hasCapability(QPlatformIntegration::Capability cap) const override;
4746+ QAbstractEventDispatcher *createEventDispatcher() const override;
4747+ QPlatformNativeInterface* nativeInterface() const override { return mNativeInterface; }
4748+ QPlatformBackingStore* createPlatformBackingStore(QWindow* window) const override;
4749+ QPlatformOpenGLContext* createPlatformOpenGLContext(QOpenGLContext* context) const override;
4750+ QPlatformFontDatabase* fontDatabase() const override { return mFontDb; }
4751+ QStringList themeNames() const override;
4752+ QPlatformTheme* createPlatformTheme(const QString& name) const override;
4753+ QPlatformServices *services() const override;
4754+ QPlatformWindow* createPlatformWindow(QWindow* window) const override;
4755+ QPlatformInputContext* inputContext() const override { return mInputContext; }
4756+ QPlatformClipboard* clipboard() const override { return mClipboard; }
4757+
4758+ QPlatformOpenGLContext* createPlatformOpenGLContext(QOpenGLContext* context);
4759+ QPlatformWindow* createPlatformWindow(QWindow* window);
4760+ UbuntuScreen* screen() const { return mScreen; }
4761+
4762+private:
4763+ void setupOptions();
4764+ void setupDescription();
4765+
4766+ QPlatformNativeInterface* mNativeInterface;
4767+ QPlatformFontDatabase* mFontDb;
4768+
4769+ UbuntuPlatformServices* mServices;
4770+
4771+ UbuntuScreen* mScreen;
4772+ UbuntuInput* mInput;
4773+ QPlatformInputContext* mInputContext;
4774+ QPlatformClipboard* mClipboard;
4775+
4776+ // Platform API stuff
4777+ UApplicationOptions* mOptions;
4778+ UApplicationDescription* mDesc;
4779+ UApplicationInstance* mInstance;
4780+ UAUiSessionProperties* mProps;
4781+ UAUiSession* mSession;
4782 };
4783
4784-#endif // QUBUNTUBASEINTEGRATION_H
4785+#endif // UBUNTU_CLIENT_INTEGRATION_H
4786
4787=== modified file 'src/ubuntumirclient/logging.h'
4788--- src/platforms/base/logging.h 2013-02-14 16:31:33 +0000
4789+++ src/ubuntumirclient/logging.h 2014-07-21 23:47:35 +0000
4790@@ -1,17 +1,18 @@
4791-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
4792-// Copyright © 2013 Canonical Ltd.
4793-//
4794-// This program is free software: you can redistribute it and/or modify it under
4795-// the terms of the GNU Lesser General Public License version 3, as published by
4796-// the Free Software Foundation.
4797-//
4798-// This program is distributed in the hope that it will be useful, but WITHOUT
4799-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
4800-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4801-// Lesser General Public License for more details.
4802-//
4803-// You should have received a copy of the GNU Lesser General Public License
4804-// along with this program. If not, see <http://www.gnu.org/licenses/>.
4805+/*
4806+ * Copyright (C) 2014 Canonical, Ltd.
4807+ *
4808+ * This program is free software: you can redistribute it and/or modify it under
4809+ * the terms of the GNU Lesser General Public License version 3, as published by
4810+ * the Free Software Foundation.
4811+ *
4812+ * This program is distributed in the hope that it will be useful, but WITHOUT
4813+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
4814+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4815+ * Lesser General Public License for more details.
4816+ *
4817+ * You should have received a copy of the GNU Lesser General Public License
4818+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4819+ */
4820
4821 #ifndef QUBUNTULOGGING_H
4822 #define QUBUNTULOGGING_H
4823
4824=== renamed file 'src/platforms/base/native_interface.cc' => 'src/ubuntumirclient/nativeinterface.cpp'
4825--- src/platforms/base/native_interface.cc 2014-02-11 13:34:38 +0000
4826+++ src/ubuntumirclient/nativeinterface.cpp 2014-07-21 23:47:35 +0000
4827@@ -1,114 +1,113 @@
4828-// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
4829-// Copyright © 2013 Canonical Ltd.
4830-//
4831-// This program is free software: you can redistribute it and/or modify it under
4832-// the terms of the GNU Lesser General Public License version 3, as published by
4833-// the Free Software Foundation.
4834-//
4835-// This program is distributed in the hope that it will be useful, but WITHOUT
4836-// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
4837-// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4838-// Lesser General Public License for more details.
4839-//
4840-// You should have received a copy of the GNU Lesser General Public License
4841-// along with this program. If not, see <http://www.gnu.org/licenses/>.
4842-
4843-// FIXME(loicm) "nativeorientation" should be implemented in the Ubuntu plugin
4844-// and not include headers from it, base isn't meant to know about plugins.
4845-// FIXME(loicm) Why return a pointer to the screen orientation enum? The enum
4846-// can just fit in the returned pointer.
4847-
4848-#include "native_interface.h"
4849-#include "screen.h"
4850-#include "ubuntu/ubuntucommon/screen.h"
4851-#include "context.h"
4852-#include "logging.h"
4853+/*
4854+ * Copyright (C) 2014 Canonical, Ltd.
4855+ *
4856+ * This program is free software: you can redistribute it and/or modify it under
4857+ * the terms of the GNU Lesser General Public License version 3, as published by
4858+ * the Free Software Foundation.
4859+ *
4860+ * This program is distributed in the hope that it will be useful, but WITHOUT
4861+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
4862+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4863+ * Lesser General Public License for more details.
4864+ *
4865+ * You should have received a copy of the GNU Lesser General Public License
4866+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4867+ */
4868+
4869+// Qt
4870 #include <private/qguiapplication_p.h>
4871 #include <QtGui/qopenglcontext.h>
4872 #include <QtGui/qscreen.h>
4873 #include <QtCore/QMap>
4874
4875-class QUbuntuBaseResourceMap : public QMap<QByteArray, QUbuntuBaseNativeInterface::ResourceType> {
4876- public:
4877- QUbuntuBaseResourceMap()
4878- : QMap<QByteArray, QUbuntuBaseNativeInterface::ResourceType>() {
4879- insert("egldisplay", QUbuntuBaseNativeInterface::EglDisplay);
4880- insert("eglcontext", QUbuntuBaseNativeInterface::EglContext);
4881- insert("nativeorientation", QUbuntuBaseNativeInterface::NativeOrientation);
4882- insert("display", QUbuntuBaseNativeInterface::Display);
4883- }
4884+// Local
4885+#include "nativeinterface.h"
4886+#include "screen.h"
4887+#include "glcontext.h"
4888+
4889+class UbuntuResourceMap : public QMap<QByteArray, UbuntuNativeInterface::ResourceType>
4890+{
4891+public:
4892+ UbuntuResourceMap()
4893+ : QMap<QByteArray, UbuntuNativeInterface::ResourceType>() {
4894+ insert("egldisplay", UbuntuNativeInterface::EglDisplay);
4895+ insert("eglcontext", UbuntuNativeInterface::EglContext);
4896+ insert("nativeorientation", UbuntuNativeInterface::NativeOrientation);
4897+ insert("display", UbuntuNativeInterface::Display);
4898+ }
4899 };
4900
4901-Q_GLOBAL_STATIC(QUbuntuBaseResourceMap, ubuntuResourceMap)
4902-
4903-QUbuntuBaseNativeInterface::QUbuntuBaseNativeInterface()
4904- : genericEventFilterType_(QByteArrayLiteral("Event"))
4905- , nativeOrientation_(NULL) {
4906- DLOG("QUbuntuBaseNativeInterface::QUbuntuBaseNativeInterface (this=%p)", this);
4907-}
4908-
4909-QUbuntuBaseNativeInterface::~QUbuntuBaseNativeInterface() {
4910- DLOG("QUbuntuBaseNativeInterface::~QUbuntuBaseNativeInterface");
4911- if (nativeOrientation_)
4912- delete nativeOrientation_;
4913-}
4914-
4915-void* QUbuntuBaseNativeInterface::nativeResourceForContext(
4916- const QByteArray& resourceString, QOpenGLContext* context) {
4917- DLOG("QUbuntuBaseNativeInterface::nativeResourceForContext (this=%p, resourceString=%s, "
4918- "context=%p)", this, resourceString.constData(), context);
4919- if (!context)
4920- return NULL;
4921- const QByteArray kLowerCaseResource = resourceString.toLower();
4922- if (!ubuntuResourceMap()->contains(kLowerCaseResource))
4923- return NULL;
4924- const ResourceType kResourceType = ubuntuResourceMap()->value(kLowerCaseResource);
4925- if (kResourceType == QUbuntuBaseNativeInterface::EglContext)
4926- return static_cast<QUbuntuBaseContext*>(context->handle())->eglContext();
4927- else
4928- return NULL;
4929-}
4930-
4931-void* QUbuntuBaseNativeInterface::nativeResourceForScreen(
4932- const QByteArray& resourceString, QScreen* screen) {
4933- DLOG("QUbuntuBaseNativeInterface::nativeResourceForScreen (this=%p, resourceString=%s, "
4934- "screen=%p)", this, resourceString.constData(), screen);
4935- const QByteArray kLowerCaseResource = resourceString.toLower();
4936- if (!ubuntuResourceMap()->contains(kLowerCaseResource))
4937- return NULL;
4938- const ResourceType kResourceType = ubuntuResourceMap()->value(kLowerCaseResource);
4939- if (kResourceType == QUbuntuBaseNativeInterface::Display) {
4940- if (!screen)
4941- screen = QGuiApplication::primaryScreen();
4942- return static_cast<QUbuntuBaseScreen*>(screen->handle())->nativeDisplay();
4943- } else
4944- return NULL;
4945-}
4946-
4947-void* QUbuntuBaseNativeInterface::nativeResourceForWindow(
4948- const QByteArray& resourceString, QWindow* window) {
4949- DLOG("QUbuntuBaseNativeInterface::nativeResourceForWindow (this=%p, resourceString=%s, "
4950- "window=%p)", this, resourceString.constData(), window);
4951- const QByteArray kLowerCaseResource = resourceString.toLower();
4952- if (!ubuntuResourceMap()->contains(kLowerCaseResource))
4953- return NULL;
4954- const ResourceType kResourceType = ubuntuResourceMap()->value(kLowerCaseResource);
4955- if (kResourceType == QUbuntuBaseNativeInterface::EglDisplay) {
4956- if (window) {
4957- return static_cast<QUbuntuBaseScreen*>(window->screen()->handle())->eglDisplay();
4958- } else {
4959- return static_cast<QUbuntuBaseScreen*>(
4960- QGuiApplication::primaryScreen()->handle())->eglDisplay();
4961- }
4962- } else if (kResourceType == QUbuntuBaseNativeInterface::NativeOrientation) {
4963- // Return the device's native screen orientation.
4964- if (window) {
4965- nativeOrientation_ = new Qt::ScreenOrientation(static_cast<QUbuntuScreen*>(window->screen()->handle())->nativeOrientation());
4966- } else {
4967- nativeOrientation_ = new Qt::ScreenOrientation(QGuiApplication::primaryScreen()->handle()->nativeOrientation());
4968- }
4969- return nativeOrientation_;
4970- } else {
4971- return NULL;
4972- }
4973+Q_GLOBAL_STATIC(UbuntuResourceMap, ubuntuResourceMap)
4974+
4975+UbuntuNativeInterface::UbuntuNativeInterface()
4976+ : mGenericEventFilterType(QByteArrayLiteral("Event"))
4977+ , mNativeOrientation(nullptr)
4978+{
4979+}
4980+
4981+UbuntuNativeInterface::~UbuntuNativeInterface()
4982+{
4983+ delete mNativeOrientation;
4984+ mNativeOrientation = nullptr;
4985+}
4986+
4987+void* UbuntuNativeInterface::nativeResourceForContext(
4988+ const QByteArray& resourceString, QOpenGLContext* context)
4989+{
4990+ if (!context)
4991+ return nullptr;
4992+
4993+ const QByteArray kLowerCaseResource = resourceString.toLower();
4994+
4995+ if (!ubuntuResourceMap()->contains(kLowerCaseResource))
4996+ return nullptr;
4997+
4998+ const ResourceType kResourceType = ubuntuResourceMap()->value(kLowerCaseResource);
4999+
5000+ if (kResourceType == UbuntuNativeInterface::EglContext)
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches