Merge lp:~alan-griffiths/miral/rework-handling-of-surface-state-changes into lp:miral
- rework-handling-of-surface-state-changes
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Gerry Boland |
Approved revision: | 384 |
Merged at revision: | 375 |
Proposed branch: | lp:~alan-griffiths/miral/rework-handling-of-surface-state-changes |
Merge into: | lp:miral |
Diff against target: |
425 lines (+137/-81) 11 files modified
debian/libmiral1.symbols (+1/-0) include/miral/window_manager_tools.h (+2/-0) miral-shell/titlebar_window_manager.cpp (+1/-1) miral/basic_window_manager.cpp (+114/-78) miral/basic_window_manager.h (+2/-1) miral/set_window_managment_policy.cpp (+1/-1) miral/symbols.map (+1/-0) miral/window_management_trace.cpp (+8/-0) miral/window_management_trace.h (+1/-0) miral/window_manager_tools.cpp (+4/-0) miral/window_manager_tools_implementation.h (+2/-0) |
To merge this branch: | bzr merge lp:~alan-griffiths/miral/rework-handling-of-surface-state-changes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gerry Boland (community) | Approve | ||
Daniel d'Andrada (community) | test | Approve | |
Review via email: mp+307163@code.launchpad.net |
Commit message
Rework the handling of surface state changes:
1. shells now have the option of ignoring (or adjusting) the default placement.
2. fixes issues arising when the state of the active window changes.
Description of the change
Rework the handling of surface state changes:
1. shells now have the option of ignoring (or adjusting) the default placement.
2. fixes issues arising when the state of the active window changes.
It may seem odd to provide position_
Gerry Boland (gerboland) wrote : | # |
+ void position_
name doesn't quite match implementation, as it also impacts size, perhaps "geometry_
Gerry Boland (gerboland) wrote : | # |
+void miral::
+ void position_
Order of the arguments now do not match. Consistency would be nice. I'm unsure why you changed the first one here.
Gerry Boland (gerboland) wrote : | # |
- policy-
- window_
- mir_surface-
- mir_surface-
- if (window_
- {
- mru_active_
-
- // Try to activate to recently active window of any application
- mru_active_
- {
- auto const w = window;
- return !(select_
- });
- }
- return;
I wasn't expecting this to vanish in this MP. Is it dead code?
Gerry Boland (gerboland) wrote : | # |
> +void
> miral::
> const& modifications, WindowInfo const& window_info) const
>
> + void position_
> const& window_info) const override;
>
> Order of the arguments now do not match. Consistency would be nice. I'm unsure
> why you changed the first one here.
Or the consistency you're developing is an (out, const in) design?
Alan Griffiths (alan-griffiths) wrote : | # |
> - policy-
> - window_
> - mir_surface-
> - mir_surface-
> - if (window_
> - {
> - mru_active_
> -
> - // Try to activate to recently active window of any application
> - mru_active_
> - {
> - auto const w = window;
> - return !(select_
> - });
> - }
> - return;
>
> I wasn't expecting this to vanish in this MP. Is it dead code?
Neither.
+ if (window == active_window())
+ {
+ // Try to activate to recently active window of any application
+ mru_active_
+ {
+ if (candidate == window)
+ return true;
+ auto const w = candidate;
+ return !(select_
+ });
+ }
Plus some duplicated code consolidated.
- 384. By Alan Griffiths
-
position_
for_state( ) => place_and_ size_for_ state()
Alan Griffiths (alan-griffiths) wrote : | # |
> > +void
> > miral::
> > const& modifications, WindowInfo const& window_info) const
> >
> > + void position_
> > const& window_info) const override;
> >
> > Order of the arguments now do not match. Consistency would be nice. I'm
> unsure
> > why you changed the first one here.
>
> Or the consistency you're developing is an (out, const in) design?
Partly that, but also both functions are /about/ the first parameter, with the second parameter being secondary.
Alan Griffiths (alan-griffiths) wrote : | # |
> + void position_
> const& window_info) const;
> name doesn't quite match implementation, as it also impacts size, perhaps
> "geometry_
place_and_
Gerry Boland (gerboland) wrote : | # |
> > + void position_
> > const& window_info) const;
> > name doesn't quite match implementation, as it also impacts size, perhaps
> > "geometry_
>
> place_and_
You use similar elsewhere, so yeah.
Gerry Boland (gerboland) : | # |
Preview Diff
1 | === modified file 'debian/libmiral1.symbols' | |||
2 | --- debian/libmiral1.symbols 2016-09-28 10:38:36 +0000 | |||
3 | +++ debian/libmiral1.symbols 2016-09-29 14:41:47 +0000 | |||
4 | @@ -180,6 +180,7 @@ | |||
5 | 180 | (c++)"miral::WindowManagerTools::invoke_under_lock(std::function<void ()> const&)@MIRAL_0.1" 0.1.0 | 180 | (c++)"miral::WindowManagerTools::invoke_under_lock(std::function<void ()> const&)@MIRAL_0.1" 0.1.0 |
6 | 181 | (c++)"miral::WindowManagerTools::modify_window(miral::WindowInfo&, miral::WindowSpecification const&)@MIRAL_0.1" 0.1.0 | 181 | (c++)"miral::WindowManagerTools::modify_window(miral::WindowInfo&, miral::WindowSpecification const&)@MIRAL_0.1" 0.1.0 |
7 | 182 | (c++)"miral::WindowManagerTools::operator=(miral::WindowManagerTools const&)@MIRAL_0.1" 0.1.0 | 182 | (c++)"miral::WindowManagerTools::operator=(miral::WindowManagerTools const&)@MIRAL_0.1" 0.1.0 |
8 | 183 | (c++)"miral::WindowManagerTools::place_and_size_for_state(miral::WindowSpecification&, miral::WindowInfo const&) const@MIRAL_0.2" 0.2.0 | ||
9 | 183 | (c++)"miral::WindowManagerTools::raise_tree(miral::Window const&)@MIRAL_0.1" 0.1.0 | 184 | (c++)"miral::WindowManagerTools::raise_tree(miral::Window const&)@MIRAL_0.1" 0.1.0 |
10 | 184 | (c++)"miral::WindowManagerTools::select_active_window(miral::Window const&)@MIRAL_0.1" 0.1.0 | 185 | (c++)"miral::WindowManagerTools::select_active_window(miral::Window const&)@MIRAL_0.1" 0.1.0 |
11 | 185 | (c++)"miral::WindowManagerTools::window_at(mir::geometry::Point) const@MIRAL_0.1" 0.1.0 | 186 | (c++)"miral::WindowManagerTools::window_at(mir::geometry::Point) const@MIRAL_0.1" 0.1.0 |
12 | 186 | 187 | ||
13 | === modified file 'include/miral/window_manager_tools.h' | |||
14 | --- include/miral/window_manager_tools.h 2016-09-07 20:23:20 +0000 | |||
15 | +++ include/miral/window_manager_tools.h 2016-09-29 14:41:47 +0000 | |||
16 | @@ -146,6 +146,8 @@ | |||
17 | 146 | /// Apply modifications to a window | 146 | /// Apply modifications to a window |
18 | 147 | void modify_window(WindowInfo& window_info, WindowSpecification const& modifications); | 147 | void modify_window(WindowInfo& window_info, WindowSpecification const& modifications); |
19 | 148 | 148 | ||
20 | 149 | /// Set a default size and position to reflect state change | ||
21 | 150 | void place_and_size_for_state(WindowSpecification& modifications, WindowInfo const& window_info) const; | ||
22 | 149 | /** @} */ | 151 | /** @} */ |
23 | 150 | 152 | ||
24 | 151 | /** Multi-thread support | 153 | /** Multi-thread support |
25 | 152 | 154 | ||
26 | === modified file 'miral-shell/titlebar_window_manager.cpp' | |||
27 | --- miral-shell/titlebar_window_manager.cpp 2016-09-28 11:42:35 +0000 | |||
28 | +++ miral-shell/titlebar_window_manager.cpp 2016-09-29 14:41:47 +0000 | |||
29 | @@ -455,7 +455,7 @@ | |||
30 | 455 | WindowSpecification modifications; | 455 | WindowSpecification modifications; |
31 | 456 | 456 | ||
32 | 457 | modifications.state() = (info.state() == state) ? mir_surface_state_restored : state; | 457 | modifications.state() = (info.state() == state) ? mir_surface_state_restored : state; |
34 | 458 | 458 | tools.place_and_size_for_state(modifications, info); | |
35 | 459 | tools.modify_window(info, modifications); | 459 | tools.modify_window(info, modifications); |
36 | 460 | } | 460 | } |
37 | 461 | } | 461 | } |
38 | 462 | 462 | ||
39 | === modified file 'miral/basic_window_manager.cpp' | |||
40 | --- miral/basic_window_manager.cpp 2016-09-23 16:55:46 +0000 | |||
41 | +++ miral/basic_window_manager.cpp 2016-09-29 14:41:47 +0000 | |||
42 | @@ -143,8 +143,10 @@ | |||
43 | 143 | { | 143 | { |
44 | 144 | Locker lock{mutex, policy}; | 144 | Locker lock{mutex, policy}; |
45 | 145 | auto& info = info_for(surface); | 145 | auto& info = info_for(surface); |
48 | 146 | validate_modification_request(info, modifications); | 146 | WindowSpecification mods{modifications}; |
49 | 147 | policy->handle_modify_window(info, modifications); | 147 | validate_modification_request(mods, info); |
50 | 148 | place_and_size_for_state(mods, info); | ||
51 | 149 | policy->handle_modify_window(info, mods); | ||
52 | 148 | } | 150 | } |
53 | 149 | 151 | ||
54 | 150 | void miral::BasicWindowManager::remove_surface( | 152 | void miral::BasicWindowManager::remove_surface( |
55 | @@ -321,7 +323,8 @@ | |||
56 | 321 | Locker lock{mutex, policy}; | 323 | Locker lock{mutex, policy}; |
57 | 322 | auto& info = info_for(surface); | 324 | auto& info = info_for(surface); |
58 | 323 | 325 | ||
60 | 324 | validate_modification_request(info, modification); | 326 | validate_modification_request(modification, info); |
61 | 327 | place_and_size_for_state(modification, info); | ||
62 | 325 | policy->handle_modify_window(info, modification); | 328 | policy->handle_modify_window(info, modification); |
63 | 326 | 329 | ||
64 | 327 | switch (attrib) | 330 | switch (attrib) |
65 | @@ -601,6 +604,38 @@ | |||
66 | 601 | if (modifications.input_shape().is_set()) | 604 | if (modifications.input_shape().is_set()) |
67 | 602 | std::shared_ptr<scene::Surface>(window)->set_input_region(modifications.input_shape().value()); | 605 | std::shared_ptr<scene::Surface>(window)->set_input_region(modifications.input_shape().value()); |
68 | 603 | 606 | ||
69 | 607 | if (modifications.state().is_set() && window_info.state() != modifications.state().value()) | ||
70 | 608 | { | ||
71 | 609 | switch (window_info.state()) | ||
72 | 610 | { | ||
73 | 611 | case mir_surface_state_restored: | ||
74 | 612 | case mir_surface_state_hidden: | ||
75 | 613 | window_info.restore_rect({window.top_left(), window.size()}); | ||
76 | 614 | break; | ||
77 | 615 | |||
78 | 616 | case mir_surface_state_vertmaximized: | ||
79 | 617 | { | ||
80 | 618 | auto restore_rect = window_info.restore_rect(); | ||
81 | 619 | restore_rect.top_left.x = window.top_left().x; | ||
82 | 620 | restore_rect.size.width = window.size().width; | ||
83 | 621 | window_info.restore_rect(restore_rect); | ||
84 | 622 | break; | ||
85 | 623 | } | ||
86 | 624 | |||
87 | 625 | case mir_surface_state_horizmaximized: | ||
88 | 626 | { | ||
89 | 627 | auto restore_rect = window_info.restore_rect(); | ||
90 | 628 | restore_rect.top_left.y = window.top_left().y; | ||
91 | 629 | restore_rect.size.height= window.size().height; | ||
92 | 630 | window_info.restore_rect(restore_rect); | ||
93 | 631 | break; | ||
94 | 632 | } | ||
95 | 633 | |||
96 | 634 | default: | ||
97 | 635 | break; | ||
98 | 636 | } | ||
99 | 637 | } | ||
100 | 638 | |||
101 | 604 | Point new_pos = modifications.top_left().is_set() ? modifications.top_left().value() : window.top_left(); | 639 | Point new_pos = modifications.top_left().is_set() ? modifications.top_left().value() : window.top_left(); |
102 | 605 | 640 | ||
103 | 606 | if (modifications.size().is_set()) | 641 | if (modifications.size().is_set()) |
104 | @@ -687,48 +722,36 @@ | |||
105 | 687 | move_tree(root, new_pos - root.window().top_left()); | 722 | move_tree(root, new_pos - root.window().top_left()); |
106 | 688 | } | 723 | } |
107 | 689 | 724 | ||
109 | 690 | void miral::BasicWindowManager::set_state(miral::WindowInfo& window_info, MirSurfaceState value) | 725 | void miral::BasicWindowManager::place_and_size_for_state( |
110 | 726 | WindowSpecification& modifications, WindowInfo const& window_info) const | ||
111 | 691 | { | 727 | { |
127 | 692 | auto const mir_surface = std::shared_ptr<scene::Surface>(window_info.window()); | 728 | if (!modifications.state().is_set() || modifications.state().value() == window_info.state()) |
113 | 693 | |||
114 | 694 | switch (value) | ||
115 | 695 | { | ||
116 | 696 | case mir_surface_state_restored: | ||
117 | 697 | case mir_surface_state_maximized: | ||
118 | 698 | case mir_surface_state_vertmaximized: | ||
119 | 699 | case mir_surface_state_horizmaximized: | ||
120 | 700 | case mir_surface_state_fullscreen: | ||
121 | 701 | case mir_surface_state_hidden: | ||
122 | 702 | case mir_surface_state_minimized: | ||
123 | 703 | break; | ||
124 | 704 | |||
125 | 705 | default: | ||
126 | 706 | mir_surface->configure(mir_surface_attrib_state, window_info.state()); | ||
128 | 707 | return; | 729 | return; |
131 | 708 | } | 730 | |
132 | 709 | 731 | auto const display_area = displays.bounding_rectangle(); | |
133 | 732 | auto const window = window_info.window(); | ||
134 | 733 | |||
135 | 734 | auto restore_rect = window_info.restore_rect(); | ||
136 | 735 | |||
137 | 736 | // window_info.restore_rect() was cached on last state change, update to reflect current window position | ||
138 | 710 | switch (window_info.state()) | 737 | switch (window_info.state()) |
139 | 711 | { | 738 | { |
140 | 712 | case mir_surface_state_restored: | 739 | case mir_surface_state_restored: |
141 | 713 | case mir_surface_state_hidden: | 740 | case mir_surface_state_hidden: |
143 | 714 | window_info.restore_rect({window_info.window().top_left(), window_info.window().size()}); | 741 | restore_rect = {window.top_left(), window.size()}; |
144 | 715 | break; | 742 | break; |
145 | 716 | 743 | ||
146 | 717 | case mir_surface_state_vertmaximized: | 744 | case mir_surface_state_vertmaximized: |
147 | 718 | { | 745 | { |
152 | 719 | auto restore_rect = window_info.restore_rect(); | 746 | restore_rect.top_left.x = window.top_left().x; |
153 | 720 | restore_rect.top_left.x = window_info.window().top_left().x; | 747 | restore_rect.size.width = window.size().width; |
150 | 721 | restore_rect.size.width = window_info.window().size().width; | ||
151 | 722 | window_info.restore_rect(restore_rect); | ||
154 | 723 | break; | 748 | break; |
155 | 724 | } | 749 | } |
156 | 725 | 750 | ||
157 | 726 | case mir_surface_state_horizmaximized: | 751 | case mir_surface_state_horizmaximized: |
158 | 727 | { | 752 | { |
163 | 728 | auto restore_rect = window_info.restore_rect(); | 753 | restore_rect.top_left.y = window.top_left().y; |
164 | 729 | restore_rect.top_left.y = window_info.window().top_left().y; | 754 | restore_rect.size.height= window.size().height; |
161 | 730 | restore_rect.size.height= window_info.window().size().height; | ||
162 | 731 | window_info.restore_rect(restore_rect); | ||
165 | 732 | break; | 755 | break; |
166 | 733 | } | 756 | } |
167 | 734 | 757 | ||
168 | @@ -736,29 +759,20 @@ | |||
169 | 736 | break; | 759 | break; |
170 | 737 | } | 760 | } |
171 | 738 | 761 | ||
181 | 739 | if (value != mir_surface_state_fullscreen) | 762 | // If the shell has also set position, that overrides restore_rect default |
182 | 740 | { | 763 | if (modifications.top_left().is_set()) |
183 | 741 | window_info.output_id({}); | 764 | restore_rect.top_left = modifications.top_left().value(); |
175 | 742 | fullscreen_surfaces.erase(window_info.window()); | ||
176 | 743 | } | ||
177 | 744 | else | ||
178 | 745 | { | ||
179 | 746 | fullscreen_surfaces.insert(window_info.window()); | ||
180 | 747 | } | ||
184 | 748 | 765 | ||
189 | 749 | if (window_info.state() == value) | 766 | // If the client or shell has also set size, that overrides restore_rect default |
190 | 750 | { | 767 | if (modifications.size().is_set()) |
191 | 751 | return; | 768 | restore_rect.size = modifications.size().value(); |
188 | 752 | } | ||
192 | 753 | 769 | ||
193 | 754 | Rectangle rect; | 770 | Rectangle rect; |
194 | 755 | 771 | ||
198 | 756 | auto const display_area = displays.bounding_rectangle(); | 772 | switch (modifications.state().value()) |
196 | 757 | |||
197 | 758 | switch (value) | ||
199 | 759 | { | 773 | { |
200 | 760 | case mir_surface_state_restored: | 774 | case mir_surface_state_restored: |
202 | 761 | rect = window_info.restore_rect(); | 775 | rect = restore_rect; |
203 | 762 | break; | 776 | break; |
204 | 763 | 777 | ||
205 | 764 | case mir_surface_state_maximized: | 778 | case mir_surface_state_maximized: |
206 | @@ -766,18 +780,18 @@ | |||
207 | 766 | break; | 780 | break; |
208 | 767 | 781 | ||
209 | 768 | case mir_surface_state_horizmaximized: | 782 | case mir_surface_state_horizmaximized: |
212 | 769 | rect.top_left = {display_area.top_left.x, window_info.restore_rect().top_left.y}; | 783 | rect.top_left = {display_area.top_left.x, restore_rect.top_left.y}; |
213 | 770 | rect.size = {display_area.size.width, window_info.restore_rect().size.height}; | 784 | rect.size = {display_area.size.width, restore_rect.size.height}; |
214 | 771 | break; | 785 | break; |
215 | 772 | 786 | ||
216 | 773 | case mir_surface_state_vertmaximized: | 787 | case mir_surface_state_vertmaximized: |
219 | 774 | rect.top_left = {window_info.restore_rect().top_left.x, display_area.top_left.y}; | 788 | rect.top_left = {restore_rect.top_left.x, display_area.top_left.y}; |
220 | 775 | rect.size = {window_info.restore_rect().size.width, display_area.size.height}; | 789 | rect.size = {restore_rect.size.width, display_area.size.height}; |
221 | 776 | break; | 790 | break; |
222 | 777 | 791 | ||
223 | 778 | case mir_surface_state_fullscreen: | 792 | case mir_surface_state_fullscreen: |
224 | 779 | { | 793 | { |
226 | 780 | rect = {(window_info.window().top_left()), window_info.window().size()}; | 794 | rect = {(window.top_left()), window.size()}; |
227 | 781 | 795 | ||
228 | 782 | if (window_info.has_output_id()) | 796 | if (window_info.has_output_id()) |
229 | 783 | { | 797 | { |
230 | @@ -794,35 +808,59 @@ | |||
231 | 794 | 808 | ||
232 | 795 | case mir_surface_state_hidden: | 809 | case mir_surface_state_hidden: |
233 | 796 | case mir_surface_state_minimized: | 810 | case mir_surface_state_minimized: |
234 | 797 | policy->advise_state_change(window_info, value); | ||
235 | 798 | window_info.state(value); | ||
236 | 799 | mir_surface->hide(); | ||
237 | 800 | mir_surface->configure(mir_surface_attrib_state, value); | ||
238 | 801 | if (window_info.window() == active_window()) | ||
239 | 802 | { | ||
240 | 803 | mru_active_windows.erase(window_info.window()); | ||
241 | 804 | |||
242 | 805 | // Try to activate to recently active window of any application | ||
243 | 806 | mru_active_windows.enumerate([&](Window& window) | ||
244 | 807 | { | ||
245 | 808 | auto const w = window; | ||
246 | 809 | return !(select_active_window(w)); | ||
247 | 810 | }); | ||
248 | 811 | } | ||
249 | 812 | return; | ||
250 | 813 | |||
251 | 814 | default: | 811 | default: |
256 | 815 | break; | 812 | return; |
257 | 816 | } | 813 | } |
258 | 817 | 814 | ||
259 | 818 | place_and_size(window_info, rect.top_left, rect.size); | 815 | modifications.top_left() = rect.top_left; |
260 | 816 | modifications.size() = rect.size; | ||
261 | 817 | } | ||
262 | 818 | |||
263 | 819 | void miral::BasicWindowManager::set_state(miral::WindowInfo& window_info, MirSurfaceState value) | ||
264 | 820 | { | ||
265 | 821 | auto const window = window_info.window(); | ||
266 | 822 | auto const mir_surface = std::shared_ptr<scene::Surface>(window); | ||
267 | 823 | |||
268 | 824 | if (value != mir_surface_state_fullscreen) | ||
269 | 825 | { | ||
270 | 826 | window_info.output_id({}); | ||
271 | 827 | fullscreen_surfaces.erase(window); | ||
272 | 828 | } | ||
273 | 829 | else | ||
274 | 830 | { | ||
275 | 831 | fullscreen_surfaces.insert(window); | ||
276 | 832 | } | ||
277 | 833 | |||
278 | 834 | if (window_info.state() == value) | ||
279 | 835 | { | ||
280 | 836 | return; | ||
281 | 837 | } | ||
282 | 838 | |||
283 | 819 | policy->advise_state_change(window_info, value); | 839 | policy->advise_state_change(window_info, value); |
284 | 820 | window_info.state(value); | 840 | window_info.state(value); |
285 | 821 | 841 | ||
286 | 822 | if (window_info.is_visible()) | 842 | if (window_info.is_visible()) |
287 | 843 | { | ||
288 | 823 | mir_surface->show(); | 844 | mir_surface->show(); |
291 | 824 | 845 | } | |
292 | 825 | mir_surface->configure(mir_surface_attrib_state, window_info.state()); | 846 | else |
293 | 847 | { | ||
294 | 848 | mir_surface->hide(); | ||
295 | 849 | |||
296 | 850 | if (window == active_window()) | ||
297 | 851 | { | ||
298 | 852 | // Try to activate to recently active window of any application | ||
299 | 853 | mru_active_windows.enumerate([&](Window& candidate) | ||
300 | 854 | { | ||
301 | 855 | if (candidate == window) | ||
302 | 856 | return true; | ||
303 | 857 | auto const w = candidate; | ||
304 | 858 | return !(select_active_window(w)); | ||
305 | 859 | }); | ||
306 | 860 | } | ||
307 | 861 | } | ||
308 | 862 | |||
309 | 863 | mir_surface->configure(mir_surface_attrib_state, value); | ||
310 | 826 | } | 864 | } |
311 | 827 | 865 | ||
312 | 828 | 866 | ||
313 | @@ -1434,9 +1472,7 @@ | |||
314 | 1434 | return default_result; | 1472 | return default_result; |
315 | 1435 | } | 1473 | } |
316 | 1436 | 1474 | ||
320 | 1437 | void miral::BasicWindowManager::validate_modification_request( | 1475 | void miral::BasicWindowManager::validate_modification_request(WindowSpecification const& modifications, WindowInfo const& window_info) const |
318 | 1438 | WindowInfo const& window_info, | ||
319 | 1439 | WindowSpecification const& modifications) const | ||
321 | 1440 | { | 1476 | { |
322 | 1441 | auto target_type = window_info.type(); | 1477 | auto target_type = window_info.type(); |
323 | 1442 | 1478 | ||
324 | 1443 | 1479 | ||
325 | === modified file 'miral/basic_window_manager.h' | |||
326 | --- miral/basic_window_manager.h 2016-09-21 13:37:35 +0000 | |||
327 | +++ miral/basic_window_manager.h 2016-09-29 14:41:47 +0000 | |||
328 | @@ -133,6 +133,7 @@ | |||
329 | 133 | auto info_for_window_id(std::string const& id) const -> WindowInfo& override; | 133 | auto info_for_window_id(std::string const& id) const -> WindowInfo& override; |
330 | 134 | 134 | ||
331 | 135 | auto id_for_window(Window const& window) const -> std::string override; | 135 | auto id_for_window(Window const& window) const -> std::string override; |
332 | 136 | void place_and_size_for_state(WindowSpecification& modifications, WindowInfo const& window_info) const override; | ||
333 | 136 | 137 | ||
334 | 137 | void invoke_under_lock(std::function<void()> const& callback) override; | 138 | void invoke_under_lock(std::function<void()> const& callback) override; |
335 | 138 | 139 | ||
336 | @@ -167,7 +168,7 @@ | |||
337 | 167 | 168 | ||
338 | 168 | void move_tree(miral::WindowInfo& root, mir::geometry::Displacement movement); | 169 | void move_tree(miral::WindowInfo& root, mir::geometry::Displacement movement); |
339 | 169 | void erase(miral::WindowInfo const& info); | 170 | void erase(miral::WindowInfo const& info); |
341 | 170 | void validate_modification_request(WindowInfo const& window_info, WindowSpecification const& modifications) const; | 171 | void validate_modification_request(WindowSpecification const& modifications, WindowInfo const& window_info) const; |
342 | 171 | void place_and_size(WindowInfo& root, Point const& new_pos, Size const& new_size); | 172 | void place_and_size(WindowInfo& root, Point const& new_pos, Size const& new_size); |
343 | 172 | void set_state(miral::WindowInfo& window_info, MirSurfaceState value); | 173 | void set_state(miral::WindowInfo& window_info, MirSurfaceState value); |
344 | 173 | }; | 174 | }; |
345 | 174 | 175 | ||
346 | === modified file 'miral/set_window_managment_policy.cpp' | |||
347 | --- miral/set_window_managment_policy.cpp 2016-09-21 14:43:46 +0000 | |||
348 | +++ miral/set_window_managment_policy.cpp 2016-09-29 14:41:47 +0000 | |||
349 | @@ -57,7 +57,7 @@ | |||
350 | 57 | { | 57 | { |
351 | 58 | auto trace_builder = [this](WindowManagerTools const& tools) -> std::unique_ptr<miral::WindowManagementPolicy> | 58 | auto trace_builder = [this](WindowManagerTools const& tools) -> std::unique_ptr<miral::WindowManagementPolicy> |
352 | 59 | { | 59 | { |
354 | 60 | return std::make_unique<WindowManagementTrace>(tools, builder); | 60 | return std::make_unique<WindowManagementTrace>(tools, builder); |
355 | 61 | }; | 61 | }; |
356 | 62 | 62 | ||
357 | 63 | return std::make_shared<BasicWindowManager>(focus_controller, display_layout, persistent_surface_store, trace_builder); | 63 | return std::make_shared<BasicWindowManager>(focus_controller, display_layout, persistent_surface_store, trace_builder); |
358 | 64 | 64 | ||
359 | === modified file 'miral/symbols.map' | |||
360 | --- miral/symbols.map 2016-09-28 10:38:36 +0000 | |||
361 | +++ miral/symbols.map 2016-09-29 14:41:47 +0000 | |||
362 | @@ -289,6 +289,7 @@ | |||
363 | 289 | miral::CursorTheme::CursorTheme*; | 289 | miral::CursorTheme::CursorTheme*; |
364 | 290 | miral::CursorTheme::operator*; | 290 | miral::CursorTheme::operator*; |
365 | 291 | miral::WindowInfo::confine_pointer*; | 291 | miral::WindowInfo::confine_pointer*; |
366 | 292 | miral::WindowManagerTools::place_and_size_for_state*; | ||
367 | 292 | miral::WindowSpecification::confine_pointer*; | 293 | miral::WindowSpecification::confine_pointer*; |
368 | 293 | typeinfo?for?miral::CursorTheme; | 294 | typeinfo?for?miral::CursorTheme; |
369 | 294 | vtable?for?miral::CursorTheme; | 295 | vtable?for?miral::CursorTheme; |
370 | 295 | 296 | ||
371 | === modified file 'miral/window_management_trace.cpp' | |||
372 | --- miral/window_management_trace.cpp 2016-09-23 16:54:30 +0000 | |||
373 | +++ miral/window_management_trace.cpp 2016-09-29 14:41:47 +0000 | |||
374 | @@ -401,6 +401,14 @@ | |||
375 | 401 | return result; | 401 | return result; |
376 | 402 | } | 402 | } |
377 | 403 | 403 | ||
378 | 404 | void miral::WindowManagementTrace::place_and_size_for_state( | ||
379 | 405 | WindowSpecification& modifications, WindowInfo const& window_info) const | ||
380 | 406 | { | ||
381 | 407 | log_input(); | ||
382 | 408 | mir::log_info("%s modifications=%s window_info=%s", __func__, dump_of(modifications).c_str(), dump_of(window_info).c_str()); | ||
383 | 409 | wrapped.place_and_size_for_state(modifications, window_info); | ||
384 | 410 | } | ||
385 | 411 | |||
386 | 404 | void miral::WindowManagementTrace::drag_active_window(mir::geometry::Displacement movement) | 412 | void miral::WindowManagementTrace::drag_active_window(mir::geometry::Displacement movement) |
387 | 405 | { | 413 | { |
388 | 406 | log_input(); | 414 | log_input(); |
389 | 407 | 415 | ||
390 | === modified file 'miral/window_management_trace.h' | |||
391 | --- miral/window_management_trace.h 2016-09-23 10:28:25 +0000 | |||
392 | +++ miral/window_management_trace.h 2016-09-29 14:41:47 +0000 | |||
393 | @@ -56,6 +56,7 @@ | |||
394 | 56 | virtual auto active_display() -> mir::geometry::Rectangle const override; | 56 | virtual auto active_display() -> mir::geometry::Rectangle const override; |
395 | 57 | virtual auto info_for_window_id(std::string const& id) const -> WindowInfo& override; | 57 | virtual auto info_for_window_id(std::string const& id) const -> WindowInfo& override; |
396 | 58 | virtual auto id_for_window(Window const& window) const -> std::string override; | 58 | virtual auto id_for_window(Window const& window) const -> std::string override; |
397 | 59 | virtual void place_and_size_for_state(WindowSpecification& modifications, WindowInfo const& window_info) const override; | ||
398 | 59 | 60 | ||
399 | 60 | virtual void drag_active_window(mir::geometry::Displacement movement) override; | 61 | virtual void drag_active_window(mir::geometry::Displacement movement) override; |
400 | 61 | 62 | ||
401 | 62 | 63 | ||
402 | === modified file 'miral/window_manager_tools.cpp' | |||
403 | --- miral/window_manager_tools.cpp 2016-09-07 20:23:20 +0000 | |||
404 | +++ miral/window_manager_tools.cpp 2016-09-29 14:41:47 +0000 | |||
405 | @@ -85,3 +85,7 @@ | |||
406 | 85 | 85 | ||
407 | 86 | void miral::WindowManagerTools::invoke_under_lock(std::function<void()> const& callback) | 86 | void miral::WindowManagerTools::invoke_under_lock(std::function<void()> const& callback) |
408 | 87 | { tools->invoke_under_lock(callback); } | 87 | { tools->invoke_under_lock(callback); } |
409 | 88 | |||
410 | 89 | void miral::WindowManagerTools::place_and_size_for_state( | ||
411 | 90 | WindowSpecification& modifications, WindowInfo const& window_info) const | ||
412 | 91 | { tools->place_and_size_for_state(modifications, window_info); } | ||
413 | 88 | 92 | ||
414 | === modified file 'miral/window_manager_tools_implementation.h' | |||
415 | --- miral/window_manager_tools_implementation.h 2016-09-21 13:37:35 +0000 | |||
416 | +++ miral/window_manager_tools_implementation.h 2016-09-29 14:41:47 +0000 | |||
417 | @@ -65,6 +65,8 @@ | |||
418 | 65 | virtual void modify_window(WindowInfo& window_info, WindowSpecification const& modifications) = 0; | 65 | virtual void modify_window(WindowInfo& window_info, WindowSpecification const& modifications) = 0; |
419 | 66 | virtual auto info_for_window_id(std::string const& id) const -> WindowInfo& = 0; | 66 | virtual auto info_for_window_id(std::string const& id) const -> WindowInfo& = 0; |
420 | 67 | virtual auto id_for_window(Window const& window) const -> std::string = 0; | 67 | virtual auto id_for_window(Window const& window) const -> std::string = 0; |
421 | 68 | virtual void place_and_size_for_state(WindowSpecification& modifications, WindowInfo const& window_info) const= 0; | ||
422 | 69 | |||
423 | 68 | /** @} */ | 70 | /** @} */ |
424 | 69 | 71 | ||
425 | 70 | /** @name Multi-thread support | 72 | /** @name Multi-thread support |
Fixes those two bugs I reported, so I'm happy with it.
No opinion on the code itself, just stating that it fixed those bugs.