Merge lp:~alan-griffiths/qtmir/spike-using-WindowManager into lp:qtmir
- spike-using-WindowManager
- Merge into trunk
Proposed by
Alan Griffiths
Status: | Superseded |
---|---|
Proposed branch: | lp:~alan-griffiths/qtmir/spike-using-WindowManager |
Merge into: | lp:qtmir |
Prerequisite: | lp:~mir-team/qtmir/compatibility-with-mir-API-changes |
Diff against target: |
1248 lines (+288/-271) 23 files modified
src/common/debughelpers.cpp (+4/-4) src/modules/Unity/Application/application_manager.cpp (+2/-2) src/modules/Unity/Application/application_manager.h (+1/-1) src/modules/Unity/Application/mirsurfaceitem.cpp (+25/-25) src/modules/Unity/Application/mirsurfaceitem.h (+4/-3) src/modules/Unity/Application/mirsurfacemanager.cpp (+8/-9) src/modules/Unity/Application/mirsurfacemanager.h (+5/-5) src/modules/Unity/Application/sessionmanager.cpp (+0/-1) src/platforms/mirserver/CMakeLists.txt (+1/-1) src/platforms/mirserver/mirserver.cpp (+32/-50) src/platforms/mirserver/mirserver.h (+8/-7) src/platforms/mirserver/mirserverintegration.cpp (+8/-4) src/platforms/mirserver/mirwindowmanager.cpp (+69/-36) src/platforms/mirserver/mirwindowmanager.h (+31/-14) src/platforms/mirserver/nativeinterface.cpp (+7/-2) src/platforms/mirserver/nativeinterface.h (+1/-1) src/platforms/mirserver/qteventfeeder.cpp (+33/-33) src/platforms/mirserver/surfaceobserver.h (+2/-1) tests/mirserver/QtEventFeeder/qteventfeeder_test.cpp (+20/-52) tests/modules/MirSurfaceItem/mirsurfaceitem_test.cpp (+17/-17) tests/modules/common/mock_mir_session.h (+4/-0) tests/modules/common/mock_surface.h (+5/-1) tests/modules/common/qtmir_test.h (+1/-2) |
To merge this branch: | bzr merge lp:~alan-griffiths/qtmir/spike-using-WindowManager |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Mir development team | Pending | ||
Review via email: mp+254235@code.launchpad.net |
This proposal has been superseded by a proposal from 2015-04-01.
Commit message
Switch from subclassing mir::shell:
Description of the change
Switch from subclassing mir::shell:
Note this is proof-of-concept branch and I've yet to rebuild the stack and test it out.
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Needs Fixing
(continuous-integration)
- 276. By Daniel van Vugt
-
Migrate to MirEvent 2.1 API, coming in Mir 0.13
- 277. By Daniel van Vugt
-
Update mock headers so they can build again, following racarr's
cursor BufferStream changes. - 278. By Daniel van Vugt
- 279. By Alan Griffiths
-
Mir 0.13.0 fixes
- 280. By Alan Griffiths
-
Workaround API that uses references to opaque types
- 281. By Alan Griffiths
-
libmircommon-dev dependency should be versioned
- 282. By Alan Griffiths
- 283. By Alan Griffiths
-
Very basic version of MirWindowManage
r::modify_ surface( )
Unmerged revisions
- 283. By Alan Griffiths
-
Very basic version of MirWindowManage
r::modify_ surface( ) - 282. By Alan Griffiths
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/common/debughelpers.cpp' |
2 | --- src/common/debughelpers.cpp 2015-02-19 23:03:14 +0000 |
3 | +++ src/common/debughelpers.cpp 2015-04-01 13:16:10 +0000 |
4 | @@ -176,14 +176,14 @@ |
5 | } |
6 | } |
7 | |
8 | -const char *mirTouchActionToStr(MirTouchInputEventTouchAction action) |
9 | +const char *mirTouchActionToStr(MirTouchAction action) |
10 | { |
11 | switch (action) { |
12 | - case mir_touch_input_event_action_up: |
13 | + case mir_touch_action_up: |
14 | return "up"; |
15 | - case mir_touch_input_event_action_down: |
16 | + case mir_touch_action_down: |
17 | return "down"; |
18 | - case mir_touch_input_event_action_change: |
19 | + case mir_touch_action_change: |
20 | return "change"; |
21 | default: |
22 | return "???"; |
23 | |
24 | === modified file 'src/modules/Unity/Application/application_manager.cpp' |
25 | --- src/modules/Unity/Application/application_manager.cpp 2015-04-01 13:16:09 +0000 |
26 | +++ src/modules/Unity/Application/application_manager.cpp 2015-04-01 13:16:10 +0000 |
27 | @@ -70,9 +70,9 @@ |
28 | //TODO: should use mir::graphics::Display::configuration |
29 | mir::geometry::Rectangles view_area; |
30 | mirServer->the_display()->for_each_display_sync_group( |
31 | - [&view_area](mir::graphics::DisplaySyncGroup& group) { |
32 | + [&view_area](mir::graphics::DisplaySyncGroup &group) { |
33 | group.for_each_display_buffer( |
34 | - [&view_area](const mir::graphics::DisplayBuffer & db) { |
35 | + [&view_area](const mir::graphics::DisplayBuffer &db) { |
36 | view_area.add(db.view_area()); |
37 | }); |
38 | }); |
39 | |
40 | === modified file 'src/modules/Unity/Application/application_manager.h' |
41 | --- src/modules/Unity/Application/application_manager.h 2015-01-09 11:23:34 +0000 |
42 | +++ src/modules/Unity/Application/application_manager.h 2015-04-01 13:16:10 +0000 |
43 | @@ -151,7 +151,7 @@ |
44 | |
45 | Application* findApplicationWithPromptSession(const mir::scene::PromptSession* promptSession); |
46 | |
47 | - QSharedPointer<MirServer> m_mirServer; |
48 | + const QSharedPointer<MirServer> m_mirServer; |
49 | |
50 | QList<Application*> m_applications; |
51 | Application* m_focusedApplication; |
52 | |
53 | === modified file 'src/modules/Unity/Application/mirsurfaceitem.cpp' |
54 | --- src/modules/Unity/Application/mirsurfaceitem.cpp 2015-03-18 10:12:03 +0000 |
55 | +++ src/modules/Unity/Application/mirsurfaceitem.cpp 2015-04-01 13:16:10 +0000 |
56 | @@ -23,7 +23,6 @@ |
57 | #include "mirbuffersgtexture.h" |
58 | #include "session.h" |
59 | #include "mirsurfaceitem.h" |
60 | -#include "mirshell.h" |
61 | #include "logging.h" |
62 | #include "ubuntukeyboardinfo.h" |
63 | |
64 | @@ -46,6 +45,7 @@ |
65 | // Mir |
66 | #include <mir/geometry/rectangle.h> |
67 | #include <mir/events/event_builders.h> |
68 | +#include <mir/shell/shell.h> |
69 | #include <mir_toolkit/event.h> |
70 | |
71 | namespace mg = mir::graphics; |
72 | @@ -71,28 +71,28 @@ |
73 | return m_mods; |
74 | } |
75 | |
76 | -mir::EventUPtr makeMirEvent(QMouseEvent *qtEvent, MirPointerInputEventAction action) |
77 | +mir::EventUPtr makeMirEvent(QMouseEvent *qtEvent, MirPointerAction action) |
78 | { |
79 | auto timestamp = qtEvent->timestamp() * 1000000; |
80 | auto modifiers = getMirModifiersFromQt(qtEvent->modifiers()); |
81 | |
82 | - std::vector<MirPointerInputEventButton> buttons; |
83 | + std::vector<MirPointerButton> buttons; |
84 | if (qtEvent->buttons() & Qt::LeftButton) |
85 | - buttons.push_back(mir_pointer_input_button_primary); |
86 | + buttons.push_back(mir_pointer_button_primary); |
87 | if (qtEvent->buttons() & Qt::RightButton) |
88 | - buttons.push_back(mir_pointer_input_button_secondary); |
89 | + buttons.push_back(mir_pointer_button_secondary); |
90 | if (qtEvent->buttons() & Qt::MidButton) |
91 | - buttons.push_back(mir_pointer_input_button_tertiary); |
92 | + buttons.push_back(mir_pointer_button_tertiary); |
93 | |
94 | return mir::events::make_event(0 /*DeviceID */, timestamp, modifiers, action, |
95 | buttons, qtEvent->x(), qtEvent->y(), 0, 0); |
96 | } |
97 | |
98 | -mir::EventUPtr makeMirEvent(QHoverEvent *qtEvent, MirPointerInputEventAction action) |
99 | +mir::EventUPtr makeMirEvent(QHoverEvent *qtEvent, MirPointerAction action) |
100 | { |
101 | auto timestamp = qtEvent->timestamp() * 1000000; |
102 | |
103 | - std::vector<MirPointerInputEventButton> buttons; |
104 | + std::vector<MirPointerButton> buttons; |
105 | |
106 | return mir::events::make_event(0 /*DeviceID */, timestamp, mir_input_event_modifier_none, action, |
107 | buttons, qtEvent->posF().x(), qtEvent->posF().y(), 0, 0); |
108 | @@ -100,20 +100,20 @@ |
109 | |
110 | mir::EventUPtr makeMirEvent(QKeyEvent *qtEvent) |
111 | { |
112 | - MirKeyInputEventAction action = mir_key_input_event_action_down; |
113 | + MirKeyboardAction action = mir_keyboard_action_down; |
114 | switch (qtEvent->type()) |
115 | { |
116 | case QEvent::KeyPress: |
117 | - action = mir_key_input_event_action_down; |
118 | + action = mir_keyboard_action_down; |
119 | break; |
120 | case QEvent::KeyRelease: |
121 | - action = mir_key_input_event_action_up; |
122 | + action = mir_keyboard_action_up; |
123 | break; |
124 | default: |
125 | break; |
126 | } |
127 | if (qtEvent->isAutoRepeat()) |
128 | - action = mir_key_input_event_action_repeat; |
129 | + action = mir_keyboard_action_repeat; |
130 | |
131 | return mir::events::make_event(0 /* DeviceID */, qtEvent->timestamp() * 1000000, |
132 | action, qtEvent->nativeVirtualKey(), |
133 | @@ -134,19 +134,19 @@ |
134 | auto touchPoint = qtTouchPoints.at(i); |
135 | auto id = touchPoint.id(); |
136 | |
137 | - MirTouchInputEventTouchAction action = mir_touch_input_event_action_change; |
138 | + MirTouchAction action = mir_touch_action_change; |
139 | if (touchPoint.state() == Qt::TouchPointReleased) |
140 | { |
141 | - action = mir_touch_input_event_action_up; |
142 | + action = mir_touch_action_up; |
143 | } |
144 | if (touchPoint.state() == Qt::TouchPointPressed) |
145 | { |
146 | - action = mir_touch_input_event_action_down; |
147 | + action = mir_touch_action_down; |
148 | } |
149 | |
150 | - MirTouchInputEventTouchTooltype tooltype = mir_touch_input_tool_type_finger; |
151 | + MirTouchTooltype tooltype = mir_touch_tooltype_finger; |
152 | if (touchPoint.flags() & QTouchEvent::TouchPoint::Pen) |
153 | - tooltype = mir_touch_input_tool_type_stylus; |
154 | + tooltype = mir_touch_tooltype_stylus; |
155 | |
156 | mir::events::add_touch(*ev, id, action, tooltype, |
157 | touchPoint.pos().x(), touchPoint.pos().y(), |
158 | @@ -187,7 +187,7 @@ |
159 | |
160 | MirSurfaceItem::MirSurfaceItem(std::shared_ptr<mir::scene::Surface> surface, |
161 | SessionInterface* session, |
162 | - MirShell *shell, |
163 | + mir::shell::Shell *shell, |
164 | std::shared_ptr<SurfaceObserver> observer, |
165 | QQuickItem *parent) |
166 | : QQuickItem(parent) |
167 | @@ -465,14 +465,14 @@ |
168 | if (type() == InputMethod) { |
169 | // FIXME: Hack to get the VKB use case working while we don't have the proper solution in place. |
170 | if (isMouseInsideUbuntuKeyboard(event)) { |
171 | - auto ev = makeMirEvent(event, mir_pointer_input_event_action_button_down); |
172 | + auto ev = makeMirEvent(event, mir_pointer_action_button_down); |
173 | m_surface->consume(*ev); |
174 | event->accept(); |
175 | } else { |
176 | event->ignore(); |
177 | } |
178 | } else { |
179 | - auto ev = makeMirEvent(event, mir_pointer_input_event_action_button_down); |
180 | + auto ev = makeMirEvent(event, mir_pointer_action_button_down); |
181 | m_surface->consume(*ev); |
182 | event->accept(); |
183 | } |
184 | @@ -480,14 +480,14 @@ |
185 | |
186 | void MirSurfaceItem::mouseMoveEvent(QMouseEvent *event) |
187 | { |
188 | - auto ev = makeMirEvent(event, mir_pointer_input_event_action_motion); |
189 | + auto ev = makeMirEvent(event, mir_pointer_action_motion); |
190 | m_surface->consume(*ev); |
191 | event->accept(); |
192 | } |
193 | |
194 | void MirSurfaceItem::mouseReleaseEvent(QMouseEvent *event) |
195 | { |
196 | - auto ev = makeMirEvent(event, mir_pointer_input_event_action_button_up); |
197 | + auto ev = makeMirEvent(event, mir_pointer_action_button_up); |
198 | m_surface->consume(*ev); |
199 | event->accept(); |
200 | } |
201 | @@ -499,21 +499,21 @@ |
202 | |
203 | void MirSurfaceItem::hoverEnterEvent(QHoverEvent *event) |
204 | { |
205 | - auto ev = makeMirEvent(event, mir_pointer_input_event_action_enter); |
206 | + auto ev = makeMirEvent(event, mir_pointer_action_enter); |
207 | m_surface->consume(*ev); |
208 | event->accept(); |
209 | } |
210 | |
211 | void MirSurfaceItem::hoverLeaveEvent(QHoverEvent *event) |
212 | { |
213 | - auto ev = makeMirEvent(event, mir_pointer_input_event_action_leave); |
214 | + auto ev = makeMirEvent(event, mir_pointer_action_leave); |
215 | m_surface->consume(*ev); |
216 | event->accept(); |
217 | } |
218 | |
219 | void MirSurfaceItem::hoverMoveEvent(QHoverEvent *event) |
220 | { |
221 | - auto ev = makeMirEvent(event, mir_pointer_input_event_action_motion); |
222 | + auto ev = makeMirEvent(event, mir_pointer_action_motion); |
223 | m_surface->consume(*ev); |
224 | event->accept(); |
225 | } |
226 | |
227 | === modified file 'src/modules/Unity/Application/mirsurfaceitem.h' |
228 | --- src/modules/Unity/Application/mirsurfaceitem.h 2015-02-20 15:52:17 +0000 |
229 | +++ src/modules/Unity/Application/mirsurfaceitem.h 2015-04-01 13:16:10 +0000 |
230 | @@ -33,8 +33,9 @@ |
231 | |
232 | #include "session_interface.h" |
233 | |
234 | +namespace mir { namespace shell { class Shell; } } |
235 | + |
236 | class SurfaceObserver; |
237 | -class MirShell; |
238 | |
239 | namespace qtmir { |
240 | |
241 | @@ -58,7 +59,7 @@ |
242 | public: |
243 | explicit MirSurfaceItem(std::shared_ptr<mir::scene::Surface> surface, |
244 | SessionInterface* session, |
245 | - MirShell *shell, |
246 | + mir::shell::Shell *shell, |
247 | std::shared_ptr<SurfaceObserver> observer, |
248 | QQuickItem *parent = 0); |
249 | ~MirSurfaceItem(); |
250 | @@ -179,7 +180,7 @@ |
251 | |
252 | std::shared_ptr<mir::scene::Surface> m_surface; |
253 | QPointer<SessionInterface> m_session; |
254 | - MirShell *const m_shell; |
255 | + mir::shell::Shell *const m_shell; |
256 | bool m_firstFrameDrawn; |
257 | bool m_live; |
258 | Qt::ScreenOrientation m_orientation; //FIXME - have to save the state as Mir has no getter for it (bug:1357429) |
259 | |
260 | === modified file 'src/modules/Unity/Application/mirsurfacemanager.cpp' |
261 | --- src/modules/Unity/Application/mirsurfacemanager.cpp 2015-02-06 09:47:21 +0000 |
262 | +++ src/modules/Unity/Application/mirsurfacemanager.cpp 2015-04-01 13:16:10 +0000 |
263 | @@ -31,7 +31,7 @@ |
264 | #include "nativeinterface.h" |
265 | #include "mirserver.h" |
266 | #include "sessionlistener.h" |
267 | -#include "mirshell.h" |
268 | +#include "mirwindowmanager.h" |
269 | #include "logging.h" |
270 | |
271 | Q_LOGGING_CATEGORY(QTMIR_SURFACES, "qtmir.surfaces") |
272 | @@ -51,9 +51,9 @@ |
273 | manager, &MirSurfaceManager::onSessionDestroyingSurface); |
274 | } |
275 | |
276 | -void connectToShell(MirSurfaceManager *manager, MirShell *shell) |
277 | +void connectToWindowManager(MirSurfaceManager *manager, MirWindowManager *windowManager) |
278 | { |
279 | - QObject::connect(shell, &MirShell::surfaceAttributeChanged, |
280 | + QObject::connect(windowManager, &MirWindowManager::surfaceAttributeChanged, |
281 | manager, &MirSurfaceManager::onSurfaceAttributeChanged); |
282 | } |
283 | |
284 | @@ -70,23 +70,22 @@ |
285 | } |
286 | |
287 | SessionListener *sessionListener = static_cast<SessionListener*>(nativeInterface->nativeResourceForIntegration("SessionListener")); |
288 | - MirShell *shell = static_cast<MirShell*>(nativeInterface->nativeResourceForIntegration("Shell")); |
289 | + MirWindowManager *window_manager = static_cast<MirWindowManager*>(nativeInterface->nativeResourceForIntegration("WindowManager")); |
290 | + mir::shell::Shell *const shell = static_cast<mir::shell::Shell*>(nativeInterface->nativeResourceForIntegration("mir::shell::Shell")); |
291 | |
292 | - the_surface_manager = new MirSurfaceManager(nativeInterface->m_mirServer, shell, SessionManager::singleton()); |
293 | + the_surface_manager = new MirSurfaceManager(shell, SessionManager::singleton()); |
294 | |
295 | connectToSessionListener(the_surface_manager, sessionListener); |
296 | - connectToShell(the_surface_manager, shell); |
297 | + connectToWindowManager(the_surface_manager, window_manager); |
298 | } |
299 | return the_surface_manager; |
300 | } |
301 | |
302 | MirSurfaceManager::MirSurfaceManager( |
303 | - const QSharedPointer<MirServer>& mirServer, |
304 | - MirShell *shell, |
305 | + mir::shell::Shell *shell, |
306 | SessionManager* sessionManager, |
307 | QObject *parent) |
308 | : MirSurfaceItemModel(parent) |
309 | - , m_mirServer(mirServer) |
310 | , m_shell(shell) |
311 | , m_sessionManager(sessionManager) |
312 | { |
313 | |
314 | === modified file 'src/modules/Unity/Application/mirsurfacemanager.h' |
315 | --- src/modules/Unity/Application/mirsurfacemanager.h 2015-02-06 09:47:21 +0000 |
316 | +++ src/modules/Unity/Application/mirsurfacemanager.h 2015-04-01 13:16:10 +0000 |
317 | @@ -37,10 +37,12 @@ |
318 | class Session; |
319 | class PromptSession; |
320 | } |
321 | + namespace shell { |
322 | + class Shell; |
323 | + } |
324 | } |
325 | |
326 | class MirServer; |
327 | -class MirShell; |
328 | |
329 | namespace qtmir { |
330 | |
331 | @@ -54,8 +56,7 @@ |
332 | |
333 | public: |
334 | explicit MirSurfaceManager( |
335 | - const QSharedPointer<MirServer>& mirServer, |
336 | - MirShell *shell, |
337 | + mir::shell::Shell *shell, |
338 | SessionManager* sessionManager, |
339 | QObject *parent = 0 |
340 | ); |
341 | @@ -81,8 +82,7 @@ |
342 | QMutex m_mutex; |
343 | |
344 | private: |
345 | - QSharedPointer<MirServer> m_mirServer; |
346 | - MirShell *const m_shell; |
347 | + mir::shell::Shell *const m_shell; |
348 | SessionManager* m_sessionManager; |
349 | static MirSurfaceManager *the_surface_manager; |
350 | }; |
351 | |
352 | === modified file 'src/modules/Unity/Application/sessionmanager.cpp' |
353 | --- src/modules/Unity/Application/sessionmanager.cpp 2015-01-28 14:25:36 +0000 |
354 | +++ src/modules/Unity/Application/sessionmanager.cpp 2015-04-01 13:16:10 +0000 |
355 | @@ -26,7 +26,6 @@ |
356 | #include "nativeinterface.h" |
357 | #include "mirserver.h" |
358 | #include "sessionlistener.h" |
359 | -#include "mirshell.h" |
360 | #include "logging.h" |
361 | #include "promptsessionlistener.h" |
362 | |
363 | |
364 | === modified file 'src/platforms/mirserver/CMakeLists.txt' |
365 | --- src/platforms/mirserver/CMakeLists.txt 2015-04-01 13:16:09 +0000 |
366 | +++ src/platforms/mirserver/CMakeLists.txt 2015-04-01 13:16:10 +0000 |
367 | @@ -37,7 +37,7 @@ |
368 | |
369 | set(MIRSERVER_QPA_PLUGIN_SRC |
370 | ../../common/debughelpers.cpp |
371 | - mirshell.cpp |
372 | + mirwindowmanager.cpp |
373 | qteventfeeder.cpp |
374 | plugin.cpp |
375 | qmirserver.cpp |
376 | |
377 | === modified file 'src/platforms/mirserver/mirserver.cpp' |
378 | --- src/platforms/mirserver/mirserver.cpp 2015-02-09 16:28:40 +0000 |
379 | +++ src/platforms/mirserver/mirserver.cpp 2015-04-01 13:16:10 +0000 |
380 | @@ -1,5 +1,5 @@ |
381 | /* |
382 | - * Copyright (C) 2013-2014 Canonical, Ltd. |
383 | + * Copyright (C) 2013-2015 Canonical, Ltd. |
384 | * |
385 | * This program is free software: you can redistribute it and/or modify it under |
386 | * the terms of the GNU Lesser General Public License version 3, as published by |
387 | @@ -19,7 +19,7 @@ |
388 | #include "mirserver.h" |
389 | |
390 | // local |
391 | -#include "mirshell.h" |
392 | +#include "mirwindowmanager.h" |
393 | #include "mirglconfig.h" |
394 | #include "mirserverstatuslistener.h" |
395 | #include "promptsessionlistener.h" |
396 | @@ -51,19 +51,25 @@ |
397 | set_command_line_handler(&ignore_unparsed_arguments); |
398 | set_command_line(argc, argv); |
399 | |
400 | - override_the_session_listener([] |
401 | - { |
402 | - return std::make_shared<SessionListener>(); |
403 | - }); |
404 | - |
405 | - override_the_prompt_session_listener([] |
406 | - { |
407 | - return std::make_shared<PromptSessionListener>(); |
408 | - }); |
409 | - |
410 | - override_the_session_authorizer([] |
411 | - { |
412 | - return std::make_shared<SessionAuthorizer>(); |
413 | + override_the_session_listener([this] |
414 | + { |
415 | + const auto result = std::make_shared<SessionListener>(); |
416 | + m_sessionListener = result; |
417 | + return result; |
418 | + }); |
419 | + |
420 | + override_the_prompt_session_listener([this] |
421 | + { |
422 | + const auto result = std::make_shared<PromptSessionListener>(); |
423 | + m_promptSessionListener = result; |
424 | + return result; |
425 | + }); |
426 | + |
427 | + override_the_session_authorizer([this] |
428 | + { |
429 | + const auto result = std::make_shared<SessionAuthorizer>(); |
430 | + m_sessionAuthorizer = result; |
431 | + return result; |
432 | }); |
433 | |
434 | override_the_compositor([] |
435 | @@ -86,17 +92,11 @@ |
436 | return std::make_shared<MirServerStatusListener>(); |
437 | }); |
438 | |
439 | - override_the_shell([this] |
440 | + override_the_window_manager_builder([this](mir::shell::FocusController*) |
441 | { |
442 | - auto const shell = std::make_shared<MirShell>( |
443 | - the_input_targeter(), |
444 | - the_surface_coordinator(), |
445 | - the_session_coordinator(), |
446 | - the_prompt_session_manager(), |
447 | - the_shell_display_layout()); |
448 | - |
449 | - m_shell = shell; |
450 | - return shell; |
451 | + const auto result = std::make_shared<MirWindowManager>(the_shell_display_layout()); |
452 | + m_windowManager = result; |
453 | + return result; |
454 | }); |
455 | |
456 | set_terminator([&](int) |
457 | @@ -113,43 +113,25 @@ |
458 | |
459 | /************************************ Shell side ************************************/ |
460 | |
461 | -// |
462 | -// Note about the |
463 | -// if (sharedPtr.unique()) return 0; |
464 | -// constructs used in the functions below. |
465 | -// The rationale is that if when you do |
466 | -// the_session_authorizer() |
467 | -// get a pointer that is unique means that Mir is not |
468 | -// holding the pointer and thus when we return from the |
469 | -// sessionAuthorizer() |
470 | -// scope the unique pointer will be destroyed so we return 0 |
471 | -// |
472 | +// Note about the"weak_ptr<X>.lock().get();" constructs used in the functions below. |
473 | +// An empty weak_ptr<> means that Mir is not holding the pointer so we return nullptr. |
474 | |
475 | SessionAuthorizer *MirServer::sessionAuthorizer() |
476 | { |
477 | - auto sharedPtr = the_session_authorizer(); |
478 | - if (sharedPtr.unique()) return 0; |
479 | - |
480 | - return static_cast<SessionAuthorizer*>(sharedPtr.get()); |
481 | + return m_sessionAuthorizer.lock().get(); |
482 | } |
483 | |
484 | SessionListener *MirServer::sessionListener() |
485 | { |
486 | - auto sharedPtr = the_session_listener(); |
487 | - if (sharedPtr.unique()) return 0; |
488 | - |
489 | - return static_cast<SessionListener*>(sharedPtr.get()); |
490 | + return m_sessionListener.lock().get(); |
491 | } |
492 | |
493 | PromptSessionListener *MirServer::promptSessionListener() |
494 | { |
495 | - auto sharedPtr = the_prompt_session_listener(); |
496 | - if (sharedPtr.unique()) return 0; |
497 | - |
498 | - return static_cast<PromptSessionListener*>(sharedPtr.get()); |
499 | + return m_promptSessionListener.lock().get(); |
500 | } |
501 | |
502 | -MirShell *MirServer::shell() |
503 | +MirWindowManager *MirServer::windowManager() |
504 | { |
505 | - return m_shell.lock().get(); |
506 | + return m_windowManager.lock().get(); |
507 | } |
508 | |
509 | === modified file 'src/platforms/mirserver/mirserver.h' |
510 | --- src/platforms/mirserver/mirserver.h 2015-04-01 13:16:09 +0000 |
511 | +++ src/platforms/mirserver/mirserver.h 2015-04-01 13:16:10 +0000 |
512 | @@ -23,7 +23,7 @@ |
513 | class QtEventFeeder; |
514 | class SessionListener; |
515 | class SessionAuthorizer; |
516 | -class MirShell; |
517 | +class MirWindowManager; |
518 | class PromptSessionListener; |
519 | |
520 | // We use virtual inheritance of mir::Server to facilitate derived classes (e.g. testing) |
521 | @@ -34,7 +34,7 @@ |
522 | |
523 | Q_PROPERTY(SessionAuthorizer* sessionAuthorizer READ sessionAuthorizer CONSTANT) |
524 | Q_PROPERTY(SessionListener* sessionListener READ sessionListener CONSTANT) |
525 | - Q_PROPERTY(MirShell* shell READ shell CONSTANT) |
526 | + Q_PROPERTY(MirWindowManager* windowManager READ windowManager CONSTANT) |
527 | Q_PROPERTY(PromptSessionListener* promptSessionListener READ promptSessionListener CONSTANT) |
528 | |
529 | public: |
530 | @@ -47,21 +47,22 @@ |
531 | using mir::Server::the_display; |
532 | using mir::Server::the_gl_config; |
533 | using mir::Server::the_main_loop; |
534 | - using mir::Server::the_prompt_session_listener; |
535 | using mir::Server::the_prompt_session_manager; |
536 | - using mir::Server::the_session_authorizer; |
537 | - using mir::Server::the_session_listener; |
538 | + using mir::Server::the_shell; |
539 | |
540 | /* qt specific */ |
541 | // getters |
542 | SessionAuthorizer *sessionAuthorizer(); |
543 | SessionListener *sessionListener(); |
544 | PromptSessionListener *promptSessionListener(); |
545 | - MirShell *shell(); |
546 | + MirWindowManager *windowManager(); |
547 | |
548 | private: |
549 | std::shared_ptr<QtEventFeeder> m_qtEventFeeder; |
550 | - std::weak_ptr<MirShell> m_shell; |
551 | + std::weak_ptr<SessionAuthorizer> m_sessionAuthorizer; |
552 | + std::weak_ptr<SessionListener> m_sessionListener; |
553 | + std::weak_ptr<PromptSessionListener> m_promptSessionListener; |
554 | + std::weak_ptr<MirWindowManager> m_windowManager; |
555 | }; |
556 | |
557 | #endif // MIRSERVER_H |
558 | |
559 | === modified file 'src/platforms/mirserver/mirserverintegration.cpp' |
560 | --- src/platforms/mirserver/mirserverintegration.cpp 2015-04-01 13:16:09 +0000 |
561 | +++ src/platforms/mirserver/mirserverintegration.cpp 2015-04-01 13:16:10 +0000 |
562 | @@ -137,10 +137,14 @@ |
563 | |
564 | mg::DisplayBuffer* first_buffer{nullptr}; |
565 | mg::DisplaySyncGroup* first_group{nullptr}; |
566 | - m_mirServer->the_display()->for_each_display_sync_group([&](mg::DisplaySyncGroup& group) { |
567 | - if (!first_group) first_group = &group; |
568 | - group.for_each_display_buffer([&](mg::DisplayBuffer& buffer) { |
569 | - if (!first_buffer) first_buffer = &buffer; |
570 | + m_mirServer->the_display()->for_each_display_sync_group([&](mg::DisplaySyncGroup &group) { |
571 | + if (!first_group) { |
572 | + first_group = &group; |
573 | + } |
574 | + group.for_each_display_buffer([&](mg::DisplayBuffer &buffer) { |
575 | + if (!first_buffer) { |
576 | + first_buffer = &buffer; |
577 | + } |
578 | }); |
579 | }); |
580 | |
581 | |
582 | === renamed file 'src/platforms/mirserver/mirshell.cpp' => 'src/platforms/mirserver/mirwindowmanager.cpp' |
583 | --- src/platforms/mirserver/mirshell.cpp 2015-04-01 13:16:09 +0000 |
584 | +++ src/platforms/mirserver/mirwindowmanager.cpp 2015-04-01 13:16:10 +0000 |
585 | @@ -14,64 +14,97 @@ |
586 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
587 | */ |
588 | |
589 | -#include "mirshell.h" |
590 | +#include "mirwindowmanager.h" |
591 | #include "logging.h" |
592 | #include "tracepoints.h" // generated from tracepoints.tp |
593 | |
594 | #include <mir/geometry/rectangle.h> |
595 | #include <mir/scene/session.h> |
596 | +#include <mir/scene/surface.h> |
597 | #include <mir/scene/surface_creation_parameters.h> |
598 | #include <mir/shell/display_layout.h> |
599 | #include <mir/shell/null_window_manager.h> |
600 | |
601 | namespace ms = mir::scene; |
602 | -using mir::shell::AbstractShell; |
603 | |
604 | -MirShell::MirShell( |
605 | - const std::shared_ptr<mir::shell::InputTargeter> &inputTargeter, |
606 | - const std::shared_ptr<mir::scene::SurfaceCoordinator> &surfaceCoordinator, |
607 | - const std::shared_ptr<mir::scene::SessionCoordinator> &sessionCoordinator, |
608 | - const std::shared_ptr<mir::scene::PromptSessionManager> &promptSessionManager, |
609 | - const std::shared_ptr<mir::shell::DisplayLayout> &displayLayout) : |
610 | - AbstractShell(inputTargeter, surfaceCoordinator, sessionCoordinator, promptSessionManager, |
611 | - [](mir::shell::FocusController*) { return std::make_shared<mir::shell::NullWindowManager>(); }), |
612 | - m_displayLayout{displayLayout} |
613 | +MirWindowManager::MirWindowManager(const std::shared_ptr<mir::shell::DisplayLayout> &displayLayout) : |
614 | + m_displayLayout{displayLayout} |
615 | { |
616 | - qCDebug(QTMIR_MIR_MESSAGES) << "MirShell::MirShell"; |
617 | + qCDebug(QTMIR_MIR_MESSAGES) << "MirWindowManager::MirWindowManager"; |
618 | } |
619 | |
620 | -mir::frontend::SurfaceId MirShell::create_surface(const std::shared_ptr<ms::Session> &session, const ms::SurfaceCreationParameters &requestParameters) |
621 | +auto MirWindowManager::add_surface( |
622 | + std::shared_ptr<mir::scene::Session> const& session, |
623 | + mir::scene::SurfaceCreationParameters const& requestParameters, |
624 | + std::function<mir::frontend::SurfaceId(std::shared_ptr<mir::scene::Session> const& session, mir::scene::SurfaceCreationParameters const& params)> const& build) |
625 | +-> mir::frontend::SurfaceId |
626 | { |
627 | tracepoint(qtmirserver, surfacePlacementStart); |
628 | |
629 | - // TODO: Callback unity8 so that it can make a decision on that. |
630 | - // unity8 must bear in mind that the called function will be on a Mir thread though. |
631 | - // The QPA shouldn't be deciding for itself on such things. |
632 | - |
633 | - ms::SurfaceCreationParameters placedParameters = requestParameters; |
634 | - |
635 | - // Just make it fullscreen for now |
636 | - mir::geometry::Rectangle rect{requestParameters.top_left, requestParameters.size}; |
637 | - m_displayLayout->size_to_output(rect); |
638 | - placedParameters.size = rect.size; |
639 | - |
640 | - qCDebug(QTMIR_MIR_MESSAGES) << "MirShell::create_surface(): size requested (" |
641 | - << requestParameters.size.width.as_int() << "," << requestParameters.size.height.as_int() << ") and placed (" |
642 | - << placedParameters.size.width.as_int() << "," << placedParameters.size.height.as_int() << ")"; |
643 | - |
644 | - tracepoint(qtmirserver, surfacePlacementEnd); |
645 | - |
646 | - return AbstractShell::create_surface(session, placedParameters); |
647 | + // TODO: Callback unity8 so that it can make a decision on that. |
648 | + // unity8 must bear in mind that the called function will be on a Mir thread though. |
649 | + // The QPA shouldn't be deciding for itself on such things. |
650 | + |
651 | + ms::SurfaceCreationParameters placedParameters = requestParameters; |
652 | + |
653 | + // Just make it fullscreen for now |
654 | + mir::geometry::Rectangle rect{requestParameters.top_left, requestParameters.size}; |
655 | + m_displayLayout->size_to_output(rect); |
656 | + placedParameters.size = rect.size; |
657 | + |
658 | + qCDebug(QTMIR_MIR_MESSAGES) << "MirWindowManager::add_surface(): size requested (" |
659 | + << requestParameters.size.width.as_int() << "," << requestParameters.size.height.as_int() << ") and placed (" |
660 | + << placedParameters.size.width.as_int() << "," << placedParameters.size.height.as_int() << ")"; |
661 | + |
662 | + tracepoint(qtmirserver, surfacePlacementEnd); |
663 | + |
664 | + return build(session, placedParameters); |
665 | } |
666 | |
667 | -int MirShell::set_surface_attribute( |
668 | - const std::shared_ptr<mir::scene::Session> &session, |
669 | - const std::shared_ptr<mir::scene::Surface> &surface, |
670 | +int MirWindowManager::set_surface_attribute( |
671 | + std::shared_ptr<mir::scene::Session> const& /*session*/, |
672 | + std::shared_ptr<mir::scene::Surface> const& surface, |
673 | MirSurfaceAttrib attrib, |
674 | int value) |
675 | { |
676 | - auto const result = AbstractShell::set_surface_attribute(session, surface, attrib, value); |
677 | + const auto result = surface->configure(attrib, value); |
678 | Q_EMIT surfaceAttributeChanged(surface.get(), attrib, result); |
679 | - |
680 | return result; |
681 | } |
682 | + |
683 | +void MirWindowManager::add_session(std::shared_ptr<mir::scene::Session> const& /*session*/) |
684 | +{ |
685 | +} |
686 | + |
687 | +void MirWindowManager::remove_session(std::shared_ptr<mir::scene::Session> const& /*session*/) |
688 | +{ |
689 | +} |
690 | + |
691 | +void MirWindowManager::remove_surface( |
692 | + std::shared_ptr<mir::scene::Session> const& /*session*/, |
693 | + std::weak_ptr<mir::scene::Surface> const& /*surface*/) |
694 | +{ |
695 | +} |
696 | + |
697 | +void MirWindowManager::add_display(mir::geometry::Rectangle const& /*area*/) |
698 | +{ |
699 | +} |
700 | + |
701 | +void MirWindowManager::remove_display(mir::geometry::Rectangle const& /*area*/) |
702 | +{ |
703 | +} |
704 | + |
705 | +bool MirWindowManager::handle_key_event(MirKeyboardEvent const* /*event*/) |
706 | +{ |
707 | + return false; |
708 | +} |
709 | + |
710 | +bool MirWindowManager::handle_touch_event(MirTouchEvent const* /*event*/) |
711 | +{ |
712 | + return false; |
713 | +} |
714 | + |
715 | +bool MirWindowManager::handle_pointer_event(MirPointerEvent const* /*event*/) |
716 | +{ |
717 | + return false; |
718 | +} |
719 | |
720 | === renamed file 'src/platforms/mirserver/mirshell.h' => 'src/platforms/mirserver/mirwindowmanager.h' |
721 | --- src/platforms/mirserver/mirshell.h 2015-02-04 17:17:53 +0000 |
722 | +++ src/platforms/mirserver/mirwindowmanager.h 2015-04-01 13:16:10 +0000 |
723 | @@ -14,10 +14,10 @@ |
724 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
725 | */ |
726 | |
727 | -#ifndef QPAMIRSERVER_SHELL_H |
728 | -#define QPAMIRSERVER_SHELL_H |
729 | +#ifndef MIRWINDOWMANAGER_H |
730 | +#define MIRWINDOWMANAGER_H |
731 | |
732 | -#include <mir/shell/abstract_shell.h> |
733 | +#include <mir/shell/window_manager.h> |
734 | #include <QObject> |
735 | |
736 | namespace mir { |
737 | @@ -26,26 +26,43 @@ |
738 | } |
739 | } |
740 | |
741 | -class MirShell : public QObject, public mir::shell::AbstractShell |
742 | +class MirWindowManager : public QObject, public mir::shell::WindowManager |
743 | { |
744 | Q_OBJECT |
745 | |
746 | public: |
747 | - MirShell( |
748 | - const std::shared_ptr<mir::shell::InputTargeter> &inputTargeter, |
749 | - const std::shared_ptr<mir::scene::SurfaceCoordinator> &surfaceCoordinator, |
750 | - const std::shared_ptr<mir::scene::SessionCoordinator> &sessionCoordinator, |
751 | - const std::shared_ptr<mir::scene::PromptSessionManager> &promptSessionManager, |
752 | - const std::shared_ptr<mir::shell::DisplayLayout> &displayLayout); |
753 | + explicit MirWindowManager(const std::shared_ptr<mir::shell::DisplayLayout> &displayLayout); |
754 | |
755 | - virtual mir::frontend::SurfaceId create_surface(const std::shared_ptr<mir::scene::Session>& session, const mir::scene::SurfaceCreationParameters ¶ms); |
756 | + auto add_surface( |
757 | + std::shared_ptr<mir::scene::Session> const& session, |
758 | + mir::scene::SurfaceCreationParameters const& params, |
759 | + std::function<mir::frontend::SurfaceId(std::shared_ptr<mir::scene::Session> const& session, mir::scene::SurfaceCreationParameters const& params)> const& build) |
760 | + -> mir::frontend::SurfaceId override; |
761 | |
762 | int set_surface_attribute( |
763 | - const std::shared_ptr<mir::scene::Session> &session, |
764 | - const std::shared_ptr<mir::scene::Surface> &surface, |
765 | + std::shared_ptr<mir::scene::Session> const& session, |
766 | + std::shared_ptr<mir::scene::Surface> const& surface, |
767 | MirSurfaceAttrib attrib, |
768 | int value) override; |
769 | |
770 | + void add_session(std::shared_ptr<mir::scene::Session> const& session) override; |
771 | + |
772 | + void remove_session(std::shared_ptr<mir::scene::Session> const& session) override; |
773 | + |
774 | + void remove_surface( |
775 | + std::shared_ptr<mir::scene::Session> const& session, |
776 | + std::weak_ptr<mir::scene::Surface> const& surface) override; |
777 | + |
778 | + void add_display(mir::geometry::Rectangle const& area) override; |
779 | + |
780 | + void remove_display(mir::geometry::Rectangle const& area) override; |
781 | + |
782 | + bool handle_key_event(MirKeyboardEvent const* event) override; |
783 | + |
784 | + bool handle_touch_event(MirTouchEvent const* event) override; |
785 | + |
786 | + bool handle_pointer_event(MirPointerEvent const* event) override; |
787 | + |
788 | Q_SIGNALS: |
789 | void surfaceAttributeChanged(mir::scene::Surface const*, const MirSurfaceAttrib, const int); |
790 | |
791 | @@ -53,4 +70,4 @@ |
792 | std::shared_ptr<mir::shell::DisplayLayout> const m_displayLayout; |
793 | }; |
794 | |
795 | -#endif /* QPAMIRSERVER_SHELL_H */ |
796 | +#endif /* MIRWINDOWMANAGER_H */ |
797 | |
798 | === modified file 'src/platforms/mirserver/nativeinterface.cpp' |
799 | --- src/platforms/mirserver/nativeinterface.cpp 2015-01-28 14:25:36 +0000 |
800 | +++ src/platforms/mirserver/nativeinterface.cpp 2015-04-01 13:16:10 +0000 |
801 | @@ -29,12 +29,17 @@ |
802 | |
803 | if (resource == "SessionAuthorizer") |
804 | result = m_mirServer->sessionAuthorizer(); |
805 | - else if (resource == "Shell") |
806 | - result = m_mirServer->shell(); |
807 | + else if (resource == "WindowManager") |
808 | + result = m_mirServer->windowManager(); |
809 | else if (resource == "SessionListener") |
810 | result = m_mirServer->sessionListener(); |
811 | else if (resource == "PromptSessionListener") |
812 | result = m_mirServer->promptSessionListener(); |
813 | + else if (resource == "mir::shell::Shell") |
814 | + { |
815 | + const std::weak_ptr<mir::shell::Shell> shell{m_mirServer->the_shell()}; |
816 | + result = shell.lock().get(); |
817 | + } |
818 | |
819 | return result; |
820 | } |
821 | |
822 | === modified file 'src/platforms/mirserver/nativeinterface.h' |
823 | --- src/platforms/mirserver/nativeinterface.h 2014-12-01 11:05:01 +0000 |
824 | +++ src/platforms/mirserver/nativeinterface.h 2015-04-01 13:16:10 +0000 |
825 | @@ -33,7 +33,7 @@ |
826 | |
827 | virtual void *nativeResourceForIntegration(const QByteArray &resource); |
828 | |
829 | - QSharedPointer<MirServer> m_mirServer; |
830 | + const QSharedPointer<MirServer> m_mirServer; |
831 | }; |
832 | |
833 | #endif // NATIVEINTEGRATION_H |
834 | |
835 | === modified file 'src/platforms/mirserver/qteventfeeder.cpp' |
836 | --- src/platforms/mirserver/qteventfeeder.cpp 2015-02-19 23:03:14 +0000 |
837 | +++ src/platforms/mirserver/qteventfeeder.cpp 2015-04-01 13:16:10 +0000 |
838 | @@ -258,14 +258,14 @@ |
839 | return static_cast<Qt::KeyboardModifiers>(qtModifiers); |
840 | } |
841 | |
842 | -Qt::MouseButton getQtMouseButtonsfromMirPointerEvent(MirPointerInputEvent const* pev) |
843 | +Qt::MouseButton getQtMouseButtonsfromMirPointerEvent(MirPointerEvent const* pev) |
844 | { |
845 | int buttons = Qt::NoButton; |
846 | - if (mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_primary)) |
847 | + if (mir_pointer_event_button_state(pev, mir_pointer_button_primary)) |
848 | buttons |= Qt::LeftButton; |
849 | - if (mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_secondary)) |
850 | + if (mir_pointer_event_button_state(pev, mir_pointer_button_secondary)) |
851 | buttons |= Qt::RightButton; |
852 | - if (mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_tertiary)) |
853 | + if (mir_pointer_event_button_state(pev, mir_pointer_button_tertiary)) |
854 | buttons |= Qt::MidButton; |
855 | |
856 | // TODO: Should mir back and forward buttons exist? |
857 | @@ -281,12 +281,12 @@ |
858 | |
859 | auto timestamp = mir_input_event_get_event_time(ev) / 1000000; |
860 | |
861 | - auto pev = mir_input_event_get_pointer_input_event(ev); |
862 | - auto modifiers = getQtModifiersFromMir(mir_pointer_input_event_get_modifiers(pev)); |
863 | + auto pev = mir_input_event_get_pointer_event(ev); |
864 | + auto modifiers = getQtModifiersFromMir(mir_pointer_event_modifiers(pev)); |
865 | auto buttons = getQtMouseButtonsfromMirPointerEvent(pev); |
866 | |
867 | - auto local_point = QPointF(mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_x), |
868 | - mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_y)); |
869 | + auto local_point = QPointF(mir_pointer_event_axis_value(pev, mir_pointer_axis_x), |
870 | + mir_pointer_event_axis_value(pev, mir_pointer_axis_y)); |
871 | |
872 | mQtWindowSystem->handleMouseEvent(timestamp, local_point, |
873 | buttons, modifiers); |
874 | @@ -299,24 +299,24 @@ |
875 | |
876 | ulong timestamp = mir_input_event_get_event_time(event) / 1000000; |
877 | |
878 | - auto kev = mir_input_event_get_key_input_event(event); |
879 | - xkb_keysym_t xk_sym = mir_key_input_event_get_key_code(kev); |
880 | + auto kev = mir_input_event_get_keyboard_event(event); |
881 | + xkb_keysym_t xk_sym = mir_keyboard_event_key_code(kev); |
882 | |
883 | // Key modifier and unicode index mapping. |
884 | - auto modifiers = getQtModifiersFromMir(mir_key_input_event_get_modifiers(kev)); |
885 | + auto modifiers = getQtModifiersFromMir(mir_keyboard_event_modifiers(kev)); |
886 | |
887 | // Key action |
888 | QEvent::Type keyType = QEvent::KeyRelease; |
889 | bool is_auto_rep = false; |
890 | |
891 | - switch (mir_key_input_event_get_action(kev)) |
892 | + switch (mir_keyboard_event_action(kev)) |
893 | { |
894 | - case mir_key_input_event_action_repeat: |
895 | + case mir_keyboard_action_repeat: |
896 | is_auto_rep = true; // fall-through |
897 | - case mir_key_input_event_action_down: |
898 | + case mir_keyboard_action_down: |
899 | keyType = QEvent::KeyPress; |
900 | break; |
901 | - case mir_key_input_event_action_up: |
902 | + case mir_keyboard_action_up: |
903 | keyType = QEvent::KeyRelease; |
904 | break; |
905 | default: |
906 | @@ -332,9 +332,9 @@ |
907 | if (context) { |
908 | // TODO: consider event.repeat_count |
909 | QKeyEvent qKeyEvent(keyType, keyCode, modifiers, |
910 | - mir_key_input_event_get_scan_code(kev), |
911 | - mir_key_input_event_get_key_code(kev), |
912 | - mir_key_input_event_get_modifiers(kev), |
913 | + mir_keyboard_event_scan_code(kev), |
914 | + mir_keyboard_event_key_code(kev), |
915 | + mir_keyboard_event_modifiers(kev), |
916 | text, is_auto_rep); |
917 | qKeyEvent.setTimestamp(timestamp); |
918 | if (context->filterEvent(&qKeyEvent)) { |
919 | @@ -344,9 +344,9 @@ |
920 | } |
921 | |
922 | mQtWindowSystem->handleExtendedKeyEvent(timestamp, keyType, keyCode, modifiers, |
923 | - mir_key_input_event_get_scan_code(kev), |
924 | - mir_key_input_event_get_key_code(kev), |
925 | - mir_key_input_event_get_modifiers(kev), text, is_auto_rep); |
926 | + mir_keyboard_event_scan_code(kev), |
927 | + mir_keyboard_event_key_code(kev), |
928 | + mir_keyboard_event_modifiers(kev), text, is_auto_rep); |
929 | } |
930 | |
931 | void QtEventFeeder::dispatchTouch(MirInputEvent const* event) |
932 | @@ -354,7 +354,7 @@ |
933 | if (!mQtWindowSystem->hasTargetWindow()) |
934 | return; |
935 | |
936 | - auto tev = mir_input_event_get_touch_input_event(event); |
937 | + auto tev = mir_input_event_get_touch_event(event); |
938 | |
939 | // FIXME(loicm) Max pressure is device specific. That one is for the Samsung Galaxy Nexus. That |
940 | // needs to be fixed as soon as the compat input lib adds query support. |
941 | @@ -364,29 +364,29 @@ |
942 | |
943 | // TODO: Is it worth setting the Qt::TouchPointStationary ones? Currently they are left |
944 | // as Qt::TouchPointMoved |
945 | - const int kPointerCount = mir_touch_input_event_get_touch_count(tev); |
946 | + const int kPointerCount = mir_touch_event_point_count(tev); |
947 | for (int i = 0; i < kPointerCount; ++i) { |
948 | QWindowSystemInterface::TouchPoint touchPoint; |
949 | |
950 | - const float kX = mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_x); |
951 | - const float kY = mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_y); |
952 | - const float kW = mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_major); |
953 | - const float kH = mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_minor); |
954 | - const float kP = mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_pressure); |
955 | - touchPoint.id = mir_touch_input_event_get_touch_id(tev, i); |
956 | + const float kX = mir_touch_event_axis_value(tev, i, mir_touch_axis_x); |
957 | + const float kY = mir_touch_event_axis_value(tev, i, mir_touch_axis_y); |
958 | + const float kW = mir_touch_event_axis_value(tev, i, mir_touch_axis_touch_major); |
959 | + const float kH = mir_touch_event_axis_value(tev, i, mir_touch_axis_touch_minor); |
960 | + const float kP = mir_touch_event_axis_value(tev, i, mir_touch_axis_pressure); |
961 | + touchPoint.id = mir_touch_event_id(tev, i); |
962 | |
963 | touchPoint.normalPosition = QPointF(kX / kWindowGeometry.width(), kY / kWindowGeometry.height()); |
964 | touchPoint.area = QRectF(kX - (kW / 2.0), kY - (kH / 2.0), kW, kH); |
965 | touchPoint.pressure = kP / kMaxPressure; |
966 | - switch (mir_touch_input_event_get_touch_action(tev, i)) |
967 | + switch (mir_touch_event_action(tev, i)) |
968 | { |
969 | - case mir_touch_input_event_action_up: |
970 | + case mir_touch_action_up: |
971 | touchPoint.state = Qt::TouchPointReleased; |
972 | break; |
973 | - case mir_touch_input_event_action_down: |
974 | + case mir_touch_action_down: |
975 | touchPoint.state = Qt::TouchPointPressed; |
976 | break; |
977 | - case mir_touch_input_event_action_change: |
978 | + case mir_touch_action_change: |
979 | touchPoint.state = Qt::TouchPointMoved; |
980 | break; |
981 | default: |
982 | |
983 | === modified file 'src/platforms/mirserver/surfaceobserver.h' |
984 | --- src/platforms/mirserver/surfaceobserver.h 2015-04-01 13:16:09 +0000 |
985 | +++ src/platforms/mirserver/surfaceobserver.h 2015-04-01 13:16:10 +0000 |
986 | @@ -42,7 +42,8 @@ |
987 | void cursor_image_set_to(mir::graphics::CursorImage const&) override {} |
988 | void orientation_set_to(MirOrientation) override {} |
989 | void client_surface_close_requested() override {} |
990 | - void keymap_changed(xkb_rule_names const&) override {} |
991 | + void keymap_changed(xkb_rule_names const &) override {} |
992 | + void renamed(char const *) override {} |
993 | |
994 | Q_SIGNALS: |
995 | void framesPosted(); |
996 | |
997 | === modified file 'tests/mirserver/QtEventFeeder/qteventfeeder_test.cpp' |
998 | --- tests/mirserver/QtEventFeeder/qteventfeeder_test.cpp 2015-02-19 23:03:14 +0000 |
999 | +++ tests/mirserver/QtEventFeeder/qteventfeeder_test.cpp 2015-04-01 13:16:10 +0000 |
1000 | @@ -15,8 +15,6 @@ |
1001 | * |
1002 | */ |
1003 | |
1004 | -#define MIR_INCLUDE_DEPRECATED_EVENT_HEADER |
1005 | - |
1006 | #include <gmock/gmock.h> |
1007 | #include <gtest/gtest.h> |
1008 | |
1009 | @@ -26,6 +24,8 @@ |
1010 | #include <QGuiApplication> |
1011 | #include <QWindow> |
1012 | |
1013 | +#include "mir/events/event_builders.h" |
1014 | + |
1015 | #include "mock_qtwindowsystem.h" |
1016 | |
1017 | using ::testing::_; |
1018 | @@ -44,6 +44,8 @@ |
1019 | using ::testing::HasId; |
1020 | using ::testing::StateIsMoved; |
1021 | |
1022 | +namespace mev = mir::events; |
1023 | + |
1024 | void PrintTo(const struct QWindowSystemInterface::TouchPoint& touchPoint, ::std::ostream* os) { |
1025 | *os << "TouchPoint(" |
1026 | << "id=" << touchPoint.id |
1027 | @@ -108,19 +110,10 @@ |
1028 | Contains(AllOf(HasId(0), |
1029 | IsPressed()))),_)).Times(1); |
1030 | |
1031 | - MirEvent mirEvent; |
1032 | - mirEvent.type = mir_event_type_motion; |
1033 | - mirEvent.motion.pointer_count = 1; |
1034 | - mirEvent.motion.pointer_coordinates[0].id = 0; |
1035 | - mirEvent.motion.pointer_coordinates[0].x = 10; |
1036 | - mirEvent.motion.pointer_coordinates[0].y = 10; |
1037 | - mirEvent.motion.pointer_coordinates[0].touch_major = 1; |
1038 | - mirEvent.motion.pointer_coordinates[0].touch_minor = 1; |
1039 | - mirEvent.motion.pointer_coordinates[0].pressure = 10; |
1040 | - mirEvent.motion.action = mir_motion_action_down; |
1041 | - mirEvent.motion.event_time = 123 * 1000000; |
1042 | - |
1043 | - qtEventFeeder->dispatch(mirEvent); |
1044 | + auto ev1 = mev::make_event(MirInputDeviceId(), 123*1000000, 0); |
1045 | + mev::add_touch(*ev1, /* touch ID */ 0, mir_touch_action_down, mir_touch_tooltype_unknown, |
1046 | + 10, 10, 10, 1, 1, 10); |
1047 | + qtEventFeeder->dispatch(*ev1); |
1048 | |
1049 | ASSERT_TRUE(Mock::VerifyAndClearExpectations(mockWindowSystem)); |
1050 | |
1051 | @@ -131,18 +124,10 @@ |
1052 | Contains(AllOf(HasId(1),IsPressed())) |
1053 | ),_)).Times(1); |
1054 | |
1055 | - mirEvent.type = mir_event_type_motion; |
1056 | - mirEvent.motion.pointer_count = 1; |
1057 | - mirEvent.motion.pointer_coordinates[0].id = 1; |
1058 | - mirEvent.motion.pointer_coordinates[0].x = 20; |
1059 | - mirEvent.motion.pointer_coordinates[0].y = 20; |
1060 | - mirEvent.motion.pointer_coordinates[0].touch_major = 1; |
1061 | - mirEvent.motion.pointer_coordinates[0].touch_minor = 1; |
1062 | - mirEvent.motion.pointer_coordinates[0].pressure = 10; |
1063 | - mirEvent.motion.action = mir_motion_action_down; |
1064 | - mirEvent.motion.event_time = 125 * 1000000; |
1065 | - |
1066 | - qtEventFeeder->dispatch(mirEvent); |
1067 | + auto ev2 = mev::make_event(MirInputDeviceId(), 125*1000000, 0); |
1068 | + mev::add_touch(*ev2, 1 /* touch ID */, mir_touch_action_down, mir_touch_tooltype_unknown, |
1069 | + 10, 10, 10, 1, 1, 10); |
1070 | + qtEventFeeder->dispatch(*ev2); |
1071 | |
1072 | ASSERT_TRUE(Mock::VerifyAndClearExpectations(mockWindowSystem)); |
1073 | } |
1074 | @@ -155,19 +140,10 @@ |
1075 | Contains(AllOf(HasId(0), |
1076 | IsPressed()))),_)).Times(1); |
1077 | |
1078 | - MirEvent mirEvent; |
1079 | - mirEvent.type = mir_event_type_motion; |
1080 | - mirEvent.motion.pointer_count = 1; |
1081 | - mirEvent.motion.pointer_coordinates[0].id = 0; |
1082 | - mirEvent.motion.pointer_coordinates[0].x = 10; |
1083 | - mirEvent.motion.pointer_coordinates[0].y = 10; |
1084 | - mirEvent.motion.pointer_coordinates[0].touch_major = 1; |
1085 | - mirEvent.motion.pointer_coordinates[0].touch_minor = 1; |
1086 | - mirEvent.motion.pointer_coordinates[0].pressure = 10; |
1087 | - mirEvent.motion.action = mir_motion_action_down; |
1088 | - mirEvent.motion.event_time = 123 * 1000000; |
1089 | - |
1090 | - qtEventFeeder->dispatch(mirEvent); |
1091 | + auto ev1 = mev::make_event(MirInputDeviceId(), 123*1000000, 0); |
1092 | + mev::add_touch(*ev1, /* touch ID */ 0, mir_touch_action_down, mir_touch_tooltype_unknown, |
1093 | + 10, 10, 10, 1, 1, 10); |
1094 | + qtEventFeeder->dispatch(*ev1); |
1095 | |
1096 | ASSERT_TRUE(Mock::VerifyAndClearExpectations(mockWindowSystem)); |
1097 | |
1098 | @@ -177,18 +153,10 @@ |
1099 | Contains(AllOf(HasId(0), StateIsMoved())) |
1100 | ),_)).Times(1); |
1101 | |
1102 | - mirEvent.type = mir_event_type_motion; |
1103 | - mirEvent.motion.pointer_count = 1; |
1104 | - mirEvent.motion.pointer_coordinates[0].id = 0; |
1105 | - mirEvent.motion.pointer_coordinates[0].x = 20; |
1106 | - mirEvent.motion.pointer_coordinates[0].y = 20; |
1107 | - mirEvent.motion.pointer_coordinates[0].touch_major = 1; |
1108 | - mirEvent.motion.pointer_coordinates[0].touch_minor = 1; |
1109 | - mirEvent.motion.pointer_coordinates[0].pressure = 10; |
1110 | - mirEvent.motion.action = mir_motion_action_down; |
1111 | - mirEvent.motion.event_time = 125 * 1000000; |
1112 | - |
1113 | - qtEventFeeder->dispatch(mirEvent); |
1114 | + auto ev2 = mev::make_event(MirInputDeviceId(), 123*1000000, 0); |
1115 | + mev::add_touch(*ev2, /* touch ID */ 0, mir_touch_action_down, mir_touch_tooltype_unknown, |
1116 | + 10, 10, 10, 1, 1, 10); |
1117 | + qtEventFeeder->dispatch(*ev2); |
1118 | |
1119 | ASSERT_TRUE(Mock::VerifyAndClearExpectations(mockWindowSystem)); |
1120 | } |
1121 | |
1122 | === modified file 'tests/modules/MirSurfaceItem/mirsurfaceitem_test.cpp' |
1123 | --- tests/modules/MirSurfaceItem/mirsurfaceitem_test.cpp 2015-02-20 15:57:36 +0000 |
1124 | +++ tests/modules/MirSurfaceItem/mirsurfaceitem_test.cpp 2015-04-01 13:16:10 +0000 |
1125 | @@ -62,26 +62,26 @@ |
1126 | EXPECT_CALL(*mockSurface, type()).Times(AnyNumber()).WillRepeatedly(Return(mir_surface_type_normal)); |
1127 | EXPECT_CALL(*mockSession, setSurface(_)).Times(AnyNumber()); |
1128 | |
1129 | - auto getTouchEvent = [](MirEvent const& event) -> MirTouchInputEvent const* |
1130 | + auto getTouchEvent = [](MirEvent const& event) -> MirTouchEvent const* |
1131 | { |
1132 | if (mir_event_get_type(&event) != mir_event_type_input) |
1133 | return nullptr; |
1134 | auto const* input_event = mir_event_get_input_event(&event); |
1135 | if (mir_input_event_get_type(input_event) != mir_input_event_type_touch) |
1136 | return nullptr; |
1137 | - return mir_input_event_get_touch_input_event(input_event); |
1138 | + return mir_input_event_get_touch_event(input_event); |
1139 | }; |
1140 | |
1141 | auto eventMatches = [&](MirEvent const& event, |
1142 | int touch_count, |
1143 | - MirTouchInputEventTouchAction action, |
1144 | - MirTouchInputEventTouchId touch_id) ->void |
1145 | + MirTouchAction action, |
1146 | + MirTouchId touch_id) ->void |
1147 | { |
1148 | auto const* touch_event = getTouchEvent(event); |
1149 | ASSERT_NE(touch_event, nullptr); |
1150 | - ASSERT_EQ(touch_count, mir_touch_input_event_get_touch_count(touch_event)); |
1151 | - ASSERT_EQ(action, mir_touch_input_event_get_touch_action(touch_event,0)); |
1152 | - ASSERT_EQ(touch_id, mir_touch_input_event_get_touch_id(touch_event,0)); |
1153 | + ASSERT_EQ(touch_count, mir_touch_event_point_count(touch_event)); |
1154 | + ASSERT_EQ(action, mir_touch_event_action(touch_event,0)); |
1155 | + ASSERT_EQ(touch_id, mir_touch_event_id(touch_event,0)); |
1156 | }; |
1157 | |
1158 | // The touch event sequence we expect mir::input::surface to receive from MirSurfaceItem. |
1159 | @@ -89,16 +89,16 @@ |
1160 | // the sequence for touch 1. |
1161 | EXPECT_CALL(*mockSurface, consume(_)) |
1162 | .WillOnce(Invoke([&] (MirEvent const& mirEvent) { |
1163 | - eventMatches(mirEvent, 1, mir_touch_input_event_action_down, 0); |
1164 | - })) |
1165 | - .WillOnce(Invoke([&] (MirEvent const& mirEvent) { |
1166 | - eventMatches(mirEvent, 1, mir_touch_input_event_action_change, 0); |
1167 | - })) |
1168 | - .WillOnce(Invoke([&] (MirEvent const& mirEvent) { |
1169 | - eventMatches(mirEvent, 1, mir_touch_input_event_action_up, 0); |
1170 | - })) |
1171 | - .WillOnce(Invoke([&] (MirEvent const& mirEvent) { |
1172 | - eventMatches(mirEvent, 1, mir_touch_input_event_action_down, 1); |
1173 | + eventMatches(mirEvent, 1, mir_touch_action_down, 0); |
1174 | + })) |
1175 | + .WillOnce(Invoke([&] (MirEvent const& mirEvent) { |
1176 | + eventMatches(mirEvent, 1, mir_touch_action_change, 0); |
1177 | + })) |
1178 | + .WillOnce(Invoke([&] (MirEvent const& mirEvent) { |
1179 | + eventMatches(mirEvent, 1, mir_touch_action_up, 0); |
1180 | + })) |
1181 | + .WillOnce(Invoke([&] (MirEvent const& mirEvent) { |
1182 | + eventMatches(mirEvent, 1, mir_touch_action_down, 1); |
1183 | })); |
1184 | |
1185 | |
1186 | |
1187 | === modified file 'tests/modules/common/mock_mir_session.h' |
1188 | --- tests/modules/common/mock_mir_session.h 2015-01-28 14:25:36 +0000 |
1189 | +++ tests/modules/common/mock_mir_session.h 2015-04-01 13:16:10 +0000 |
1190 | @@ -66,6 +66,10 @@ |
1191 | void suspend_prompt_session() override {}; |
1192 | void resume_prompt_session() override {}; |
1193 | |
1194 | + MOCK_CONST_METHOD1(get_buffer_stream, std::shared_ptr<frontend::BufferStream>(frontend::BufferStreamId)); |
1195 | + MOCK_METHOD1(destroy_buffer_stream, void(frontend::BufferStreamId)); |
1196 | + MOCK_METHOD1(create_buffer_stream, frontend::BufferStreamId(graphics::BufferProperties const&)); |
1197 | + |
1198 | private: |
1199 | std::string m_sessionName; |
1200 | pid_t m_sessionId; |
1201 | |
1202 | === modified file 'tests/modules/common/mock_surface.h' |
1203 | --- tests/modules/common/mock_surface.h 2015-04-01 13:16:09 +0000 |
1204 | +++ tests/modules/common/mock_surface.h 2015-04-01 13:16:10 +0000 |
1205 | @@ -66,7 +66,7 @@ |
1206 | MOCK_METHOD1(set_reception_mode, void(input::InputReceptionMode mode)); |
1207 | MOCK_METHOD0(request_client_surface_close, void()); |
1208 | MOCK_CONST_METHOD1(buffers_ready_for_compositor, int(void const*)); |
1209 | - void set_keymap(xkb_rule_names const&) override {} |
1210 | + void set_keymap(xkb_rule_names const &) override {} |
1211 | |
1212 | // from mir::input::surface |
1213 | MOCK_CONST_METHOD1(input_area_contains, bool(geometry::Point const& point)); |
1214 | @@ -80,9 +80,13 @@ |
1215 | MOCK_CONST_METHOD0(client_input_fd, int()); |
1216 | MOCK_METHOD2(configure, int(MirSurfaceAttrib attrib, int value)); |
1217 | MOCK_CONST_METHOD1(query, int(MirSurfaceAttrib attrib)); |
1218 | + bool modify(const Modifications &) override { return false; } |
1219 | + |
1220 | |
1221 | // from mir::scene::SurfaceBufferAccess |
1222 | MOCK_METHOD1(with_most_recent_buffer_do, void(std::function<void(graphics::Buffer&)> const& exec)); |
1223 | + |
1224 | + MOCK_METHOD2(set_cursor_stream, void(std::shared_ptr<frontend::BufferStream> const&, geometry::Displacement const&)); |
1225 | }; |
1226 | |
1227 | } // namespace scene |
1228 | |
1229 | === modified file 'tests/modules/common/qtmir_test.h' |
1230 | --- tests/modules/common/qtmir_test.h 2015-02-06 09:47:21 +0000 |
1231 | +++ tests/modules/common/qtmir_test.h 2015-04-01 13:16:10 +0000 |
1232 | @@ -109,7 +109,6 @@ |
1233 | &applicationManager, |
1234 | } |
1235 | , surfaceManager{ |
1236 | - mirServer, |
1237 | mirShell, |
1238 | &sessionManager |
1239 | } |
1240 | @@ -150,7 +149,7 @@ |
1241 | testing::NiceMock<testing::MockDesktopFileReaderFactory> desktopFileReaderFactory; |
1242 | testing::NiceMock<testing::MockSharedWakelock> sharedWakelock; |
1243 | QSharedPointer<FakeMirServer> mirServer; |
1244 | - MirShell *mirShell{nullptr}; |
1245 | + mir::shell::Shell *mirShell{nullptr}; |
1246 | QSharedPointer<TaskController> taskController; |
1247 | ApplicationManager applicationManager; |
1248 | SessionManager sessionManager; |
FAILED: Continuous integration, rev:340 jenkins. qa.ubuntu. com/job/ qtmir-ci/ 244/ jenkins. qa.ubuntu. com/job/ qtmir-vivid- amd64-ci/ 95/console jenkins. qa.ubuntu. com/job/ qtmir-vivid- armhf-ci/ 95/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/qtmir- ci/244/ rebuild
http://