aboutsummaryrefslogtreecommitdiff
path: root/rootston/xdg_shell_v6.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-10-28 11:58:34 +0200
committeremersion <contact@emersion.fr>2017-10-28 11:58:34 +0200
commitfb0c9a356e1b9e86f4b29d3be739e8b17c5771e9 (patch)
tree3c23eec87cff62bb90e856b1f4dc9a2f4ec0d968 /rootston/xdg_shell_v6.c
parentb97160238fa5b61fef81316102559c8c3e137cd2 (diff)
Enforce resize bounds in rootston
Diffstat (limited to 'rootston/xdg_shell_v6.c')
-rw-r--r--rootston/xdg_shell_v6.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c
index 85871144..4f284851 100644
--- a/rootston/xdg_shell_v6.c
+++ b/rootston/xdg_shell_v6.c
@@ -29,6 +29,21 @@ static void resize(struct roots_view *view, uint32_t width, uint32_t height) {
assert(view->type == ROOTS_XDG_SHELL_V6_VIEW);
struct wlr_xdg_surface_v6 *surf = view->xdg_surface_v6;
if (surf->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
+ struct wlr_xdg_toplevel_v6_state *state =
+ &surf->toplevel_state->current;
+ if (width < state->min_width) {
+ width = state->min_width;
+ } else if (state->max_width > 0 &&
+ width < state->max_width) {
+ width = state->max_width;
+ }
+ if (height < state->min_height) {
+ height = state->min_height;
+ } else if (state->max_height > 0 &&
+ height < state->max_height) {
+ height = state->max_height;
+ }
+
wlr_xdg_toplevel_v6_set_size(surf, width, height);
}
}