Skip to content

Commit

Permalink
do not allow set client size less than its min size
Browse files Browse the repository at this point in the history
  • Loading branch information
sevz17 committed Mar 18, 2022
1 parent 467123d commit 475c134
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
20 changes: 20 additions & 0 deletions client.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,23 @@ client_surface_at(Client *c, double cx, double cy, double *sx, double *sy)
#endif
return wlr_xdg_surface_surface_at(c->surface.xdg, cx, cy, sx, sy);
}

static inline void
client_min_size(Client *c, int *width, int *height)
{
struct wlr_xdg_toplevel *toplevel;
struct wlr_xdg_toplevel_state *state;
#ifdef XWAYLAND
if (client_is_x11(c)) {
struct wlr_xwayland_surface_size_hints *size_hints;
size_hints = c->surface.xwayland->size_hints;
*width = size_hints->min_width;
*height = size_hints->min_height;
return;
}
#endif
toplevel = c->surface.xdg->toplevel;
state = &toplevel->current;
*width = state->min_width;
*height = state->min_height;
}
6 changes: 4 additions & 2 deletions dwl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1636,11 +1636,13 @@ rendermon(struct wl_listener *listener, void *data)
void
resize(Client *c, int x, int y, int w, int h, int interact)
{
int min_width = 0, min_height = 0;
struct wlr_box *bbox = interact ? &sgeom : &c->mon->w;
client_min_size(c, &min_width, &min_height);
c->geom.x = x;
c->geom.y = y;
c->geom.width = w;
c->geom.height = h;
c->geom.width = MAX(min_width + 2 * c->bw, w);
c->geom.height = MAX(min_height + 2 * c->bw, h);
applybounds(c, bbox);

/* Update scene-graph, including borders */
Expand Down

0 comments on commit 475c134

Please sign in to comment.