removed snap-to-border for managed mode

This commit is contained in:
Anselm R. Garbe 2006-05-29 09:50:11 +02:00
parent 0115b00394
commit 4d5ad01a01
4 changed files with 22 additions and 33 deletions

View File

@ -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:

View File

@ -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;

View File

@ -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;

View File

@ -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);