Merge lp:~alan-griffiths/miral/fix-1704776 into lp:miral

Proposed by Alan Griffiths on 2017-07-17
Status: Merged
Approved by: Gerry Boland on 2017-07-17
Approved revision: 563
Merged at revision: 563
Proposed branch: lp:~alan-griffiths/miral/fix-1704776
Merge into: lp:miral
Diff against target: 132 lines (+44/-22)
2 files modified
miral-shell/floating_window_manager.cpp (+42/-20)
miral-shell/floating_window_manager.h (+2/-2)
To merge this branch: bzr merge lp:~alan-griffiths/miral/fix-1704776
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve on 2017-07-17
Gerry Boland (community) 2017-07-17 Approve on 2017-07-17
Review via email: mp+327514@code.launchpad.net

Commit message

[miral-shell] "floating" window manager allows resizing maximized windows

To post a comment you must log in.
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:562
https://mir-jenkins.ubuntu.com/job/miral-ci/39/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-miral/59
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4930
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4919
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4919
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4919
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=artful/63
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=artful/63/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=xenial/63
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=xenial/63/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=zesty/63
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=zesty/63/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=artful/63
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=artful/63/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=xenial/63
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=xenial/63/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=zesty/63
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=zesty/63/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/miral-ci/39/rebuild

review: Approve (continuous-integration)
lp:~alan-griffiths/miral/fix-1704776 updated on 2017-07-17
563. By Alan Griffiths on 2017-07-17

Better names

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:563
https://mir-jenkins.ubuntu.com/job/miral-ci/40/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-miral/60/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4931
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4920
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4920
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4920
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=artful/64/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=xenial/64
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=xenial/64/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=zesty/64
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=zesty/64/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=artful/64
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=artful/64/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=xenial/64
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=xenial/64/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=zesty/64
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=zesty/64/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/miral-ci/40/rebuild

review: Needs Fixing (continuous-integration)
Gerry Boland (gerboland) wrote :

Sure, why not

review: Approve
Mir CI Bot (mir-ci-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'miral-shell/floating_window_manager.cpp'
2--- miral-shell/floating_window_manager.cpp 2017-04-18 15:12:42 +0000
3+++ miral-shell/floating_window_manager.cpp 2017-07-17 11:44:59 +0000
4@@ -237,14 +237,14 @@
5
6 auto new_width = std::max(old_size.width + delta_width, Width{5});
7 auto new_height = std::max(old_size.height + delta_height, Height{5});
8- Displacement delta{
9+ Displacement movement{
10 DeltaX{touch_pinch_left - old_touch_pinch_left},
11 DeltaY{touch_pinch_top - old_touch_pinch_top}};
12
13 auto& window_info = tools.info_for(window);
14- keep_size_within_limits(window_info, delta, new_width, new_height);
15+ keep_window_within_constraints(window_info, movement, new_width, new_height);
16
17- auto new_pos = window.top_left() + delta;
18+ auto new_pos = window.top_left() + movement;
19 Size new_size{new_width, new_height};
20
21 { // Workaround for lp:1627697
22@@ -561,15 +561,15 @@
23 int const x_sign = left_resize? -1 : 1;
24 int const y_sign = top_resize? -1 : 1;
25
26- auto delta = cursor-old_cursor;
27-
28- auto new_width = old_pos.size.width + x_sign * delta.dx;
29- auto new_height = old_pos.size.height + y_sign * delta.dy;
30-
31- keep_size_within_limits(window_info, delta, new_width, new_height);
32+ auto movement = cursor-old_cursor;
33+
34+ auto new_width = old_pos.size.width + x_sign * movement.dx;
35+ auto new_height = old_pos.size.height + y_sign * movement.dy;
36+
37+ keep_window_within_constraints(window_info, movement, new_width, new_height);
38
39 Size new_size{new_width, new_height};
40- Point new_pos = top_left + left_resize*delta.dx + top_resize*delta.dy;
41+ Point new_pos = top_left + left_resize*movement.dx + top_resize*movement.dy;
42
43 WindowSpecification modifications;
44 modifications.top_left() = new_pos;
45@@ -579,24 +579,46 @@
46 return true;
47 }
48
49-void FloatingWindowManagerPolicy::keep_size_within_limits(
50- WindowInfo const& window_info, Displacement& delta, Width& new_width, Height& new_height) const
51+void FloatingWindowManagerPolicy::keep_window_within_constraints(
52+ WindowInfo const& window_info, Displacement& movement, Width& new_width, Height& new_height) const
53 {
54+ switch (window_info.state())
55+ {
56+ case mir_window_state_maximized:
57+ case mir_window_state_fullscreen:
58+ new_width = window_info.window().size().width;
59+ new_height = window_info.window().size().height;
60+ movement = {0, 0};
61+ break;
62+
63+ case mir_window_state_vertmaximized:
64+ new_height = window_info.window().size().height;
65+ movement.dy = DeltaY{0};
66+ break;
67+
68+ case mir_window_state_horizmaximized:
69+ new_width = window_info.window().size().width;
70+ movement.dx - DeltaX{0};
71+ break;
72+
73+ default:;
74+ }
75+
76 auto const min_width = std::max(window_info.min_width(), Width{5});
77 auto const min_height = std::max(window_info.min_height(), Height{5});
78
79 if (new_width < min_width)
80 {
81 new_width = min_width;
82- if (delta.dx > DeltaX{0})
83- delta.dx = DeltaX{0};
84+ if (movement.dx > DeltaX{0})
85+ movement.dx = DeltaX{0};
86 }
87
88 if (new_height < min_height)
89 {
90 new_height = min_height;
91- if (delta.dy > DeltaY{0})
92- delta.dy = DeltaY{0};
93+ if (movement.dy > DeltaY{0})
94+ movement.dy = DeltaY{0};
95 }
96
97 auto const max_width = window_info.max_width();
98@@ -605,15 +627,15 @@
99 if (new_width > max_width)
100 {
101 new_width = max_width;
102- if (delta.dx < DeltaX{0})
103- delta.dx = DeltaX{0};
104+ if (movement.dx < DeltaX{0})
105+ movement.dx = DeltaX{0};
106 }
107
108 if (new_height > max_height)
109 {
110 new_height = max_height;
111- if (delta.dy < DeltaY{0})
112- delta.dy = DeltaY{0};
113+ if (movement.dy < DeltaY{0})
114+ movement.dy = DeltaY{0};
115 }
116 }
117
118
119=== modified file 'miral-shell/floating_window_manager.h'
120--- miral-shell/floating_window_manager.h 2017-04-18 15:12:42 +0000
121+++ miral-shell/floating_window_manager.h 2017-07-17 11:44:59 +0000
122@@ -106,9 +106,9 @@
123
124 void end_resize();
125
126- void keep_size_within_limits(
127+ void keep_window_within_constraints(
128 miral::WindowInfo const& window_info,
129- Displacement& delta,
130+ Displacement& movement,
131 Width& new_width,
132 Height& new_height) const;
133

Subscribers

People subscribed via source and target branches