wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 33ec75a1579df359b4e959efcea9f9764f270d7e
parent 61d5a141f772dbf406716d2835d0ec9e017e7d11
Author: Kris Maglione <jg@suckless.org>
Date:   Sat,  7 Apr 2007 02:44:39 -0400

New window moving algorithm which doesn't require (but suggests) warping.

Diffstat:
cmd/wmii/mouse.c | 37++++++++++++++++++-------------------
cmd/wmii/view.c | 16++++++++--------
2 files changed, 26 insertions(+), 27 deletions(-)

diff --git a/cmd/wmii/mouse.c b/cmd/wmii/mouse.c @@ -2,6 +2,7 @@ * See LICENSE file for license details. */ #include <stdlib.h> +#include <stdio.h> #include <string.h> #include <util.h> #include "dat.h" @@ -361,7 +362,7 @@ do_mouse_resize(Client *c, Bool opaque, BlitzAlign align) { int snap, dx, dy, pt_x, pt_y, hr_x, hr_y; uint num; Bool floating; - float rx, ry; + float rx, ry, hrx, hry; Frame *f; f = c->sel; @@ -423,9 +424,11 @@ do_mouse_resize(Client *c, Bool opaque, BlitzAlign align) { else if(f->client->fullscreen) return; else if(!opaque) { - hr_x = screen->rect.width / 2; - hr_y = screen->rect.height / 2; - warppointer(hr_x, hr_y); + hrx = (double)(screen->rect.width + frect.width - 2 * labelh(&def.font)) / screen->rect.width; + hry = (double)(screen->rect.height + frect.height - 3 * labelh(&def.font)) / screen->rect.height; + pt_x = r_east(&frect) - labelh(&def.font); + pt_y = r_south(&frect) - labelh(&def.font); + warppointer(pt_x / hrx, pt_y / hry); flushevents(PointerMotionMask, False); } @@ -449,14 +452,13 @@ do_mouse_resize(Client *c, Bool opaque, BlitzAlign align) { resize_client(c, &frect); if(!opaque) { - if(align != CENTER) - XTranslateCoordinates(blz.dpy, - /* src, dst */ c->framewin, blz.root, - /* src_x */ (frect.width * rx), - /* src_y */ (frect.height * ry), - /* dest x,y */ &pt_x, &pt_y, - /* child */ &dummy - ); + XTranslateCoordinates(blz.dpy, + /* src, dst */ c->framewin, blz.root, + /* src_x */ (frect.width * rx), + /* src_y */ (frect.height * ry), + /* dest x,y */ &pt_x, &pt_y, + /* child */ &dummy + ); if(pt_y > screen->brect.y) pt_y = screen->brect.y - 1; warppointer(pt_x, pt_y); @@ -475,11 +477,8 @@ do_mouse_resize(Client *c, Bool opaque, BlitzAlign align) { dy = ev.xmotion.y_root; if(align == CENTER && !opaque) { - if(dx == hr_x && dy == hr_y) - continue; - warppointer(hr_x, hr_y); - dx -= hr_x; - dy -= hr_y; + dx = (dx * hrx) - pt_x; + dy = (dy * hry) - pt_y; }else{ dx -= pt_x; dy -= pt_y; @@ -488,8 +487,7 @@ do_mouse_resize(Client *c, Bool opaque, BlitzAlign align) { pt_y += dy; rect_morph_xy(&origin, dx, dy, &align); - if(align != CENTER) - check_frame_constraints(&origin); + check_frame_constraints(&origin); frect = origin; if(floating) @@ -498,6 +496,7 @@ do_mouse_resize(Client *c, Bool opaque, BlitzAlign align) { grav = align ^ CENTER; apply_sizehints(c, &frect, floating, True, grav); + check_frame_constraints(&frect); if(opaque) { XMoveWindow(blz.dpy, c->framewin, frect.x, frect.y); diff --git a/cmd/wmii/view.c b/cmd/wmii/view.c @@ -171,7 +171,7 @@ restack_view(View *v) { Area *a; Frame *f; Client *c; - uint n, i, fs; + uint n, i; if(v != screen->sel) return; @@ -188,14 +188,14 @@ restack_view(View *v) { wins = erealloc(wins, sizeof(Window) * winssz); } - fs = 0; - for(f=v->area->stack; f; f=f->snext) { + wins[n++] = screen->barwin; + for(f=v->area->stack; f; f=f->snext) + if(f->client->fullscreen) { + n--; + break; + } + for(f=v->area->stack; f; f=f->snext) wins[n++] = f->client->framewin; - if(f->client->fullscreen) - fs++; - } - if(fs == 0) - wins[n++] = screen->barwin; for(a=v->area->next; a; a=a->next) { if(a->frame) { wins[n++] = a->sel->client->framewin;