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

Proposed by Alan Griffiths
Status: Merged
Approved by: Gerry Boland
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
Gerry Boland (community) Approve
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.
Revision history for this message
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
563. By Alan Griffiths

Better names

Revision history for this message
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)
Revision history for this message
Gerry Boland (gerboland) wrote :

Sure, why not

review: Approve
Revision history for this message
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
=== modified file 'miral-shell/floating_window_manager.cpp'
--- miral-shell/floating_window_manager.cpp 2017-04-18 15:12:42 +0000
+++ miral-shell/floating_window_manager.cpp 2017-07-17 11:44:59 +0000
@@ -237,14 +237,14 @@
237237
238 auto new_width = std::max(old_size.width + delta_width, Width{5});238 auto new_width = std::max(old_size.width + delta_width, Width{5});
239 auto new_height = std::max(old_size.height + delta_height, Height{5});239 auto new_height = std::max(old_size.height + delta_height, Height{5});
240 Displacement delta{240 Displacement movement{
241 DeltaX{touch_pinch_left - old_touch_pinch_left},241 DeltaX{touch_pinch_left - old_touch_pinch_left},
242 DeltaY{touch_pinch_top - old_touch_pinch_top}};242 DeltaY{touch_pinch_top - old_touch_pinch_top}};
243243
244 auto& window_info = tools.info_for(window);244 auto& window_info = tools.info_for(window);
245 keep_size_within_limits(window_info, delta, new_width, new_height);245 keep_window_within_constraints(window_info, movement, new_width, new_height);
246246
247 auto new_pos = window.top_left() + delta;247 auto new_pos = window.top_left() + movement;
248 Size new_size{new_width, new_height};248 Size new_size{new_width, new_height};
249249
250 { // Workaround for lp:1627697250 { // Workaround for lp:1627697
@@ -561,15 +561,15 @@
561 int const x_sign = left_resize? -1 : 1;561 int const x_sign = left_resize? -1 : 1;
562 int const y_sign = top_resize? -1 : 1;562 int const y_sign = top_resize? -1 : 1;
563563
564 auto delta = cursor-old_cursor;564 auto movement = cursor-old_cursor;
565565
566 auto new_width = old_pos.size.width + x_sign * delta.dx;566 auto new_width = old_pos.size.width + x_sign * movement.dx;
567 auto new_height = old_pos.size.height + y_sign * delta.dy;567 auto new_height = old_pos.size.height + y_sign * movement.dy;
568568
569 keep_size_within_limits(window_info, delta, new_width, new_height);569 keep_window_within_constraints(window_info, movement, new_width, new_height);
570570
571 Size new_size{new_width, new_height};571 Size new_size{new_width, new_height};
572 Point new_pos = top_left + left_resize*delta.dx + top_resize*delta.dy;572 Point new_pos = top_left + left_resize*movement.dx + top_resize*movement.dy;
573573
574 WindowSpecification modifications;574 WindowSpecification modifications;
575 modifications.top_left() = new_pos;575 modifications.top_left() = new_pos;
@@ -579,24 +579,46 @@
579 return true;579 return true;
580}580}
581581
582void FloatingWindowManagerPolicy::keep_size_within_limits(582void FloatingWindowManagerPolicy::keep_window_within_constraints(
583 WindowInfo const& window_info, Displacement& delta, Width& new_width, Height& new_height) const583 WindowInfo const& window_info, Displacement& movement, Width& new_width, Height& new_height) const
584{584{
585 switch (window_info.state())
586 {
587 case mir_window_state_maximized:
588 case mir_window_state_fullscreen:
589 new_width = window_info.window().size().width;
590 new_height = window_info.window().size().height;
591 movement = {0, 0};
592 break;
593
594 case mir_window_state_vertmaximized:
595 new_height = window_info.window().size().height;
596 movement.dy = DeltaY{0};
597 break;
598
599 case mir_window_state_horizmaximized:
600 new_width = window_info.window().size().width;
601 movement.dx - DeltaX{0};
602 break;
603
604 default:;
605 }
606
585 auto const min_width = std::max(window_info.min_width(), Width{5});607 auto const min_width = std::max(window_info.min_width(), Width{5});
586 auto const min_height = std::max(window_info.min_height(), Height{5});608 auto const min_height = std::max(window_info.min_height(), Height{5});
587609
588 if (new_width < min_width)610 if (new_width < min_width)
589 {611 {
590 new_width = min_width;612 new_width = min_width;
591 if (delta.dx > DeltaX{0})613 if (movement.dx > DeltaX{0})
592 delta.dx = DeltaX{0};614 movement.dx = DeltaX{0};
593 }615 }
594616
595 if (new_height < min_height)617 if (new_height < min_height)
596 {618 {
597 new_height = min_height;619 new_height = min_height;
598 if (delta.dy > DeltaY{0})620 if (movement.dy > DeltaY{0})
599 delta.dy = DeltaY{0};621 movement.dy = DeltaY{0};
600 }622 }
601623
602 auto const max_width = window_info.max_width();624 auto const max_width = window_info.max_width();
@@ -605,15 +627,15 @@
605 if (new_width > max_width)627 if (new_width > max_width)
606 {628 {
607 new_width = max_width;629 new_width = max_width;
608 if (delta.dx < DeltaX{0})630 if (movement.dx < DeltaX{0})
609 delta.dx = DeltaX{0};631 movement.dx = DeltaX{0};
610 }632 }
611633
612 if (new_height > max_height)634 if (new_height > max_height)
613 {635 {
614 new_height = max_height;636 new_height = max_height;
615 if (delta.dy < DeltaY{0})637 if (movement.dy < DeltaY{0})
616 delta.dy = DeltaY{0};638 movement.dy = DeltaY{0};
617 }639 }
618}640}
619641
620642
=== modified file 'miral-shell/floating_window_manager.h'
--- miral-shell/floating_window_manager.h 2017-04-18 15:12:42 +0000
+++ miral-shell/floating_window_manager.h 2017-07-17 11:44:59 +0000
@@ -106,9 +106,9 @@
106106
107 void end_resize();107 void end_resize();
108108
109 void keep_size_within_limits(109 void keep_window_within_constraints(
110 miral::WindowInfo const& window_info,110 miral::WindowInfo const& window_info,
111 Displacement& delta,111 Displacement& movement,
112 Width& new_width,112 Width& new_width,
113 Height& new_height) const;113 Height& new_height) const;
114114

Subscribers

People subscribed via source and target branches