Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x11-kiosk: defer fullscreening of applications until they are placed once #3670

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 0 additions & 6 deletions src/server/scene/surface_stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ struct SurfaceDepthLayerObserver : ms::NullSurfaceObserver

ms::SurfaceStack::SurfaceStack(std::shared_ptr<SceneReport> const& report) :
report{report},
scene_changed{false},
surface_observer{std::make_shared<SurfaceDepthLayerObserver>(this)},
multiplexer(linearising_executor)
{
Expand All @@ -153,7 +152,6 @@ mc::SceneElementSequence ms::SurfaceStack::scene_elements_for(mc::CompositorID i
{
RecursiveReadLock lg(guard);

scene_changed = false;
mc::SceneElementSequence elements;
for (auto const& layer : surface_layers)
{
Expand Down Expand Up @@ -227,10 +225,6 @@ void ms::SurfaceStack::remove_input_visualization(

void ms::SurfaceStack::emit_scene_changed()
{
{
RecursiveWriteLock lg(guard);
scene_changed = true;
}
observers.scene_changed();
}

Expand Down
1 change: 0 additions & 1 deletion src/server/scene/surface_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ class SurfaceStack :
Observers observers;
/// If not expired the screen is locked (and only surfaces that appear on the lock screen should be shown)
std::atomic<bool> is_locked = false;
std::atomic<bool> scene_changed;
std::shared_ptr<SurfaceObserver> surface_observer;
SessionLockObserverMultiplexer multiplexer;
};
Expand Down
Loading