aboutsummaryrefslogtreecommitdiffstats
path: root/mousefunc.c
diff options
context:
space:
mode:
authorokan2009-08-24 23:49:04 +0000
committerokan2009-08-24 23:49:04 +0000
commit796a52c20656342eabaf923d6141d83883689d15 (patch)
tree95561d6d722104057243d99690fafec235e5ac3e /mousefunc.c
parentc460e9758e8fcb33b958beca85d70b67857758d4 (diff)
downloadcwm-796a52c20656342eabaf923d6141d83883689d15.tar.gz
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.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/mousefunc.c b/mousefunc.c
index b58c82c..5b43a81 100644
--- a/mousefunc.c
+++ b/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);