mirror of
https://codeberg.org/dwl/dwl.git
synced 2026-09-19 13:52:48 +00:00
Reapply "respect size hints"
This reverts commit 31bf1cbaf6.
Fixes https://codeberg.org/dwl/dwl/issues/105
Fixes https://codeberg.org/dwl/dwl/issues/634
Fixes https://codeberg.org/dwl/dwl/issues/1171
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
#include <getopt.h>
|
||||
#include <libinput.h>
|
||||
#include <limits.h>
|
||||
#include <linux/input-event-codes.h>
|
||||
#include <math.h>
|
||||
#include <signal.h>
|
||||
@@ -483,9 +484,18 @@ static struct wlr_xwayland *xwayland;
|
||||
void
|
||||
applybounds(Client *c, struct wlr_box *bbox)
|
||||
{
|
||||
/* set minimum possible */
|
||||
c->geom.width = MAX(1 + 2 * (int)c->bw, c->geom.width);
|
||||
c->geom.height = MAX(1 + 2 * (int)c->bw, c->geom.height);
|
||||
if (!c->isfullscreen) {
|
||||
struct wlr_box min = {0}, max = {0};
|
||||
client_get_size_hints(c, &max, &min);
|
||||
c->geom.width = MAX(min.width + 2 * (int)c->bw, c->geom.width);
|
||||
c->geom.height = MAX(min.height + 2 * (int)c->bw, c->geom.height);
|
||||
/* Some clients set their max size to INT_MAX, which does not violate the
|
||||
* protocol but it's unnecesary, as they can set their max size to zero. */
|
||||
if (max.width && 2 * (int)c->bw <= INT_MAX - max.width) /* Checks for overflow */
|
||||
c->geom.width = MIN(max.width + 2 * (int)c->bw, c->geom.width);
|
||||
if (max.height && 2 * (int)c->bw <= INT_MAX - max.height) /* Checks for overflow */
|
||||
c->geom.height = MIN(max.height + 2 * (int)c->bw, c->geom.height);
|
||||
}
|
||||
|
||||
if (c->geom.x >= bbox->x + bbox->width)
|
||||
c->geom.x = bbox->x + bbox->width - c->geom.width;
|
||||
|
||||
Reference in New Issue
Block a user