Mir

Merge lp:~alan-griffiths/mir/tiling-after-display-reconfig into lp:mir

Proposed by Alan Griffiths on 2017-09-26
Status: Merged
Merged at revision: 4273
Proposed branch: lp:~alan-griffiths/mir/tiling-after-display-reconfig
Merge into: lp:mir
Diff against target: 69 lines (+20/-15)
2 files modified
examples/miral-shell/tiling_window_manager.cpp (+18/-14)
src/miral/display_configuration_listeners.cpp (+2/-1)
To merge this branch: bzr merge lp:~alan-griffiths/mir/tiling-after-display-reconfig
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve on 2017-09-27
Mir development team 2017-09-26 Pending
Review via email: mp+331378@code.launchpad.net

Commit message

Fix the worst of the retiling bugs when the a display is unplugged

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

PASSED: Continuous integration, rev:4270
https://mir-jenkins.ubuntu.com/job/mir-ci/3697/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/5069
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5305
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5293
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5293
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5293
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5113
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5113/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5113
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5113/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5113
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5113/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5113
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5113/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5113
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5113/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5113
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5113/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5113
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5113/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5113
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5113/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/miral-shell/tiling_window_manager.cpp'
2--- examples/miral-shell/tiling_window_manager.cpp 2017-08-21 15:58:34 +0000
3+++ examples/miral-shell/tiling_window_manager.cpp 2017-09-26 20:21:37 +0000
4@@ -529,20 +529,26 @@
5
6 if (!window_info.parent())
7 {
8- auto const new_pos = window.top_left() + (new_tile.top_left - old_tile.top_left);
9- auto const offset = new_pos - new_tile.top_left;
10-
11- // For now just scale if was filling width/height of tile
12- auto const old_size = window.size();
13- auto const scaled_width = old_size.width == old_tile.size.width ? new_tile.size.width : old_size.width;
14- auto const scaled_height = old_size.height == old_tile.size.height ? new_tile.size.height : old_size.height;
15-
16- auto width = std::min(new_tile.size.width.as_int() - offset.dx.as_int(), scaled_width.as_int());
17- auto height = std::min(new_tile.size.height.as_int() - offset.dy.as_int(), scaled_height.as_int());
18+ auto offset_in_tile = window.top_left() - old_tile.top_left;
19+ offset_in_tile.dx = std::min(offset_in_tile.dx, as_displacement(new_tile.size).dx);
20+ offset_in_tile.dy = std::min(offset_in_tile.dy, as_displacement(new_tile.size).dy);
21+
22+ Rectangle new_placement{new_tile.top_left + offset_in_tile, window.size()};
23+
24+ if (window.size().width == old_tile.size.width)
25+ new_placement.size.width = new_tile.size.width;
26+
27+ if (window.size().height == old_tile.size.height)
28+ new_placement.size.height = new_tile.size.height;
29+
30+ if (!new_placement.overlaps(new_tile))
31+ new_placement.top_left = new_tile.top_left;
32+
33+ new_placement = new_placement.intersection_with(new_tile);
34
35 WindowSpecification modifications;
36- modifications.top_left() = new_pos;
37- modifications.size() = {width, height};
38+ modifications.top_left() = new_placement.top_left;
39+ modifications.size() = new_placement.size;
40 tools.modify_window(window_info, modifications);
41 }
42 }
43@@ -652,12 +658,10 @@
44 dirty_displays = true;
45 }
46
47-#include <iostream>
48 void TilingWindowManagerPolicy::advise_output_update(const Output& updated, const Output& original)
49 {
50 if (!equivalent_display_area(updated, original))
51 {
52- std::cout << "Original: " << original.extents() << "new: " << updated.extents() << '\n';
53 live_displays.remove(original.extents());
54 live_displays.add(updated.extents());
55
56
57=== modified file 'src/miral/display_configuration_listeners.cpp'
58--- src/miral/display_configuration_listeners.cpp 2017-08-21 14:18:55 +0000
59+++ src/miral/display_configuration_listeners.cpp 2017-09-26 20:21:37 +0000
60@@ -83,7 +83,8 @@
61 {
62 Output o{output};
63
64- if (!o.connected() || !o.valid()) return;
65+ if (!o.valid() || !o.used() || !o.connected() || o.power_mode() != mir_power_mode_on)
66+ return;
67
68 auto op = find_if(
69 begin(active_outputs), end(active_outputs), [&](Output const& oo)

Subscribers

People subscribed via source and target branches