[hackers] [wmii] Take aspect hints into account in grow commands. || Kris Maglione

From: <hg_AT_suckless.org>
Date: Thu, 28 Oct 2010 13:56:04 +0000 (UTC)

changeset: 2785:327e87c7bb2b
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Thu Oct 28 09:55:54 2010 -0400
files: cmd/wmii/message.c
description:
Take aspect hints into account in grow commands.

diff -r 9466b4993b71 -r 327e87c7bb2b cmd/wmii/message.c
--- a/cmd/wmii/message.c Wed Oct 13 17:33:02 2010 -0400
+++ b/cmd/wmii/message.c Thu Oct 28 09:55:54 2010 -0400
@@ -833,12 +833,13 @@
 msg_grow(View *v, IxpMsg *m) {
         Client *c;
         Frame *f;
- Rectangle r;
+ Rectangle h, r;
         Point amount;
         int dir;
 
         f = getframe(v, screen->idx, m);
         c = f->client;
+ h = c->w.hints->aspect;
 
         dir = getdirection(m);
 
@@ -850,17 +851,20 @@
                 amount.y = c->w.hints->inc.y;
         getamt(m, &amount);
 
+ if (dir == LLEFT || dir == LRIGHT)
+ amount.y = h.min.x ? amount.x * h.min.y / h.min.x : 0;
+ else
+ amount.x = h.min.y ? amount.y * h.min.x / h.min.y : 0;
+
         if(f->area->floating)
                 r = f->r;
         else
                 r = f->colr;
- switch(dir) {
- case LLEFT: r.min.x -= amount.x; break;
- case LRIGHT: r.max.x += amount.x; break;
- case LUP: r.min.y -= amount.y; break;
- case LDOWN: r.max.y += amount.y; break;
- default: abort();
- }
+
+ if (dir == LLEFT || dir == LUP)
+ r.min = subpt(r.min, amount);
+ else if (dir == LRIGHT || dir == LDOWN)
+ r.max = addpt(r.max, amount);
 
         if(f->area->floating)
                 float_resizeframe(f, r);
Received on Thu Oct 28 2010 - 15:56:04 CEST

This archive was generated by hypermail 2.2.0 : Thu Oct 28 2010 - 16:00:09 CEST