Merge lp:~alan-griffiths/miral/miral-shell-intro-text into lp:miral
- miral-shell-intro-text
- Merge into trunk
Proposed by
Alan Griffiths
Status: | Superseded |
---|---|
Proposed branch: | lp:~alan-griffiths/miral/miral-shell-intro-text |
Merge into: | lp:miral |
Prerequisite: | lp:~alan-griffiths/miral/workspaces-example |
Diff against target: |
761 lines (+293/-73) 7 files modified
include/mir/client/display_config.h (+75/-0) miral-shell/CMakeLists.txt (+1/-1) miral-shell/decoration_provider.cpp (+176/-35) miral-shell/decoration_provider.h (+14/-8) miral-shell/titlebar_window_manager.cpp (+23/-26) miral-shell/titlebar_window_manager.h (+3/-3) miral/CMakeLists.txt (+1/-0) |
To merge this branch: | bzr merge lp:~alan-griffiths/miral/miral-shell-intro-text |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir development team | Pending | ||
Review via email: mp+317120@code.launchpad.net |
This proposal has been superseded by a proposal from 2017-02-17.
Commit message
[miral-shell] Use background on 1st monitor to show keyboard shortcuts
Description of the change
To post a comment you must log in.
- 511. By Alan Griffiths
-
Better naming
- 512. By Alan Griffiths
- 513. By Alan Griffiths
- 514. By Alan Griffiths
- 515. By Alan Griffiths
- 516. By Alan Griffiths
-
Display helptext on all outputs
- 517. By Alan Griffiths
- 518. By Alan Griffiths
-
Remove intro text if display config changes
Unmerged revisions
- 518. By Alan Griffiths
-
Remove intro text if display config changes
- 517. By Alan Griffiths
- 516. By Alan Griffiths
-
Display helptext on all outputs
- 515. By Alan Griffiths
- 514. By Alan Griffiths
- 513. By Alan Griffiths
- 512. By Alan Griffiths
- 511. By Alan Griffiths
-
Better naming
- 510. By Alan Griffiths
-
Fix whitespace
- 509. By Alan Griffiths
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'include/mir/client/display_config.h' | |||
2 | --- include/mir/client/display_config.h 1970-01-01 00:00:00 +0000 | |||
3 | +++ include/mir/client/display_config.h 2017-02-16 17:33:30 +0000 | |||
4 | @@ -0,0 +1,75 @@ | |||
5 | 1 | /* | ||
6 | 2 | * Copyright © 2017 Canonical Ltd. | ||
7 | 3 | * | ||
8 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
9 | 5 | * under the terms of the GNU General Public License version 3, | ||
10 | 6 | * as published by the Free Software Foundation. | ||
11 | 7 | * | ||
12 | 8 | * This program is distributed in the hope that it will be useful, | ||
13 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | 11 | * GNU General Public License for more details. | ||
16 | 12 | * | ||
17 | 13 | * You should have received a copy of the GNU General Public License | ||
18 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | 15 | * | ||
20 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
21 | 17 | */ | ||
22 | 18 | |||
23 | 19 | #ifndef MIR_CLIENT_DISPLAY_CONFIG_H | ||
24 | 20 | #define MIR_CLIENT_DISPLAY_CONFIG_H | ||
25 | 21 | |||
26 | 22 | #include <mir_toolkit/mir_connection.h> | ||
27 | 23 | #include <mir_toolkit/mir_display_configuration.h> | ||
28 | 24 | |||
29 | 25 | #include <functional> | ||
30 | 26 | #include <memory> | ||
31 | 27 | |||
32 | 28 | namespace mir | ||
33 | 29 | { | ||
34 | 30 | /// Convenient C++ wrappers around the Mir toolkit API. | ||
35 | 31 | /// | ||
36 | 32 | /// These wrappers are intentionally inline adapters: the compiled code depend directly on the Mir toolkit API. | ||
37 | 33 | namespace client | ||
38 | 34 | { | ||
39 | 35 | class DisplayConfig | ||
40 | 36 | { | ||
41 | 37 | public: | ||
42 | 38 | DisplayConfig() = default; | ||
43 | 39 | |||
44 | 40 | explicit DisplayConfig(MirDisplayConfig* config) : self{config, deleter} {} | ||
45 | 41 | |||
46 | 42 | explicit DisplayConfig(MirConnection* connection) : | ||
47 | 43 | self{mir_connection_create_display_configuration(connection), deleter} {} | ||
48 | 44 | |||
49 | 45 | operator MirDisplayConfig*() { return self.get(); } | ||
50 | 46 | |||
51 | 47 | operator MirDisplayConfig const*() const { return self.get(); } | ||
52 | 48 | |||
53 | 49 | void reset() { self.reset(); } | ||
54 | 50 | |||
55 | 51 | void for_each_output(std::function<void(MirOutput const*)> const& enumerator) const | ||
56 | 52 | { | ||
57 | 53 | auto const count = mir_display_config_get_num_outputs(*this); | ||
58 | 54 | |||
59 | 55 | for (int i = 0; i != count; ++i) | ||
60 | 56 | enumerator(mir_display_config_get_output(*this, i)); | ||
61 | 57 | } | ||
62 | 58 | |||
63 | 59 | void for_each_output(std::function<void(MirOutput*)> const& enumerator) | ||
64 | 60 | { | ||
65 | 61 | auto const count = mir_display_config_get_num_outputs(*this); | ||
66 | 62 | |||
67 | 63 | for (int i = 0; i != count; ++i) | ||
68 | 64 | enumerator(mir_display_config_get_mutable_output(*this, i)); | ||
69 | 65 | } | ||
70 | 66 | |||
71 | 67 | private: | ||
72 | 68 | static void deleter(MirDisplayConfig* config) { mir_display_config_release(config); } | ||
73 | 69 | |||
74 | 70 | std::shared_ptr <MirDisplayConfig> self; | ||
75 | 71 | }; | ||
76 | 72 | } | ||
77 | 73 | } | ||
78 | 74 | |||
79 | 75 | #endif //MIR_CLIENT_DISPLAY_CONFIG_H | ||
80 | 0 | 76 | ||
81 | === modified file 'miral-shell/CMakeLists.txt' | |||
82 | --- miral-shell/CMakeLists.txt 2016-12-14 11:22:57 +0000 | |||
83 | +++ miral-shell/CMakeLists.txt 2017-02-16 17:33:30 +0000 | |||
84 | @@ -45,7 +45,7 @@ | |||
85 | 45 | shell_main.cpp | 45 | shell_main.cpp |
86 | 46 | tiling_window_manager.cpp tiling_window_manager.h | 46 | tiling_window_manager.cpp tiling_window_manager.h |
87 | 47 | titlebar_window_manager.cpp titlebar_window_manager.h | 47 | titlebar_window_manager.cpp titlebar_window_manager.h |
89 | 48 | titlebar_provider.cpp titlebar_provider.h | 48 | decoration_provider.cpp decoration_provider.h |
90 | 49 | titlebar_config.cpp titlebar_config.h | 49 | titlebar_config.cpp titlebar_config.h |
91 | 50 | ) | 50 | ) |
92 | 51 | 51 | ||
93 | 52 | 52 | ||
94 | === renamed file 'miral-shell/titlebar_provider.cpp' => 'miral-shell/decoration_provider.cpp' | |||
95 | --- miral-shell/titlebar_provider.cpp 2017-02-16 17:33:30 +0000 | |||
96 | +++ miral-shell/decoration_provider.cpp 2017-02-16 17:33:30 +0000 | |||
97 | @@ -1,5 +1,5 @@ | |||
98 | 1 | /* | 1 | /* |
100 | 2 | * Copyright © 2016 Canonical Ltd. | 2 | * Copyright © 2016-2017 Canonical Ltd. |
101 | 3 | * | 3 | * |
102 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
103 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
104 | @@ -16,9 +16,10 @@ | |||
105 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
106 | 17 | */ | 17 | */ |
107 | 18 | 18 | ||
109 | 19 | #include "titlebar_provider.h" | 19 | #include "decoration_provider.h" |
110 | 20 | #include "titlebar_config.h" | 20 | #include "titlebar_config.h" |
111 | 21 | 21 | ||
112 | 22 | #include <mir/client/display_config.h> | ||
113 | 22 | #include <mir/client/window_spec.h> | 23 | #include <mir/client/window_spec.h> |
114 | 23 | 24 | ||
115 | 24 | #include <mir_toolkit/mir_buffer_stream.h> | 25 | #include <mir_toolkit/mir_buffer_stream.h> |
116 | @@ -37,8 +38,9 @@ | |||
117 | 37 | namespace | 38 | namespace |
118 | 38 | { | 39 | { |
119 | 39 | int const title_bar_height = 12; | 40 | int const title_bar_height = 12; |
120 | 41 | char const* const wallpaper_name = "wallpaper"; | ||
121 | 40 | 42 | ||
123 | 41 | void null_surface_callback(MirWindow*, void*) {} | 43 | void null_window_callback(MirWindow*, void*) {} |
124 | 42 | 44 | ||
125 | 43 | struct Printer | 45 | struct Printer |
126 | 44 | { | 46 | { |
127 | @@ -48,6 +50,7 @@ | |||
128 | 48 | Printer& operator=(Printer const&) = delete; | 50 | Printer& operator=(Printer const&) = delete; |
129 | 49 | 51 | ||
130 | 50 | void print(MirGraphicsRegion const& region, std::string const& title, int const intensity); | 52 | void print(MirGraphicsRegion const& region, std::string const& title, int const intensity); |
131 | 53 | void printhelp(MirGraphicsRegion const& region); | ||
132 | 51 | 54 | ||
133 | 52 | private: | 55 | private: |
134 | 53 | std::wstring_convert<std::codecvt_utf16<wchar_t>> converter; | 56 | std::wstring_convert<std::codecvt_utf16<wchar_t>> converter; |
135 | @@ -59,11 +62,7 @@ | |||
136 | 59 | 62 | ||
137 | 60 | void paint_surface(MirWindow* surface, std::string const& title, int const intensity) | 63 | void paint_surface(MirWindow* surface, std::string const& title, int const intensity) |
138 | 61 | { | 64 | { |
139 | 62 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | ||
140 | 63 | MirBufferStream* buffer_stream = mir_surface_get_buffer_stream(surface); | ||
141 | 64 | #else | ||
142 | 65 | MirBufferStream* buffer_stream = mir_window_get_buffer_stream(surface); | 65 | MirBufferStream* buffer_stream = mir_window_get_buffer_stream(surface); |
143 | 66 | #endif | ||
144 | 67 | 66 | ||
145 | 68 | // TODO sometimes buffer_stream is nullptr - find out why (and fix). | 67 | // TODO sometimes buffer_stream is nullptr - find out why (and fix). |
146 | 69 | // (Only observed when creating a lot of clients at once) | 68 | // (Only observed when creating a lot of clients at once) |
147 | @@ -152,22 +151,114 @@ | |||
148 | 152 | base_y += glyph->advance.y >> 6; | 151 | base_y += glyph->advance.y >> 6; |
149 | 153 | } | 152 | } |
150 | 154 | } | 153 | } |
151 | 154 | |||
152 | 155 | void Printer::printhelp(MirGraphicsRegion const& region) | ||
153 | 156 | { | ||
154 | 157 | static char const* const helptext[] = | ||
155 | 158 | { | ||
156 | 159 | "Welcome to miral-shell", | ||
157 | 160 | "", | ||
158 | 161 | "Keyboard shortcuts:", | ||
159 | 162 | "", | ||
160 | 163 | " o Switch apps: Alt-Tab, tap or click on the corresponding window", | ||
161 | 164 | " o Switch window: Alt-`, tap or click on the corresponding window", | ||
162 | 165 | "", | ||
163 | 166 | " o Move window: Alt-leftmousebutton drag (three finger drag)", | ||
164 | 167 | " o Resize window: Alt-middle_button drag (three finger pinch)", | ||
165 | 168 | "", | ||
166 | 169 | " o Maximize/restore current window (to display size). : Alt-F11", | ||
167 | 170 | " o Maximize/restore current window (to display height): Shift-F11", | ||
168 | 171 | " o Maximize/restore current window (to display width) : Ctrl-F11", | ||
169 | 172 | "", | ||
170 | 173 | " o Switch workspace: Meta-Alt-[F1|F2|F3|F4]", | ||
171 | 174 | " o Switch workspace taking active window: Meta-Ctrl-[F1|F2|F3|F4]", | ||
172 | 175 | "", | ||
173 | 176 | " o To exit: Ctrl-Alt-BkSp", | ||
174 | 177 | }; | ||
175 | 178 | |||
176 | 179 | int help_width = 0; | ||
177 | 180 | unsigned int help_height = 0; | ||
178 | 181 | unsigned int line_height = 0; | ||
179 | 182 | |||
180 | 183 | for (auto const* rawline : helptext) | ||
181 | 184 | { | ||
182 | 185 | int line_width = 0; | ||
183 | 186 | |||
184 | 187 | auto const line = converter.from_bytes(rawline); | ||
185 | 188 | |||
186 | 189 | auto const fwidth = std::min(region.width / 60, 20); | ||
187 | 190 | |||
188 | 191 | FT_Set_Pixel_Sizes(face, fwidth, 0); | ||
189 | 192 | |||
190 | 193 | for (auto const& ch : line) | ||
191 | 194 | { | ||
192 | 195 | FT_Load_Glyph(face, FT_Get_Char_Index(face, ch), FT_LOAD_DEFAULT); | ||
193 | 196 | auto const glyph = face->glyph; | ||
194 | 197 | FT_Render_Glyph(glyph, FT_RENDER_MODE_NORMAL); | ||
195 | 198 | |||
196 | 199 | line_width += glyph->advance.x >> 6; | ||
197 | 200 | line_height = std::max(line_height, glyph->bitmap.rows + glyph->bitmap.rows/2); | ||
198 | 201 | } | ||
199 | 202 | |||
200 | 203 | if (help_width < line_width) help_width = line_width; | ||
201 | 204 | help_height += line_height; | ||
202 | 205 | } | ||
203 | 206 | |||
204 | 207 | int base_y = (region.height - help_height)/2; | ||
205 | 208 | |||
206 | 209 | for (auto const* rawline : helptext) | ||
207 | 210 | { | ||
208 | 211 | int base_x = (region.width - help_width)/2; | ||
209 | 212 | |||
210 | 213 | auto const line = converter.from_bytes(rawline); | ||
211 | 214 | |||
212 | 215 | for (auto const& ch : line) | ||
213 | 216 | { | ||
214 | 217 | FT_Load_Glyph(face, FT_Get_Char_Index(face, ch), FT_LOAD_DEFAULT); | ||
215 | 218 | auto const glyph = face->glyph; | ||
216 | 219 | FT_Render_Glyph(glyph, FT_RENDER_MODE_NORMAL); | ||
217 | 220 | |||
218 | 221 | auto const& bitmap = glyph->bitmap; | ||
219 | 222 | auto const x = base_x + glyph->bitmap_left; | ||
220 | 223 | |||
221 | 224 | if (static_cast<int>(x + bitmap.width) <= region.width) | ||
222 | 225 | { | ||
223 | 226 | unsigned char* src = bitmap.buffer; | ||
224 | 227 | |||
225 | 228 | auto const y = base_y - glyph->bitmap_top; | ||
226 | 229 | char* dest = region.vaddr + y * region.stride + 4 * x; | ||
227 | 230 | |||
228 | 231 | for (auto row = 0u; row != bitmap.rows; ++row) | ||
229 | 232 | { | ||
230 | 233 | for (auto col = 0u; col != 4 * bitmap.width; ++col) | ||
231 | 234 | dest[col] |= src[col / 4]/2; | ||
232 | 235 | |||
233 | 236 | src += bitmap.pitch; | ||
234 | 237 | dest += region.stride; | ||
235 | 238 | } | ||
236 | 239 | } | ||
237 | 240 | |||
238 | 241 | base_x += glyph->advance.x >> 6; | ||
239 | 242 | } | ||
240 | 243 | base_y += line_height; | ||
241 | 244 | } | ||
242 | 245 | } | ||
243 | 155 | } | 246 | } |
244 | 156 | 247 | ||
245 | 157 | using namespace mir::client; | 248 | using namespace mir::client; |
246 | 158 | using namespace mir::geometry; | 249 | using namespace mir::geometry; |
247 | 159 | 250 | ||
249 | 160 | TitlebarProvider::TitlebarProvider(miral::WindowManagerTools const& tools) : tools{tools} | 251 | DecorationProvider::DecorationProvider(miral::WindowManagerTools const& tools) : tools{tools} |
250 | 161 | { | 252 | { |
251 | 162 | 253 | ||
252 | 163 | } | 254 | } |
253 | 164 | 255 | ||
255 | 165 | TitlebarProvider::~TitlebarProvider() | 256 | DecorationProvider::~DecorationProvider() |
256 | 166 | { | 257 | { |
257 | 167 | stop(); | 258 | stop(); |
258 | 168 | } | 259 | } |
259 | 169 | 260 | ||
261 | 170 | void TitlebarProvider::stop() | 261 | void DecorationProvider::stop() |
262 | 171 | { | 262 | { |
263 | 172 | enqueue_work([this] | 263 | enqueue_work([this] |
264 | 173 | { | 264 | { |
265 | @@ -177,30 +268,75 @@ | |||
266 | 177 | 268 | ||
267 | 178 | enqueue_work([this] | 269 | enqueue_work([this] |
268 | 179 | { | 270 | { |
269 | 271 | wallpaper.erase(begin(wallpaper), end(wallpaper)); | ||
270 | 180 | connection.reset(); | 272 | connection.reset(); |
271 | 181 | stop_work(); | 273 | stop_work(); |
272 | 182 | }); | 274 | }); |
273 | 183 | } | 275 | } |
274 | 184 | 276 | ||
276 | 185 | void TitlebarProvider::operator()(mir::client::Connection connection) | 277 | namespace |
277 | 278 | { | ||
278 | 279 | void render_pattern(MirGraphicsRegion* region, uint8_t const pattern[]) | ||
279 | 280 | { | ||
280 | 281 | char* row = region->vaddr; | ||
281 | 282 | |||
282 | 283 | for (int j = 0; j < region->height; j++) | ||
283 | 284 | { | ||
284 | 285 | uint32_t* pixel = (uint32_t*)row; | ||
285 | 286 | |||
286 | 287 | for (int i = 0; i < region->width; i++) | ||
287 | 288 | memcpy(pixel + i, pattern, sizeof pixel[i]); | ||
288 | 289 | |||
289 | 290 | row += region->stride; | ||
290 | 291 | } | ||
291 | 292 | |||
292 | 293 | static Printer printer; | ||
293 | 294 | printer.printhelp(*region); | ||
294 | 295 | } | ||
295 | 296 | } | ||
296 | 297 | |||
297 | 298 | void DecorationProvider::operator()(Connection connection) | ||
298 | 186 | { | 299 | { |
299 | 187 | this->connection = connection; | 300 | this->connection = connection; |
300 | 301 | |||
301 | 302 | DisplayConfig const display_conf{this->connection}; | ||
302 | 303 | |||
303 | 304 | display_conf.for_each_output([this](MirOutput const* output) | ||
304 | 305 | { | ||
305 | 306 | wallpaper.push_back( | ||
306 | 307 | WindowSpec::for_gloss(this->connection, 100, 100) | ||
307 | 308 | .set_pixel_format(mir_pixel_format_xrgb_8888) | ||
308 | 309 | .set_buffer_usage(mir_buffer_usage_software) | ||
309 | 310 | .set_fullscreen_on_output(mir_output_get_id(output)) | ||
310 | 311 | .set_name(wallpaper_name).create_window()); | ||
311 | 312 | |||
312 | 313 | MirGraphicsRegion graphics_region; | ||
313 | 314 | MirBufferStream* buffer_stream = mir_window_get_buffer_stream(wallpaper.back()); | ||
314 | 315 | |||
315 | 316 | mir_buffer_stream_get_graphics_region(buffer_stream, &graphics_region); | ||
316 | 317 | |||
317 | 318 | static uint8_t const pattern[4] = { 0x00, 0x00, 0x00, 0x00 }; | ||
318 | 319 | |||
319 | 320 | render_pattern(&graphics_region, pattern); | ||
320 | 321 | mir_buffer_stream_swap_buffers_sync(buffer_stream); | ||
321 | 322 | }); | ||
322 | 323 | |||
323 | 188 | start_work(); | 324 | start_work(); |
324 | 189 | } | 325 | } |
325 | 190 | 326 | ||
327 | 191 | void TitlebarProvider::operator()(std::weak_ptr<mir::scene::Session> const& session) | 327 | void DecorationProvider::operator()(std::weak_ptr<mir::scene::Session> const& session) |
328 | 192 | { | 328 | { |
329 | 193 | std::lock_guard<decltype(mutex)> lock{mutex}; | 329 | std::lock_guard<decltype(mutex)> lock{mutex}; |
330 | 194 | this->weak_session = session; | 330 | this->weak_session = session; |
331 | 195 | } | 331 | } |
332 | 196 | 332 | ||
334 | 197 | auto TitlebarProvider::session() const -> std::shared_ptr<mir::scene::Session> | 333 | auto DecorationProvider::session() const -> std::shared_ptr<mir::scene::Session> |
335 | 198 | { | 334 | { |
336 | 199 | std::lock_guard<decltype(mutex)> lock{mutex}; | 335 | std::lock_guard<decltype(mutex)> lock{mutex}; |
337 | 200 | return weak_session.lock(); | 336 | return weak_session.lock(); |
338 | 201 | } | 337 | } |
339 | 202 | 338 | ||
341 | 203 | void TitlebarProvider::create_titlebar_for(miral::Window const& window) | 339 | void DecorationProvider::create_titlebar_for(miral::Window const& window) |
342 | 204 | { | 340 | { |
343 | 205 | enqueue_work([this, window] | 341 | enqueue_work([this, window] |
344 | 206 | { | 342 | { |
345 | @@ -220,7 +356,7 @@ | |||
346 | 220 | }); | 356 | }); |
347 | 221 | } | 357 | } |
348 | 222 | 358 | ||
350 | 223 | void TitlebarProvider::paint_titlebar_for(miral::WindowInfo const& info, int intensity) | 359 | void DecorationProvider::paint_titlebar_for(miral::WindowInfo const& info, int intensity) |
351 | 224 | { | 360 | { |
352 | 225 | if (auto data = find_titlebar_data(info.window())) | 361 | if (auto data = find_titlebar_data(info.window())) |
353 | 226 | { | 362 | { |
354 | @@ -240,7 +376,7 @@ | |||
355 | 240 | } | 376 | } |
356 | 241 | } | 377 | } |
357 | 242 | 378 | ||
359 | 243 | void TitlebarProvider::destroy_titlebar_for(miral::Window const& window) | 379 | void DecorationProvider::destroy_titlebar_for(miral::Window const& window) |
360 | 244 | { | 380 | { |
361 | 245 | if (auto data = find_titlebar_data(window)) | 381 | if (auto data = find_titlebar_data(window)) |
362 | 246 | { | 382 | { |
363 | @@ -248,11 +384,7 @@ | |||
364 | 248 | { | 384 | { |
365 | 249 | enqueue_work([surface] | 385 | enqueue_work([surface] |
366 | 250 | { | 386 | { |
372 | 251 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | 387 | mir_window_release(surface, &null_window_callback, nullptr); |
368 | 252 | mir_surface_release(surface, &null_surface_callback, nullptr); | ||
369 | 253 | #else | ||
370 | 254 | mir_window_release(surface, &null_surface_callback, nullptr); | ||
371 | 255 | #endif | ||
373 | 256 | }); | 388 | }); |
374 | 257 | } | 389 | } |
375 | 258 | 390 | ||
376 | @@ -264,7 +396,7 @@ | |||
377 | 264 | } | 396 | } |
378 | 265 | } | 397 | } |
379 | 266 | 398 | ||
381 | 267 | void TitlebarProvider::resize_titlebar_for(miral::WindowInfo const& window_info, Size const& size) | 399 | void DecorationProvider::resize_titlebar_for(miral::WindowInfo const& window_info, Size const& size) |
382 | 268 | { | 400 | { |
383 | 269 | auto const window = window_info.window(); | 401 | auto const window = window_info.window(); |
384 | 270 | 402 | ||
385 | @@ -279,9 +411,10 @@ | |||
386 | 279 | } | 411 | } |
387 | 280 | } | 412 | } |
388 | 281 | 413 | ||
390 | 282 | void TitlebarProvider::place_new_titlebar(miral::WindowSpecification& window_spec) | 414 | void DecorationProvider::place_new_decoration(miral::WindowSpecification& window_spec) |
391 | 283 | { | 415 | { |
392 | 284 | auto const name = window_spec.name().value(); | 416 | auto const name = window_spec.name().value(); |
393 | 417 | if (name == "wallpaper") return; | ||
394 | 285 | 418 | ||
395 | 286 | std::lock_guard<decltype(mutex)> lock{mutex}; | 419 | std::lock_guard<decltype(mutex)> lock{mutex}; |
396 | 287 | 420 | ||
397 | @@ -296,8 +429,10 @@ | |||
398 | 296 | window_spec.top_left() = parent_window.top_left() - Displacement{0, title_bar_height}; | 429 | window_spec.top_left() = parent_window.top_left() - Displacement{0, title_bar_height}; |
399 | 297 | } | 430 | } |
400 | 298 | 431 | ||
402 | 299 | void TitlebarProvider::advise_new_titlebar(miral::WindowInfo const& window_info) | 432 | void DecorationProvider::advise_new_titlebar(miral::WindowInfo const& window_info) |
403 | 300 | { | 433 | { |
404 | 434 | if (window_info.name() == wallpaper_name) return; | ||
405 | 435 | |||
406 | 301 | { | 436 | { |
407 | 302 | std::lock_guard<decltype(mutex)> lock{mutex}; | 437 | std::lock_guard<decltype(mutex)> lock{mutex}; |
408 | 303 | 438 | ||
409 | @@ -307,7 +442,7 @@ | |||
410 | 307 | tools.raise_tree(window_info.parent()); | 442 | tools.raise_tree(window_info.parent()); |
411 | 308 | } | 443 | } |
412 | 309 | 444 | ||
414 | 310 | void TitlebarProvider::advise_state_change(miral::WindowInfo const& window_info, MirWindowState state) | 445 | void DecorationProvider::advise_state_change(miral::WindowInfo const& window_info, MirWindowState state) |
415 | 311 | { | 446 | { |
416 | 312 | if (auto titlebar = find_titlebar_window(window_info.window())) | 447 | if (auto titlebar = find_titlebar_window(window_info.window())) |
417 | 313 | { | 448 | { |
418 | @@ -332,7 +467,7 @@ | |||
419 | 332 | } | 467 | } |
420 | 333 | } | 468 | } |
421 | 334 | 469 | ||
423 | 335 | void TitlebarProvider::repaint_titlebar_for(miral::WindowInfo const& window_info) | 470 | void DecorationProvider::repaint_titlebar_for(miral::WindowInfo const& window_info) |
424 | 336 | { | 471 | { |
425 | 337 | if (auto data = find_titlebar_data(window_info.window())) | 472 | if (auto data = find_titlebar_data(window_info.window())) |
426 | 338 | { | 473 | { |
427 | @@ -346,23 +481,19 @@ | |||
428 | 346 | } | 481 | } |
429 | 347 | } | 482 | } |
430 | 348 | 483 | ||
432 | 349 | TitlebarProvider::Data::~Data() | 484 | DecorationProvider::Data::~Data() |
433 | 350 | { | 485 | { |
434 | 351 | if (auto surface = titlebar.exchange(nullptr)) | 486 | if (auto surface = titlebar.exchange(nullptr)) |
440 | 352 | #if MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 4, 0) | 487 | mir_window_release(surface, &null_window_callback, nullptr); |
436 | 353 | mir_surface_release(surface, &null_surface_callback, nullptr); | ||
437 | 354 | #else | ||
438 | 355 | mir_window_release(surface, &null_surface_callback, nullptr); | ||
439 | 356 | #endif | ||
441 | 357 | } | 488 | } |
442 | 358 | 489 | ||
444 | 359 | void TitlebarProvider::insert(MirWindow* surface, Data* data) | 490 | void DecorationProvider::insert(MirWindow* surface, Data* data) |
445 | 360 | { | 491 | { |
446 | 361 | data->on_create(surface); | 492 | data->on_create(surface); |
447 | 362 | data->titlebar = surface; | 493 | data->titlebar = surface; |
448 | 363 | } | 494 | } |
449 | 364 | 495 | ||
451 | 365 | TitlebarProvider::Data* TitlebarProvider::find_titlebar_data(miral::Window const& window) | 496 | DecorationProvider::Data* DecorationProvider::find_titlebar_data(miral::Window const& window) |
452 | 366 | { | 497 | { |
453 | 367 | std::lock_guard<decltype(mutex)> lock{mutex}; | 498 | std::lock_guard<decltype(mutex)> lock{mutex}; |
454 | 368 | 499 | ||
455 | @@ -371,7 +502,7 @@ | |||
456 | 371 | return (find != window_to_titlebar.end()) ? &find->second : nullptr; | 502 | return (find != window_to_titlebar.end()) ? &find->second : nullptr; |
457 | 372 | } | 503 | } |
458 | 373 | 504 | ||
460 | 374 | miral::Window TitlebarProvider::find_titlebar_window(miral::Window const& window) const | 505 | miral::Window DecorationProvider::find_titlebar_window(miral::Window const& window) const |
461 | 375 | { | 506 | { |
462 | 376 | std::lock_guard<decltype(mutex)> lock{mutex}; | 507 | std::lock_guard<decltype(mutex)> lock{mutex}; |
463 | 377 | 508 | ||
464 | @@ -380,6 +511,16 @@ | |||
465 | 380 | return (find != window_to_titlebar.end()) ? find->second.window : miral::Window{}; | 511 | return (find != window_to_titlebar.end()) ? find->second.window : miral::Window{}; |
466 | 381 | } | 512 | } |
467 | 382 | 513 | ||
468 | 514 | bool DecorationProvider::is_decoration(miral::Window const& window) const | ||
469 | 515 | { | ||
470 | 516 | return window.application() == session(); | ||
471 | 517 | } | ||
472 | 518 | |||
473 | 519 | bool DecorationProvider::is_titlebar(miral::WindowInfo const& window_info) const | ||
474 | 520 | { | ||
475 | 521 | return window_info.window().application() == session() && window_info.name() != wallpaper_name; | ||
476 | 522 | } | ||
477 | 523 | |||
478 | 383 | Worker::~Worker() | 524 | Worker::~Worker() |
479 | 384 | { | 525 | { |
480 | 385 | if (worker.joinable()) worker.join(); | 526 | if (worker.joinable()) worker.join(); |
481 | 386 | 527 | ||
482 | === renamed file 'miral-shell/titlebar_provider.h' => 'miral-shell/decoration_provider.h' | |||
483 | --- miral-shell/titlebar_provider.h 2017-02-16 17:33:30 +0000 | |||
484 | +++ miral-shell/decoration_provider.h 2017-02-16 17:33:30 +0000 | |||
485 | @@ -1,5 +1,5 @@ | |||
486 | 1 | /* | 1 | /* |
488 | 2 | * Copyright © 2016 Canonical Ltd. | 2 | * Copyright © 2016-2017 Canonical Ltd. |
489 | 3 | * | 3 | * |
490 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
491 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
492 | @@ -16,8 +16,8 @@ | |||
493 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
494 | 17 | */ | 17 | */ |
495 | 18 | 18 | ||
498 | 19 | #ifndef MIRAL_SHELL_TITLEBAR_PROVIDER_H | 19 | #ifndef MIRAL_SHELL_DECORATION_PROVIDER_H |
499 | 20 | #define MIRAL_SHELL_TITLEBAR_PROVIDER_H | 20 | #define MIRAL_SHELL_DECORATION_PROVIDER_H |
500 | 21 | 21 | ||
501 | 22 | 22 | ||
502 | 23 | #include <miral/window_manager_tools.h> | 23 | #include <miral/window_manager_tools.h> |
503 | @@ -29,6 +29,8 @@ | |||
504 | 29 | #include <map> | 29 | #include <map> |
505 | 30 | #include <mutex> | 30 | #include <mutex> |
506 | 31 | #include <mir/client/connection.h> | 31 | #include <mir/client/connection.h> |
507 | 32 | #include <mir/client/window.h> | ||
508 | 33 | |||
509 | 32 | #include <thread> | 34 | #include <thread> |
510 | 33 | #include <condition_variable> | 35 | #include <condition_variable> |
511 | 34 | #include <queue> | 36 | #include <queue> |
512 | @@ -54,11 +56,11 @@ | |||
513 | 54 | void do_work(); | 56 | void do_work(); |
514 | 55 | }; | 57 | }; |
515 | 56 | 58 | ||
517 | 57 | class TitlebarProvider : Worker | 59 | class DecorationProvider : Worker |
518 | 58 | { | 60 | { |
519 | 59 | public: | 61 | public: |
522 | 60 | TitlebarProvider(miral::WindowManagerTools const& tools); | 62 | DecorationProvider(miral::WindowManagerTools const& tools); |
523 | 61 | ~TitlebarProvider(); | 63 | ~DecorationProvider(); |
524 | 62 | 64 | ||
525 | 63 | void operator()(mir::client::Connection connection); | 65 | void operator()(mir::client::Connection connection); |
526 | 64 | void operator()(std::weak_ptr<mir::scene::Session> const& session); | 66 | void operator()(std::weak_ptr<mir::scene::Session> const& session); |
527 | @@ -66,7 +68,7 @@ | |||
528 | 66 | auto session() const -> std::shared_ptr<mir::scene::Session>; | 68 | auto session() const -> std::shared_ptr<mir::scene::Session>; |
529 | 67 | 69 | ||
530 | 68 | void create_titlebar_for(miral::Window const& window); | 70 | void create_titlebar_for(miral::Window const& window); |
532 | 69 | void place_new_titlebar(miral::WindowSpecification& window_spec); | 71 | void place_new_decoration(miral::WindowSpecification& window_spec); |
533 | 70 | void paint_titlebar_for(miral::WindowInfo const& window, int intensity); | 72 | void paint_titlebar_for(miral::WindowInfo const& window, int intensity); |
534 | 71 | void destroy_titlebar_for(miral::Window const& window); | 73 | void destroy_titlebar_for(miral::Window const& window); |
535 | 72 | void resize_titlebar_for(miral::WindowInfo const& window_info, mir::geometry::Size const& size); | 74 | void resize_titlebar_for(miral::WindowInfo const& window_info, mir::geometry::Size const& size); |
536 | @@ -75,6 +77,9 @@ | |||
537 | 75 | 77 | ||
538 | 76 | void stop(); | 78 | void stop(); |
539 | 77 | 79 | ||
540 | 80 | bool is_decoration(miral::Window const& window) const; | ||
541 | 81 | bool is_titlebar(miral::WindowInfo const& window_info) const; | ||
542 | 82 | |||
543 | 78 | private: | 83 | private: |
544 | 79 | struct Data | 84 | struct Data |
545 | 80 | { | 85 | { |
546 | @@ -92,6 +97,7 @@ | |||
547 | 92 | miral::WindowManagerTools tools; | 97 | miral::WindowManagerTools tools; |
548 | 93 | std::mutex mutable mutex; | 98 | std::mutex mutable mutex; |
549 | 94 | mir::client::Connection connection; | 99 | mir::client::Connection connection; |
550 | 100 | std::vector<mir::client::Window> wallpaper; | ||
551 | 95 | std::weak_ptr<mir::scene::Session> weak_session; | 101 | std::weak_ptr<mir::scene::Session> weak_session; |
552 | 96 | 102 | ||
553 | 97 | SurfaceMap window_to_titlebar; | 103 | SurfaceMap window_to_titlebar; |
554 | @@ -104,4 +110,4 @@ | |||
555 | 104 | }; | 110 | }; |
556 | 105 | 111 | ||
557 | 106 | 112 | ||
559 | 107 | #endif //MIRAL_SHELL_TITLEBAR_PROVIDER_H | 113 | #endif //MIRAL_SHELL_DECORATION_PROVIDER_H |
560 | 108 | 114 | ||
561 | === modified file 'miral-shell/titlebar_window_manager.cpp' | |||
562 | --- miral-shell/titlebar_window_manager.cpp 2017-02-16 17:33:30 +0000 | |||
563 | +++ miral-shell/titlebar_window_manager.cpp 2017-02-16 17:33:30 +0000 | |||
564 | @@ -1,5 +1,5 @@ | |||
565 | 1 | /* | 1 | /* |
567 | 2 | * Copyright © 2016 Canonical Ltd. | 2 | * Copyright © 2016-2017 Canonical Ltd. |
568 | 3 | * | 3 | * |
569 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
570 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
571 | @@ -17,7 +17,7 @@ | |||
572 | 17 | */ | 17 | */ |
573 | 18 | 18 | ||
574 | 19 | #include "titlebar_window_manager.h" | 19 | #include "titlebar_window_manager.h" |
576 | 20 | #include "titlebar_provider.h" | 20 | #include "decoration_provider.h" |
577 | 21 | 21 | ||
578 | 22 | #include <miral/application_info.h> | 22 | #include <miral/application_info.h> |
579 | 23 | #include <miral/internal_client.h> | 23 | #include <miral/internal_client.h> |
580 | @@ -78,9 +78,9 @@ | |||
581 | 78 | miral::InternalClientLauncher const& launcher) : | 78 | miral::InternalClientLauncher const& launcher) : |
582 | 79 | CanonicalWindowManagerPolicy(tools), | 79 | CanonicalWindowManagerPolicy(tools), |
583 | 80 | spinner{spinner}, | 80 | spinner{spinner}, |
585 | 81 | titlebar_provider{std::make_unique<TitlebarProvider>(tools)} | 81 | decoration_provider{std::make_unique<DecorationProvider>(tools)} |
586 | 82 | { | 82 | { |
588 | 83 | launcher.launch("decorations", *titlebar_provider); | 83 | launcher.launch("decorations", *decoration_provider); |
589 | 84 | 84 | ||
590 | 85 | for (auto key : {KEY_F1, KEY_F2, KEY_F3, KEY_F4}) | 85 | for (auto key : {KEY_F1, KEY_F2, KEY_F3, KEY_F4}) |
591 | 86 | key_to_workspace[key] = this->tools.create_workspace(); | 86 | key_to_workspace[key] = this->tools.create_workspace(); |
592 | @@ -142,9 +142,9 @@ | |||
593 | 142 | { | 142 | { |
594 | 143 | if (auto const possible_titlebar = tools.window_at(old_cursor)) | 143 | if (auto const possible_titlebar = tools.window_at(old_cursor)) |
595 | 144 | { | 144 | { |
597 | 145 | if (possible_titlebar.application() == titlebar_provider->session()) | 145 | auto const& info = tools.info_for(possible_titlebar); |
598 | 146 | if (decoration_provider->is_titlebar(info)) | ||
599 | 146 | { | 147 | { |
600 | 147 | auto const& info = tools.info_for(possible_titlebar); | ||
601 | 148 | if (tools.select_active_window(info.parent()) == info.parent()) | 148 | if (tools.select_active_window(info.parent()) == info.parent()) |
602 | 149 | tools.drag_active_window(cursor - old_cursor); | 149 | tools.drag_active_window(cursor - old_cursor); |
603 | 150 | consumes_event = true; | 150 | consumes_event = true; |
604 | @@ -309,19 +309,16 @@ | |||
605 | 309 | { | 309 | { |
606 | 310 | CanonicalWindowManagerPolicy::advise_new_window(window_info); | 310 | CanonicalWindowManagerPolicy::advise_new_window(window_info); |
607 | 311 | 311 | ||
608 | 312 | auto const application = window_info.window().application(); | ||
609 | 313 | auto const parent = window_info.parent(); | 312 | auto const parent = window_info.parent(); |
610 | 314 | 313 | ||
614 | 315 | auto const is_titlebar = application == titlebar_provider->session(); | 314 | if (decoration_provider->is_titlebar(window_info)) |
612 | 316 | |||
613 | 317 | if (is_titlebar) | ||
615 | 318 | { | 315 | { |
617 | 319 | titlebar_provider->advise_new_titlebar(window_info); | 316 | decoration_provider->advise_new_titlebar(window_info); |
618 | 320 | 317 | ||
619 | 321 | if (tools.active_window() == parent) | 318 | if (tools.active_window() == parent) |
621 | 322 | titlebar_provider->paint_titlebar_for(tools.info_for(parent), 0xFF); | 319 | decoration_provider->paint_titlebar_for(tools.info_for(parent), 0xFF); |
622 | 323 | else | 320 | else |
624 | 324 | titlebar_provider->paint_titlebar_for(tools.info_for(parent), 0x3F); | 321 | decoration_provider->paint_titlebar_for(tools.info_for(parent), 0x3F); |
625 | 325 | } | 322 | } |
626 | 326 | 323 | ||
627 | 327 | if (!parent) | 324 | if (!parent) |
628 | @@ -340,7 +337,7 @@ | |||
629 | 340 | void TitlebarWindowManagerPolicy::handle_window_ready(WindowInfo& window_info) | 337 | void TitlebarWindowManagerPolicy::handle_window_ready(WindowInfo& window_info) |
630 | 341 | { | 338 | { |
631 | 342 | if (window_info.window().application() != spinner.session() && window_info.needs_titlebar(window_info.type())) | 339 | if (window_info.window().application() != spinner.session() && window_info.needs_titlebar(window_info.type())) |
633 | 343 | titlebar_provider->create_titlebar_for(window_info.window()); | 340 | decoration_provider->create_titlebar_for(window_info.window()); |
634 | 344 | 341 | ||
635 | 345 | CanonicalWindowManagerPolicy::handle_window_ready(window_info); | 342 | CanonicalWindowManagerPolicy::handle_window_ready(window_info); |
636 | 346 | } | 343 | } |
637 | @@ -349,14 +346,14 @@ | |||
638 | 349 | { | 346 | { |
639 | 350 | CanonicalWindowManagerPolicy::advise_focus_lost(info); | 347 | CanonicalWindowManagerPolicy::advise_focus_lost(info); |
640 | 351 | 348 | ||
642 | 352 | titlebar_provider->paint_titlebar_for(info, 0x3F); | 349 | decoration_provider->paint_titlebar_for(info, 0x3F); |
643 | 353 | } | 350 | } |
644 | 354 | 351 | ||
645 | 355 | void TitlebarWindowManagerPolicy::advise_focus_gained(WindowInfo const& info) | 352 | void TitlebarWindowManagerPolicy::advise_focus_gained(WindowInfo const& info) |
646 | 356 | { | 353 | { |
647 | 357 | CanonicalWindowManagerPolicy::advise_focus_gained(info); | 354 | CanonicalWindowManagerPolicy::advise_focus_gained(info); |
648 | 358 | 355 | ||
650 | 359 | titlebar_provider->paint_titlebar_for(info, 0xFF); | 356 | decoration_provider->paint_titlebar_for(info, 0xFF); |
651 | 360 | 357 | ||
652 | 361 | // Frig to force the spinner to the top | 358 | // Frig to force the spinner to the top |
653 | 362 | if (auto const spinner_session = spinner.session()) | 359 | if (auto const spinner_session = spinner.session()) |
654 | @@ -372,21 +369,21 @@ | |||
655 | 372 | { | 369 | { |
656 | 373 | CanonicalWindowManagerPolicy::advise_state_change(window_info, state); | 370 | CanonicalWindowManagerPolicy::advise_state_change(window_info, state); |
657 | 374 | 371 | ||
659 | 375 | titlebar_provider->advise_state_change(window_info, state); | 372 | decoration_provider->advise_state_change(window_info, state); |
660 | 376 | } | 373 | } |
661 | 377 | 374 | ||
662 | 378 | void TitlebarWindowManagerPolicy::advise_resize(WindowInfo const& window_info, Size const& new_size) | 375 | void TitlebarWindowManagerPolicy::advise_resize(WindowInfo const& window_info, Size const& new_size) |
663 | 379 | { | 376 | { |
664 | 380 | CanonicalWindowManagerPolicy::advise_resize(window_info, new_size); | 377 | CanonicalWindowManagerPolicy::advise_resize(window_info, new_size); |
665 | 381 | 378 | ||
667 | 382 | titlebar_provider->resize_titlebar_for(window_info, new_size); | 379 | decoration_provider->resize_titlebar_for(window_info, new_size); |
668 | 383 | } | 380 | } |
669 | 384 | 381 | ||
670 | 385 | void TitlebarWindowManagerPolicy::advise_delete_window(WindowInfo const& window_info) | 382 | void TitlebarWindowManagerPolicy::advise_delete_window(WindowInfo const& window_info) |
671 | 386 | { | 383 | { |
672 | 387 | CanonicalWindowManagerPolicy::advise_delete_window(window_info); | 384 | CanonicalWindowManagerPolicy::advise_delete_window(window_info); |
673 | 388 | 385 | ||
675 | 389 | titlebar_provider->destroy_titlebar_for(window_info.window()); | 386 | decoration_provider->destroy_titlebar_for(window_info.window()); |
676 | 390 | } | 387 | } |
677 | 391 | 388 | ||
678 | 392 | bool TitlebarWindowManagerPolicy::handle_keyboard_event(MirKeyboardEvent const* event) | 389 | bool TitlebarWindowManagerPolicy::handle_keyboard_event(MirKeyboardEvent const* event) |
679 | @@ -535,7 +532,7 @@ | |||
680 | 535 | if (action == mir_keyboard_action_down && scan_code == KEY_BACKSPACE && | 532 | if (action == mir_keyboard_action_down && scan_code == KEY_BACKSPACE && |
681 | 536 | (modifiers == (mir_input_event_modifier_alt | mir_input_event_modifier_ctrl))) | 533 | (modifiers == (mir_input_event_modifier_alt | mir_input_event_modifier_ctrl))) |
682 | 537 | { | 534 | { |
684 | 538 | titlebar_provider->stop(); | 535 | decoration_provider->stop(); |
685 | 539 | } | 536 | } |
686 | 540 | 537 | ||
687 | 541 | return false; | 538 | return false; |
688 | @@ -654,8 +651,8 @@ | |||
689 | 654 | if (parameters.state().value() != mir_window_state_fullscreen && needs_titlebar) | 651 | if (parameters.state().value() != mir_window_state_fullscreen && needs_titlebar) |
690 | 655 | parameters.top_left() = Point{parameters.top_left().value().x, parameters.top_left().value().y + DeltaY{title_bar_height}}; | 652 | parameters.top_left() = Point{parameters.top_left().value().x, parameters.top_left().value().y + DeltaY{title_bar_height}}; |
691 | 656 | 653 | ||
694 | 657 | if (app_info.application() == titlebar_provider->session()) | 654 | if (app_info.application() == decoration_provider->session()) |
695 | 658 | titlebar_provider->place_new_titlebar(parameters); | 655 | decoration_provider->place_new_decoration(parameters); |
696 | 659 | 656 | ||
697 | 660 | parameters.userdata() = std::make_shared<PolicyData>(); | 657 | parameters.userdata() = std::make_shared<PolicyData>(); |
698 | 661 | return parameters; | 658 | return parameters; |
699 | @@ -697,8 +694,8 @@ | |||
700 | 697 | 694 | ||
701 | 698 | tools.for_each_window_in_workspace(active_workspace, [&](Window const& window) | 695 | tools.for_each_window_in_workspace(active_workspace, [&](Window const& window) |
702 | 699 | { | 696 | { |
705 | 700 | if (window.application() == titlebar_provider->session()) | 697 | if (decoration_provider->is_decoration(window)) |
706 | 701 | return; // titlebars are taken care of automatically | 698 | return; // decorations are taken care of automatically |
707 | 702 | 699 | ||
708 | 703 | auto const& window_info = tools.info_for(window); | 700 | auto const& window_info = tools.info_for(window); |
709 | 704 | auto& pdata = policy_data_for(window_info); | 701 | auto& pdata = policy_data_for(window_info); |
710 | @@ -709,8 +706,8 @@ | |||
711 | 709 | 706 | ||
712 | 710 | tools.for_each_window_in_workspace(old_active, [&](Window const& window) | 707 | tools.for_each_window_in_workspace(old_active, [&](Window const& window) |
713 | 711 | { | 708 | { |
716 | 712 | if (window.application() == titlebar_provider->session()) | 709 | if (decoration_provider->is_decoration(window)) |
717 | 713 | return; // titlebars are taken care of automatically | 710 | return; // decorations are taken care of automatically |
718 | 714 | 711 | ||
719 | 715 | auto const& window_info = tools.info_for(window); | 712 | auto const& window_info = tools.info_for(window); |
720 | 716 | auto& pdata = policy_data_for(window_info); | 713 | auto& pdata = policy_data_for(window_info); |
721 | 717 | 714 | ||
722 | === modified file 'miral-shell/titlebar_window_manager.h' | |||
723 | --- miral-shell/titlebar_window_manager.h 2017-02-16 17:33:30 +0000 | |||
724 | +++ miral-shell/titlebar_window_manager.h 2017-02-16 17:33:30 +0000 | |||
725 | @@ -1,5 +1,5 @@ | |||
726 | 1 | /* | 1 | /* |
728 | 2 | * Copyright © 2016 Canonical Ltd. | 2 | * Copyright © 2016-2017 Canonical Ltd. |
729 | 3 | * | 3 | * |
730 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
731 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
732 | @@ -31,7 +31,7 @@ | |||
733 | 31 | 31 | ||
734 | 32 | using namespace mir::geometry; | 32 | using namespace mir::geometry; |
735 | 33 | 33 | ||
737 | 34 | class TitlebarProvider; | 34 | class DecorationProvider; |
738 | 35 | 35 | ||
739 | 36 | class TitlebarWindowManagerPolicy : public miral::CanonicalWindowManagerPolicy, miral::WorkspacePolicy | 36 | class TitlebarWindowManagerPolicy : public miral::CanonicalWindowManagerPolicy, miral::WorkspacePolicy |
740 | 37 | { | 37 | { |
741 | @@ -98,7 +98,7 @@ | |||
742 | 98 | 98 | ||
743 | 99 | SpinnerSplash const spinner; | 99 | SpinnerSplash const spinner; |
744 | 100 | 100 | ||
746 | 101 | std::unique_ptr<TitlebarProvider> const titlebar_provider; | 101 | std::unique_ptr<DecorationProvider> const decoration_provider; |
747 | 102 | 102 | ||
748 | 103 | void end_resize(); | 103 | void end_resize(); |
749 | 104 | 104 | ||
750 | 105 | 105 | ||
751 | === modified file 'miral/CMakeLists.txt' | |||
752 | --- miral/CMakeLists.txt 2017-02-16 17:33:30 +0000 | |||
753 | +++ miral/CMakeLists.txt 2017-02-16 17:33:30 +0000 | |||
754 | @@ -55,6 +55,7 @@ | |||
755 | 55 | ${CMAKE_SOURCE_DIR}/include/mir/client/window_spec.h | 55 | ${CMAKE_SOURCE_DIR}/include/mir/client/window_spec.h |
756 | 56 | ${CMAKE_SOURCE_DIR}/include/mir/client/window_id.h | 56 | ${CMAKE_SOURCE_DIR}/include/mir/client/window_id.h |
757 | 57 | ${CMAKE_SOURCE_DIR}/include/mir/client/connection.h | 57 | ${CMAKE_SOURCE_DIR}/include/mir/client/connection.h |
758 | 58 | ${CMAKE_SOURCE_DIR}/include/mir/client/display_config.h | ||
759 | 58 | ${CMAKE_SOURCE_DIR}/include/mir/client/window.h | 59 | ${CMAKE_SOURCE_DIR}/include/mir/client/window.h |
760 | 59 | ${CMAKE_SOURCE_DIR}/include/mir/client/detail/mir_forward_compatibility.h | 60 | ${CMAKE_SOURCE_DIR}/include/mir/client/detail/mir_forward_compatibility.h |
761 | 60 | ) | 61 | ) |