Merge lp:~dandrader/qtmir/allowClientResize into lp:qtmir

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Lukáš Tinkl
Approved revision: 611
Merged at revision: 619
Proposed branch: lp:~dandrader/qtmir/allowClientResize
Merge into: lp:qtmir
Diff against target: 155 lines (+41/-6)
8 files modified
CMakeLists.txt (+1/-1)
debian/control (+2/-2)
debian/gles-patches/convert-to-gles.patch (+1/-1)
src/common/windowmodelnotifier.h (+5/-0)
src/modules/Unity/Application/mirsurface.cpp (+15/-0)
src/modules/Unity/Application/mirsurface.h (+3/-0)
src/platforms/mirserver/windowmanagementpolicy.cpp (+11/-2)
tests/framework/fake_mirsurface.h (+3/-0)
To merge this branch: bzr merge lp:~dandrader/qtmir/allowClientResize
Reviewer Review Type Date Requested Status
Lukáš Tinkl (community) Abstain
Unity8 CI Bot (community) continuous-integration Approve
Gerry Boland (community) Approve
Review via email: mp+319209@code.launchpad.net

Commit message

Implement MirSurface::allowClientResize

Description of the change

Prereq-archive: ppa:ci-train-ppa-service/2555

* Are there any related MPs required for this MP to build/function as expected? Please list.
https://code.launchpad.net/~dandrader/unity-api/surfaceAllowClientResize/+merge/319730
https://code.launchpad.net/~dandrader/unity8/allowClientResize/+merge/319210

* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Not applicable

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

- CanonicalWindowManagerPolicy::handle_modify_window(windowInfo, modifications);
+ tools.modify_window(window_info, modifications);

I'd prefer you kept the reference to the CanonicalWindowManagerPolicy, for consistency. We're trying to use as much Mir code as possible (even though it is trivial)

+ auto extraWindowInfo = getExtraInfo(windowInfo);
const auto & <- to save a copy?

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

On 08/03/2017 09:17, Gerry Boland wrote:
> + auto extraWindowInfo = getExtraInfo(windowInfo);
> const auto & <- to save a copy?

Are you sure? getExtraInfo() returns a std::shared_ptr<>. Won't move
semantics take care of that?

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> On 08/03/2017 09:17, Gerry Boland wrote:
> > + auto extraWindowInfo = getExtraInfo(windowInfo);
> > const auto & <- to save a copy?
>
> Are you sure? getExtraInfo() returns a std::shared_ptr<>. Won't move
> semantics take care of that?

The times that 'const auto&' gains over 'const auto' are mostly those when the function returns a reference.

For any function that returns a type (i.e. not a reference) it is very likely that RVO "takes care of it" and invoking move semantics would actually be less efficient.

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

Ok, compilers can do magic

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

- pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=26)
+ pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=27)

You also need to add the above to the toplevel CMakeLists.txt so that it compiles

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

> - pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=26)
> + pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=27)
>
> You also need to add the above to the toplevel CMakeLists.txt so that it
> compiles

Done.

611. By Daniel d'Andrada

bump unity-shell-application required version

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:611
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/572/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4428
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4456
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4289
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4289/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4289
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4289/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4289
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4289/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4289
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4289/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4289
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4289/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4289
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4289/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) :
review: Abstain

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2017-02-08 19:53:50 +0000
3+++ CMakeLists.txt 2017-03-13 19:42:34 +0000
4@@ -90,7 +90,7 @@
5 pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt)
6 pkg_check_modules(QTDBUSTEST libqtdbustest-1 REQUIRED)
7 pkg_check_modules(QTDBUSMOCK libqtdbusmock-1 REQUIRED)
8-pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=26)
9+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=27)
10 pkg_check_modules(CGMANAGER libcgmanager REQUIRED)
11 pkg_check_modules(CONTENT_HUB libcontent-hub>=0.2 REQUIRED)
12
13
14=== modified file 'debian/control'
15--- debian/control 2017-03-07 23:41:44 +0000
16+++ debian/control 2017-03-13 19:42:34 +0000
17@@ -25,7 +25,7 @@
18 libubuntu-app-launch3-dev,
19 libubuntu-application-api-dev (>= 2.1.0),
20 libudev-dev,
21- libunity-api-dev (>= 8.2),
22+ libunity-api-dev (>= 8.5),
23 liburl-dispatcher1-dev,
24 libxkbcommon-dev,
25 libxrender-dev,
26@@ -102,7 +102,7 @@
27 Conflicts: libqtmir,
28 libunity-mir1,
29 Provides: unity-application-impl,
30- unity-application-impl-26,
31+ unity-application-impl-27,
32 Description: Qt plugin for Unity specific Mir APIs
33 QtMir provides Qt/QML bindings for Mir features that are exposed through the
34 qtmir-desktop or qtmir-android QPA plugin such as Application management
35
36=== modified file 'debian/gles-patches/convert-to-gles.patch'
37--- debian/gles-patches/convert-to-gles.patch 2017-02-15 13:20:44 +0000
38+++ debian/gles-patches/convert-to-gles.patch 2017-03-13 19:42:34 +0000
39@@ -84,7 +84,7 @@
40 -Conflicts: libqtmir,
41 - libunity-mir1,
42 -Provides: unity-application-impl,
43-- unity-application-impl-26,
44+- unity-application-impl-27,
45 -Description: Qt plugin for Unity specific Mir APIs
46 - QtMir provides Qt/QML bindings for Mir features that are exposed through the
47 - qtmir-desktop or qtmir-android QPA plugin such as Application management
48
49=== modified file 'src/common/windowmodelnotifier.h'
50--- src/common/windowmodelnotifier.h 2017-01-18 21:24:15 +0000
51+++ src/common/windowmodelnotifier.h 2017-03-13 19:42:34 +0000
52@@ -20,6 +20,7 @@
53 #include <QObject>
54 #include <QPoint>
55 #include <QSize>
56+#include <QMutex>
57
58 #include <miral/window_info.h>
59
60@@ -58,6 +59,10 @@
61 // Mir::MaximizedBottomLeftState:
62 // Mir::MaximizedBottomRightState:
63 Mir::State state{Mir::UnknownState};
64+
65+ bool allowClientResize{true};
66+
67+ QMutex mutex;
68 };
69
70 std::shared_ptr<ExtraWindowInfo> getExtraInfo(const miral::WindowInfo &windowInfo);
71
72=== modified file 'src/modules/Unity/Application/mirsurface.cpp'
73--- src/modules/Unity/Application/mirsurface.cpp 2017-03-07 23:42:05 +0000
74+++ src/modules/Unity/Application/mirsurface.cpp 2017-03-13 19:42:34 +0000
75@@ -767,6 +767,7 @@
76
77 void MirSurface::emitSizeChanged()
78 {
79+ qCDebug(QTMIR_SURFACES).nospace() << "MirSurface[" << (void*)this << "," << appId() << "]::sizeChanged(" << m_size << ")";
80 Q_EMIT sizeChanged(m_size);
81 }
82
83@@ -937,6 +938,20 @@
84 return m_surface->confine_pointer_state() == mir_pointer_confined_to_window;
85 }
86
87+bool MirSurface::allowClientResize() const
88+{
89+ return m_extraInfo->allowClientResize;
90+}
91+
92+void MirSurface::setAllowClientResize(bool value)
93+{
94+ if (m_extraInfo->allowClientResize != value) {
95+ QMutexLocker locker(&m_extraInfo->mutex);
96+ m_extraInfo->allowClientResize = value;
97+ Q_EMIT allowClientResizeChanged(value);
98+ }
99+}
100+
101 void MirSurface::activate()
102 {
103 INFO_MSG << "()";
104
105=== modified file 'src/modules/Unity/Application/mirsurface.h'
106--- src/modules/Unity/Application/mirsurface.h 2017-02-02 09:17:48 +0000
107+++ src/modules/Unity/Application/mirsurface.h 2017-03-13 19:42:34 +0000
108@@ -96,6 +96,9 @@
109
110 bool confinesMousePointer() const override;
111
112+ bool allowClientResize() const override;
113+ void setAllowClientResize(bool) override;
114+
115 Q_INVOKABLE void activate() override;
116
117 unity::shell::application::MirSurfaceInterface *parentSurface() const override;
118
119=== modified file 'src/platforms/mirserver/windowmanagementpolicy.cpp'
120--- src/platforms/mirserver/windowmanagementpolicy.cpp 2017-02-15 13:21:50 +0000
121+++ src/platforms/mirserver/windowmanagementpolicy.cpp 2017-03-13 19:42:34 +0000
122@@ -90,9 +90,18 @@
123
124 void WindowManagementPolicy::handle_modify_window(
125 miral::WindowInfo &windowInfo,
126- const miral::WindowSpecification &modifications)
127+ const miral::WindowSpecification &modificationsClient)
128 {
129- // TODO this applies the default policy. Qt needs to process the request instead
130+ miral::WindowSpecification modifications(modificationsClient);
131+
132+ if (modifications.size().is_set()) {
133+ auto extraWindowInfo = getExtraInfo(windowInfo);
134+ QMutexLocker locker(&extraWindowInfo->mutex);
135+ if (!extraWindowInfo->allowClientResize) {
136+ modifications.size().consume();
137+ }
138+ }
139+
140 CanonicalWindowManagerPolicy::handle_modify_window(windowInfo, modifications);
141
142 // TODO Once Qt processes the request we probably don't want to notify from here
143
144=== modified file 'tests/framework/fake_mirsurface.h'
145--- tests/framework/fake_mirsurface.h 2017-02-02 09:17:48 +0000
146+++ tests/framework/fake_mirsurface.h 2017-03-13 19:42:34 +0000
147@@ -79,6 +79,9 @@
148 QRect inputBounds() const override { return QRect(0,0,10,10); }
149 bool confinesMousePointer() const override { return false; }
150
151+ bool allowClientResize() const override { return true; }
152+ void setAllowClientResize(bool) override {}
153+
154 unity::shell::application::MirSurfaceInterface *parentSurface() const override { return nullptr; }
155 unity::shell::application::MirSurfaceListInterface *childSurfaceList() const override { return nullptr; }
156

Subscribers

People subscribed via source and target branches