Skip to content

Commit

Permalink
Don't assume that window size is specified (#3690)
Browse files Browse the repository at this point in the history
Fixes: #3689
  • Loading branch information
AlanGriffiths committed Nov 29, 2024
1 parent 7026cdb commit c4060b0
Showing 1 changed file with 12 additions and 3 deletions.
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

0 comments on commit c4060b0

Please sign in to comment.