some more fixes for resizing clients. aspect ratio is not the last thing checked and so rules all, that might need to change.. however, it now uses base-size only for aspect ratios and base-size/min-size for other sizing shit, as per the ICCCM.
This commit is contained in:
parent
bda9e6aaf9
commit
05e52e3c8e
1 changed files with 35 additions and 24 deletions
|
@ -1601,7 +1601,6 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
|
||||||
gboolean user, gboolean final)
|
gboolean user, gboolean final)
|
||||||
{
|
{
|
||||||
gboolean moved = FALSE, resized = FALSE;
|
gboolean moved = FALSE, resized = FALSE;
|
||||||
int basew, baseh, minw, minh;
|
|
||||||
|
|
||||||
/* gets the frame's position */
|
/* gets the frame's position */
|
||||||
frame_client_gravity(self->frame, &x, &y);
|
frame_client_gravity(self->frame, &x, &y);
|
||||||
|
@ -1658,7 +1657,10 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find the base and min sizes */
|
if (!(w == self->area.width && h == self->area.height)) {
|
||||||
|
int basew, baseh, minw, minh;
|
||||||
|
|
||||||
|
/* base size is substituted with min size if not specified */
|
||||||
if (self->base_size.width || self->base_size.height) {
|
if (self->base_size.width || self->base_size.height) {
|
||||||
basew = self->base_size.width;
|
basew = self->base_size.width;
|
||||||
baseh = self->base_size.height;
|
baseh = self->base_size.height;
|
||||||
|
@ -1666,6 +1668,7 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
|
||||||
basew = self->min_size.width;
|
basew = self->min_size.width;
|
||||||
baseh = self->min_size.height;
|
baseh = self->min_size.height;
|
||||||
}
|
}
|
||||||
|
/* min size is substituted with base size if not specified */
|
||||||
if (self->min_size.width || self->min_size.height) {
|
if (self->min_size.width || self->min_size.height) {
|
||||||
minw = self->min_size.width;
|
minw = self->min_size.width;
|
||||||
minh = self->min_size.height;
|
minh = self->min_size.height;
|
||||||
|
@ -1674,7 +1677,6 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
|
||||||
minh = self->base_size.height;
|
minh = self->base_size.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(w == self->area.width && h == self->area.height)) {
|
|
||||||
w -= basew;
|
w -= basew;
|
||||||
h -= baseh;
|
h -= baseh;
|
||||||
|
|
||||||
|
@ -1697,19 +1699,13 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
|
||||||
h += ah;
|
h += ah;
|
||||||
|
|
||||||
/* if this is a user-requested resize, then check against min/max
|
/* if this is a user-requested resize, then check against min/max
|
||||||
sizes and aspect ratios */
|
sizes */
|
||||||
|
|
||||||
/* smaller than min size or bigger than max size? */
|
/* smaller than min size or bigger than max size? */
|
||||||
if (w > self->max_size.width) w = self->max_size.width;
|
if (w > self->max_size.width) w = self->max_size.width;
|
||||||
if (w < minw) w = minw;
|
if (w < minw) w = minw;
|
||||||
if (h > self->max_size.height) h = self->max_size.height;
|
if (h > self->max_size.height) h = self->max_size.height;
|
||||||
if (h < minh) h = minh;
|
if (h < minh) h = minh;
|
||||||
|
|
||||||
/* adjust the height ot match the width for the aspect ratios */
|
|
||||||
if (self->min_ratio)
|
|
||||||
if (h * self->min_ratio > w) h = (int)(w / self->min_ratio);
|
|
||||||
if (self->max_ratio)
|
|
||||||
if (h * self->max_ratio < w) h = (int)(w / self->max_ratio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* keep to the increments */
|
/* keep to the increments */
|
||||||
|
@ -1728,6 +1724,21 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
|
||||||
|
|
||||||
w += basew;
|
w += basew;
|
||||||
h += baseh;
|
h += baseh;
|
||||||
|
|
||||||
|
if (user) {
|
||||||
|
/* adjust the height to match the width for the aspect ratios.
|
||||||
|
for this, min size is not substituted for base size ever. */
|
||||||
|
w -= self->base_size.width;
|
||||||
|
h -= self->base_size.height;
|
||||||
|
|
||||||
|
if (self->min_ratio)
|
||||||
|
if (h * self->min_ratio > w) h = (int)(w / self->min_ratio);
|
||||||
|
if (self->max_ratio)
|
||||||
|
if (h * self->max_ratio < w) h = (int)(w / self->max_ratio);
|
||||||
|
|
||||||
|
w += self->base_size.width;
|
||||||
|
h += self->base_size.height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (anchor) {
|
switch (anchor) {
|
||||||
|
|
Loading…
Reference in a new issue