]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xdg: take into account minimum window size for resizing (#2221)
authorHiroaki Yamamoto <hrak1529@gmail.com>
Sun, 6 Oct 2024 15:58:54 +0000 (00:58 +0900)
committerGitHub <noreply@github.com>
Sun, 6 Oct 2024 15:58:54 +0000 (16:58 +0100)
This is especially relavant for <resize drawContents="no">.

src/xdg.c

index 5184fea4d26c049b0d84e21996d58ab9faab4635..da0ceeef119a1e37558ac2379509f40b0b788918 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -44,6 +44,20 @@ xdg_toplevel_from_view(struct view *view)
        return xdg_surface->toplevel;
 }
 
+static struct view_size_hints
+xdg_toplevel_view_get_size_hints(struct view *view)
+{
+       assert(view);
+
+       struct wlr_xdg_toplevel *toplevel = xdg_toplevel_from_view(view);
+       struct wlr_xdg_toplevel_state *state = &toplevel->current;
+
+       return (struct view_size_hints){
+               .min_width = state->min_width,
+               .min_height = state->min_height,
+       };
+}
+
 static bool
 xdg_toplevel_view_contains_window_type(struct view *view, int32_t window_type)
 {
@@ -779,6 +793,7 @@ static const struct view_impl xdg_toplevel_view_impl = {
        .move_to_back = view_impl_move_to_back,
        .get_root = xdg_toplevel_view_get_root,
        .append_children = xdg_toplevel_view_append_children,
+       .get_size_hints = xdg_toplevel_view_get_size_hints,
        .contains_window_type = xdg_toplevel_view_contains_window_type,
        .get_pid = xdg_view_get_pid,
 };