aboutsummaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorokan2011-09-03 09:42:33 +0000
committerokan2011-09-03 09:42:33 +0000
commitc3ab5d4f1316da4c6aba8acb4460121ee3e45b59 (patch)
tree418448f0e4caf5939426e4e63f92a58ec951dc9b /client.c
parent41d2656d3236f0988ac500f3899c14cfec52598c (diff)
downloadcwm-c3ab5d4f1316da4c6aba8acb4460121ee3e45b59.tar.gz
split off window hints from geometry so we don't need to carry them all
around when dealing with {,h,v}max. same idea from oga.
Diffstat (limited to '')
-rw-r--r--client.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/client.c b/client.c
index 6359a35..23908c5 100644
--- a/client.c
+++ b/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: client.c,v 1.87 2011/09/03 09:20:58 okan Exp $
+ * $OpenBSD: client.c,v 1.88 2011/09/03 09:42:33 okan Exp $
*/
#include <sys/param.h>
@@ -725,36 +725,36 @@ client_getsizehints(struct client_ctx *cc)
cc->size->flags = PSize;
if (cc->size->flags & PBaseSize) {
- cc->geom.basew = cc->size->base_width;
- cc->geom.baseh = cc->size->base_height;
+ cc->hint.basew = cc->size->base_width;
+ cc->hint.baseh = cc->size->base_height;
} else if (cc->size->flags & PMinSize) {
- cc->geom.basew = cc->size->min_width;
- cc->geom.baseh = cc->size->min_height;
+ cc->hint.basew = cc->size->min_width;
+ cc->hint.baseh = cc->size->min_height;
}
if (cc->size->flags & PMinSize) {
- cc->geom.minw = cc->size->min_width;
- cc->geom.minh = cc->size->min_height;
+ cc->hint.minw = cc->size->min_width;
+ cc->hint.minh = cc->size->min_height;
} else if (cc->size->flags & PBaseSize) {
- cc->geom.minw = cc->size->base_width;
- cc->geom.minh = cc->size->base_height;
+ cc->hint.minw = cc->size->base_width;
+ cc->hint.minh = cc->size->base_height;
}
if (cc->size->flags & PMaxSize) {
- cc->geom.maxw = cc->size->max_width;
- cc->geom.maxh = cc->size->max_height;
+ cc->hint.maxw = cc->size->max_width;
+ cc->hint.maxh = cc->size->max_height;
}
if (cc->size->flags & PResizeInc) {
- cc->geom.incw = cc->size->width_inc;
- cc->geom.inch = cc->size->height_inc;
+ cc->hint.incw = cc->size->width_inc;
+ cc->hint.inch = cc->size->height_inc;
}
- cc->geom.incw = MAX(1, cc->geom.incw);
- cc->geom.inch = MAX(1, cc->geom.inch);
+ cc->hint.incw = MAX(1, cc->hint.incw);
+ cc->hint.inch = MAX(1, cc->hint.inch);
if (cc->size->flags & PAspect) {
if (cc->size->min_aspect.x > 0)
- cc->geom.mina = (float)cc->size->min_aspect.y /
+ cc->hint.mina = (float)cc->size->min_aspect.y /
cc->size->min_aspect.x;
if (cc->size->max_aspect.y > 0)
- cc->geom.maxa = (float)cc->size->max_aspect.x /
+ cc->hint.maxa = (float)cc->size->max_aspect.x /
cc->size->max_aspect.y;
}
}
@@ -763,48 +763,48 @@ client_applysizehints(struct client_ctx *cc)
{
Bool baseismin;
- baseismin = (cc->geom.basew == cc->geom.minw) &&
- (cc->geom.baseh == cc->geom.minh);
+ baseismin = (cc->hint.basew == cc->hint.minw) &&
+ (cc->hint.baseh == cc->hint.minh);
/* temporarily remove base dimensions, ICCCM 4.1.2.3 */
if (!baseismin) {
- cc->geom.width -= cc->geom.basew;
- cc->geom.height -= cc->geom.baseh;
+ cc->geom.width -= cc->hint.basew;
+ cc->geom.height -= cc->hint.baseh;
}
/* adjust for aspect limits */
- if (cc->geom.mina > 0 && cc->geom.maxa > 0) {
- if (cc->geom.maxa <
+ if (cc->hint.mina > 0 && cc->hint.maxa > 0) {
+ if (cc->hint.maxa <
(float)cc->geom.width / cc->geom.height)
- cc->geom.width = cc->geom.height * cc->geom.maxa;
- else if (cc->geom.mina <
+ cc->geom.width = cc->geom.height * cc->hint.maxa;
+ else if (cc->hint.mina <
(float)cc->geom.height / cc->geom.width)
- cc->geom.height = cc->geom.width * cc->geom.mina;
+ cc->geom.height = cc->geom.width * cc->hint.mina;
}
/* remove base dimensions for increment */
if (baseismin) {
- cc->geom.width -= cc->geom.basew;
- cc->geom.height -= cc->geom.baseh;
+ cc->geom.width -= cc->hint.basew;
+ cc->geom.height -= cc->hint.baseh;
}
/* adjust for increment value */
- cc->geom.width -= cc->geom.width % cc->geom.incw;
- cc->geom.height -= cc->geom.height % cc->geom.inch;
+ cc->geom.width -= cc->geom.width % cc->hint.incw;
+ cc->geom.height -= cc->geom.height % cc->hint.inch;
/* restore base dimensions */
- cc->geom.width += cc->geom.basew;
- cc->geom.height += cc->geom.baseh;
+ cc->geom.width += cc->hint.basew;
+ cc->geom.height += cc->hint.baseh;
/* adjust for min width/height */
- cc->geom.width = MAX(cc->geom.width, cc->geom.minw);
- cc->geom.height = MAX(cc->geom.height, cc->geom.minh);
+ cc->geom.width = MAX(cc->geom.width, cc->hint.minw);
+ cc->geom.height = MAX(cc->geom.height, cc->hint.minh);
/* adjust for max width/height */
- if (cc->geom.maxw)
- cc->geom.width = MIN(cc->geom.width, cc->geom.maxw);
- if (cc->geom.maxh)
- cc->geom.height = MIN(cc->geom.height, cc->geom.maxh);
+ if (cc->hint.maxw)
+ cc->geom.width = MIN(cc->geom.width, cc->hint.maxw);
+ if (cc->hint.maxh)
+ cc->geom.height = MIN(cc->geom.height, cc->hint.maxh);
}
static void