diff options
author | okan <okan> | 2009-08-24 23:49:04 +0000 |
---|---|---|
committer | okan <okan> | 2009-08-24 23:49:04 +0000 |
commit | 028a1778db0caa04ca4f82be32998a7f65c802a5 (patch) | |
tree | 9284024c4d2a1962e8959b43a9ad5d7b1d5cf997 /mousefunc.c | |
parent | 09d88f4a18623fff580e7381aa242dae5b53cc18 (diff) | |
download | cwm-028a1778db0caa04ca4f82be32998a7f65c802a5.tar.gz cwm-028a1778db0caa04ca4f82be32998a7f65c802a5.tar.xz cwm-028a1778db0caa04ca4f82be32998a7f65c802a5.zip |
bring together gathering, calculating and applying of size hints;
additionally, respect aspect ratio hints. ok oga@
Diffstat (limited to 'mousefunc.c')
-rw-r--r-- | mousefunc.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/mousefunc.c b/mousefunc.c index fc6c8b9..74bbf04 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -33,22 +33,7 @@ mousefunc_sweep_calc(struct client_ctx *cc, int x, int y, int mx, int my) cc->geom.width = abs(x - mx) - cc->bwidth; cc->geom.height = abs(y - my) - cc->bwidth; - if (cc->size->flags & PResizeInc) { - cc->geom.width -= - (cc->geom.width - cc->geom.min_dx) % cc->size->width_inc; - cc->geom.height -= - (cc->geom.height - cc->geom.min_dy) % cc->size->height_inc; - } - - if (cc->size->flags & PMinSize) { - cc->geom.width = MAX(cc->geom.width, cc->size->min_width); - cc->geom.height = MAX(cc->geom.height, cc->size->min_height); - } - - if (cc->size->flags & PMaxSize) { - cc->geom.width = MIN(cc->geom.width, cc->size->max_width); - cc->geom.height = MIN(cc->geom.height, cc->size->max_height); - } + client_applysizehints(cc); cc->geom.x = x <= mx ? x : x - cc->geom.width; cc->geom.y = y <= my ? y : y - cc->geom.height; @@ -64,8 +49,8 @@ mousefunc_sweep_draw(struct client_ctx *cc) int width, height, width_size, width_name; snprintf(asize, sizeof(asize), "%dx%d", - (cc->geom.width - cc->geom.min_dx) / cc->size->width_inc, - (cc->geom.height - cc->geom.min_dy) / cc->size->height_inc); + (cc->geom.width - cc->geom.basew) / MAX(1, cc->geom.incw), + (cc->geom.height - cc->geom.baseh) / MAX(1, cc->geom.inch)); width_size = font_width(asize, strlen(asize)) + 4; width_name = font_width(cc->name, strlen(cc->name)) + 4; width = MAX(width_size, width_name); @@ -90,9 +75,6 @@ mousefunc_window_resize(struct client_ctx *cc, void *arg) struct screen_ctx *sc = CCTOSC(cc); int x = cc->geom.x, y = cc->geom.y; - cc->size->width_inc = MAX(1, cc->size->width_inc); - cc->size->height_inc = MAX(1, cc->size->height_inc); - client_raise(cc); client_ptrsave(cc); |