Status: | Merged |
---|---|
Merged at revision: | 165 |
Proposed branch: | lp:~robertcarr/qtubuntu/mir2 |
Merge into: | lp:qtubuntu |
Diff against target: |
973 lines (+638/-81) 29 files modified
debian/control (+2/-1) deploy.sh (+2/-0) src/platforms/base/input.h (+3/-2) src/platforms/base/native_interface.cc (+1/-1) src/platforms/base/screen.cc (+6/-1) src/platforms/base/window.cc (+1/-1) src/platforms/platforms.pro (+1/-2) src/platforms/ubuntu/main.cc (+0/-47) src/platforms/ubuntu/ubuntu.json (+0/-3) src/platforms/ubuntu/ubuntu.pro (+14/-0) src/platforms/ubuntu/ubuntu/main.cc (+67/-0) src/platforms/ubuntu/ubuntu/ubuntu.json (+3/-0) src/platforms/ubuntu/ubuntu/ubuntu.pro (+24/-0) src/platforms/ubuntu/ubuntucommon/input_adaptor_factory.h (+32/-0) src/platforms/ubuntu/ubuntucommon/integration.cc (+5/-6) src/platforms/ubuntu/ubuntucommon/integration.h (+2/-1) src/platforms/ubuntu/ubuntucommon/ubuntucommon.pro (+9/-16) src/platforms/ubuntu/ubuntumir/ubuntumir.pro (+16/-0) src/platforms/ubuntu/ubuntumir/ubuntumirclient/main.cc (+47/-0) src/platforms/ubuntu/ubuntumir/ubuntumirclient/ubuntumirclient.json (+3/-0) src/platforms/ubuntu/ubuntumir/ubuntumirclient/ubuntumirclient.pro (+24/-0) src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.cc (+180/-0) src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.h (+31/-0) src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.cc (+43/-0) src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.h (+27/-0) src/platforms/ubuntu/ubuntumir/ubuntumircommon/ubuntumircommon.pro (+21/-0) src/platforms/ubuntu/ubuntumir/ubuntumirserver/main.cc (+47/-0) src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.json (+3/-0) src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.pro (+24/-0) |
To merge this branch: | bzr merge lp:~robertcarr/qtubuntu/mir2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Loïc Molinari (community) | Needs Fixing | ||
Review via email: mp+170111@code.launchpad.net |
Commit message
Mir server and client support.
Description of the change
Some changes for mir support. Just waking up, back to make more detailed description in 20 min :)
- 148. By Robert Carr
-
Revert deb changes
Robert Carr (robertcarr) wrote : | # |
Robert Carr (robertcarr) wrote : | # |
Packaging is assembling at lp:~robertcarr/qtubuntu/mir-with-packaging
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:147
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
- 149. By Robert Carr
-
Remove stencil hack
Robert Carr (robertcarr) wrote : | # |
Removed the stencil buffer hack as it only affects desktop radeon and will carry it locally/elsewhere until we get a real fix.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:148
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:149
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
Robert Carr (robertcarr) wrote : | # |
Jenkins failure is due to requiring platform-api rev. 69 (Add mir support), which adds the ua_ui_display_
- 150. By Robert Carr
-
Bump papi dependency
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:150
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:150
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
- 151. By Robert Carr
-
XKBCommon build dep
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:151
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 152. By Robert Carr
-
Merge trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:152
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:152
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 153. By Robert Carr
-
Add mir session property stubs until papi changes land
- 154. By Robert Carr
-
Remove stubs
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:153
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:154
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 155. By Robert Carr
-
Update deploy.sh paths
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:155
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 156. By Robert Carr
-
Only link qeglconvenience.cpp on mir
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:156
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Loïc Molinari (loic.molinari) wrote : | # |
I haven't been involved in the discussions, but it seems like having the mir libs wrapped into ubuntu platform libs isn't really useful, and even more considering the mapping isn't 1:1 and requires code instead of just linking the plugins to the different platform libs. Why not directly writing QPA plugins based on the mir libraries? I guess if we don't have good reasons for that, people in the community will just start doing that. Maybe we should prepare qtubuntu for that. Here's my review anyway.
1/ I think we should have a cleaner directory hierarchy and include "client" in the name of the mir client plugin, something like that:
platforms
├── base (qubuntubase.a)
├── ubuntu (qubuntu.so)
├── ubuntulegacy (qubuntulegacy.so)
└── ubuntumir
├── common (qubuntumircomm
├── client (qubuntumirclie
└── server (qubuntumirserv
2/ I'd like to keep the key mapping feature for the ubuntu plugin. Now that there is another plugin that's doing it differently I think we should refactor the base input class like that:
class QUbuntuBaseInput : public QObject {
...
public:
...
virtual void dispatchMotionE
virtual void dispatchKeyEven
virtual void dispatchHWSwitc
...
};
By removing the handle*Event virtual functions, directly having the dispatch*Event functions as virtual and move the implementations of these functions (that are different for ubuntu and ubuntumir) directly in the plugins. That said it would be bad to reimplement dispatchMotionE
3/ I'm quite skeptical with copying the EglConvenience code, for obvious design reasons but also for legal reasons. I haven't taken the time to reflect on it though but if there's a good reason (actually if there's a bad reason too) it should be described in the code.
Now for the cosmetics:
4/ Is that ugly because of the platform API (in which case there shouldn't really be a comment) or because it could be improved (in which case there should be a description of how it could be improved)? Also qtubuntu uses FIXME(nickname) instead of TODO so that we can directly ask the person who knows more about it.
+ // TODO: A little ugly
+ UAUiDisplay* u_display = ua_ui_display_
+ ASSERT((eglDisplay_ = eglGetDisplay(
+ ua_ui_display_
5/ qtubuntu project uses the Google coding guidelines, can you please respect it and at least use 2 spaces for indentation (see translateKey() for instance).
6/ As a policy in the qtubuntu project, file-scoped symbols (that don't need to be visible cross object boundary) use the static keyword, so to keep it consistent can you please replace the use of unnamed namespace for the translateKey() function? (That function currently uses both static and unnamed namesp...
- 157. By Robert Carr
-
Rename ubuntu plugin to mirclient
- 158. By Robert Carr
-
Revert input changes
- 159. By Robert Carr
-
More source reorganizing
- 160. By Robert Carr
-
dispatchKeyEvent can be virtual
- 161. By Robert Carr
-
Begin input refactoring
- 162. By Robert Carr
-
More work on refactoring
- 163. By Robert Carr
-
Directory reorg
- 164. By Robert Carr
-
Add some mir input support
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:164
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
- 165. By Robert Carr
-
Remove qegl
- 166. By Robert Carr
-
input.h: Clean up access
- 167. By Robert Carr
-
Cleanup'
- 168. By Robert Carr
-
More cleanup
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:168
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:169
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
Robert Carr (robertcarr) wrote : | # |
>> I haven't been involved in the discussions, but it seems like having the mir libs wrapped into ubuntu platform libs >> isn't really useful, and even more considering the mapping isn't 1:1 and requires code instead of just linking the
>> plugins to the different platform libs.
>>
Actually for mirclient and server (The only two backends which will remain) the code is the same. There is some other reasoning, ping me on IRC and we will talk about it.
>>
1/ I think we should have a cleaner directory hierarchy and include "client" in the name of the mir client plugin, something like that:
>>
Addressed
>>
2/ I'd like to keep the key mapping feature for the ubuntu plugin. Now that there is another plugin that's doing it differently I think we should refactor the base input class like that:
>>
Addressed
>>
3/ I'm quite skeptical with copying the EglConvenience code, for obvious design reasons but also for legal reasons. I haven't taken the time to reflect on it though but if there's a good reason (actually if there's a bad reason too) it should be described in the code.
>>
No longer required by desktop qt in saucy so I deleted it.
>> Now for the cosmetics:
>> 4
SNIP
>> 7
Addressed!
Requires: https:/
Ricardo Mendoza (ricmm) wrote : | # |
Robert Carr (robertcarr) wrote : | # |
Ping?
- 169. By Robert Carr
-
Remove generated file
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:169
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Loïc Molinari (loic.molinari) wrote : | # |
Remains 2 generated moc files (main.moc).
- 170. By Robert Carr
-
Merge trunk
- 171. By Robert Carr
-
Remove moc files
Robert Carr (robertcarr) wrote : | # |
Merged trunk! Removed moc. I seem to not get emails/lose emails from this branch :(
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:171
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'debian/control' |
2 | --- debian/control 2013-07-16 21:36:24 +0000 |
3 | +++ debian/control 2013-07-23 19:01:25 +0000 |
4 | @@ -10,9 +10,10 @@ |
5 | libgles2-mesa-dev, |
6 | libglib2.0-dev, |
7 | libhybris-dev, |
8 | - libplatform-api1-dev (>= 0.18.1daily13.06.11), |
9 | + libubuntu-platform-api1-dev (>= 0.18.1daily13.06.18-0ubuntu1), |
10 | libudev-dev, |
11 | libxrender-dev, |
12 | + libxkbcommon-dev, |
13 | qt5-default, |
14 | qtbase5-private-dev, |
15 | qtdeclarative5-private-dev, |
16 | |
17 | === modified file 'deploy.sh' |
18 | --- deploy.sh 2013-02-12 11:09:38 +0000 |
19 | +++ deploy.sh 2013-07-23 19:01:25 +0000 |
20 | @@ -1,6 +1,8 @@ |
21 | #!/bin/bash -i |
22 | |
23 | adb push src/platforms/ubuntu/libqubuntu.so /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/plugins/platforms |
24 | +adb push src/platforms/ubuntu/libqubuntumir.so /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/plugins/platforms |
25 | +adb push src/platforms/ubuntu/libqubuntumirserver.so /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/plugins/platforms |
26 | adb push src/platforms/ubuntulegacy/libqubuntulegacy.so /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/plugins/platforms |
27 | adb push src/modules/application/libubuntuapplicationplugin.so /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/imports/Ubuntu/Application |
28 | adb push src/modules/application/qmldir /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/imports/Ubuntu/Application |
29 | |
30 | === modified file 'src/platforms/base/input.h' |
31 | --- src/platforms/base/input.h 2013-02-26 01:03:00 +0000 |
32 | +++ src/platforms/base/input.h 2013-07-23 19:01:25 +0000 |
33 | @@ -38,11 +38,12 @@ |
34 | void postEvent(QWindow* window, const void* event); |
35 | QUbuntuBaseIntegration* integration() const { return integration_; } |
36 | |
37 | - private: |
38 | + protected: |
39 | + virtual void dispatchKeyEvent(QWindow* window, const void* event); |
40 | void dispatchMotionEvent(QWindow* window, const void* event); |
41 | - void dispatchKeyEvent(QWindow* window, const void* event); |
42 | void dispatchHWSwitchEvent(QWindow* window, const void* event); |
43 | |
44 | + private: |
45 | QUbuntuBaseIntegration* integration_; |
46 | QTouchDevice* touchDevice_; |
47 | QList<QWindowSystemInterface::TouchPoint> touchPoints_; |
48 | |
49 | === modified file 'src/platforms/base/native_interface.cc' |
50 | --- src/platforms/base/native_interface.cc 2013-02-14 16:31:33 +0000 |
51 | +++ src/platforms/base/native_interface.cc 2013-07-23 19:01:25 +0000 |
52 | @@ -20,7 +20,7 @@ |
53 | |
54 | #include "native_interface.h" |
55 | #include "screen.h" |
56 | -#include "ubuntu/screen.h" |
57 | +#include "ubuntu/ubuntucommon/screen.h" |
58 | #include "context.h" |
59 | #include "logging.h" |
60 | #include <private/qguiapplication_p.h> |
61 | |
62 | === modified file 'src/platforms/base/screen.cc' |
63 | --- src/platforms/base/screen.cc 2013-02-26 01:14:35 +0000 |
64 | +++ src/platforms/base/screen.cc 2013-07-23 19:01:25 +0000 |
65 | @@ -17,6 +17,8 @@ |
66 | #include "logging.h" |
67 | #include <QtPlatformSupport/private/qeglconvenience_p.h> |
68 | |
69 | +#include <ubuntu/application/ui/display.h> |
70 | + |
71 | static const int kSwapInterval = 1; |
72 | |
73 | #if !defined(QT_NO_DEBUG) |
74 | @@ -76,7 +78,10 @@ |
75 | , eglConfig_(NULL) { |
76 | // Initialize EGL. |
77 | ASSERT(eglBindAPI(EGL_OPENGL_ES_API) == EGL_TRUE); |
78 | - ASSERT((eglDisplay_ = eglGetDisplay(EGL_DEFAULT_DISPLAY)) != EGL_NO_DISPLAY); |
79 | + |
80 | + UAUiDisplay* u_display = ua_ui_display_new_with_index(0); |
81 | + ASSERT((eglDisplay_ = eglGetDisplay(ua_ui_display_get_native_type(u_display))) != EGL_NO_DISPLAY); |
82 | + ua_ui_display_destroy(u_display); |
83 | ASSERT(eglInitialize(eglDisplay_, NULL, NULL) == EGL_TRUE); |
84 | |
85 | // Configure EGL buffers format. |
86 | |
87 | === modified file 'src/platforms/base/window.cc' |
88 | --- src/platforms/base/window.cc 2013-02-14 16:31:33 +0000 |
89 | +++ src/platforms/base/window.cc 2013-07-23 19:01:25 +0000 |
90 | @@ -33,7 +33,7 @@ |
91 | } |
92 | |
93 | void QUbuntuBaseWindow::createSurface(EGLNativeWindowType nativeWindow) { |
94 | - DLOG("QUbuntuBaseWindow::createSurface (this=%p, nativeWindow=%u)", this, nativeWindow); |
95 | + DLOG("QUbuntuBaseWindow::createSurface (this=%p, nativeWindow=%p)", this, reinterpret_cast<void*>(nativeWindow)); |
96 | ASSERT((eglSurface_ = eglCreateWindowSurface( |
97 | screen_->eglDisplay(), screen_->eglConfig(), nativeWindow, NULL)) != EGL_NO_SURFACE); |
98 | } |
99 | |
100 | === modified file 'src/platforms/platforms.pro' |
101 | --- src/platforms/platforms.pro 2013-01-17 19:51:06 +0000 |
102 | +++ src/platforms/platforms.pro 2013-07-23 19:01:25 +0000 |
103 | @@ -1,6 +1,5 @@ |
104 | TEMPLATE = subdirs |
105 | |
106 | -SUBDIRS += base ubuntulegacy ubuntu |
107 | +SUBDIRS += base ubuntu |
108 | |
109 | -ubuntulegacy.depends = base |
110 | ubuntu.depends = base |
111 | |
112 | === added directory 'src/platforms/ubuntu' |
113 | === removed file 'src/platforms/ubuntu/main.cc' |
114 | --- src/platforms/ubuntu/main.cc 2013-02-14 16:31:33 +0000 |
115 | +++ src/platforms/ubuntu/main.cc 1970-01-01 00:00:00 +0000 |
116 | @@ -1,47 +0,0 @@ |
117 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
118 | -// Copyright © 2013 Canonical Ltd. |
119 | -// |
120 | -// This program is free software: you can redistribute it and/or modify it under |
121 | -// the terms of the GNU Lesser General Public License version 3, as published by |
122 | -// the Free Software Foundation. |
123 | -// |
124 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
125 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
126 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
127 | -// Lesser General Public License for more details. |
128 | -// |
129 | -// You should have received a copy of the GNU Lesser General Public License |
130 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
131 | - |
132 | -#include <qpa/qplatformintegrationplugin.h> |
133 | -#include "integration.h" |
134 | - |
135 | -QT_BEGIN_NAMESPACE |
136 | - |
137 | -class QUbuntuIntegrationPlugin : public QPlatformIntegrationPlugin { |
138 | - Q_OBJECT |
139 | - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.1" |
140 | - FILE "ubuntu.json") |
141 | - |
142 | - public: |
143 | - QStringList keys() const; |
144 | - QPlatformIntegration* create(const QString&, const QStringList&); |
145 | -}; |
146 | - |
147 | -QStringList QUbuntuIntegrationPlugin::keys() const { |
148 | - QStringList list; |
149 | - list << "ubuntu"; |
150 | - return list; |
151 | -} |
152 | - |
153 | -QPlatformIntegration* QUbuntuIntegrationPlugin::create( |
154 | - const QString& system, const QStringList& paramList) { |
155 | - Q_UNUSED(paramList); |
156 | - if (system.toLower() == "ubuntu") |
157 | - return new QUbuntuIntegration(); |
158 | - return 0; |
159 | -} |
160 | - |
161 | -QT_END_NAMESPACE |
162 | - |
163 | -#include "main.moc" |
164 | |
165 | === added directory 'src/platforms/ubuntu/ubuntu' |
166 | === removed file 'src/platforms/ubuntu/ubuntu.json' |
167 | --- src/platforms/ubuntu/ubuntu.json 2013-01-17 19:51:06 +0000 |
168 | +++ src/platforms/ubuntu/ubuntu.json 1970-01-01 00:00:00 +0000 |
169 | @@ -1,3 +0,0 @@ |
170 | -{ |
171 | - "Keys": [ "ubuntu" ] |
172 | -} |
173 | |
174 | === added file 'src/platforms/ubuntu/ubuntu.pro' |
175 | --- src/platforms/ubuntu/ubuntu.pro 1970-01-01 00:00:00 +0000 |
176 | +++ src/platforms/ubuntu/ubuntu.pro 2013-07-23 19:01:25 +0000 |
177 | @@ -0,0 +1,14 @@ |
178 | +TEMPLATE = subdirs |
179 | + |
180 | +!mirclient:!mirserver { |
181 | +CONFIG += hybris |
182 | +} |
183 | + |
184 | +hybris { |
185 | +SUBDIRS += ubuntu |
186 | +} |
187 | + |
188 | +SUBDIRS += ubuntucommon ubuntumir |
189 | + |
190 | +ubuntu.depends = ubuntucommon |
191 | +ubuntumir.depends = ubuntucommon |
192 | |
193 | === added file 'src/platforms/ubuntu/ubuntu/main.cc' |
194 | --- src/platforms/ubuntu/ubuntu/main.cc 1970-01-01 00:00:00 +0000 |
195 | +++ src/platforms/ubuntu/ubuntu/main.cc 2013-07-23 19:01:25 +0000 |
196 | @@ -0,0 +1,67 @@ |
197 | +// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
198 | +// Copyright © 2013 Canonical Ltd. |
199 | +// |
200 | +// This program is free software: you can redistribute it and/or modify it under |
201 | +// the terms of the GNU Lesser General Public License version 3, as published by |
202 | +// the Free Software Foundation. |
203 | +// |
204 | +// This program is distributed in the hope that it will be useful, but WITHOUT |
205 | +// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
206 | +// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
207 | +// Lesser General Public License for more details. |
208 | +// |
209 | +// You should have received a copy of the GNU Lesser General Public License |
210 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
211 | + |
212 | +#include <qpa/qplatformintegrationplugin.h> |
213 | +#include "ubuntucommon/integration.h" |
214 | +#include "ubuntucommon/input.h" |
215 | +#include "ubuntucommon/input_adaptor_factory.h" |
216 | + |
217 | +namespace |
218 | +{ |
219 | +struct InputAdaptorFactory : public QUbuntuInputAdaptorFactory { |
220 | + InputAdaptorFactory() {} |
221 | + ~InputAdaptorFactory() {} |
222 | + |
223 | + QUbuntuInput* create_input_adaptor(QUbuntuIntegration *integration){ |
224 | + return new QUbuntuInput(integration); |
225 | + } |
226 | + |
227 | + static InputAdaptorFactory* instance(){ |
228 | + static InputAdaptorFactory global_instance; |
229 | + return &global_instance; |
230 | + } |
231 | +}; |
232 | +} |
233 | + |
234 | + |
235 | +QT_BEGIN_NAMESPACE |
236 | + |
237 | +class QUbuntuIntegrationPlugin : public QPlatformIntegrationPlugin { |
238 | + Q_OBJECT |
239 | + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.1" |
240 | + FILE "ubuntu.json") |
241 | + |
242 | + public: |
243 | + QStringList keys() const; |
244 | + QPlatformIntegration* create(const QString&, const QStringList&); |
245 | +}; |
246 | + |
247 | +QStringList QUbuntuIntegrationPlugin::keys() const { |
248 | + QStringList list; |
249 | + list << "ubuntu"; |
250 | + return list; |
251 | +} |
252 | + |
253 | +QPlatformIntegration* QUbuntuIntegrationPlugin::create( |
254 | + const QString& system, const QStringList& paramList) { |
255 | + Q_UNUSED(paramList); |
256 | + if (system.toLower() == "ubuntu") |
257 | + return new QUbuntuIntegration(InputAdaptorFactory::instance()); |
258 | + return 0; |
259 | +} |
260 | + |
261 | +QT_END_NAMESPACE |
262 | + |
263 | +#include "main.moc" |
264 | |
265 | === added file 'src/platforms/ubuntu/ubuntu/ubuntu.json' |
266 | --- src/platforms/ubuntu/ubuntu/ubuntu.json 1970-01-01 00:00:00 +0000 |
267 | +++ src/platforms/ubuntu/ubuntu/ubuntu.json 2013-07-23 19:01:25 +0000 |
268 | @@ -0,0 +1,3 @@ |
269 | +{ |
270 | + "Keys": [ "ubuntu" ] |
271 | +} |
272 | |
273 | === added file 'src/platforms/ubuntu/ubuntu/ubuntu.pro' |
274 | --- src/platforms/ubuntu/ubuntu/ubuntu.pro 1970-01-01 00:00:00 +0000 |
275 | +++ src/platforms/ubuntu/ubuntu/ubuntu.pro 2013-07-23 19:01:25 +0000 |
276 | @@ -0,0 +1,24 @@ |
277 | +TARGET = qubuntu |
278 | +TEMPLATE = lib |
279 | + |
280 | +QT += core-private gui-private platformsupport-private sensors-private |
281 | + |
282 | +DEFINES += MESA_EGL_NO_X11_HEADERS |
283 | +QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden |
284 | +QMAKE_LFLAGS += -Wl,-no-undefined |
285 | + |
286 | +CONFIG(debug) { |
287 | + QMAKE_CXXFLAGS_DEBUG += -Werror |
288 | +} |
289 | + |
290 | +SOURCES = main.cc |
291 | + |
292 | +CONFIG += plugin link_prl |
293 | + |
294 | +INCLUDEPATH += ../../ ../ |
295 | +LIBS += -L../ubuntucommon -lqubuntucommon -lubuntu_application_api -L../../base -lubuntubase |
296 | + |
297 | +OTHER_FILES += ubuntu.json |
298 | + |
299 | +target.path += $$[QT_INSTALL_PLUGINS]/platforms |
300 | +INSTALLS += target |
301 | |
302 | === renamed directory 'src/platforms/ubuntu' => 'src/platforms/ubuntu/ubuntucommon' |
303 | === added file 'src/platforms/ubuntu/ubuntucommon/input_adaptor_factory.h' |
304 | --- src/platforms/ubuntu/ubuntucommon/input_adaptor_factory.h 1970-01-01 00:00:00 +0000 |
305 | +++ src/platforms/ubuntu/ubuntucommon/input_adaptor_factory.h 2013-07-23 19:01:25 +0000 |
306 | @@ -0,0 +1,32 @@ |
307 | +// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
308 | +// Copyright © 2013 Canonical Ltd. |
309 | +// |
310 | +// This program is free software: you can redistribute it and/or modify it under |
311 | +// the terms of the GNU Lesser General Public License version 3, as published by |
312 | +// the Free Software Foundation. |
313 | +// |
314 | +// This program is distributed in the hope that it will be useful, but WITHOUT |
315 | +// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
316 | +// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
317 | +// Lesser General Public License for more details. |
318 | +// |
319 | +// You should have received a copy of the GNU Lesser General Public License |
320 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
321 | + |
322 | +#ifndef QUBUNTU_INPUT_ADAPTOR_FACTORY_H_ |
323 | +#define QUBUNTU_INPUT_ADAPTOR_FACTORY_H_ |
324 | + |
325 | +class QUbuntuInput; |
326 | +class QUbuntuIntegration; |
327 | + |
328 | +class QUbuntuInputAdaptorFactory { |
329 | + public: |
330 | + virtual ~QUbuntuInputAdaptorFactory() {} |
331 | + |
332 | + virtual QUbuntuInput* create_input_adaptor(QUbuntuIntegration* integration) = 0; |
333 | + |
334 | + protected: |
335 | + QUbuntuInputAdaptorFactory() {} |
336 | +}; |
337 | + |
338 | +#endif |
339 | |
340 | === modified file 'src/platforms/ubuntu/ubuntucommon/integration.cc' |
341 | --- src/platforms/ubuntu/integration.cc 2013-06-05 20:54:18 +0000 |
342 | +++ src/platforms/ubuntu/ubuntucommon/integration.cc 2013-07-23 19:01:25 +0000 |
343 | @@ -17,6 +17,7 @@ |
344 | #include "window.h" |
345 | #include "input.h" |
346 | #include "clipboard.h" |
347 | +#include "input_adaptor_factory.h" |
348 | #include "base/logging.h" |
349 | #include <QtCore/QCoreApplication> |
350 | #include <qpa/qplatformnativeinterface.h> |
351 | @@ -42,7 +43,7 @@ |
352 | integration->inputContext()->hideInputPanel(); |
353 | } |
354 | |
355 | -QUbuntuIntegration::QUbuntuIntegration() |
356 | +QUbuntuIntegration::QUbuntuIntegration(QUbuntuInputAdaptorFactory *input_factory) |
357 | : clipboard_(new QUbuntuClipboard()) { |
358 | // Init Ubuntu Platform library. |
359 | QStringList args = QCoreApplication::arguments(); |
360 | @@ -73,7 +74,7 @@ |
361 | |
362 | // Initialize input. |
363 | if (qEnvironmentVariableIsEmpty("QTUBUNTU_NO_INPUT")) { |
364 | - input_ = new QUbuntuInput(this); |
365 | + input_ = input_factory->create_input_adaptor(this); |
366 | inputContext_ = QPlatformInputContextFactory::create(); |
367 | } else { |
368 | input_ = NULL; |
369 | @@ -134,10 +135,8 @@ |
370 | props_ = ua_ui_session_properties_new(); |
371 | ua_ui_session_properties_set_type(props_, static_cast<UAUiSessionType>(sessionType)); |
372 | |
373 | - ua_ui_session_properties_set_remote_pid( |
374 | - props_, |
375 | - static_cast<uint32_t>(QCoreApplication::applicationPid()) |
376 | - ); |
377 | + ua_ui_session_properties_set_remote_pid(props_, |
378 | + static_cast<uint32_t>(QCoreApplication::applicationPid())); |
379 | |
380 | session_ = ua_ui_session_new_with_properties(props_); |
381 | |
382 | |
383 | === modified file 'src/platforms/ubuntu/ubuntucommon/integration.h' |
384 | --- src/platforms/ubuntu/integration.h 2013-05-21 22:11:57 +0000 |
385 | +++ src/platforms/ubuntu/ubuntucommon/integration.h 2013-07-23 19:01:25 +0000 |
386 | @@ -21,11 +21,12 @@ |
387 | #include <ubuntu/application/instance.h> |
388 | #include <ubuntu/application/ui/session.h> |
389 | |
390 | +class QUbuntuInputAdaptorFactory; |
391 | class QUbuntuInput; |
392 | |
393 | class QUbuntuIntegration : public QUbuntuBaseIntegration { |
394 | public: |
395 | - QUbuntuIntegration(); |
396 | + QUbuntuIntegration(QUbuntuInputAdaptorFactory* input_factory); |
397 | ~QUbuntuIntegration(); |
398 | |
399 | // QPlatformIntegration methods. |
400 | |
401 | === renamed file 'src/platforms/ubuntu/ubuntu.pro' => 'src/platforms/ubuntu/ubuntucommon/ubuntucommon.pro' |
402 | --- src/platforms/ubuntu/ubuntu.pro 2013-02-26 19:25:07 +0000 |
403 | +++ src/platforms/ubuntu/ubuntucommon/ubuntucommon.pro 2013-07-23 19:01:25 +0000 |
404 | @@ -1,4 +1,4 @@ |
405 | -TARGET = qubuntu |
406 | +TARGET = qubuntucommon |
407 | TEMPLATE = lib |
408 | |
409 | QT += core-private gui-private platformsupport-private sensors-private |
410 | @@ -11,8 +11,7 @@ |
411 | QMAKE_CXXFLAGS_DEBUG += -Werror |
412 | } |
413 | |
414 | -SOURCES = main.cc \ |
415 | - integration.cc \ |
416 | +SOURCES = integration.cc \ |
417 | window.cc \ |
418 | screen.cc \ |
419 | input.cc \ |
420 | @@ -22,16 +21,10 @@ |
421 | window.h \ |
422 | screen.h \ |
423 | input.h \ |
424 | - clipboard.h |
425 | - |
426 | -CONFIG += plugin link_prl |
427 | - |
428 | -PRE_TARGETDEPS = ../base/libubuntubase.a |
429 | - |
430 | -INCLUDEPATH += .. |
431 | -LIBS += -L../base -lubuntubase -lubuntu_application_api |
432 | - |
433 | -OTHER_FILES += ubuntu.json |
434 | - |
435 | -target.path += $$[QT_INSTALL_PLUGINS]/platforms |
436 | -INSTALLS += target |
437 | + clipboard.h \ |
438 | + input_adaptor_factory.h |
439 | + |
440 | +CONFIG += static plugin create_prl link_prl |
441 | + |
442 | +INCLUDEPATH += ../../ |
443 | +LIBS += -L../base -Wl,--whole-archive -lubuntubase -Wl,--no-whole-archive |
444 | |
445 | === added directory 'src/platforms/ubuntu/ubuntumir' |
446 | === added file 'src/platforms/ubuntu/ubuntumir/ubuntumir.pro' |
447 | --- src/platforms/ubuntu/ubuntumir/ubuntumir.pro 1970-01-01 00:00:00 +0000 |
448 | +++ src/platforms/ubuntu/ubuntumir/ubuntumir.pro 2013-07-23 19:01:25 +0000 |
449 | @@ -0,0 +1,16 @@ |
450 | +TEMPLATE = subdirs |
451 | + |
452 | +mirclient|mirserver{ |
453 | +SUBDIRS += ubuntumircommon |
454 | +} |
455 | + |
456 | +mirclient { |
457 | +SUBDIRS += ubuntumirclient |
458 | +} |
459 | +mirserver { |
460 | +SUBDIRS += ubuntumirserver |
461 | +} |
462 | + |
463 | +ubuntumirclient.depends = ubuntumircommon |
464 | +ubuntumirserver.depends = ubuntumircommon |
465 | + |
466 | |
467 | === added directory 'src/platforms/ubuntu/ubuntumir/ubuntumirclient' |
468 | === added file 'src/platforms/ubuntu/ubuntumir/ubuntumirclient/main.cc' |
469 | --- src/platforms/ubuntu/ubuntumir/ubuntumirclient/main.cc 1970-01-01 00:00:00 +0000 |
470 | +++ src/platforms/ubuntu/ubuntumir/ubuntumirclient/main.cc 2013-07-23 19:01:25 +0000 |
471 | @@ -0,0 +1,47 @@ |
472 | +// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
473 | +// Copyright © 2013 Canonical Ltd. |
474 | +// |
475 | +// This program is free software: you can redistribute it and/or modify it under |
476 | +// the terms of the GNU Lesser General Public License version 3, as published by |
477 | +// the Free Software Foundation. |
478 | +// |
479 | +// This program is distributed in the hope that it will be useful, but WITHOUT |
480 | +// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
481 | +// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
482 | +// Lesser General Public License for more details. |
483 | +// |
484 | +// You should have received a copy of the GNU Lesser General Public License |
485 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
486 | + |
487 | +#include <qpa/qplatformintegrationplugin.h> |
488 | +#include "ubuntumircommon/integration.h" |
489 | + |
490 | +QT_BEGIN_NAMESPACE |
491 | + |
492 | +class QUbuntuMirClientIntegrationPlugin : public QPlatformIntegrationPlugin { |
493 | + Q_OBJECT |
494 | + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.1" |
495 | + FILE "ubuntumirclient.json") |
496 | + |
497 | + public: |
498 | + QStringList keys() const; |
499 | + QPlatformIntegration* create(const QString&, const QStringList&); |
500 | +}; |
501 | + |
502 | +QStringList QUbuntuMirClientIntegrationPlugin::keys() const { |
503 | + QStringList list; |
504 | + list << "ubuntumirclient"; |
505 | + return list; |
506 | +} |
507 | + |
508 | +QPlatformIntegration* QUbuntuMirClientIntegrationPlugin::create( |
509 | + const QString& system, const QStringList& paramList) { |
510 | + Q_UNUSED(paramList); |
511 | + if (system.toLower() == "ubuntumirclient") |
512 | + return new QUbuntuMirIntegration(); |
513 | + return 0; |
514 | +} |
515 | + |
516 | +QT_END_NAMESPACE |
517 | + |
518 | +#include "main.moc" |
519 | |
520 | === added file 'src/platforms/ubuntu/ubuntumir/ubuntumirclient/ubuntumirclient.json' |
521 | --- src/platforms/ubuntu/ubuntumir/ubuntumirclient/ubuntumirclient.json 1970-01-01 00:00:00 +0000 |
522 | +++ src/platforms/ubuntu/ubuntumir/ubuntumirclient/ubuntumirclient.json 2013-07-23 19:01:25 +0000 |
523 | @@ -0,0 +1,3 @@ |
524 | +{ |
525 | + "Keys": [ "ubuntumirclient" ] |
526 | +} |
527 | |
528 | === added file 'src/platforms/ubuntu/ubuntumir/ubuntumirclient/ubuntumirclient.pro' |
529 | --- src/platforms/ubuntu/ubuntumir/ubuntumirclient/ubuntumirclient.pro 1970-01-01 00:00:00 +0000 |
530 | +++ src/platforms/ubuntu/ubuntumir/ubuntumirclient/ubuntumirclient.pro 2013-07-23 19:01:25 +0000 |
531 | @@ -0,0 +1,24 @@ |
532 | +TARGET = qubuntumirclient |
533 | +TEMPLATE = lib |
534 | + |
535 | +QT += core-private gui-private platformsupport-private sensors-private |
536 | + |
537 | +DEFINES += MESA_EGL_NO_X11_HEADERS |
538 | +QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden |
539 | +QMAKE_LFLAGS += -Wl,-no-undefined |
540 | + |
541 | +CONFIG(debug) { |
542 | + QMAKE_CXXFLAGS_DEBUG += -Werror |
543 | +} |
544 | + |
545 | +SOURCES = main.cc |
546 | + |
547 | +CONFIG += plugin link_prl |
548 | + |
549 | +INCLUDEPATH += ../../../ ../../ ../ |
550 | +LIBS += -Wl,--whole-archive -L../../../base -lubuntubase -L../../ubuntucommon -lqubuntucommon -L../ubuntumircommon -lqubuntumircommon -Wl,--no-whole-archive -lubuntu_application_api_mirclient |
551 | + |
552 | +OTHER_FILES += ubuntumirclient.json |
553 | + |
554 | +target.path += $$[QT_INSTALL_PLUGINS]/platforms |
555 | +INSTALLS += target |
556 | |
557 | === added directory 'src/platforms/ubuntu/ubuntumir/ubuntumircommon' |
558 | === added file 'src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.cc' |
559 | --- src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.cc 1970-01-01 00:00:00 +0000 |
560 | +++ src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.cc 2013-07-23 19:01:25 +0000 |
561 | @@ -0,0 +1,180 @@ |
562 | +// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
563 | +// Copyright © 2013 Canonical Ltd. |
564 | +// |
565 | +// This program is free software: you can redistribute it and/or modify it under |
566 | +// the terms of the GNU Lesser General Public License version 3, as published by |
567 | +// the Free Software Foundation. |
568 | +// |
569 | +// This program is distributed in the hope that it will be useful, but WITHOUT |
570 | +// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
571 | +// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
572 | +// Lesser General Public License for more details. |
573 | +// |
574 | +// You should have received a copy of the GNU Lesser General Public License |
575 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
576 | + |
577 | +#include "input.h" |
578 | +#include "integration.h" |
579 | +#include "base/logging.h" |
580 | + |
581 | +#include <QtCore/qglobal.h> |
582 | +#include <QtCore/QCoreApplication> |
583 | +#include <private/qguiapplication_p.h> |
584 | +#include <qpa/qplatforminputcontext.h> |
585 | +#include <qpa/qwindowsysteminterface.h> |
586 | + |
587 | +#include <xkbcommon/xkbcommon.h> |
588 | +#include <xkbcommon/xkbcommon-keysyms.h> |
589 | + |
590 | +#include <ubuntu/application/ui/input/event.h> |
591 | + |
592 | +// XKB Keysyms which do not map directly to Qt types (i.e. Unicode points) |
593 | +static const uint32_t KeyTable[] = { |
594 | + XKB_KEY_Escape, Qt::Key_Escape, |
595 | + XKB_KEY_Tab, Qt::Key_Tab, |
596 | + XKB_KEY_ISO_Left_Tab, Qt::Key_Backtab, |
597 | + XKB_KEY_BackSpace, Qt::Key_Backspace, |
598 | + XKB_KEY_Return, Qt::Key_Return, |
599 | + XKB_KEY_Insert, Qt::Key_Insert, |
600 | + XKB_KEY_Delete, Qt::Key_Delete, |
601 | + XKB_KEY_Clear, Qt::Key_Delete, |
602 | + XKB_KEY_Pause, Qt::Key_Pause, |
603 | + XKB_KEY_Print, Qt::Key_Print, |
604 | + |
605 | + XKB_KEY_Home, Qt::Key_Home, |
606 | + XKB_KEY_End, Qt::Key_End, |
607 | + XKB_KEY_Left, Qt::Key_Left, |
608 | + XKB_KEY_Up, Qt::Key_Up, |
609 | + XKB_KEY_Right, Qt::Key_Right, |
610 | + XKB_KEY_Down, Qt::Key_Down, |
611 | + XKB_KEY_Prior, Qt::Key_PageUp, |
612 | + XKB_KEY_Next, Qt::Key_PageDown, |
613 | + |
614 | + XKB_KEY_Shift_L, Qt::Key_Shift, |
615 | + XKB_KEY_Shift_R, Qt::Key_Shift, |
616 | + XKB_KEY_Shift_Lock, Qt::Key_Shift, |
617 | + XKB_KEY_Control_L, Qt::Key_Control, |
618 | + XKB_KEY_Control_R, Qt::Key_Control, |
619 | + XKB_KEY_Meta_L, Qt::Key_Meta, |
620 | + XKB_KEY_Meta_R, Qt::Key_Meta, |
621 | + XKB_KEY_Alt_L, Qt::Key_Alt, |
622 | + XKB_KEY_Alt_R, Qt::Key_Alt, |
623 | + XKB_KEY_Caps_Lock, Qt::Key_CapsLock, |
624 | + XKB_KEY_Num_Lock, Qt::Key_NumLock, |
625 | + XKB_KEY_Scroll_Lock, Qt::Key_ScrollLock, |
626 | + XKB_KEY_Super_L, Qt::Key_Super_L, |
627 | + XKB_KEY_Super_R, Qt::Key_Super_R, |
628 | + XKB_KEY_Menu, Qt::Key_Menu, |
629 | + XKB_KEY_Hyper_L, Qt::Key_Hyper_L, |
630 | + XKB_KEY_Hyper_R, Qt::Key_Hyper_R, |
631 | + XKB_KEY_Help, Qt::Key_Help, |
632 | + |
633 | + XKB_KEY_KP_Space, Qt::Key_Space, |
634 | + XKB_KEY_KP_Tab, Qt::Key_Tab, |
635 | + XKB_KEY_KP_Enter, Qt::Key_Enter, |
636 | + XKB_KEY_KP_Home, Qt::Key_Home, |
637 | + XKB_KEY_KP_Left, Qt::Key_Left, |
638 | + XKB_KEY_KP_Up, Qt::Key_Up, |
639 | + XKB_KEY_KP_Right, Qt::Key_Right, |
640 | + XKB_KEY_KP_Down, Qt::Key_Down, |
641 | + XKB_KEY_KP_Prior, Qt::Key_PageUp, |
642 | + XKB_KEY_KP_Next, Qt::Key_PageDown, |
643 | + XKB_KEY_KP_End, Qt::Key_End, |
644 | + XKB_KEY_KP_Begin, Qt::Key_Clear, |
645 | + XKB_KEY_KP_Insert, Qt::Key_Insert, |
646 | + XKB_KEY_KP_Delete, Qt::Key_Delete, |
647 | + XKB_KEY_KP_Equal, Qt::Key_Equal, |
648 | + XKB_KEY_KP_Multiply, Qt::Key_Asterisk, |
649 | + XKB_KEY_KP_Add, Qt::Key_Plus, |
650 | + XKB_KEY_KP_Separator, Qt::Key_Comma, |
651 | + XKB_KEY_KP_Subtract, Qt::Key_Minus, |
652 | + XKB_KEY_KP_Decimal, Qt::Key_Period, |
653 | + XKB_KEY_KP_Divide, Qt::Key_Slash, |
654 | + |
655 | + XKB_KEY_ISO_Level3_Shift, Qt::Key_AltGr, |
656 | + XKB_KEY_Multi_key, Qt::Key_Multi_key, |
657 | + XKB_KEY_Codeinput, Qt::Key_Codeinput, |
658 | + XKB_KEY_SingleCandidate, Qt::Key_SingleCandidate, |
659 | + XKB_KEY_MultipleCandidate, Qt::Key_MultipleCandidate, |
660 | + XKB_KEY_PreviousCandidate, Qt::Key_PreviousCandidate, |
661 | + |
662 | + XKB_KEY_Mode_switch, Qt::Key_Mode_switch, |
663 | + XKB_KEY_script_switch, Qt::Key_Mode_switch, |
664 | + |
665 | + 0, 0 |
666 | +}; |
667 | + |
668 | +QUbuntuMirInput::QUbuntuMirInput(QUbuntuIntegration* integration) |
669 | + : QUbuntuInput(integration) { |
670 | +} |
671 | + |
672 | +QUbuntuMirInput::~QUbuntuMirInput() { |
673 | +} |
674 | + |
675 | +static uint32_t translateKeysym(uint32_t sym, char *string, size_t size) { |
676 | + Q_UNUSED(size); |
677 | + string[0] = '\0'; |
678 | + |
679 | + if (sym >= XKB_KEY_F1 && sym <= XKB_KEY_F35) |
680 | + return Qt::Key_F1 + (int(sym) - XKB_KEY_F1); |
681 | + |
682 | + for (int i = 0; KeyTable[i]; i += 2) |
683 | + if (sym == KeyTable[i]) |
684 | + return KeyTable[i + 1]; |
685 | + |
686 | + string[0] = sym; |
687 | + string[1] = '\0'; |
688 | + return toupper(sym); |
689 | +} |
690 | + |
691 | +void QUbuntuMirInput::dispatchKeyEvent(QWindow* window, const void* ev) { |
692 | + DLOG("QUbuntuBaseInput::dispatchKeyEvent (this=%p, window=%p, event=%p)", this, window, ev); |
693 | + const Event* event = reinterpret_cast<const Event*>(ev); |
694 | + |
695 | +#if (LOG_EVENTS != 0) |
696 | + // Key event logging. |
697 | + LOG("KEY device_id:%d source_id:%d action:%d flags:%d meta_state:%d key_code:%d " |
698 | + "scan_code:%d repeat_count:%d down_time:%lld event_time:%lld is_system_key:%d", |
699 | + event->device_id, event->source_id, event->action, event->flags, event->meta_state, |
700 | + event->details.key.key_code, event->details.key.scan_code, |
701 | + event->details.key.repeat_count, event->details.key.down_time, |
702 | + event->details.key.event_time, event->details.key.is_system_key); |
703 | +#endif |
704 | + |
705 | + ulong timestamp = event->details.key.event_time / 1000000; |
706 | + xkb_keysym_t xk_sym = (xkb_keysym_t)event->details.key.key_code; |
707 | + |
708 | + // Key modifier and unicode index mapping. |
709 | + const int kMetaState = event->meta_state; |
710 | + Qt::KeyboardModifiers modifiers = Qt::NoModifier; |
711 | + if (kMetaState & U_KEY_MODIFIER_SHIFT) { |
712 | + modifiers |= Qt::ShiftModifier; |
713 | + } |
714 | + if (kMetaState & U_KEY_MODIFIER_CTRL) { |
715 | + modifiers |= Qt::ControlModifier; |
716 | + } |
717 | + if (kMetaState & U_KEY_MODIFIER_ALT) { |
718 | + modifiers |= Qt::AltModifier; |
719 | + } |
720 | + if (kMetaState & U_KEY_MODIFIER_META) { |
721 | + modifiers |= Qt::MetaModifier; |
722 | + } |
723 | + |
724 | + QEvent::Type keyType = event->action == U_KEY_ACTION_DOWN ? QEvent::KeyPress : QEvent::KeyRelease; |
725 | + |
726 | + char s[2]; |
727 | + int sym = translateKeysym(xk_sym, s, sizeof(s)); |
728 | + QString text = QString::fromLatin1(s); |
729 | + |
730 | + QPlatformInputContext* context = QGuiApplicationPrivate::platformIntegration()->inputContext(); |
731 | + if (context) { |
732 | + QKeyEvent qKeyEvent(keyType, sym, modifiers, text); |
733 | + qKeyEvent.setTimestamp(timestamp); |
734 | + if (context->filterEvent(&qKeyEvent)) { |
735 | + DLOG("key event filtered out by input context"); |
736 | + return; |
737 | + } |
738 | + } |
739 | + |
740 | + handleKeyEvent(window, timestamp, keyType, sym, modifiers, text); |
741 | +} |
742 | |
743 | === added file 'src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.h' |
744 | --- src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.h 1970-01-01 00:00:00 +0000 |
745 | +++ src/platforms/ubuntu/ubuntumir/ubuntumircommon/input.h 2013-07-23 19:01:25 +0000 |
746 | @@ -0,0 +1,31 @@ |
747 | +// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
748 | +// Copyright © 2013 Canonical Ltd. |
749 | +// |
750 | +// This program is free software: you can redistribute it and/or modify it under |
751 | +// the terms of the GNU Lesser General Public License version 3, as published by |
752 | +// the Free Software Foundation. |
753 | +// |
754 | +// This program is distributed in the hope that it will be useful, but WITHOUT |
755 | +// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
756 | +// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
757 | +// Lesser General Public License for more details. |
758 | +// |
759 | +// You should have received a copy of the GNU Lesser General Public License |
760 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
761 | + |
762 | +#ifndef QUBUNTU_MIR_INPUT_H |
763 | +#define QUBUNTU_MIR_INPUT_H |
764 | + |
765 | +#include "ubuntucommon/input.h" |
766 | + |
767 | +class QUbuntuIntegration; |
768 | + |
769 | +class QUbuntuMirInput : public QUbuntuInput { |
770 | +public: |
771 | + QUbuntuMirInput(QUbuntuIntegration* integration); |
772 | + ~QUbuntuMirInput(); |
773 | + |
774 | + virtual void dispatchKeyEvent(QWindow* window, const void* event); |
775 | +}; |
776 | + |
777 | +#endif // QUBUNTU_MIR_INPUT_H |
778 | |
779 | === added file 'src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.cc' |
780 | --- src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.cc 1970-01-01 00:00:00 +0000 |
781 | +++ src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.cc 2013-07-23 19:01:25 +0000 |
782 | @@ -0,0 +1,43 @@ |
783 | +// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
784 | +// Copyright © 2013 Canonical Ltd. |
785 | +// |
786 | +// This program is free software: you can redistribute it and/or modify it under |
787 | +// the terms of the GNU Lesser General Public License version 3, as published by |
788 | +// the Free Software Foundation. |
789 | +// |
790 | +// This program is distributed in the hope that it will be useful, but WITHOUT |
791 | +// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
792 | +// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
793 | +// Lesser General Public License for more details. |
794 | +// |
795 | +// You should have received a copy of the GNU Lesser General Public License |
796 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
797 | + |
798 | +#include "input.h" |
799 | +#include "integration.h" |
800 | +#include "ubuntucommon/input_adaptor_factory.h" |
801 | + |
802 | +namespace |
803 | +{ |
804 | +struct InputAdaptorFactory : public QUbuntuInputAdaptorFactory { |
805 | + InputAdaptorFactory() {} |
806 | + ~InputAdaptorFactory() {} |
807 | + |
808 | + QUbuntuInput *create_input_adaptor(QUbuntuIntegration* integration) |
809 | + { |
810 | + return new QUbuntuMirInput(integration); |
811 | + } |
812 | + static InputAdaptorFactory* instance() |
813 | + { |
814 | + static InputAdaptorFactory global_instance; |
815 | + return &global_instance; |
816 | + } |
817 | +}; |
818 | +} |
819 | + |
820 | +QUbuntuMirIntegration::QUbuntuMirIntegration() |
821 | + : QUbuntuIntegration(InputAdaptorFactory::instance()) { |
822 | +} |
823 | + |
824 | +QUbuntuMirIntegration::~QUbuntuMirIntegration() { |
825 | +} |
826 | |
827 | === added file 'src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.h' |
828 | --- src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.h 1970-01-01 00:00:00 +0000 |
829 | +++ src/platforms/ubuntu/ubuntumir/ubuntumircommon/integration.h 2013-07-23 19:01:25 +0000 |
830 | @@ -0,0 +1,27 @@ |
831 | +// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
832 | +// Copyright © 2013 Canonical Ltd. |
833 | +// |
834 | +// This program is free software: you can redistribute it and/or modify it under |
835 | +// the terms of the GNU Lesser General Public License version 3, as published by |
836 | +// the Free Software Foundation. |
837 | +// |
838 | +// This program is distributed in the hope that it will be useful, but WITHOUT |
839 | +// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
840 | +// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
841 | +// Lesser General Public License for more details. |
842 | +// |
843 | +// You should have received a copy of the GNU Lesser General Public License |
844 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
845 | + |
846 | +#ifndef QUBUNTU_MIR_INTEGRATION_H |
847 | +#define QUBUNTU_MIR_INTEGRATION_H |
848 | + |
849 | +#include "ubuntucommon/integration.h" |
850 | + |
851 | +class QUbuntuMirIntegration : public QUbuntuIntegration { |
852 | +public: |
853 | + QUbuntuMirIntegration(); |
854 | + ~QUbuntuMirIntegration(); |
855 | +}; |
856 | + |
857 | +#endif // QUBUNTU_MIR_INTEGRATION_H |
858 | |
859 | === added file 'src/platforms/ubuntu/ubuntumir/ubuntumircommon/ubuntumircommon.pro' |
860 | --- src/platforms/ubuntu/ubuntumir/ubuntumircommon/ubuntumircommon.pro 1970-01-01 00:00:00 +0000 |
861 | +++ src/platforms/ubuntu/ubuntumir/ubuntumircommon/ubuntumircommon.pro 2013-07-23 19:01:25 +0000 |
862 | @@ -0,0 +1,21 @@ |
863 | +TARGET = qubuntumircommon |
864 | +TEMPLATE = lib |
865 | + |
866 | +QT += core-private gui-private platformsupport-private sensors-private |
867 | + |
868 | +DEFINES += MESA_EGL_NO_X11_HEADERS |
869 | +QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden |
870 | +QMAKE_LFLAGS += -Wl,-no-undefined -L../ubuntucommon |
871 | + |
872 | +CONFIG(debug) { |
873 | + QMAKE_CXXFLAGS_DEBUG += -Werror |
874 | +} |
875 | + |
876 | +SOURCES = input.cc integration.cc |
877 | + |
878 | +HEADERS = input.h integration.h |
879 | + |
880 | +CONFIG += static plugin create_prl link_prl |
881 | + |
882 | +INCLUDEPATH += ../../../ ../../ |
883 | +LIBS += -Wl,--whole-archive -lqubuntucommon -Wl,--no-whole-archive |
884 | |
885 | === added directory 'src/platforms/ubuntu/ubuntumir/ubuntumirserver' |
886 | === added file 'src/platforms/ubuntu/ubuntumir/ubuntumirserver/main.cc' |
887 | --- src/platforms/ubuntu/ubuntumir/ubuntumirserver/main.cc 1970-01-01 00:00:00 +0000 |
888 | +++ src/platforms/ubuntu/ubuntumir/ubuntumirserver/main.cc 2013-07-23 19:01:25 +0000 |
889 | @@ -0,0 +1,47 @@ |
890 | +// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
891 | +// Copyright © 2013 Canonical Ltd. |
892 | +// |
893 | +// This program is free software: you can redistribute it and/or modify it under |
894 | +// the terms of the GNU Lesser General Public License version 3, as published by |
895 | +// the Free Software Foundation. |
896 | +// |
897 | +// This program is distributed in the hope that it will be useful, but WITHOUT |
898 | +// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
899 | +// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
900 | +// Lesser General Public License for more details. |
901 | +// |
902 | +// You should have received a copy of the GNU Lesser General Public License |
903 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
904 | + |
905 | +#include <qpa/qplatformintegrationplugin.h> |
906 | +#include "ubuntumircommon/integration.h" |
907 | + |
908 | +QT_BEGIN_NAMESPACE |
909 | + |
910 | +class QUbuntuMirServerIntegrationPlugin : public QPlatformIntegrationPlugin { |
911 | + Q_OBJECT |
912 | + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.1" |
913 | + FILE "ubuntumirserver.json") |
914 | + |
915 | + public: |
916 | + QStringList keys() const; |
917 | + QPlatformIntegration* create(const QString&, const QStringList&); |
918 | +}; |
919 | + |
920 | +QStringList QUbuntuMirServerIntegrationPlugin::keys() const { |
921 | + QStringList list; |
922 | + list << "ubuntumirserver"; |
923 | + return list; |
924 | +} |
925 | + |
926 | +QPlatformIntegration* QUbuntuMirServerIntegrationPlugin::create( |
927 | + const QString& system, const QStringList& paramList) { |
928 | + Q_UNUSED(paramList); |
929 | + if (system.toLower() == "ubuntumirserver") |
930 | + return new QUbuntuMirIntegration(); |
931 | + return 0; |
932 | +} |
933 | + |
934 | +QT_END_NAMESPACE |
935 | + |
936 | +#include "main.moc" |
937 | |
938 | === added file 'src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.json' |
939 | --- src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.json 1970-01-01 00:00:00 +0000 |
940 | +++ src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.json 2013-07-23 19:01:25 +0000 |
941 | @@ -0,0 +1,3 @@ |
942 | +{ |
943 | + "Keys": [ "ubuntumirserver" ] |
944 | +} |
945 | |
946 | === added file 'src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.pro' |
947 | --- src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.pro 1970-01-01 00:00:00 +0000 |
948 | +++ src/platforms/ubuntu/ubuntumir/ubuntumirserver/ubuntumirserver.pro 2013-07-23 19:01:25 +0000 |
949 | @@ -0,0 +1,24 @@ |
950 | +TARGET = qubuntumirserver |
951 | +TEMPLATE = lib |
952 | + |
953 | +QT += core-private gui-private platformsupport-private sensors-private |
954 | + |
955 | +DEFINES += MESA_EGL_NO_X11_HEADERS |
956 | +QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden |
957 | +QMAKE_LFLAGS += -Wl,-no-undefined |
958 | + |
959 | +CONFIG(debug) { |
960 | + QMAKE_CXXFLAGS_DEBUG += -Werror |
961 | +} |
962 | + |
963 | +SOURCES = main.cc |
964 | + |
965 | +CONFIG += plugin link_prl |
966 | + |
967 | +INCLUDEPATH += ../../../ ../../ ../ |
968 | +LIBS += -Wl,--whole-archive -L../../../base -lubuntubase -L../../ubuntucommon -lqubuntucommon -L../ubuntumircommon -lqubuntumircommon -Wl,--no-whole-archive -lubuntu_application_api_mirserver |
969 | + |
970 | +OTHER_FILES += ubuntu.json |
971 | + |
972 | +target.path += $$[QT_INSTALL_PLUGINS]/platforms |
973 | +INSTALLS += target |
Some notes: The key handling changes aren't worrisome for the phablet build as this is unused by the OSK. It's possible this could affect some autopilot tests that use synthetic evdev events. I heard there were some issues there anyway (old code couldn't for example map shift + : -> ;).
Mir emits xkbcommon keysyms (or rather maps in the client library).
Around 1199 Ive commented out this session_properties stuff because I wasn't able to find out what it was supposed to do to make a mirserver implementation.
Around 562 am working around a strange mesa bug on mir/radeon :( Will try and figure it out soon but just confirmed it is still needed.
QEGLConvenience.cpp is needed to build on desktop.
I think the context creation bits may need some work as even on desktop I get GLES when my desktop Qt isn't built for it (and so some QML bits end up not working after creating invalid shaders). Things work well on phone!