Skip to content

Commit eaf506f

Browse files
committed
Ensure surfaces can only resize down to 32x32
1 parent 7ddfe20 commit eaf506f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/surface/xdg_view.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,13 @@ wlr_box XdgView::get_surface_geometry() const {
270270
return box;
271271
}
272272

273+
constexpr int32_t XDG_SURFACE_MIN_SIZE = 32;
274+
273275
wlr_box XdgView::get_surface_min_size() const {
274-
return {.x = 0, .y = 0, .width = wlr.current.min_width, .height = wlr.current.min_height};
276+
return {.x = 0,
277+
.y = 0,
278+
.width = std::max(XDG_SURFACE_MIN_SIZE, wlr.current.min_width),
279+
.height = std::max(XDG_SURFACE_MIN_SIZE, wlr.current.min_height)};
275280
}
276281

277282
wlr_box XdgView::get_surface_max_size() const {

src/surface/xwayland_view.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,14 @@ wlr_box XWaylandView::get_surface_geometry() const {
236236
return {.x = wlr.x, .y = wlr.y, .width = wlr.width, .height = wlr.height};
237237
}
238238

239+
constexpr int32_t XWAYLAND_SURFACE_MIN_SIZE = 32;
240+
239241
wlr_box XWaylandView::get_surface_min_size() const {
240242
wlr_box min = {.x = 0, .y = 0, .width = 0, .height = 0};
241243
if (wlr.size_hints != nullptr) {
242244
const auto& hints = *wlr.size_hints;
243-
min.width = std::max(hints.min_width, hints.base_width);
244-
min.height = std::max(hints.min_height, hints.base_height);
245+
min.width = std::max({XWAYLAND_SURFACE_MIN_SIZE, hints.min_width, hints.base_width});
246+
min.height = std::max({XWAYLAND_SURFACE_MIN_SIZE, hints.min_height, hints.base_height});
245247
}
246248
return min;
247249
}

0 commit comments

Comments
 (0)