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

Don't assume that window size is specified #3690

Merged
merged 1 commit into from
Nov 29, 2024
Merged
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
15 changes: 12 additions & 3 deletions examples/example-server-lib/tiling_window_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,20 @@ void TilingWindowManagerPolicy::update_surfaces(ApplicationInfo& info, Rectangle
void TilingWindowManagerPolicy::clip_to_tile(miral::WindowSpecification& parameters, Rectangle const& tile)
{
auto const displacement = parameters.top_left().value() - tile.top_left;
auto const width_available = tile.size.width.as_int()-displacement.dx.as_int();
auto const height_available = tile.size.height.as_int()-displacement.dy.as_int();

auto width = std::min(tile.size.width.as_int()-displacement.dx.as_int(), parameters.size().value().width.as_int());
auto height = std::min(tile.size.height.as_int()-displacement.dy.as_int(), parameters.size().value().height.as_int());
if (parameters.size())
{
auto width = std::min(width_available, parameters.size().value().width.as_int());
auto height = std::min(height_available, parameters.size().value().height.as_int());

parameters.size() = Size{width, height};
parameters.size() = Size{width, height};
}
else
{
parameters.size() = Size{width_available, height_available};
}
}

void TilingWindowManagerPolicy::resize(Window window, Point cursor, Point old_cursor, Rectangle bounds)
Expand Down
Loading