diff --git a/examples/mir-x11-kiosk/x11_kiosk_window_manager.cpp b/examples/mir-x11-kiosk/x11_kiosk_window_manager.cpp index 459d83651fa..36c21b47b9f 100644 --- a/examples/mir-x11-kiosk/x11_kiosk_window_manager.cpp +++ b/examples/mir-x11-kiosk/x11_kiosk_window_manager.cpp @@ -106,13 +106,22 @@ void X11KioskWindowManagerPolicy::handle_modify_window(WindowInfo& window_info, tools.modify_window(window_info, mods); } - specification.state() = mir_window_state_fullscreen; - specification.size() = mir::optional_value{}; // Ignore requested size (if any) when we fullscreen - specification.top_left() = mir::optional_value{}; // Ignore requested position (if any) when we fullscreen - tools.place_and_size_for_state(specification, window_info); + if (window_info.is_visible() || !modifications.state().is_set() || modifications.state().value() != mir_window_state_restored) + { + specification.state() = mir_window_state_fullscreen; + specification.size() = mir::optional_value{}; // Ignore requested size (if any) when we fullscreen + specification.top_left() = mir::optional_value{}; // Ignore requested position (if any) when we fullscreen + tools.place_and_size_for_state(specification, window_info); - if (!modifications.state().is_set() || modifications.state().value() != mir_window_state_restored) - specification.state() = modifications.state(); + if (!modifications.state().is_set() || modifications.state().value() != mir_window_state_restored) + specification.state() = modifications.state(); + } + else + { + // We have one X11 application (vmware-view) that doesn't submit any buffers unless it + // can first "restore" its window + tools.place_and_size_for_state(specification, window_info); + } } CanonicalWindowManagerPolicy::handle_modify_window(window_info, specification); @@ -132,3 +141,21 @@ X11KioskWindowManagerPolicy::confirm_placement_on_display(WindowInfo const& /*wi { return new_placement; } + +void X11KioskWindowManagerPolicy::handle_window_ready(miral::WindowInfo& window_info) +{ + if ((window_info.type() == mir_window_type_normal || window_info.type() == mir_window_type_freestyle) && + !window_info.parent()) + { + // We have one X11 application (vmware-view) that doesn't submit any buffers unless it + // can first "restore" its window. We've got a buffer now, so we can fullscreen it + if (window_info.state() == mir_window_state_restored) + { + WindowSpecification specification; + specification.state() = mir_window_state_fullscreen; + tools.place_and_size_for_state(specification, WindowInfo{}); + tools.modify_window(window_info, specification); + } + } + CanonicalWindowManagerPolicy::handle_window_ready(window_info); +} diff --git a/examples/mir-x11-kiosk/x11_kiosk_window_manager.h b/examples/mir-x11-kiosk/x11_kiosk_window_manager.h index 4751d4056ba..824df0c1d1d 100644 --- a/examples/mir-x11-kiosk/x11_kiosk_window_manager.h +++ b/examples/mir-x11-kiosk/x11_kiosk_window_manager.h @@ -37,8 +37,9 @@ class X11KioskWindowManagerPolicy : public miral::CanonicalWindowManagerPolicy void handle_modify_window(miral::WindowInfo& window_info, miral::WindowSpecification const& modifications) override; void handle_request_move(miral::WindowInfo& window_info, MirInputEvent const* input_event) override; + void handle_window_ready(miral::WindowInfo& window_info) override; void handle_request_resize(miral::WindowInfo& window_info, MirInputEvent const* input_event, - MirResizeEdge edge) override; + MirResizeEdge edge) override; auto confirm_placement_on_display(const miral::WindowInfo& window_info, MirWindowState new_state, Rectangle const& new_placement) -> Rectangle override;