Merge lp:~artmello/qtubuntu/qtubuntu-new_mir_api into lp:qtubuntu

Proposed by Arthur Mello
Status: Merged
Approved by: Gerry Boland
Approved revision: 378
Merged at revision: 368
Proposed branch: lp:~artmello/qtubuntu/qtubuntu-new_mir_api
Merge into: lp:qtubuntu
Prerequisite: lp:~gerboland/qtubuntu/upstream-closer
Diff against target: 1045 lines (+220/-210)
10 files modified
src/ubuntumirclient/qmirclientcursor.cpp (+17/-11)
src/ubuntumirclient/qmirclientcursor.h (+5/-4)
src/ubuntumirclient/qmirclientdebugextension.cpp (+4/-4)
src/ubuntumirclient/qmirclientdebugextension.h (+6/-5)
src/ubuntumirclient/qmirclientinput.cpp (+46/-46)
src/ubuntumirclient/qmirclientinput.h (+3/-3)
src/ubuntumirclient/qmirclientnativeinterface.cpp (+4/-4)
src/ubuntumirclient/qmirclientnativeinterface.h (+2/-2)
src/ubuntumirclient/qmirclientwindow.cpp (+130/-128)
src/ubuntumirclient/qmirclientwindow.h (+3/-3)
To merge this branch: bzr merge lp:~artmello/qtubuntu/qtubuntu-new_mir_api
Reviewer Review Type Date Requested Status
Lukáš Tinkl (community) Abstain
Daniel d'Andrada (community) Approve
Gerry Boland (community) Abstain
Review via email: mp+316577@code.launchpad.net

Commit message

Update code to use new Mir Api's.

Changes:
- Update/Remove deprecated code to fix build issues

Description of the change

Update code to use new Mir Api's.

Changes:
- Update/Remove deprecated code to fix build issues

To post a comment you must log in.
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Could you please update the copyright header of all modified files to 2017?

Revision history for this message
Arthur Mello (artmello) wrote :

> Could you please update the copyright header of all modified files to 2017?

done on rev 375

Revision history for this message
Gerry Boland (gerboland) wrote :

+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
             auto cursorConfiguration = mir_cursor_configuration_from_name(cursorName.data());
- mir_surface_configure_cursor(surface, cursorConfiguration);
+#pragma GCC diagnostic pop

If we have to work around Mir in this way, then Mir has a problem. Is Mir really missing a non-deprecated API for this?

review: Needs Information
Revision history for this message
Gerry Boland (gerboland) wrote :

Ok, tracked this change down to mir rev 3858. Comment says:

"client: deprecate mir_cursor_configuration_from_name and prepare to deprecate mir_surface_configure_cursor, mir_cursor_configuration_destroy, and mir_cursor_configuration_from_buffer_stream once MirRenderSurface is published. The new alternative is to use MirSurfaceSpec based cursor configurations.

The new functions are mir_surface_spec_set_cursor_name and mir_surface_spec_set_cursor_render_surface which set the cursor from the canonical names, or sets a custom cursor via a MirRenderSurface.

This also makes application of cursors something the shell can mediate, like the rest of the surface modifications. (previously it was unable to mediate this)."

Revision history for this message
Gerry Boland (gerboland) wrote :

As supporting the new cursor API requires extra work, I'm ok with landing this with the deprecation workaround

review: Abstain
Revision history for this message
Arthur Mello (artmello) wrote :

> If we have to work around Mir in this way, then Mir has a problem. Is Mir
> really missing a non-deprecated API for this?

While searching on how to replace mir_cursor_configuration_from_name, I saw that it was possible to use mir_window_spec_set_cursor_name passing a pointer for MirWindowSpec and a name. I was not totally sure on how to get MirWindowSpec from the window on that point. Looking for examples, found the used code here on a mir acceptance-test [0]. But I am totally up to change it and do not use this workaround.

[0] http://bazaar.launchpad.net/~mir-team/mir/development-branch/view/head:/tests/acceptance-tests/test_client_cursor_api.cpp#L223

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

"""
Qt::WindowState mirWindowStateToWindowState(MirWindowState state)
"""

With the s/Surface/Window that name got confusing and repetitive. Could you please name it like this instead?

mirWindowStateToQt

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

In makeSurfaceSpec (src/ubuntumirclient/qmirclientwindow.cpp) you're no longer applying the specified pixel format.

To do so, add this call after the switch (type) {}:

mir_window_spec_set_pixel_format(spec.get(), pixelFormat);

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

> In makeSurfaceSpec (src/ubuntumirclient/qmirclientwindow.cpp) you're no longer
> applying the specified pixel format.
>
> To do so, add this call after the switch (type) {}:
>
> mir_window_spec_set_pixel_format(spec.get(), pixelFormat);

And then remove this code:

"""
#if MIR_CLIENT_VERSION >= MIR_VERSION_NUMBER(3, 4, 0)
    Q_UNUSED(pixelFormat);
#endif
"""

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

In several headers you're replacing a forward declaration with a #include.

"""
- struct MirSurface;
"""

"""
+ #include <mir_toolkit/mir_window.h>
"""

Please maintain the forward declaration style. It makes the header files more lightweight.

Revision history for this message
Arthur Mello (artmello) wrote :

> """
> Qt::WindowState mirWindowStateToWindowState(MirWindowState state)
> """
>
> With the s/Surface/Window that name got confusing and repetitive. Could you
> please name it like this instead?
>
> mirWindowStateToQt

done (r377)

Revision history for this message
Arthur Mello (artmello) wrote :

> > In makeSurfaceSpec (src/ubuntumirclient/qmirclientwindow.cpp) you're no
> longer
> > applying the specified pixel format.
> >
> > To do so, add this call after the switch (type) {}:
> >
> > mir_window_spec_set_pixel_format(spec.get(), pixelFormat);
>
> And then remove this code:
>
> """
> #if MIR_CLIENT_VERSION >= MIR_VERSION_NUMBER(3, 4, 0)
> Q_UNUSED(pixelFormat);
> #endif
> """

done (r378)

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

All good. Thanks

review: Approve
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

Here's some more changes to properly use the mir's new extension mechanism (no longer a separate debug library) and the cursor_name api changes:

https://code.launchpad.net/~albaguirre/qtubuntu/more-new-mir-apis

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Can you please merge your parent?

Text conflict in src/ubuntumirclient/qmirclientcursor.cpp
Text conflict in src/ubuntumirclient/qmirclientcursor.h
Text conflict in src/ubuntumirclient/qmirclientdebugextension.cpp
Text conflict in src/ubuntumirclient/qmirclientdebugextension.h
Text conflict in src/ubuntumirclient/qmirclientinput.cpp
Text conflict in src/ubuntumirclient/qmirclientinput.h
Text conflict in src/ubuntumirclient/qmirclientnativeinterface.cpp
Text conflict in src/ubuntumirclient/qmirclientnativeinterface.h
Text conflict in src/ubuntumirclient/qmirclientwindow.cpp
Text conflict in src/ubuntumirclient/qmirclientwindow.h
10 conflicts encountered.

2017-02-08 15:54:48,633 ERROR zesty/qtubuntu: Failed to merge https://code.launchpad.net/~artmello/qtubuntu/qtubuntu-new_mir_api

review: Needs Fixing
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

All good, sorry for the noise, parent has been sorted out.

review: Abstain

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ubuntumirclient/qmirclientcursor.cpp'
2--- src/ubuntumirclient/qmirclientcursor.cpp 2017-02-08 16:39:07 +0000
3+++ src/ubuntumirclient/qmirclientcursor.cpp 2017-02-08 16:39:07 +0000
4@@ -1,6 +1,6 @@
5 /****************************************************************************
6 **
7-** Copyright (C) 2015-2016 Canonical, Ltd.
8+** Copyright (C) 2015-2017 Canonical, Ltd.
9 ** Contact: https://www.qt.io/licensing/
10 **
11 ** This file is part of the plugins of the Qt Toolkit.
12@@ -141,9 +141,9 @@
13 return;
14 }
15
16- MirSurface *surface = static_cast<QMirClientWindow*>(window->handle())->mirSurface();
17+ MirWindow *mirWindow = static_cast<QMirClientWindow*>(window->handle())->mirWindow();
18
19- if (!surface) {
20+ if (!mirWindow) {
21 return;
22 }
23
24@@ -151,23 +151,26 @@
25 if (windowCursor) {
26 qCDebug(mirclientCursor, "changeCursor shape=%s, window=%p", qtCursorShapeToStr(windowCursor->shape()), window);
27 if (!windowCursor->pixmap().isNull()) {
28- configureMirCursorWithPixmapQCursor(surface, *windowCursor);
29+ configureMirCursorWithPixmapQCursor(mirWindow, *windowCursor);
30 } else if (windowCursor->shape() == Qt::BitmapCursor) {
31 // TODO: Implement bitmap cursor support
32- applyDefaultCursorConfiguration(surface);
33+ applyDefaultCursorConfiguration(mirWindow);
34 } else {
35 const auto &cursorName = mShapeToCursorName.value(windowCursor->shape(), QByteArray("left_ptr"));
36+#pragma GCC diagnostic push
37+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
38 auto cursorConfiguration = mir_cursor_configuration_from_name(cursorName.data());
39- mir_surface_configure_cursor(surface, cursorConfiguration);
40+#pragma GCC diagnostic pop
41+ mir_window_configure_cursor(mirWindow, cursorConfiguration);
42 mir_cursor_configuration_destroy(cursorConfiguration);
43 }
44 } else {
45- applyDefaultCursorConfiguration(surface);
46+ applyDefaultCursorConfiguration(mirWindow);
47 }
48
49 }
50
51-void QMirClientCursor::configureMirCursorWithPixmapQCursor(MirSurface *surface, QCursor &cursor)
52+void QMirClientCursor::configureMirCursorWithPixmapQCursor(MirWindow *window, QCursor &cursor)
53 {
54 QImage image = cursor.pixmap().toImage();
55
56@@ -194,16 +197,19 @@
57
58 {
59 auto configuration = mir_cursor_configuration_from_buffer_stream(bufferStream, cursor.hotSpot().x(), cursor.hotSpot().y());
60- mir_surface_configure_cursor(surface, configuration);
61+ mir_window_configure_cursor(window, configuration);
62 mir_cursor_configuration_destroy(configuration);
63 }
64
65 mir_buffer_stream_release_sync(bufferStream);
66 }
67
68-void QMirClientCursor::applyDefaultCursorConfiguration(MirSurface *surface)
69+void QMirClientCursor::applyDefaultCursorConfiguration(MirWindow *window)
70 {
71+#pragma GCC diagnostic push
72+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
73 auto cursorConfiguration = mir_cursor_configuration_from_name("left_ptr");
74- mir_surface_configure_cursor(surface, cursorConfiguration);
75+#pragma GCC diagnostic pop
76+ mir_window_configure_cursor(window, cursorConfiguration);
77 mir_cursor_configuration_destroy(cursorConfiguration);
78 }
79
80=== modified file 'src/ubuntumirclient/qmirclientcursor.h'
81--- src/ubuntumirclient/qmirclientcursor.h 2017-02-08 16:39:07 +0000
82+++ src/ubuntumirclient/qmirclientcursor.h 2017-02-08 16:39:07 +0000
83@@ -1,6 +1,6 @@
84 /****************************************************************************
85 **
86-** Copyright (C) 2015-2016 Canonical, Ltd.
87+** Copyright (C) 2015-2017 Canonical, Ltd.
88 ** Contact: https://www.qt.io/licensing/
89 **
90 ** This file is part of the plugins of the Qt Toolkit.
91@@ -46,8 +46,9 @@
92 #include <QMap>
93 #include <QByteArray>
94
95+#include <mir_toolkit/mir_window.h>
96+
97 struct MirConnection;
98-struct MirSurface;
99
100 class QMirClientCursor : public QPlatformCursor
101 {
102@@ -55,8 +56,8 @@
103 QMirClientCursor(MirConnection *connection);
104 void changeCursor(QCursor *windowCursor, QWindow *window) override;
105 private:
106- void configureMirCursorWithPixmapQCursor(MirSurface *surface, QCursor &cursor);
107- void applyDefaultCursorConfiguration(MirSurface *surface);
108+ void configureMirCursorWithPixmapQCursor(MirWindow *window, QCursor &cursor);
109+ void applyDefaultCursorConfiguration(MirWindow *window);
110 QMap<int, QByteArray> mShapeToCursorName;
111 MirConnection *mConnection;
112 };
113
114=== modified file 'src/ubuntumirclient/qmirclientdebugextension.cpp'
115--- src/ubuntumirclient/qmirclientdebugextension.cpp 2017-02-08 16:39:07 +0000
116+++ src/ubuntumirclient/qmirclientdebugextension.cpp 2017-02-08 16:39:07 +0000
117@@ -1,6 +1,6 @@
118 /****************************************************************************
119 **
120-** Copyright (C) 2016 Canonical, Ltd.
121+** Copyright (C) 2016-2017 Canonical, Ltd.
122 ** Contact: https://www.qt.io/licensing/
123 **
124 ** This file is part of the plugins of the Qt Toolkit.
125@@ -52,7 +52,7 @@
126 , m_mapper(nullptr)
127 {
128 qCDebug(mirclientDebug) << "NOTICE: Loading mirclient-debug-extension";
129- m_mapper = (MapperPrototype) m_mirclientDebug.resolve("mir_debug_surface_coords_to_screen");
130+ m_mapper = (MapperPrototype) m_mirclientDebug.resolve("mir_extension_window_coordinate_translation");
131
132 if (!m_mirclientDebug.isLoaded()) {
133 qCWarning(mirclientDebug) << "ERROR: mirclient-debug-extension failed to load:"
134@@ -68,14 +68,14 @@
135 return m_mirclientDebug.isLoaded() && m_mapper;
136 }
137
138-QPoint QMirClientDebugExtension::mapSurfacePointToScreen(MirSurface *surface, const QPoint &point)
139+QPoint QMirClientDebugExtension::mapWindowPointToScreen(MirWindow *window, const QPoint &point)
140 {
141 if (!m_mapper) {
142 return point;
143 }
144
145 QPoint mappedPoint;
146- bool status = m_mapper(surface, point.x(), point.y(), &mappedPoint.rx(), &mappedPoint.ry());
147+ bool status = m_mapper(window, point.x(), point.y(), &mappedPoint.rx(), &mappedPoint.ry());
148 if (status) {
149 return mappedPoint;
150 } else {
151
152=== modified file 'src/ubuntumirclient/qmirclientdebugextension.h'
153--- src/ubuntumirclient/qmirclientdebugextension.h 2017-02-08 16:39:07 +0000
154+++ src/ubuntumirclient/qmirclientdebugextension.h 2017-02-08 16:39:07 +0000
155@@ -1,6 +1,6 @@
156 /****************************************************************************
157 **
158-** Copyright (C) 2016 Canonical, Ltd.
159+** Copyright (C) 2016-2017 Canonical, Ltd.
160 ** Contact: https://www.qt.io/licensing/
161 **
162 ** This file is part of the plugins of the Qt Toolkit.
163@@ -43,9 +43,10 @@
164
165 #include <QPoint>
166 #include <QLibrary>
167-struct MirSurface;
168-
169-typedef bool (*MapperPrototype)(MirSurface* surface, int x, int y, int* screenX, int* screenY);
170+
171+#include <mir_toolkit/mir_window.h>
172+
173+typedef bool (*MapperPrototype)(MirWindow* window, int x, int y, int* screenX, int* screenY);
174
175
176 class QMirClientDebugExtension
177@@ -55,7 +56,7 @@
178
179 bool isEnabled() const;
180
181- QPoint mapSurfacePointToScreen(MirSurface *, const QPoint &point);
182+ QPoint mapWindowPointToScreen(MirWindow *, const QPoint &point);
183
184 private:
185 QLibrary m_mirclientDebug;
186
187=== modified file 'src/ubuntumirclient/qmirclientinput.cpp'
188--- src/ubuntumirclient/qmirclientinput.cpp 2017-02-08 16:39:07 +0000
189+++ src/ubuntumirclient/qmirclientinput.cpp 2017-02-08 16:39:07 +0000
190@@ -1,6 +1,6 @@
191 /****************************************************************************
192 **
193-** Copyright (C) 2014-2016 Canonical, Ltd.
194+** Copyright (C) 2014-2017 Canonical, Ltd.
195 ** Contact: https://www.qt.io/licensing/
196 **
197 ** This file is part of the plugins of the Qt Toolkit.
198@@ -167,22 +167,22 @@
199 0, 0
200 };
201
202-Qt::WindowState mirSurfaceStateToWindowState(MirSurfaceState state)
203+Qt::WindowState mirWindowStateToQt(MirWindowState state)
204 {
205 switch (state) {
206- case mir_surface_state_fullscreen:
207+ case mir_window_state_fullscreen:
208 return Qt::WindowFullScreen;
209- case mir_surface_state_maximized:
210- case mir_surface_state_vertmaximized:
211- case mir_surface_state_horizmaximized:
212+ case mir_window_state_maximized:
213+ case mir_window_state_vertmaximized:
214+ case mir_window_state_horizmaximized:
215 return Qt::WindowMaximized;
216- case mir_surface_state_minimized:
217+ case mir_window_state_minimized:
218 return Qt::WindowMinimized;
219- case mir_surface_state_hidden:
220+ case mir_window_state_hidden:
221 // We should be handling this state separately.
222 Q_ASSERT(false);
223- case mir_surface_state_restored:
224- case mir_surface_state_unknown:
225+ case mir_window_state_restored:
226+ case mir_window_state_unknown:
227 default:
228 return Qt::WindowNoState;
229 }
230@@ -236,28 +236,28 @@
231 return "key";
232 case mir_event_type_motion:
233 return "motion";
234- case mir_event_type_surface:
235- return "surface";
236+ case mir_event_type_window:
237+ return "window";
238 case mir_event_type_resize:
239 return "resize";
240 case mir_event_type_prompt_session_state_change:
241 return "prompt_session_state_change";
242 case mir_event_type_orientation:
243 return "orientation";
244- case mir_event_type_close_surface:
245- return "close_surface";
246+ case mir_event_type_close_window:
247+ return "close_window";
248 case mir_event_type_input:
249 return "input";
250 case mir_event_type_keymap:
251 return "keymap";
252- case mir_event_type_input_configuration:
253- return "input_configuration";
254- case mir_event_type_surface_output:
255- return "surface_output";
256+ case mir_event_type_window_output:
257+ return "window_output";
258 case mir_event_type_input_device_state:
259 return "input_device_state";
260- case mir_event_type_surface_placement:
261- return "surface_placement";
262+ case mir_event_type_window_placement:
263+ return "window_placement";
264+ default:
265+ Q_UNREACHABLE();
266 }
267 Q_UNREACHABLE();
268 }
269@@ -310,16 +310,16 @@
270 }
271 break;
272 }
273- case mir_event_type_surface:
274- handleSurfaceEvent(ubuntuEvent->window, mir_event_get_surface_event(nativeEvent));
275+ case mir_event_type_window:
276+ handleWindowEvent(ubuntuEvent->window, mir_event_get_window_event(nativeEvent));
277 break;
278- case mir_event_type_surface_output:
279- handleSurfaceOutputEvent(ubuntuEvent->window, mir_event_get_surface_output_event(nativeEvent));
280+ case mir_event_type_window_output:
281+ handleWindowOutputEvent(ubuntuEvent->window, mir_event_get_window_output_event(nativeEvent));
282 break;
283 case mir_event_type_orientation:
284 dispatchOrientationEvent(ubuntuEvent->window->window(), mir_event_get_orientation_event(nativeEvent));
285 break;
286- case mir_event_type_close_surface:
287+ case mir_event_type_close_window:
288 QWindowSystemInterface::handleCloseEvent(ubuntuEvent->window->window());
289 break;
290 default:
291@@ -618,49 +618,49 @@
292 new OrientationChangeEvent(OrientationChangeEvent::mType, orientation));
293 }
294
295-void QMirClientInput::handleSurfaceEvent(const QPointer<QMirClientWindow> &window, const MirSurfaceEvent *event)
296+void QMirClientInput::handleWindowEvent(const QPointer<QMirClientWindow> &window, const MirWindowEvent *event)
297 {
298- auto surfaceEventAttribute = mir_surface_event_get_attribute(event);
299+ auto windowEventAttribute = mir_window_event_get_attribute(event);
300
301- switch (surfaceEventAttribute) {
302- case mir_surface_attrib_focus: {
303+ switch (windowEventAttribute) {
304+ case mir_window_attrib_focus: {
305 window->handleSurfaceFocusChanged(
306- mir_surface_event_get_attribute_value(event) == mir_surface_focused);
307+ mir_window_event_get_attribute_value(event) == mir_window_focus_state_focused);
308 break;
309 }
310- case mir_surface_attrib_visibility: {
311+ case mir_window_attrib_visibility: {
312 window->handleSurfaceExposeChange(
313- mir_surface_event_get_attribute_value(event) == mir_surface_visibility_exposed);
314+ mir_window_event_get_attribute_value(event) == mir_window_visibility_exposed);
315 break;
316 }
317 // Remaining attributes are ones client sets for server, and server should not override them
318- case mir_surface_attrib_state: {
319- MirSurfaceState state = static_cast<MirSurfaceState>(mir_surface_event_get_attribute_value(event));
320+ case mir_window_attrib_state: {
321+ MirWindowState state = static_cast<MirWindowState>(mir_window_event_get_attribute_value(event));
322
323- if (state == mir_surface_state_hidden) {
324+ if (state == mir_window_state_hidden) {
325 window->handleSurfaceVisibilityChanged(false);
326 } else {
327 // it's visible!
328 window->handleSurfaceVisibilityChanged(true);
329- window->handleSurfaceStateChanged(mirSurfaceStateToWindowState(state));
330+ window->handleSurfaceStateChanged(mirWindowStateToQt(state));
331 }
332 break;
333 }
334- case mir_surface_attrib_type:
335- case mir_surface_attrib_swapinterval:
336- case mir_surface_attrib_dpi:
337- case mir_surface_attrib_preferred_orientation:
338- case mir_surface_attribs:
339+ case mir_window_attrib_type:
340+ case mir_window_attrib_swapinterval:
341+ case mir_window_attrib_dpi:
342+ case mir_window_attrib_preferred_orientation:
343+ case mir_window_attribs:
344 break;
345 }
346 }
347
348-void QMirClientInput::handleSurfaceOutputEvent(const QPointer<QMirClientWindow> &window, const MirSurfaceOutputEvent *event)
349+void QMirClientInput::handleWindowOutputEvent(const QPointer<QMirClientWindow> &window, const MirWindowOutputEvent *event)
350 {
351- const uint32_t outputId = mir_surface_output_event_get_output_id(event);
352- const int dpi = mir_surface_output_event_get_dpi(event);
353- const MirFormFactor formFactor = mir_surface_output_event_get_form_factor(event);
354- const float scale = mir_surface_output_event_get_scale(event);
355+ const uint32_t outputId = mir_window_output_event_get_output_id(event);
356+ const int dpi = mir_window_output_event_get_dpi(event);
357+ const MirFormFactor formFactor = mir_window_output_event_get_form_factor(event);
358+ const float scale = mir_window_output_event_get_scale(event);
359
360 const auto screenObserver = mIntegration->screenObserver();
361 QMirClientScreen *screen = screenObserver->findScreenWithId(outputId);
362
363=== modified file 'src/ubuntumirclient/qmirclientinput.h'
364--- src/ubuntumirclient/qmirclientinput.h 2017-02-08 16:39:07 +0000
365+++ src/ubuntumirclient/qmirclientinput.h 2017-02-08 16:39:07 +0000
366@@ -1,6 +1,6 @@
367 /****************************************************************************
368 **
369-** Copyright (C) 2014-2016 Canonical, Ltd.
370+** Copyright (C) 2014-2017 Canonical, Ltd.
371 ** Contact: https://www.qt.io/licensing/
372 **
373 ** This file is part of the plugins of the Qt Toolkit.
374@@ -71,8 +71,8 @@
375 void dispatchInputEvent(QMirClientWindow *window, const MirInputEvent *event);
376
377 void dispatchOrientationEvent(QWindow* window, const MirOrientationEvent *event);
378- void handleSurfaceEvent(const QPointer<QMirClientWindow> &window, const MirSurfaceEvent *event);
379- void handleSurfaceOutputEvent(const QPointer<QMirClientWindow> &window, const MirSurfaceOutputEvent *event);
380+ void handleWindowEvent(const QPointer<QMirClientWindow> &window, const MirWindowEvent *event);
381+ void handleWindowOutputEvent(const QPointer<QMirClientWindow> &window, const MirWindowOutputEvent *event);
382
383 private:
384 QMirClientClientIntegration* mIntegration;
385
386=== modified file 'src/ubuntumirclient/qmirclientnativeinterface.cpp'
387--- src/ubuntumirclient/qmirclientnativeinterface.cpp 2017-02-08 16:39:07 +0000
388+++ src/ubuntumirclient/qmirclientnativeinterface.cpp 2017-02-08 16:39:07 +0000
389@@ -1,6 +1,6 @@
390 /****************************************************************************
391 **
392-** Copyright (C) 2016 Canonical, Ltd.
393+** Copyright (C) 2016-2017 Canonical, Ltd.
394 ** Contact: https://www.qt.io/licensing/
395 **
396 ** This file is part of the plugins of the Qt Toolkit.
397@@ -60,7 +60,7 @@
398 insert("nativeorientation", QMirClientNativeInterface::NativeOrientation);
399 insert("display", QMirClientNativeInterface::Display);
400 insert("mirconnection", QMirClientNativeInterface::MirConnection);
401- insert("mirsurface", QMirClientNativeInterface::MirSurface);
402+ insert("mirwindow", QMirClientNativeInterface::MirWindow);
403 insert("scale", QMirClientNativeInterface::Scale);
404 insert("formfactor", QMirClientNativeInterface::FormFactor);
405 }
406@@ -137,11 +137,11 @@
407 mNativeOrientation = new Qt::ScreenOrientation(platformScreen->nativeOrientation());
408 }
409 return mNativeOrientation;
410- case MirSurface:
411+ case MirWindow:
412 if (window) {
413 auto ubuntuWindow = static_cast<QMirClientWindow*>(window->handle());
414 if (ubuntuWindow) {
415- return ubuntuWindow->mirSurface();
416+ return ubuntuWindow->mirWindow();
417 } else {
418 return nullptr;
419 }
420
421=== modified file 'src/ubuntumirclient/qmirclientnativeinterface.h'
422--- src/ubuntumirclient/qmirclientnativeinterface.h 2017-02-08 16:39:07 +0000
423+++ src/ubuntumirclient/qmirclientnativeinterface.h 2017-02-08 16:39:07 +0000
424@@ -1,6 +1,6 @@
425 /****************************************************************************
426 **
427-** Copyright (C) 2016 Canonical, Ltd.
428+** Copyright (C) 2016-2017 Canonical, Ltd.
429 ** Contact: https://www.qt.io/licensing/
430 **
431 ** This file is part of the plugins of the Qt Toolkit.
432@@ -50,7 +50,7 @@
433 class QMirClientNativeInterface : public QPlatformNativeInterface {
434 Q_OBJECT
435 public:
436- enum ResourceType { EglDisplay, EglContext, NativeOrientation, Display, MirConnection, MirSurface, Scale, FormFactor };
437+ enum ResourceType { EglDisplay, EglContext, NativeOrientation, Display, MirConnection, MirWindow, Scale, FormFactor };
438
439 QMirClientNativeInterface(const QMirClientClientIntegration *integration);
440 ~QMirClientNativeInterface();
441
442=== modified file 'src/ubuntumirclient/qmirclientwindow.cpp'
443--- src/ubuntumirclient/qmirclientwindow.cpp 2017-02-08 16:39:07 +0000
444+++ src/ubuntumirclient/qmirclientwindow.cpp 2017-02-08 16:39:07 +0000
445@@ -1,6 +1,6 @@
446 /****************************************************************************
447 **
448-** Copyright (C) 2014-2016 Canonical, Ltd.
449+** Copyright (C) 2014-2017 Canonical, Ltd.
450 ** Contact: https://www.qt.io/licensing/
451 **
452 ** This file is part of the plugins of the Qt Toolkit.
453@@ -84,14 +84,14 @@
454
455 struct MirSpecDeleter
456 {
457- void operator()(MirSurfaceSpec *spec) { mir_surface_spec_release(spec); }
458+ void operator()(MirWindowSpec *spec) { mir_window_spec_release(spec); }
459 };
460
461-using Spec = std::unique_ptr<MirSurfaceSpec, MirSpecDeleter>;
462+using Spec = std::unique_ptr<MirWindowSpec, MirSpecDeleter>;
463
464-EGLNativeWindowType nativeWindowFor(MirSurface *surf)
465+EGLNativeWindowType nativeWindowFor(MirWindow *surf)
466 {
467- auto stream = mir_surface_get_buffer_stream(surf);
468+ auto stream = mir_window_get_buffer_stream(surf);
469 return reinterpret_cast<EGLNativeWindowType>(mir_buffer_stream_get_egl_native_window(stream));
470 }
471
472@@ -112,18 +112,18 @@
473 Q_UNREACHABLE();
474 }
475
476-const char *mirSurfaceStateToStr(MirSurfaceState surfaceState)
477+const char *mirWindowStateToStr(MirWindowState windowState)
478 {
479- switch (surfaceState) {
480- case mir_surface_state_unknown: return "unknown";
481- case mir_surface_state_restored: return "restored";
482- case mir_surface_state_minimized: return "minimized";
483- case mir_surface_state_maximized: return "vertmaximized";
484- case mir_surface_state_vertmaximized: return "vertmaximized";
485- case mir_surface_state_fullscreen: return "fullscreen";
486- case mir_surface_state_horizmaximized: return "horizmaximized";
487- case mir_surface_state_hidden: return "hidden";
488- case mir_surface_states: Q_UNREACHABLE();
489+ switch (windowState) {
490+ case mir_window_state_unknown: return "unknown";
491+ case mir_window_state_restored: return "restored";
492+ case mir_window_state_minimized: return "minimized";
493+ case mir_window_state_maximized: return "vertmaximized";
494+ case mir_window_state_vertmaximized: return "vertmaximized";
495+ case mir_window_state_fullscreen: return "fullscreen";
496+ case mir_window_state_horizmaximized: return "horizmaximized";
497+ case mir_window_state_hidden: return "hidden";
498+ case mir_window_states: Q_UNREACHABLE();
499 }
500 Q_UNREACHABLE();
501 }
502@@ -146,57 +146,57 @@
503 Q_UNREACHABLE();
504 }
505
506-const char *mirSurfaceTypeToStr(MirSurfaceType type)
507+const char *mirWindowTypeToStr(MirWindowType type)
508 {
509 switch (type) {
510- case mir_surface_type_normal: return "Normal"; /**< AKA "regular" */
511- case mir_surface_type_utility: return "Utility"; /**< AKA "floating regular" */
512- case mir_surface_type_dialog: return "Dialog";
513- case mir_surface_type_gloss: return "Gloss";
514- case mir_surface_type_freestyle: return "Freestyle";
515- case mir_surface_type_menu: return "Menu";
516- case mir_surface_type_inputmethod: return "Input Method"; /**< AKA "OSK" or handwriting etc. */
517- case mir_surface_type_satellite: return "Satellite"; /**< AKA "toolbox"/"toolbar" */
518- case mir_surface_type_tip: return "Tip"; /**< AKA "tooltip" */
519- case mir_surface_types: Q_UNREACHABLE();
520+ case mir_window_type_normal: return "Normal"; /**< AKA "regular" */
521+ case mir_window_type_utility: return "Utility"; /**< AKA "floating regular" */
522+ case mir_window_type_dialog: return "Dialog";
523+ case mir_window_type_gloss: return "Gloss";
524+ case mir_window_type_freestyle: return "Freestyle";
525+ case mir_window_type_menu: return "Menu";
526+ case mir_window_type_inputmethod: return "Input Method"; /**< AKA "OSK" or handwriting etc. */
527+ case mir_window_type_satellite: return "Satellite"; /**< AKA "toolbox"/"toolbar" */
528+ case mir_window_type_tip: return "Tip"; /**< AKA "tooltip" */
529+ case mir_window_types: Q_UNREACHABLE();
530 }
531 return "";
532 }
533
534-MirSurfaceState qtWindowStateToMirSurfaceState(Qt::WindowState state)
535+MirWindowState qtWindowStateToMirWindowState(Qt::WindowState state)
536 {
537 switch (state) {
538 case Qt::WindowNoState:
539 case Qt::WindowActive:
540- return mir_surface_state_restored;
541+ return mir_window_state_restored;
542 case Qt::WindowFullScreen:
543- return mir_surface_state_fullscreen;
544+ return mir_window_state_fullscreen;
545 case Qt::WindowMaximized:
546- return mir_surface_state_maximized;
547+ return mir_window_state_maximized;
548 case Qt::WindowMinimized:
549- return mir_surface_state_minimized;
550+ return mir_window_state_minimized;
551 }
552- return mir_surface_state_unknown; // should never be reached
553+ return mir_window_state_unknown; // should never be reached
554 }
555
556-MirSurfaceType qtWindowTypeToMirSurfaceType(Qt::WindowType type)
557+MirWindowType qtWindowTypeToMirWindowType(Qt::WindowType type)
558 {
559 switch (type & Qt::WindowType_Mask) {
560 case Qt::Dialog:
561- return mir_surface_type_dialog;
562+ return mir_window_type_dialog;
563 case Qt::Sheet:
564 case Qt::Drawer:
565- return mir_surface_type_utility;
566+ return mir_window_type_utility;
567 case Qt::Popup:
568 case Qt::Tool:
569- return mir_surface_type_menu;
570+ return mir_window_type_menu;
571 case Qt::ToolTip:
572- return mir_surface_type_tip;
573+ return mir_window_type_tip;
574 case Qt::SplashScreen:
575- return mir_surface_type_freestyle;
576+ return mir_window_type_freestyle;
577 case Qt::Window:
578 default:
579- return mir_surface_type_normal;
580+ return mir_window_type_normal;
581 }
582 }
583
584@@ -225,15 +225,15 @@
585 return parent ? static_cast<QMirClientWindow *>(parent->handle()) : nullptr;
586 }
587
588-bool requiresParent(const MirSurfaceType type)
589+bool requiresParent(const MirWindowType type)
590 {
591 switch (type) {
592- case mir_surface_type_dialog: //FIXME - not quite what the specification dictates, but is what Mir's api dictates
593- case mir_surface_type_utility:
594- case mir_surface_type_gloss:
595- case mir_surface_type_menu:
596- case mir_surface_type_satellite:
597- case mir_surface_type_tip:
598+ case mir_window_type_dialog: //FIXME - not quite what the specification dictates, but is what Mir's api dictates
599+ case mir_window_type_utility:
600+ case mir_window_type_gloss:
601+ case mir_window_type_menu:
602+ case mir_window_type_satellite:
603+ case mir_window_type_tip:
604 return true;
605 default:
606 return false;
607@@ -242,7 +242,7 @@
608
609 bool requiresParent(const Qt::WindowType type)
610 {
611- return requiresParent(qtWindowTypeToMirSurfaceType(type));
612+ return requiresParent(qtWindowTypeToMirWindowType(type));
613 }
614
615 Spec makeSurfaceSpec(QWindow *window, MirPixelFormat pixelFormat, QMirClientWindow *parentWindowHandle,
616@@ -251,16 +251,16 @@
617 const auto geometry = window->geometry();
618 const int width = geometry.width() > 0 ? geometry.width() : 1;
619 const int height = geometry.height() > 0 ? geometry.height() : 1;
620- auto type = qtWindowTypeToMirSurfaceType(window->type());
621+ auto type = qtWindowTypeToMirWindowType(window->type());
622
623 if (U_ON_SCREEN_KEYBOARD_ROLE == roleFor(window)) {
624- type = mir_surface_type_inputmethod;
625+ type = mir_window_type_inputmethod;
626 }
627
628 MirRectangle location{geometry.x(), geometry.y(), 0, 0};
629- MirSurface *parent = nullptr;
630+ MirWindow *parent = nullptr;
631 if (parentWindowHandle) {
632- parent = parentWindowHandle->mirSurface();
633+ parent = parentWindowHandle->mirWindow();
634 // Qt uses absolute positioning, but Mir positions surfaces relative to parent.
635 location.top -= parentWindowHandle->geometry().top();
636 location.left -= parentWindowHandle->geometry().left();
637@@ -269,85 +269,87 @@
638 Spec spec;
639
640 switch (type) {
641- case mir_surface_type_menu:
642- spec = Spec{mir_connection_create_spec_for_menu(connection, width, height, pixelFormat, parent,
643+ case mir_window_type_menu:
644+ spec = Spec{mir_create_menu_window_spec(connection, width, height, parent,
645 &location, mir_edge_attachment_any)};
646 break;
647- case mir_surface_type_dialog:
648- spec = Spec{mir_connection_create_spec_for_modal_dialog(connection, width, height, pixelFormat, parent)};
649- break;
650- case mir_surface_type_utility:
651- spec = Spec{mir_connection_create_spec_for_dialog(connection, width, height, pixelFormat)};
652- break;
653- case mir_surface_type_tip:
654+ case mir_window_type_dialog:
655+ spec = Spec{mir_create_modal_dialog_window_spec(connection, width, height, parent)};
656+ break;
657+ case mir_window_type_utility:
658+ spec = Spec{mir_create_dialog_window_spec(connection, width, height)};
659+ break;
660+ case mir_window_type_tip:
661 #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 4, 0)
662 spec = Spec{mir_connection_create_spec_for_tooltip(connection, width, height, pixelFormat, parent,
663 &location)};
664 #else
665- spec = Spec{mir_connection_create_spec_for_tip(connection, width, height, pixelFormat, parent,
666+ spec = Spec{mir_create_tip_window_spec(connection, width, height, parent,
667 &location, mir_edge_attachment_any)};
668 #endif
669 break;
670- case mir_surface_type_inputmethod:
671- spec = Spec{mir_connection_create_spec_for_input_method(connection, width, height, pixelFormat)};
672+ case mir_window_type_inputmethod:
673+ spec = Spec{mir_create_input_method_window_spec(connection, width, height)};
674 break;
675 default:
676- spec = Spec{mir_connection_create_spec_for_normal_surface(connection, width, height, pixelFormat)};
677+ spec = Spec{mir_create_normal_window_spec(connection, width, height)};
678 break;
679 }
680
681+ mir_window_spec_set_pixel_format(spec.get(), pixelFormat);
682+
683 qCDebug(mirclient, "makeSurfaceSpec(window=%p): %s spec (type=0x%x, position=(%d, %d)px, size=(%dx%d)px)",
684- window, mirSurfaceTypeToStr(type), window->type(), location.left, location.top, width, height);
685+ window, mirWindowTypeToStr(type), window->type(), location.left, location.top, width, height);
686
687 return std::move(spec);
688 }
689
690-void setSizingConstraints(MirSurfaceSpec *spec, const QSize& minSize, const QSize& maxSize, const QSize& increment)
691+void setSizingConstraints(MirWindowSpec *spec, const QSize& minSize, const QSize& maxSize, const QSize& increment)
692 {
693- mir_surface_spec_set_min_width(spec, minSize.width());
694- mir_surface_spec_set_min_height(spec, minSize.height());
695+ mir_window_spec_set_min_width(spec, minSize.width());
696+ mir_window_spec_set_min_height(spec, minSize.height());
697 if (maxSize.width() >= minSize.width()) {
698- mir_surface_spec_set_max_width(spec, maxSize.width());
699+ mir_window_spec_set_max_width(spec, maxSize.width());
700 }
701 if (maxSize.height() >= minSize.height()) {
702- mir_surface_spec_set_max_height(spec, maxSize.height());
703+ mir_window_spec_set_max_height(spec, maxSize.height());
704 }
705 if (increment.width() > 0) {
706- mir_surface_spec_set_width_increment(spec, increment.width());
707+ mir_window_spec_set_width_increment(spec, increment.width());
708 }
709 if (increment.height() > 0) {
710- mir_surface_spec_set_height_increment(spec, increment.height());
711+ mir_window_spec_set_height_increment(spec, increment.height());
712 }
713 }
714
715-MirSurface *createMirSurface(QWindow *window, int mirOutputId, QMirClientWindow *parentWindowHandle,
716+MirWindow *createMirWindow(QWindow *window, int mirOutputId, QMirClientWindow *parentWindowHandle,
717 MirPixelFormat pixelFormat, MirConnection *connection,
718- mir_surface_event_callback inputCallback, void *inputContext)
719+ MirWindowEventCallback inputCallback, void *inputContext)
720 {
721 auto spec = makeSurfaceSpec(window, pixelFormat, parentWindowHandle, connection);
722
723 // Install event handler as early as possible
724- mir_surface_spec_set_event_handler(spec.get(), inputCallback, inputContext);
725+ mir_window_spec_set_event_handler(spec.get(), inputCallback, inputContext);
726
727 const auto title = window->title().toUtf8();
728- mir_surface_spec_set_name(spec.get(), title.constData());
729+ mir_window_spec_set_name(spec.get(), title.constData());
730
731 setSizingConstraints(spec.get(), window->minimumSize(), window->maximumSize(), window->sizeIncrement());
732
733 if (window->windowState() == Qt::WindowFullScreen) {
734- mir_surface_spec_set_fullscreen_on_output(spec.get(), mirOutputId);
735+ mir_window_spec_set_fullscreen_on_output(spec.get(), mirOutputId);
736 }
737
738 if (window->flags() & LowChromeWindowHint) {
739- mir_surface_spec_set_shell_chrome(spec.get(), mir_shell_chrome_low);
740+ mir_window_spec_set_shell_chrome(spec.get(), mir_shell_chrome_low);
741 }
742
743 if (!window->isVisible()) {
744- mir_surface_spec_set_state(spec.get(), mir_surface_state_hidden);
745+ mir_window_spec_set_state(spec.get(), mir_window_state_hidden);
746 }
747
748- auto surface = mir_surface_create_sync(spec.get());
749- Q_ASSERT(mir_surface_is_valid(surface));
750+ auto surface = mir_create_window_sync(spec.get());
751+ Q_ASSERT(mir_window_is_valid(surface));
752 return surface;
753 }
754
755@@ -415,17 +417,17 @@
756 void handleSurfaceResized(int width, int height);
757 int needsRepaint() const;
758
759- MirSurfaceState state() const { return mir_surface_get_state(mMirSurface); }
760- void setState(MirSurfaceState state);
761+ MirWindowState state() const { return mir_window_get_state(mMirWindow); }
762+ void setState(MirWindowState state);
763
764- MirSurfaceType type() const { return mir_surface_get_type(mMirSurface); }
765+ MirWindowType type() const { return mir_window_get_type(mMirWindow); }
766
767 void setShellChrome(MirShellChrome shellChrome);
768
769 EGLSurface eglSurface() const { return mEglSurface; }
770- MirSurface *mirSurface() const { return mMirSurface; }
771+ MirWindow *mirWindow() const { return mMirWindow; }
772
773- void setSurfaceParent(MirSurface*);
774+ void setSurfaceParent(MirWindow*);
775 bool hasParent() const { return mParented; }
776
777 QSurfaceFormat format() const { return mFormat; }
778@@ -435,7 +437,7 @@
779 QString persistentSurfaceId();
780
781 private:
782- static void surfaceEventCallback(MirSurface* surface, const MirEvent *event, void* context);
783+ static void surfaceEventCallback(MirWindow* surface, const MirEvent *event, void* context);
784 void postEvent(const MirEvent *event);
785
786 QWindow * const mWindow;
787@@ -444,7 +446,7 @@
788 MirConnection * const mConnection;
789 QMirClientWindow * mParentWindowHandle{nullptr};
790
791- MirSurface* mMirSurface;
792+ MirWindow* mMirWindow;
793 const EGLDisplay mEglDisplay;
794 EGLSurface mEglSurface;
795
796@@ -507,15 +509,15 @@
797
798 mParentWindowHandle = getParentIfNecessary(mWindow, input);
799
800- mMirSurface = createMirSurface(mWindow, outputId, mParentWindowHandle, mPixelFormat, connection, surfaceEventCallback, this);
801- mEglSurface = eglCreateWindowSurface(mEglDisplay, config, nativeWindowFor(mMirSurface), nullptr);
802+ mMirWindow = createMirWindow(mWindow, outputId, mParentWindowHandle, mPixelFormat, connection, surfaceEventCallback, this);
803+ mEglSurface = eglCreateWindowSurface(mEglDisplay, config, nativeWindowFor(mMirWindow), nullptr);
804
805- mNeedsExposeCatchup = mir_surface_get_visibility(mMirSurface) == mir_surface_visibility_occluded;
806+ mNeedsExposeCatchup = mir_window_get_visibility(mMirWindow) == mir_window_visibility_occluded;
807
808 // Window manager can give us a final size different from what we asked for
809 // so let's check what we ended up getting
810- MirSurfaceParameters parameters;
811- mir_surface_get_parameters(mMirSurface, &parameters);
812+ MirWindowParameters parameters;
813+ mir_window_get_parameters(mMirWindow, &parameters);
814
815 auto geom = mWindow->geometry();
816 geom.setWidth(parameters.width);
817@@ -538,18 +540,18 @@
818 {
819 if (mEglSurface != EGL_NO_SURFACE)
820 eglDestroySurface(mEglDisplay, mEglSurface);
821- if (mMirSurface) {
822- mir_surface_release_sync(mMirSurface);
823+ if (mMirWindow) {
824+ mir_window_release_sync(mMirWindow);
825 }
826 }
827
828 void UbuntuSurface::updateGeometry(const QRect &newGeometry)
829 {
830
831- auto spec = Spec{mir_connection_create_spec_for_changes(mConnection)};
832+ auto spec = Spec{mir_create_window_spec(mConnection)};
833
834- mir_surface_spec_set_width(spec.get(), newGeometry.width());
835- mir_surface_spec_set_height(spec.get(), newGeometry.height());
836+ mir_window_spec_set_width(spec.get(), newGeometry.width());
837+ mir_window_spec_set_height(spec.get(), newGeometry.height());
838
839 MirRectangle mirRect {0,0,0,0};
840
841@@ -568,26 +570,26 @@
842 mirRect.top = newGeometry.y();
843 }
844
845- mir_surface_spec_set_placement(spec.get(), &mirRect,
846+ mir_window_spec_set_placement(spec.get(), &mirRect,
847 mir_placement_gravity_northwest /* rect_gravity */, mir_placement_gravity_northwest /* surface_gravity */,
848 (MirPlacementHints)0, 0 /* offset_dx */, 0 /* offset_dy */);
849
850- mir_surface_apply_spec(mMirSurface, spec.get());
851+ mir_window_apply_spec(mMirWindow, spec.get());
852 }
853
854 void UbuntuSurface::updateTitle(const QString& newTitle)
855 {
856 const auto title = newTitle.toUtf8();
857- Spec spec{mir_connection_create_spec_for_changes(mConnection)};
858- mir_surface_spec_set_name(spec.get(), title.constData());
859- mir_surface_apply_spec(mMirSurface, spec.get());
860+ Spec spec{mir_create_window_spec(mConnection)};
861+ mir_window_spec_set_name(spec.get(), title.constData());
862+ mir_window_apply_spec(mMirWindow, spec.get());
863 }
864
865 void UbuntuSurface::setSizingConstraints(const QSize& minSize, const QSize& maxSize, const QSize& increment)
866 {
867- Spec spec{mir_connection_create_spec_for_changes(mConnection)};
868+ Spec spec{mir_create_window_spec(mConnection)};
869 ::setSizingConstraints(spec.get(), minSize, maxSize, increment);
870- mir_surface_apply_spec(mMirSurface, spec.get());
871+ mir_window_apply_spec(mMirWindow, spec.get());
872 }
873
874 void UbuntuSurface::handleSurfaceResized(int width, int height)
875@@ -620,17 +622,17 @@
876 return 0;
877 }
878
879-void UbuntuSurface::setState(MirSurfaceState state)
880+void UbuntuSurface::setState(MirWindowState state)
881 {
882- mir_wait_for(mir_surface_set_state(mMirSurface, state));
883+ mir_window_set_state(mMirWindow, state);
884 }
885
886 void UbuntuSurface::setShellChrome(MirShellChrome chrome)
887 {
888 if (chrome != mShellChrome) {
889- auto spec = Spec{mir_connection_create_spec_for_changes(mConnection)};
890- mir_surface_spec_set_shell_chrome(spec.get(), chrome);
891- mir_surface_apply_spec(mMirSurface, spec.get());
892+ auto spec = Spec{mir_create_window_spec(mConnection)};
893+ mir_window_spec_set_shell_chrome(spec.get(), chrome);
894+ mir_window_apply_spec(mMirWindow, spec.get());
895
896 mShellChrome = chrome;
897 }
898@@ -667,7 +669,7 @@
899 }
900 }
901
902-void UbuntuSurface::surfaceEventCallback(MirSurface *surface, const MirEvent *event, void* context)
903+void UbuntuSurface::surfaceEventCallback(MirWindow *surface, const MirEvent *event, void* context)
904 {
905 Q_UNUSED(surface);
906 Q_ASSERT(context != nullptr);
907@@ -697,20 +699,20 @@
908 mInput->postEvent(mPlatformWindow, event);
909 }
910
911-void UbuntuSurface::setSurfaceParent(MirSurface* parent)
912+void UbuntuSurface::setSurfaceParent(MirWindow* parent)
913 {
914 qCDebug(mirclient, "setSurfaceParent(window=%p)", mWindow);
915
916 mParented = true;
917- Spec spec{mir_connection_create_spec_for_changes(mConnection)};
918- mir_surface_spec_set_parent(spec.get(), parent);
919- mir_surface_apply_spec(mMirSurface, spec.get());
920+ Spec spec{mir_create_window_spec(mConnection)};
921+ mir_window_spec_set_parent(spec.get(), parent);
922+ mir_window_apply_spec(mMirWindow, spec.get());
923 }
924
925 QString UbuntuSurface::persistentSurfaceId()
926 {
927 if (mPersistentIdStr.isEmpty()) {
928- MirPersistentId* mirPermaId = mir_surface_request_persistent_id_sync(mMirSurface);
929+ MirPersistentId* mirPermaId = mir_window_request_persistent_id_sync(mMirWindow);
930 mPersistentIdStr = mir_persistent_id_as_string(mirPermaId);
931 mir_persistent_id_release(mirPermaId);
932 }
933@@ -738,7 +740,7 @@
934 qCDebug(mirclient, "QMirClientWindow(window=%p, screen=%p, input=%p, surf=%p) with title '%s', role: '%d'",
935 w, w->screen()->handle(), input, mSurface.get(), qPrintable(window()->title()), roleFor(window()));
936
937- updatePanelHeightHack(mSurface->state() != mir_surface_state_fullscreen);
938+ updatePanelHeightHack(mSurface->state() != mir_window_state_fullscreen);
939
940 // queue the windowPropertyChanged signal. If it's emitted directly, the platformWindow will not yet be set for the window.
941 QMetaObject::invokeMethod(mNativeInterface, "windowPropertyChanged", Qt::QueuedConnection,
942@@ -878,7 +880,7 @@
943 {
944 if (mDebugExtention) {
945 auto geom = QPlatformWindow::geometry();
946- geom.moveTopLeft(mDebugExtention->mapSurfacePointToScreen(mSurface->mirSurface(), QPoint(0,0)));
947+ geom.moveTopLeft(mDebugExtention->mapWindowPointToScreen(mSurface->mirWindow(), QPoint(0,0)));
948 return geom;
949 } else {
950 return QPlatformWindow::geometry();
951@@ -919,7 +921,7 @@
952 // so morph it into a modal dialog
953 auto parent = transientParentFor(window());
954 if (parent) {
955- mSurface->setSurfaceParent(parent->mirSurface());
956+ mSurface->setSurfaceParent(parent->mirWindow());
957 }
958 }
959 }
960@@ -961,7 +963,7 @@
961 QPoint QMirClientWindow::mapToGlobal(const QPoint &pos) const
962 {
963 if (mDebugExtention) {
964- return mDebugExtention->mapSurfacePointToScreen(mSurface->mirSurface(), pos);
965+ return mDebugExtention->mapWindowPointToScreen(mSurface->mirWindow(), pos);
966 } else {
967 return pos;
968 }
969@@ -972,9 +974,9 @@
970 return mSurface->eglSurface();
971 }
972
973-MirSurface *QMirClientWindow::mirSurface() const
974+MirWindow *QMirClientWindow::mirWindow() const
975 {
976- return mSurface->mirSurface();
977+ return mSurface->mirWindow();
978 }
979
980 WId QMirClientWindow::winId() const
981@@ -1008,7 +1010,7 @@
982 if (!qFuzzyCompare(scale, mScale)) {
983 mScale = scale;
984 // update the panelHeight hack since it depends on GU
985- updatePanelHeightHack(mSurface->state() != mir_surface_state_fullscreen);
986+ updatePanelHeightHack(mSurface->state() != mir_window_state_fullscreen);
987
988 Q_EMIT mNativeInterface->windowPropertyChanged(this, QStringLiteral("scale"));
989 }
990@@ -1017,14 +1019,14 @@
991 void QMirClientWindow::updateSurfaceState()
992 {
993 QMutexLocker lock(&mMutex);
994- MirSurfaceState newState = mWindowVisible ? qtWindowStateToMirSurfaceState(mWindowState) :
995- mir_surface_state_hidden;
996- qCDebug(mirclient, "updateSurfaceState (window=%p, surfaceState=%s)", window(), mirSurfaceStateToStr(newState));
997+ MirWindowState newState = mWindowVisible ? qtWindowStateToMirWindowState(mWindowState) :
998+ mir_window_state_hidden;
999+ qCDebug(mirclient, "updateSurfaceState (window=%p, surfaceState=%s)", window(), mirWindowStateToStr(newState));
1000 if (newState != mSurface->state()) {
1001 mSurface->setState(newState);
1002
1003 lock.unlock();
1004- updatePanelHeightHack(newState != mir_surface_state_fullscreen);
1005+ updatePanelHeightHack(newState != mir_window_state_fullscreen);
1006 }
1007 }
1008
1009
1010=== modified file 'src/ubuntumirclient/qmirclientwindow.h'
1011--- src/ubuntumirclient/qmirclientwindow.h 2017-02-08 16:39:07 +0000
1012+++ src/ubuntumirclient/qmirclientwindow.h 2017-02-08 16:39:07 +0000
1013@@ -1,6 +1,6 @@
1014 /****************************************************************************
1015 **
1016-** Copyright (C) 2014-2016 Canonical, Ltd.
1017+** Copyright (C) 2014-2017 Canonical, Ltd.
1018 ** Contact: https://www.qt.io/licensing/
1019 **
1020 ** This file is part of the plugins of the Qt Toolkit.
1021@@ -46,6 +46,7 @@
1022 #include <QMutex>
1023
1024 #include <mir_toolkit/common.h> // needed only for MirFormFactor enum
1025+#include <mir_toolkit/mir_window.h>
1026
1027 #include <memory>
1028
1029@@ -57,7 +58,6 @@
1030 class QMirClientInput;
1031 class QMirClientScreen;
1032 class UbuntuSurface;
1033-struct MirSurface;
1034 class MirConnection;
1035
1036 class QMirClientWindow : public QObject, public QPlatformWindow
1037@@ -89,7 +89,7 @@
1038
1039 // New methods.
1040 void *eglSurface() const;
1041- MirSurface *mirSurface() const;
1042+ MirWindow *mirWindow() const;
1043 void handleSurfaceResized(int width, int height);
1044 void handleSurfaceExposeChange(bool exposed);
1045 void handleSurfaceFocusChanged(bool focused);

Subscribers

People subscribed via source and target branches