MCPcopy Create free account
hub / github.com/canonical/mir / modify_surface

Method modify_surface

src/server/shell/abstract_shell.cpp:281–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281void msh::AbstractShell::modify_surface(std::shared_ptr<scene::Session> const& session, std::shared_ptr<scene::Surface> const& surface, SurfaceSpecification const& modifications)
282{
283 auto wm_relevant_mods = modifications;
284
285 auto window_size{surface->window_size()};
286 auto content_size{surface->content_size()};
287
288 if (wm_relevant_mods.aux_rect.is_set())
289 wm_relevant_mods.aux_rect.value().top_left += surface->content_offset();
290
291 if (modifications.server_side_decorated.is_set())
292 {
293 if (modifications.server_side_decorated.value())
294 {
295 decoration_manager->decorate(surface);
296
297 content_size =
298 {
299 modifications.width.value_or(content_size.width),
300 modifications.height.value_or(content_size.height)
301 };
302 wm_relevant_mods.width = content_size.width;
303 wm_relevant_mods.height = content_size.height;
304
305 // When adding decorations we need to resize the window for WM
306 window_size = decoration_manager->compute_size_with_decorations(
307 content_size,
308 modifications.type.value_or(surface->type()),
309 modifications.state.value_or(surface->state()));
310 }
311 else if (window_size != content_size)
312 {
313 decoration_manager->undecorate(surface);
314
315 content_size =
316 {
317 modifications.width.value_or(content_size.width),
318 modifications.height.value_or(content_size.height)
319 };
320 wm_relevant_mods.width = content_size.width;
321 wm_relevant_mods.height = content_size.height;
322
323 // When removing decorations we need to resize the window for WM
324 window_size = content_size;
325 }
326 }
327
328 adjust_size_constraints_for_ssd(wm_relevant_mods, window_size, content_size);
329
330 report->update_surface(*session, *surface, wm_relevant_mods);
331
332 if (wm_relevant_mods.streams.is_set())
333 {
334 session->configure_streams(*surface, wm_relevant_mods.streams.consume());
335 }
336 if (!wm_relevant_mods.is_empty())
337 {
338 window_manager->modify_surface(session, surface, wm_relevant_mods);

Callers

nothing calls this directly

Calls 15

is_emptyMethod · 0.80
window_sizeMethod · 0.45
content_sizeMethod · 0.45
is_setMethod · 0.45
valueMethod · 0.45
content_offsetMethod · 0.45
decorateMethod · 0.45
value_orMethod · 0.45
typeMethod · 0.45
stateMethod · 0.45

Tested by

no test coverage detected