diff --git a/src/surface/xdg_view.cpp b/src/surface/xdg_view.cpp index d58d42266..166457282 100644 --- a/src/surface/xdg_view.cpp +++ b/src/surface/xdg_view.cpp @@ -270,8 +270,13 @@ wlr_box XdgView::get_surface_geometry() const { return box; } +constexpr int32_t XDG_SURFACE_MIN_SIZE = 32; + wlr_box XdgView::get_surface_min_size() const { - return {.x = 0, .y = 0, .width = wlr.current.min_width, .height = wlr.current.min_height}; + return {.x = 0, + .y = 0, + .width = std::max(XDG_SURFACE_MIN_SIZE, wlr.current.min_width), + .height = std::max(XDG_SURFACE_MIN_SIZE, wlr.current.min_height)}; } wlr_box XdgView::get_surface_max_size() const { diff --git a/src/surface/xwayland_view.cpp b/src/surface/xwayland_view.cpp index 42196972c..26164fa98 100644 --- a/src/surface/xwayland_view.cpp +++ b/src/surface/xwayland_view.cpp @@ -236,12 +236,14 @@ wlr_box XWaylandView::get_surface_geometry() const { return {.x = wlr.x, .y = wlr.y, .width = wlr.width, .height = wlr.height}; } +constexpr int32_t XWAYLAND_SURFACE_MIN_SIZE = 32; + wlr_box XWaylandView::get_surface_min_size() const { wlr_box min = {.x = 0, .y = 0, .width = 0, .height = 0}; if (wlr.size_hints != nullptr) { const auto& hints = *wlr.size_hints; - min.width = std::max(hints.min_width, hints.base_width); - min.height = std::max(hints.min_height, hints.base_height); + min.width = std::max({XWAYLAND_SURFACE_MIN_SIZE, hints.min_width, hints.base_width}); + min.height = std::max({XWAYLAND_SURFACE_MIN_SIZE, hints.min_height, hints.base_height}); } return min; }