Merge lp:~alan-griffiths/miral/workspaces-example into lp:miral
- workspaces-example
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Alan Griffiths |
Approved revision: | 531 |
Merged at revision: | 516 |
Proposed branch: | lp:~alan-griffiths/miral/workspaces-example |
Merge into: | lp:miral |
Prerequisite: | lp:~alan-griffiths/miral/workspace-examples-prerequisites |
Diff against target: |
338 lines (+212/-8) 4 files modified
miral-shell/decoration_provider.cpp (+3/-3) miral-shell/titlebar_window_manager.cpp (+184/-3) miral-shell/titlebar_window_manager.h (+24/-1) miral/window_management_trace.cpp (+1/-1) |
To merge this branch: | bzr merge lp:~alan-griffiths/miral/workspaces-example |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brandon Schaefer (community) | Approve | ||
Gerry Boland | Pending | ||
Alan Griffiths | Pending | ||
Review via email: mp+317630@code.launchpad.net |
This proposal supersedes a proposal from 2017-02-17.
Commit message
[miral-shell] Example workspaces implementation
Description of the change
[miral-shell] Example workspaces implementation
Provides four workspaces:
o Switch workspace . . . . . . . . . . : Meta-Alt-
o Switch workspace taking active window: Meta-Ctrl-
~~~
Note: the "prerequisite" branch lp:~alan-griffiths/miral/workspace-examples-prerequisites only exists to workaround the launchpad limitation of a single prerequisite.
Gerry Boland (gerboland) wrote : Posted in a previous version of this proposal | # |
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
The active window tracking gets confused here.
Start miral-app
Start an app from the command line (e.g. mir_demo_
Move that app to another workspace (e.g. Ctrl-Meta-F4)
Switch back to first workspace (Alt-Meta-F4)
Move the terminal too (e.g. Ctrl-Meta-F4)
Now
1. Both apps show a "focussed" toolbar
2. Alt-Tab doesn't switch between apps
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
If a window in a hidden sets the state from the client then it overrides the hidden state imposed by the workspace.
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
> If a window in a hidden sets the state from the client then it overrides the
> hidden state imposed by the workspace.
Fixed
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
> 1. Both apps show a "focussed" toolbar
> 2. Alt-Tab doesn't switch between apps
Fixed
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
An issues I can reproduce:
1) Open egl plasma demo
2) Open egl triangle demo
3) egl triangle should be on top
4) switch work spaces to 2, meta + alt + f2
5) switch back to work space 1, meta + alt + f1
6) (note that egl triangle is ontop still but no window appears to be focused, ie. toolbars are greyed out)
7) switch back to work space 2, meta + alt + f2
8) switch back to work space 1, meta + alt + f1
Expected:
egl triangle to still be on top and focused
Result:
egl triangle is below egl plasma and plasma has focus
You can test this by alt+tabbing to get triangle back on top.
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
> An issues I can reproduce:
> 1) Open egl plasma demo
> 2) Open egl triangle demo
> 3) egl triangle should be on top
> 4) switch work spaces to 2, meta + alt + f2
> 5) switch back to work space 1, meta + alt + f1
> 6) (note that egl triangle is ontop still but no window appears to be focused,
> ie. toolbars are greyed out)
> 7) switch back to work space 2, meta + alt + f2
> 8) switch back to work space 1, meta + alt + f1
>
> Expected:
> egl triangle to still be on top and focused
>
> Result:
> egl triangle is below egl plasma and plasma has focus
>
> You can test this by alt+tabbing to get triangle back on top.
Fixed
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal | # |
Randomly seem to be getting garbage for window addresses:
[2017-02-17 07:26:25.497852] miral::Window Management: for_each_
- 522. By Alan Griffiths
-
Add workspace keys
- 523. By Alan Griffiths
-
merge lp:~alan-griffiths/miral/workspace-examples-prerequisites
- 524. By Alan Griffiths
-
Fix logging
Alan Griffiths (alan-griffiths) wrote : | # |
> Randomly seem to be getting garbage for window addresses:
> [2017-02-17 07:26:25.497852] miral::Window Management: for_each_
Fixed
Brandon Schaefer (brandontschaefer) wrote : | # |
1) Open egl plasma
2) Open egl triangle
3) Switch back and forth from f1 <---> f2 a few times with meta + alt
4) Switch to f1 with meta + alt, then using meta + ctrl moving the egl triangle to f2 then back to f1 with out letting go of the hot key
5) Switch to f2 using meta + alt
Expected:
An emtpy workspace
Result:
Egl triangle on this workspace, note if you switch to any other workspaces the egl triangle will still be there
Brandon Schaefer (brandontschaefer) wrote : | # |
Ok easier way:
1) Open egl plasma and egl triangle
2) meta + ctrl + f2
3) meta + ctrl + f1
4) meta + alt + f2
Expected:
An emtpy workspace
Result:
App on all workspaces
- 525. By Alan Griffiths
-
Fix
Alan Griffiths (alan-griffiths) wrote : | # |
> Ok easier way:
>
> 1) Open egl plasma and egl triangle
> 2) meta + ctrl + f2
> 3) meta + ctrl + f1
> 4) meta + alt + f2
>
> Expected:
> An emtpy workspace
>
> Result:
> App on all workspaces
Fixed
Alan Griffiths (alan-griffiths) wrote : | # |
> > Ok easier way:
> >
> > 1) Open egl plasma and egl triangle
> > 2) meta + ctrl + f2
> > 3) meta + ctrl + f1
> > 4) meta + alt + f2
> >
> > Expected:
> > An emtpy workspace
> >
> > Result:
> > App on all workspaces
>
> Fixed
Well, mostly fixed. There are some related scenarios I'm still qualifying that are not quite there yet.
But possibly good enough?
- 526. By Alan Griffiths
-
Fix logging
- 527. By Alan Griffiths
-
Better solution
Alan Griffiths (alan-griffiths) wrote : | # |
OK now?
Brandon Schaefer (brandontschaefer) wrote : | # |
Yup, looking good to me!
- 528. By Alan Griffiths
-
Comments to clarify code I can't simplify
- 529. By Alan Griffiths
-
DRY - reduce repetitive workspace visible/hidden code
- 530. By Alan Griffiths
-
merge :parent
- 531. By Alan Griffiths
-
merge lp:~alan-griffiths/miral/workspace-examples-prerequisites
Preview Diff
1 | === modified file 'miral-shell/decoration_provider.cpp' | |||
2 | --- miral-shell/decoration_provider.cpp 2017-02-17 11:00:17 +0000 | |||
3 | +++ miral-shell/decoration_provider.cpp 2017-02-20 17:31:27 +0000 | |||
4 | @@ -169,9 +169,9 @@ | |||
5 | 169 | " o Maximize/restore current window (to display size). : Alt-F11", | 169 | " o Maximize/restore current window (to display size). : Alt-F11", |
6 | 170 | " o Maximize/restore current window (to display height): Shift-F11", | 170 | " o Maximize/restore current window (to display height): Shift-F11", |
7 | 171 | " o Maximize/restore current window (to display width) : Ctrl-F11", | 171 | " o Maximize/restore current window (to display width) : Ctrl-F11", |
11 | 172 | // "", | 172 | "", |
12 | 173 | // " o Switch workspace: Meta-Alt-[F1|F2|F3|F4]", | 173 | " o Switch workspace: Meta-Alt-[F1|F2|F3|F4]", |
13 | 174 | // " o Switch workspace taking active window: Meta-Ctrl-[F1|F2|F3|F4]", | 174 | " o Switch workspace taking active window: Meta-Ctrl-[F1|F2|F3|F4]", |
14 | 175 | "", | 175 | "", |
15 | 176 | " o To exit: Ctrl-Alt-BkSp", | 176 | " o To exit: Ctrl-Alt-BkSp", |
16 | 177 | }; | 177 | }; |
17 | 178 | 178 | ||
18 | === modified file 'miral-shell/titlebar_window_manager.cpp' | |||
19 | --- miral-shell/titlebar_window_manager.cpp 2017-02-20 15:47:49 +0000 | |||
20 | +++ miral-shell/titlebar_window_manager.cpp 2017-02-20 17:31:27 +0000 | |||
21 | @@ -32,6 +32,18 @@ | |||
22 | 32 | namespace | 32 | namespace |
23 | 33 | { | 33 | { |
24 | 34 | int const title_bar_height = 12; | 34 | int const title_bar_height = 12; |
25 | 35 | |||
26 | 36 | struct PolicyData | ||
27 | 37 | { | ||
28 | 38 | bool in_hidden_workspace{false}; | ||
29 | 39 | |||
30 | 40 | MirWindowState old_state; | ||
31 | 41 | }; | ||
32 | 42 | |||
33 | 43 | inline PolicyData& policy_data_for(WindowInfo const& info) | ||
34 | 44 | { | ||
35 | 45 | return *std::static_pointer_cast<PolicyData>(info.userdata()); | ||
36 | 46 | } | ||
37 | 35 | } | 47 | } |
38 | 36 | 48 | ||
39 | 37 | TitlebarWindowManagerPolicy::TitlebarWindowManagerPolicy( | 49 | TitlebarWindowManagerPolicy::TitlebarWindowManagerPolicy( |
40 | @@ -43,6 +55,11 @@ | |||
41 | 43 | decoration_provider{std::make_unique<DecorationProvider>(tools)} | 55 | decoration_provider{std::make_unique<DecorationProvider>(tools)} |
42 | 44 | { | 56 | { |
43 | 45 | launcher.launch("decorations", *decoration_provider); | 57 | launcher.launch("decorations", *decoration_provider); |
44 | 58 | |||
45 | 59 | for (auto key : {KEY_F1, KEY_F2, KEY_F3, KEY_F4}) | ||
46 | 60 | key_to_workspace[key] = this->tools.create_workspace(); | ||
47 | 61 | |||
48 | 62 | active_workspace = key_to_workspace[KEY_F1]; | ||
49 | 46 | } | 63 | } |
50 | 47 | 64 | ||
51 | 48 | TitlebarWindowManagerPolicy::~TitlebarWindowManagerPolicy() = default; | 65 | TitlebarWindowManagerPolicy::~TitlebarWindowManagerPolicy() = default; |
52 | @@ -266,17 +283,25 @@ | |||
53 | 266 | { | 283 | { |
54 | 267 | CanonicalWindowManagerPolicy::advise_new_window(window_info); | 284 | CanonicalWindowManagerPolicy::advise_new_window(window_info); |
55 | 268 | 285 | ||
56 | 286 | auto const parent = window_info.parent(); | ||
57 | 287 | |||
58 | 269 | if (decoration_provider->is_titlebar(window_info)) | 288 | if (decoration_provider->is_titlebar(window_info)) |
59 | 270 | { | 289 | { |
60 | 271 | decoration_provider->advise_new_titlebar(window_info); | 290 | decoration_provider->advise_new_titlebar(window_info); |
61 | 272 | 291 | ||
62 | 273 | auto const parent = window_info.parent(); | ||
63 | 274 | |||
64 | 275 | if (tools.active_window() == parent) | 292 | if (tools.active_window() == parent) |
65 | 276 | decoration_provider->paint_titlebar_for(tools.info_for(parent), 0xFF); | 293 | decoration_provider->paint_titlebar_for(tools.info_for(parent), 0xFF); |
66 | 277 | else | 294 | else |
67 | 278 | decoration_provider->paint_titlebar_for(tools.info_for(parent), 0x3F); | 295 | decoration_provider->paint_titlebar_for(tools.info_for(parent), 0x3F); |
68 | 279 | } | 296 | } |
69 | 297 | |||
70 | 298 | if (!parent) | ||
71 | 299 | tools.add_tree_to_workspace(window_info.window(), active_workspace); | ||
72 | 300 | else | ||
73 | 301 | { | ||
74 | 302 | if (policy_data_for(tools.info_for(parent)).in_hidden_workspace) | ||
75 | 303 | apply_workspace_hidden_to(window_info.window()); | ||
76 | 304 | } | ||
77 | 280 | } | 305 | } |
78 | 281 | 306 | ||
79 | 282 | void TitlebarWindowManagerPolicy::handle_window_ready(WindowInfo& window_info) | 307 | void TitlebarWindowManagerPolicy::handle_window_ready(WindowInfo& window_info) |
80 | @@ -337,6 +362,36 @@ | |||
81 | 337 | auto const scan_code = mir_keyboard_event_scan_code(event); | 362 | auto const scan_code = mir_keyboard_event_scan_code(event); |
82 | 338 | auto const modifiers = mir_keyboard_event_modifiers(event) & modifier_mask; | 363 | auto const modifiers = mir_keyboard_event_modifiers(event) & modifier_mask; |
83 | 339 | 364 | ||
84 | 365 | // Switch workspaces | ||
85 | 366 | if (action == mir_keyboard_action_down && | ||
86 | 367 | modifiers == (mir_input_event_modifier_alt | mir_input_event_modifier_meta)) | ||
87 | 368 | { | ||
88 | 369 | switch (scan_code) | ||
89 | 370 | { | ||
90 | 371 | case KEY_F1: | ||
91 | 372 | case KEY_F2: | ||
92 | 373 | case KEY_F3: | ||
93 | 374 | case KEY_F4: | ||
94 | 375 | switch_workspace_to(key_to_workspace[scan_code]); | ||
95 | 376 | return true; | ||
96 | 377 | } | ||
97 | 378 | } | ||
98 | 379 | |||
99 | 380 | // Switch workspace taking the active window | ||
100 | 381 | if (action == mir_keyboard_action_down && | ||
101 | 382 | modifiers == (mir_input_event_modifier_ctrl | mir_input_event_modifier_meta)) | ||
102 | 383 | { | ||
103 | 384 | switch (scan_code) | ||
104 | 385 | { | ||
105 | 386 | case KEY_F1: | ||
106 | 387 | case KEY_F2: | ||
107 | 388 | case KEY_F3: | ||
108 | 389 | case KEY_F4: | ||
109 | 390 | switch_workspace_to(key_to_workspace[scan_code], tools.active_window()); | ||
110 | 391 | return true; | ||
111 | 392 | } | ||
112 | 393 | } | ||
113 | 394 | |||
114 | 340 | if (action != mir_keyboard_action_repeat) | 395 | if (action != mir_keyboard_action_repeat) |
115 | 341 | end_resize(); | 396 | end_resize(); |
116 | 342 | 397 | ||
117 | @@ -362,7 +417,7 @@ | |||
118 | 362 | } | 417 | } |
119 | 363 | else if (action == mir_keyboard_action_down && scan_code == KEY_F4) | 418 | else if (action == mir_keyboard_action_down && scan_code == KEY_F4) |
120 | 364 | { | 419 | { |
122 | 365 | switch (modifiers & modifier_mask) | 420 | switch (modifiers) |
123 | 366 | { | 421 | { |
124 | 367 | case mir_input_event_modifier_alt|mir_input_event_modifier_shift: | 422 | case mir_input_event_modifier_alt|mir_input_event_modifier_shift: |
125 | 368 | if (auto const& window = tools.active_window()) | 423 | if (auto const& window = tools.active_window()) |
126 | @@ -569,5 +624,131 @@ | |||
127 | 569 | if (app_info.application() == decoration_provider->session()) | 624 | if (app_info.application() == decoration_provider->session()) |
128 | 570 | decoration_provider->place_new_decoration(parameters); | 625 | decoration_provider->place_new_decoration(parameters); |
129 | 571 | 626 | ||
130 | 627 | parameters.userdata() = std::make_shared<PolicyData>(); | ||
131 | 572 | return parameters; | 628 | return parameters; |
132 | 573 | } | 629 | } |
133 | 630 | |||
134 | 631 | void TitlebarWindowManagerPolicy::advise_adding_to_workspace( | ||
135 | 632 | std::shared_ptr<Workspace> const& workspace, std::vector<Window> const& windows) | ||
136 | 633 | { | ||
137 | 634 | if (windows.empty()) | ||
138 | 635 | return; | ||
139 | 636 | |||
140 | 637 | for (auto const& window : windows) | ||
141 | 638 | { | ||
142 | 639 | if (workspace == active_workspace) | ||
143 | 640 | { | ||
144 | 641 | apply_workspace_visible_to(window); | ||
145 | 642 | } | ||
146 | 643 | else | ||
147 | 644 | { | ||
148 | 645 | apply_workspace_hidden_to(window); | ||
149 | 646 | } | ||
150 | 647 | } | ||
151 | 648 | } | ||
152 | 649 | |||
153 | 650 | void TitlebarWindowManagerPolicy::switch_workspace_to( | ||
154 | 651 | std::shared_ptr<Workspace> const& workspace, | ||
155 | 652 | Window const& window) | ||
156 | 653 | { | ||
157 | 654 | if (workspace == active_workspace) | ||
158 | 655 | return; | ||
159 | 656 | |||
160 | 657 | auto const old_active = active_workspace; | ||
161 | 658 | active_workspace = workspace; | ||
162 | 659 | |||
163 | 660 | auto const old_active_window = tools.active_window(); | ||
164 | 661 | |||
165 | 662 | if (!old_active_window) | ||
166 | 663 | { | ||
167 | 664 | // If there's no active window, the first shown grabs focus: get the right one | ||
168 | 665 | if (auto const ww = workspace_to_active[workspace]) | ||
169 | 666 | { | ||
170 | 667 | tools.for_each_workspace_containing(ww, [&](std::shared_ptr<miral::Workspace> const& ws) | ||
171 | 668 | { | ||
172 | 669 | if (ws == workspace) | ||
173 | 670 | { | ||
174 | 671 | apply_workspace_visible_to(ww); | ||
175 | 672 | } | ||
176 | 673 | }); | ||
177 | 674 | } | ||
178 | 675 | } | ||
179 | 676 | |||
180 | 677 | tools.remove_tree_from_workspace(window, old_active); | ||
181 | 678 | tools.add_tree_to_workspace(window, active_workspace); | ||
182 | 679 | |||
183 | 680 | tools.for_each_window_in_workspace(active_workspace, [&](Window const& window) | ||
184 | 681 | { | ||
185 | 682 | if (decoration_provider->is_decoration(window)) | ||
186 | 683 | return; // decorations are taken care of automatically | ||
187 | 684 | |||
188 | 685 | apply_workspace_visible_to(window); | ||
189 | 686 | }); | ||
190 | 687 | |||
191 | 688 | bool hide_old_active = false; | ||
192 | 689 | tools.for_each_window_in_workspace(old_active, [&](Window const& window) | ||
193 | 690 | { | ||
194 | 691 | if (decoration_provider->is_decoration(window)) | ||
195 | 692 | return; // decorations are taken care of automatically | ||
196 | 693 | |||
197 | 694 | if (window == old_active_window) | ||
198 | 695 | { | ||
199 | 696 | // If we hide the active window focus will shift: do that last | ||
200 | 697 | hide_old_active = true; | ||
201 | 698 | return; | ||
202 | 699 | } | ||
203 | 700 | |||
204 | 701 | apply_workspace_hidden_to(window); | ||
205 | 702 | }); | ||
206 | 703 | |||
207 | 704 | if (hide_old_active) | ||
208 | 705 | { | ||
209 | 706 | apply_workspace_hidden_to(old_active_window); | ||
210 | 707 | |||
211 | 708 | // Remember the old active_window when we switch away | ||
212 | 709 | workspace_to_active[old_active] = old_active_window; | ||
213 | 710 | } | ||
214 | 711 | } | ||
215 | 712 | |||
216 | 713 | void TitlebarWindowManagerPolicy::apply_workspace_hidden_to(Window const& window) | ||
217 | 714 | { | ||
218 | 715 | auto const& window_info = tools.info_for(window); | ||
219 | 716 | auto& pdata = policy_data_for(window_info); | ||
220 | 717 | if (!pdata.in_hidden_workspace) | ||
221 | 718 | { | ||
222 | 719 | pdata.in_hidden_workspace = true; | ||
223 | 720 | pdata.old_state = window_info.state(); | ||
224 | 721 | |||
225 | 722 | WindowSpecification modifications; | ||
226 | 723 | modifications.state() = mir_window_state_hidden; | ||
227 | 724 | tools.place_and_size_for_state(modifications, window_info); | ||
228 | 725 | tools.modify_window(window_info.window(), modifications); | ||
229 | 726 | } | ||
230 | 727 | } | ||
231 | 728 | |||
232 | 729 | void TitlebarWindowManagerPolicy::apply_workspace_visible_to(Window const& window) | ||
233 | 730 | { | ||
234 | 731 | auto const& window_info = tools.info_for(window); | ||
235 | 732 | auto& pdata = policy_data_for(window_info); | ||
236 | 733 | if (pdata.in_hidden_workspace) | ||
237 | 734 | { | ||
238 | 735 | pdata.in_hidden_workspace = false; | ||
239 | 736 | WindowSpecification modifications; | ||
240 | 737 | modifications.state() = pdata.old_state; | ||
241 | 738 | tools.place_and_size_for_state(modifications, window_info); | ||
242 | 739 | tools.modify_window(window_info.window(), modifications); | ||
243 | 740 | } | ||
244 | 741 | } | ||
245 | 742 | |||
246 | 743 | void TitlebarWindowManagerPolicy::handle_modify_window(WindowInfo& window_info, WindowSpecification const& modifications) | ||
247 | 744 | { | ||
248 | 745 | auto mods = modifications; | ||
249 | 746 | |||
250 | 747 | auto& pdata = policy_data_for(window_info); | ||
251 | 748 | |||
252 | 749 | if (pdata.in_hidden_workspace && mods.state().is_set()) | ||
253 | 750 | pdata.old_state = mods.state().consume(); | ||
254 | 751 | |||
255 | 752 | CanonicalWindowManagerPolicy::handle_modify_window(window_info, mods); | ||
256 | 753 | } | ||
257 | 754 | |||
258 | 574 | 755 | ||
259 | === modified file 'miral-shell/titlebar_window_manager.h' | |||
260 | --- miral-shell/titlebar_window_manager.h 2017-02-20 15:47:49 +0000 | |||
261 | +++ miral-shell/titlebar_window_manager.h 2017-02-20 17:31:27 +0000 | |||
262 | @@ -20,10 +20,12 @@ | |||
263 | 20 | #define MIRAL_SHELL_TITLEBAR_WINDOW_MANAGER_H | 20 | #define MIRAL_SHELL_TITLEBAR_WINDOW_MANAGER_H |
264 | 21 | 21 | ||
265 | 22 | #include <miral/canonical_window_manager.h> | 22 | #include <miral/canonical_window_manager.h> |
266 | 23 | #include <miral/workspace_policy.h> | ||
267 | 23 | 24 | ||
268 | 24 | #include "spinner/splash.h" | 25 | #include "spinner/splash.h" |
269 | 25 | 26 | ||
270 | 26 | #include <chrono> | 27 | #include <chrono> |
271 | 28 | #include <map> | ||
272 | 27 | 29 | ||
273 | 28 | namespace miral { class InternalClientLauncher; } | 30 | namespace miral { class InternalClientLauncher; } |
274 | 29 | 31 | ||
275 | @@ -31,7 +33,7 @@ | |||
276 | 31 | 33 | ||
277 | 32 | class DecorationProvider; | 34 | class DecorationProvider; |
278 | 33 | 35 | ||
280 | 34 | class TitlebarWindowManagerPolicy : public miral::CanonicalWindowManagerPolicy | 36 | class TitlebarWindowManagerPolicy : public miral::CanonicalWindowManagerPolicy, miral::WorkspacePolicy |
281 | 35 | { | 37 | { |
282 | 36 | public: | 38 | public: |
283 | 37 | TitlebarWindowManagerPolicy(miral::WindowManagerTools const& tools, SpinnerSplash const& spinner, miral::InternalClientLauncher const& launcher); | 39 | TitlebarWindowManagerPolicy(miral::WindowManagerTools const& tools, SpinnerSplash const& spinner, miral::InternalClientLauncher const& launcher); |
284 | @@ -48,6 +50,8 @@ | |||
285 | 48 | * o Maximize/restore current window (to display size): Alt-F11 | 50 | * o Maximize/restore current window (to display size): Alt-F11 |
286 | 49 | * o Maximize/restore current window (to display height): Shift-F11 | 51 | * o Maximize/restore current window (to display height): Shift-F11 |
287 | 50 | * o Maximize/restore current window (to display width): Ctrl-F11 | 52 | * o Maximize/restore current window (to display width): Ctrl-F11 |
288 | 53 | * o Switch workspace . . . . . . . . . . : Meta-Alt-[F1|F2|F3|F4] | ||
289 | 54 | * o Switch workspace taking active window: Meta-Ctrl-[F1|F2|F3|F4] | ||
290 | 51 | * @{ */ | 55 | * @{ */ |
291 | 52 | bool handle_pointer_event(MirPointerEvent const* event) override; | 56 | bool handle_pointer_event(MirPointerEvent const* event) override; |
292 | 53 | bool handle_touch_event(MirTouchEvent const* event) override; | 57 | bool handle_touch_event(MirTouchEvent const* event) override; |
293 | @@ -63,6 +67,8 @@ | |||
294 | 63 | void advise_state_change(miral::WindowInfo const& window_info, MirWindowState state) override; | 67 | void advise_state_change(miral::WindowInfo const& window_info, MirWindowState state) override; |
295 | 64 | void advise_resize(miral::WindowInfo const& window_info, Size const& new_size) override; | 68 | void advise_resize(miral::WindowInfo const& window_info, Size const& new_size) override; |
296 | 65 | void advise_delete_window(miral::WindowInfo const& window_info) override; | 69 | void advise_delete_window(miral::WindowInfo const& window_info) override; |
297 | 70 | |||
298 | 71 | void handle_modify_window(miral::WindowInfo& window_info, miral::WindowSpecification const& modifications) override; | ||
299 | 66 | /** @} */ | 72 | /** @} */ |
300 | 67 | 73 | ||
301 | 68 | protected: | 74 | protected: |
302 | @@ -104,6 +110,23 @@ | |||
303 | 104 | 110 | ||
304 | 105 | // Workaround for lp:1627697 | 111 | // Workaround for lp:1627697 |
305 | 106 | std::chrono::steady_clock::time_point last_resize; | 112 | std::chrono::steady_clock::time_point last_resize; |
306 | 113 | |||
307 | 114 | void advise_adding_to_workspace( | ||
308 | 115 | std::shared_ptr<miral::Workspace> const& workspace, | ||
309 | 116 | std::vector<miral::Window> const& windows) override; | ||
310 | 117 | |||
311 | 118 | // Switch workspace, taking window (if not null) | ||
312 | 119 | void switch_workspace_to( | ||
313 | 120 | std::shared_ptr<miral::Workspace> const& workspace, | ||
314 | 121 | miral::Window const& window = miral::Window{}); | ||
315 | 122 | |||
316 | 123 | std::shared_ptr<miral::Workspace> active_workspace; | ||
317 | 124 | std::map<int, std::shared_ptr<miral::Workspace>> key_to_workspace; | ||
318 | 125 | std::map<std::shared_ptr<miral::Workspace>, miral::Window> workspace_to_active; | ||
319 | 126 | |||
320 | 127 | void apply_workspace_visible_to(miral::Window const& window); | ||
321 | 128 | |||
322 | 129 | void apply_workspace_hidden_to(miral::Window const& window); | ||
323 | 107 | }; | 130 | }; |
324 | 108 | 131 | ||
325 | 109 | #endif //MIRAL_SHELL_TITLEBAR_WINDOW_MANAGER_H | 132 | #endif //MIRAL_SHELL_TITLEBAR_WINDOW_MANAGER_H |
326 | 110 | 133 | ||
327 | === modified file 'miral/window_management_trace.cpp' | |||
328 | --- miral/window_management_trace.cpp 2017-02-10 15:22:37 +0000 | |||
329 | +++ miral/window_management_trace.cpp 2017-02-20 17:31:27 +0000 | |||
330 | @@ -558,7 +558,7 @@ | |||
331 | 558 | void miral::WindowManagementTrace::for_each_workspace_containing( | 558 | void miral::WindowManagementTrace::for_each_workspace_containing( |
332 | 559 | miral::Window const& window, std::function<void(std::shared_ptr<miral::Workspace> const&)> const& callback) | 559 | miral::Window const& window, std::function<void(std::shared_ptr<miral::Workspace> const&)> const& callback) |
333 | 560 | try { | 560 | try { |
335 | 561 | mir::log_info("%s window=%s", __func__, dump_of(window)); | 561 | mir::log_info("%s window=%s", __func__, dump_of(window).c_str()); |
336 | 562 | wrapped.for_each_workspace_containing(window, callback); | 562 | wrapped.for_each_workspace_containing(window, callback); |
337 | 563 | } | 563 | } |
338 | 564 | MIRAL_TRACE_EXCEPTION | 564 | MIRAL_TRACE_EXCEPTION |
Looks quite ok. The old state save/restore and window_state_hidden updates are a bit repetitive, but more belong in the policy implementation, so is ok