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

Proposed by Alan Griffiths on 2016-12-05
Status: Merged
Approved by: Daniel d'Andrada on 2016-12-05
Approved revision: 466
Merged at revision: 466
Proposed branch: lp:~alan-griffiths/miral/fix-1646735
Merge into: lp:miral
Diff against target: 167 lines (+60/-1)
10 files modified
debian/libmiral1.symbols (+2/-0)
include/miral/canonical_window_manager.h (+3/-0)
include/miral/window_management_policy.h (+10/-0)
miral-shell/tiling_window_manager.cpp (+13/-0)
miral-shell/tiling_window_manager.h (+2/-0)
miral/basic_window_manager.cpp (+4/-1)
miral/canonical_window_manager.cpp (+6/-0)
miral/symbols.map (+8/-0)
miral/window_management_trace.cpp (+10/-0)
miral/window_management_trace.h (+2/-0)
To merge this branch: bzr merge lp:~alan-griffiths/miral/fix-1646735
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) 2016-12-05 Approve on 2016-12-05
Review via email: mp+312447@code.launchpad.net

Commit Message

[libmiral] Allow the WM policy a say in inherited moves

Description of the Change

Allow the WM policy a say in inherited moves

Movement of window "trees" is an area that needs more test around it, especially when tips and menus are involved. I aim to get to that, but landing this could be helpful already.

To post a comment you must log in.
Daniel d'Andrada (dandrader) wrote :

I would prefer if shell could give miral enough context information (eg, the available desktop area) so that it could make correct decision on its own. But maybe that doesn't match miral's API style.

But confirm_inherited_move() works as well and is probably safer in case something other than the available desktop area happens to affect this decision.

What I wonder is how much value miral is adding in this specific case (moving child windows) with this API. What's more work for shell: validating every single child movement or implementing inherited child movement on its own?

review: Approve
Alan Griffiths (alan-griffiths) wrote :

I'd like Gerry's take on this too (see below).

> I would prefer if shell could give miral enough context information (eg, the
> available desktop area) so that it could make correct decision on its own. But
> maybe that doesn't match miral's API style.
>
> But confirm_inherited_move() works as well and is probably safer in case
> something other than the available desktop area happens to affect this
> decision.

Exactly, my concern is that the "available desktop area" isn't a simple concept that MirAL can handle.

In the "tiling" case it is the tile associated with the window.

In Unity8 it is the available region(s) on any outputs (but not associated with any specific windows).

In a lot of window managers there's no constraint - windows can be moved offscreen.

> What I wonder is how much value miral is adding in this specific case (moving
> child windows) with this API. What's more work for shell: validating every
> single child movement or implementing inherited child movement on its own?

I'm imagining that qtmir can implement the "available desktop area" concept as needed by Unity8 and that there's no other work needed further up the stack.

Daniel d'Andrada (dandrader) wrote :

On 05/12/2016 09:07, Alan Griffiths wrote:
> I'm imagining that qtmir can implement the "available desktop area" concept as needed by Unity8 and that there's no other work needed further up the stack.

Yes, that's how I plan to do it.

Gerry Boland (gerboland) wrote :

Having the "available desktop area" concept as something in the shell-specific policy makes sense to me. Unity8 does have different requirements to a tiling WM in this area.

I like Alan's suggestion, let's see how do-able it is.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/libmiral1.symbols'
2--- debian/libmiral1.symbols 2016-11-29 12:59:36 +0000
3+++ debian/libmiral1.symbols 2016-12-05 09:52:38 +0000
4@@ -315,3 +315,5 @@
5 (c++)"miral::DebugExtension::DebugExtension()@MIRAL_0.5" 0.5.0
6 (c++)"miral::DebugExtension::operator=(miral::DebugExtension const&)@MIRAL_0.5" 0.5.0
7 (c++)"miral::DebugExtension::operator()(mir::Server&) const@MIRAL_0.5" 0.5.0
8+ MIRAL_0.6@MIRAL_0.6 0.6.0
9+ (c++)"miral::CanonicalWindowManagerPolicy::confirm_inherited_move(miral::WindowInfo const&, mir::geometry::Displacement)@MIRAL_0.6" 0.6.0
10
11=== modified file 'include/miral/canonical_window_manager.h'
12--- include/miral/canonical_window_manager.h 2016-08-02 16:20:54 +0000
13+++ include/miral/canonical_window_manager.h 2016-12-05 09:52:38 +0000
14@@ -49,6 +49,9 @@
15 /// Raises the window (and any children)
16 void advise_focus_gained(WindowInfo const& info) override;
17
18+ /// Move the child window with the parent
19+ auto confirm_inherited_move(WindowInfo const& window_info, Displacement movement) -> Rectangle override;
20+
21 protected:
22 WindowManagerTools tools;
23 };
24
25=== modified file 'include/miral/window_management_policy.h'
26--- include/miral/window_management_policy.h 2016-11-17 14:05:54 +0000
27+++ include/miral/window_management_policy.h 2016-12-05 09:52:38 +0000
28@@ -19,6 +19,7 @@
29 #ifndef MIRAL_WINDOW_MANAGEMENT_POLICY_H
30 #define MIRAL_WINDOW_MANAGEMENT_POLICY_H
31
32+#include <mir/geometry/displacement.h>
33 #include <mir/geometry/rectangles.h>
34 #include <mir_toolkit/event.h>
35
36@@ -172,6 +173,15 @@
37 virtual void advise_raise(std::vector<Window> const& windows);
38 /** @} */
39
40+ /** Confirm (and optionally adjust) the motion of a child window when the parent is moved.
41+ *
42+ * @param window_info the window
43+ * @param movement the movement of the parent
44+ *
45+ * @return the confirmed placement of the window
46+ */
47+ virtual auto confirm_inherited_move(WindowInfo const& window_info, Displacement movement) -> Rectangle = 0;
48+
49 virtual ~WindowManagementPolicy() = default;
50 WindowManagementPolicy() = default;
51 WindowManagementPolicy(WindowManagementPolicy const&) = delete;
52
53=== modified file 'miral-shell/tiling_window_manager.cpp'
54--- miral-shell/tiling_window_manager.cpp 2016-11-17 14:54:47 +0000
55+++ miral-shell/tiling_window_manager.cpp 2016-12-05 09:52:38 +0000
56@@ -615,6 +615,19 @@
57 tiles.erase(application.userdata());
58 dirty_tiles = true;
59 }
60+
61+auto TilingWindowManagerPolicy::confirm_inherited_move(miral::WindowInfo const& window_info, Displacement movement)
62+-> Rectangle
63+{
64+ auto const& window = window_info.window();
65+ WindowSpecification mods;
66+ mods.top_left() = window.top_left() + movement;
67+ constrain_size_and_place(mods, window, tile_for(window_info));
68+ auto pos = mods.top_left().is_set() ? mods.top_left().value() : window.top_left();
69+ auto size = mods.size().is_set() ? mods.size().value() : window.size();
70+ return {pos, size};
71+}
72+
73 void TilingWindowManagerPolicy::advise_end()
74 {
75 if (dirty_tiles)
76
77=== modified file 'miral-shell/tiling_window_manager.h'
78--- miral-shell/tiling_window_manager.h 2016-11-17 11:09:14 +0000
79+++ miral-shell/tiling_window_manager.h 2016-12-05 09:52:38 +0000
80@@ -73,6 +73,8 @@
81 void advise_new_app(miral::ApplicationInfo& application) override;
82 void advise_delete_app(miral::ApplicationInfo const& application) override;
83
84+ auto confirm_inherited_move(miral::WindowInfo const& window_info, Displacement movement) -> Rectangle override;
85+
86 private:
87 void advise_output_create(miral::Output const& output) override;
88 void advise_output_update(miral::Output const& updated, miral::Output const& original) override;
89
90=== modified file 'miral/basic_window_manager.cpp'
91--- miral/basic_window_manager.cpp 2016-11-16 12:48:17 +0000
92+++ miral/basic_window_manager.cpp 2016-12-05 09:52:38 +0000
93@@ -528,7 +528,10 @@
94 root.window().move_to(top_left);
95
96 for (auto const& child: root.children())
97- move_tree(info_for(child), movement);
98+ {
99+ auto const& pos = policy->confirm_inherited_move(info_for(child), movement);
100+ place_and_size(info_for(child), pos.top_left, pos.size);
101+ }
102 }
103
104 void miral::BasicWindowManager::modify_window(WindowInfo& window_info, WindowSpecification const& modifications)
105
106=== modified file 'miral/canonical_window_manager.cpp'
107--- miral/canonical_window_manager.cpp 2016-07-27 15:43:19 +0000
108+++ miral/canonical_window_manager.cpp 2016-12-05 09:52:38 +0000
109@@ -59,3 +59,9 @@
110 {
111 tools.raise_tree(info.window());
112 }
113+
114+auto miral::CanonicalWindowManagerPolicy::confirm_inherited_move(WindowInfo const& window_info, Displacement movement)
115+-> Rectangle
116+{
117+ return {window_info.window().top_left()+movement, window_info.window().size()};
118+}
119
120=== modified file 'miral/symbols.map'
121--- miral/symbols.map 2016-11-29 12:59:36 +0000
122+++ miral/symbols.map 2016-12-05 09:52:38 +0000
123@@ -342,3 +342,11 @@
124 vtable?for?miral::DebugExtension;
125 };
126 } MIRAL_0.4;
127+
128+MIRAL_0.6 {
129+global:
130+ extern "C++" {
131+ miral::CanonicalWindowManagerPolicy::confirm_inherited_move*;
132+ non-virtual?thunk?to?miral::CanonicalWindowManagerPolicy::confirm_inherited_move*;
133+ };
134+} MIRAL_0.5;
135
136=== modified file 'miral/window_management_trace.cpp'
137--- miral/window_management_trace.cpp 2016-11-29 10:55:43 +0000
138+++ miral/window_management_trace.cpp 2016-12-05 09:52:38 +0000
139@@ -552,6 +552,16 @@
140 return policy->handle_pointer_event(event);
141 }
142
143+auto miral::WindowManagementTrace::confirm_inherited_move(WindowInfo const& window_info, Displacement movement)
144+-> Rectangle
145+{
146+ std::stringstream out;
147+ out << movement;
148+ mir::log_info("%s window_info=%s, movement=%s", __func__, dump_of(window_info).c_str(), out.str().c_str());
149+
150+ return policy->confirm_inherited_move(window_info, movement);
151+}
152+
153 void miral::WindowManagementTrace::advise_begin()
154 {
155 log_input = []{};
156
157=== modified file 'miral/window_management_trace.h'
158--- miral/window_management_trace.h 2016-11-03 10:15:24 +0000
159+++ miral/window_management_trace.h 2016-12-05 09:52:38 +0000
160@@ -86,6 +86,8 @@
161
162 virtual bool handle_pointer_event(MirPointerEvent const* event) override;
163
164+ auto confirm_inherited_move(WindowInfo const& window_info, Displacement movement) -> Rectangle override;
165+
166 public:
167 virtual void advise_begin() override;
168

Subscribers

People subscribed via source and target branches