Skip to content

Commit

Permalink
Allow vmware-view to "restore" windows and submit a buffer before for…
Browse files Browse the repository at this point in the history
…cing "fullscreen"
  • Loading branch information
AlanGriffiths committed Nov 19, 2024
1 parent af3388f commit ed00444
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
39 changes: 33 additions & 6 deletions examples/mir-x11-kiosk/x11_kiosk_window_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Size>{}; // Ignore requested size (if any) when we fullscreen
specification.top_left() = mir::optional_value<Point>{}; // 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<Size>{}; // Ignore requested size (if any) when we fullscreen
specification.top_left() = mir::optional_value<Point>{}; // 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);
Expand All @@ -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);
}
3 changes: 2 additions & 1 deletion examples/mir-x11-kiosk/x11_kiosk_window_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ed00444

Please sign in to comment.