diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2009-08-24 23:49:05 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2009-08-24 23:49:05 +0000 |
commit | 2eab1059f3e79528b291c772dfa0951a972cc7f8 (patch) | |
tree | 45525d0cb340f0292d2d0f0b111720a7f424f6da /app/cwm/mousefunc.c | |
parent | ed1b5563c4641e53c0e59162f18a28dc0787510e (diff) |
bring together gathering, calculating and applying of size hints;
additionally, respect aspect ratio hints.
ok oga@
Diffstat (limited to 'app/cwm/mousefunc.c')
-rw-r--r-- | app/cwm/mousefunc.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/app/cwm/mousefunc.c b/app/cwm/mousefunc.c index b58c82cf5..5b43a8143 100644 --- a/app/cwm/mousefunc.c +++ b/app/cwm/mousefunc.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: mousefunc.c,v 1.12 2009/06/20 00:55:42 okan Exp $ + * $Id: mousefunc.c,v 1.13 2009/08/24 23:49:04 okan Exp $ */ #include "headers.h" @@ -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); |