commit 4d5ad01a01dee31cf74f5909772559255fd4a61f
parent 0115b00394aa7a7c97a008e1431c58c3b116ffc1
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Mon, 29 May 2006 09:50:11 +0200
removed snap-to-border for managed mode
Diffstat:
4 files changed, 22 insertions(+), 33 deletions(-)
diff --git a/TODO.wmii-4 b/TODO.wmii-4
@@ -1,4 +1,3 @@
-- remove snap-to-border for managed windows (is pointless).
- UTF8 fixes with iconv?
- re-introduce mouse based resizals (titlebar and border)
- idea for column mode:
diff --git a/cmd/wm/mouse.c b/cmd/wm/mouse.c
@@ -183,12 +183,13 @@ do_mouse_move(Client *c)
int px = 0, py = 0, wex, wey, ex, ey, i;
Window dummy;
XEvent ev;
- int snapw = (rect.width * def.snap) / 1000;
- int snaph = (rect.height * def.snap) / 1000;
- unsigned int num;
+ unsigned int num = 0;
unsigned int dmask;
Frame *f = c->frame.data[c->sel];
- XRectangle *rects = rects_of_view(f->area->view, idx_of_area(f->area) == 0, &num);
+ int aidx = idx_of_area(f->area);
+ int snapw = aidx ? 0 : (rect.width * def.snap) / 1000;
+ int snaph = aidx ? 0 : (rect.height * def.snap) / 1000;
+ XRectangle *rects = aidx ? nil : rects_of_view(f->area->view, &num);
XRectangle frect = f->rect;
XPoint pt;
@@ -209,7 +210,7 @@ do_mouse_move(Client *c)
switch (ev.type) {
case ButtonRelease:
draw_pseudo_border(&frect);
- if(idx_of_area(f->area))
+ if(aidx)
resize_column(c, &frect, &pt);
else
resize_client(c, &frect, False);
@@ -227,7 +228,8 @@ do_mouse_move(Client *c)
draw_pseudo_border(&frect);
frect.x = px - ex;
frect.y = py - ey;
- snap_move(&frect, rects, num, snapw, snaph);
+ if(!aidx)
+ snap_move(&frect, rects, num, snapw, snaph);
draw_pseudo_border(&frect);
break;
default: break;
@@ -417,12 +419,13 @@ do_mouse_resize(Client *c, BlitzAlign align)
int px = 0, py = 0, i, ox, oy;
Window dummy;
XEvent ev;
- int snapw = (rect.width * def.snap) / 1000;
- int snaph = (rect.height * def.snap) / 1000;
unsigned int dmask;
- unsigned int num;
+ unsigned int num = 0;
Frame *f = c->frame.data[c->sel];
- XRectangle *rects = rects_of_view(f->area->view, idx_of_area(f->area) == 0, &num);
+ int aidx = idx_of_area(f->area);
+ int snapw = aidx ? 0 : (rect.width * def.snap) / 1000;
+ int snaph = aidx ? 0 : (rect.height * def.snap) / 1000;
+ XRectangle *rects = aidx ? nil : rects_of_view(f->area->view, &num);
XRectangle frect = f->rect;
XRectangle origin = frect;
@@ -440,7 +443,7 @@ do_mouse_resize(Client *c, BlitzAlign align)
switch (ev.type) {
case ButtonRelease:
draw_pseudo_border(&frect);
- if(idx_of_area(f->area))
+ if(aidx)
resize_column(c, &frect, nil);
else
resize_client(c, &frect, False);
@@ -453,8 +456,9 @@ do_mouse_resize(Client *c, BlitzAlign align)
XTranslateCoordinates(dpy, c->framewin, root, ev.xmotion.x,
ev.xmotion.y, &px, &py, &dummy);
draw_pseudo_border(&frect);
- snap_resize(&frect, &origin, align, rects, num, px,
- ox, py, oy, snapw, snaph);
+ if(!aidx)
+ snap_resize(&frect, &origin, align, rects, num, px,
+ ox, py, oy, snapw, snaph);
draw_pseudo_border(&frect);
break;
default: break;
diff --git a/cmd/wm/view.c b/cmd/wm/view.c
@@ -109,32 +109,18 @@ focus_view(View *v)
}
XRectangle *
-rects_of_view(View *v, Bool isfloat, unsigned int *num)
+rects_of_view(View *v, unsigned int *num)
{
XRectangle *result = nil;
unsigned int i;
*num = 0;
- if(isfloat)
- *num = v->area.data[0]->frame.size + 1;
- else {
- for(i = 1; i < v->area.size; i++)
- *num += v->area.data[i]->frame.size + 1;
- }
+ *num = v->area.data[0]->frame.size + 1;
if(*num) {
result = cext_emallocz(*num * sizeof(XRectangle));
- if(isfloat) {
- for(i = 0; i < *num; i++)
- result[i] = v->area.data[0]->frame.data[0]->rect;
- }
- else {
- unsigned int j, n = 0;
- for(i = 1; i < v->area.size; i++) {
- for(j = 0; j < v->area.data[i]->frame.size; j++)
- result[n++] = v->area.data[i]->frame.data[j]->rect;
- }
- }
+ for(i = 0; i < *num; i++)
+ result[i] = v->area.data[0]->frame.data[0]->rect;
result[*num - 1] = brect;
}
return result;
diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h
@@ -297,7 +297,7 @@ void arrange_view(View *v);
void scale_view(View *v, float w);
View *create_view(const char *name);
void focus_view(View *v);
-XRectangle *rects_of_view(View *v, Bool isfloat, unsigned int *num);
+XRectangle *rects_of_view(View *v, unsigned int *num);
int idx_of_view_id(unsigned short id);
void select_view(const char *arg);
int idx_of_view(View *v);