mirror of https://github.com/0intro/wmii
Got rid of some of said cruft.
This commit is contained in:
parent
868f3b2bb4
commit
1025c92f0f
4
client.c
4
client.c
|
@ -543,7 +543,7 @@ move_client(Client *c, char *arg) {
|
|||
new.x += x;
|
||||
new.y += y;
|
||||
if(!f->area->floating)
|
||||
resize_column(f->client, &new, nil);
|
||||
resize_column(f->client, &new);
|
||||
else
|
||||
resize_client(f->client, &new, False);
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ size_client(Client *c, char *arg) {
|
|||
new.width += w;
|
||||
new.height += h;
|
||||
if(!f->area->floating)
|
||||
resize_column(f->client, &new, nil);
|
||||
resize_column(f->client, &new);
|
||||
else
|
||||
resize_client(f->client, &new, False);
|
||||
}
|
||||
|
|
177
column.c
177
column.c
|
@ -5,20 +5,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static int
|
||||
max(int a, int b) {
|
||||
if(a > b)
|
||||
return a;
|
||||
return b;
|
||||
}
|
||||
|
||||
static int
|
||||
min(int a, int b) {
|
||||
if(a < b)
|
||||
return a;
|
||||
return b;
|
||||
}
|
||||
|
||||
char *
|
||||
str_of_column_mode(int mode) {
|
||||
switch(mode) {
|
||||
|
@ -311,168 +297,9 @@ AfterVertical:
|
|||
focus_view(screen, v);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* I think this will go later */
|
||||
static Frame *
|
||||
frame_of_point(XPoint *pt) {
|
||||
Area *a;
|
||||
View *v = screen->sel;
|
||||
Frame *f = nil;
|
||||
|
||||
if(!v)
|
||||
return nil;
|
||||
for(a=v->area->next; a && !ispointinrect(pt->x, pt->y, &a->rect);
|
||||
a=a->next);
|
||||
if(a)
|
||||
for(f=a->frame; f && !ispointinrect(pt->x, pt->y, &f->rect);
|
||||
f=f->anext);
|
||||
return f;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
drop_move(Frame *f, XRectangle *nrect) {
|
||||
XRectangle *arect, *frect;
|
||||
Frame *ft, *f_high;
|
||||
Area *a, *a_high;
|
||||
View *v;
|
||||
int high, over, before;
|
||||
|
||||
v = f->view;
|
||||
high = 0;
|
||||
a_high = nil;
|
||||
|
||||
for(a = v->area->next; a; a = a->next) {
|
||||
arect = &a->rect;
|
||||
over = min(arect->x + arect->width, nrect->x + nrect->width) -
|
||||
max(arect->x, nrect->x);
|
||||
if(over > high) {
|
||||
high = over;
|
||||
a_high = a;
|
||||
}
|
||||
}
|
||||
|
||||
over = (nrect->x + nrect->width) - screen->rect.width;
|
||||
if(over > high) {
|
||||
for(a_high = f->area; a_high->next; a_high = a_high->next);
|
||||
a_high = new_column(v, a_high, 0);
|
||||
send_to_area(a_high, f->area, f);
|
||||
arrange_column(a_high, False);
|
||||
return;
|
||||
}else if(-(nrect->x) > high) {
|
||||
a_high = new_column(v, v->area, 0);
|
||||
send_to_area(a_high, f->area, f);
|
||||
arrange_column(a_high, False);
|
||||
return;
|
||||
}
|
||||
|
||||
if(f->area != a_high)
|
||||
send_to_area(a_high, f->area, f);
|
||||
|
||||
high = 0;
|
||||
for(ft = f->area->frame; ft; ft = ft->anext) {
|
||||
frect = &ft->rect;
|
||||
over = min(frect->y + frect->height, nrect->y + nrect->height) -
|
||||
max(frect->y, nrect->y);
|
||||
if(over > high) {
|
||||
high = over;
|
||||
f_high = ft;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
over = (nrect->y + nrect->height) - (screen->rect.height - screen->brect.height);
|
||||
if(over > high) {
|
||||
remove_frame(f);
|
||||
for(ft = f->area->frame; ft->anext; ft = ft->anext);
|
||||
insert_frame(ft, f, False);
|
||||
focus(f->client, False);
|
||||
return;
|
||||
}else if(-(nrect->y) > high) {
|
||||
remove_frame(f);
|
||||
insert_frame(f->area->frame, f, True);
|
||||
focus(f->client, False);
|
||||
return;
|
||||
}
|
||||
|
||||
if(f_high != f) {
|
||||
remove_frame(f);
|
||||
frect = &f_high->rect;
|
||||
before = (frect->y - nrect->y) >
|
||||
((nrect->y + nrect->height) - (frect->y + frect->height)) ?
|
||||
True : False;
|
||||
insert_frame(f_high, f, before);
|
||||
focus(f->client, False);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* I'm keeping this around for the moment. Rather than digging through hg later */
|
||||
static void
|
||||
drop_move_old(Frame *f, XRectangle *new, XPoint *pt) {
|
||||
Area *tgt, *src;
|
||||
Frame *ft;
|
||||
View *v;
|
||||
|
||||
tgt = nil;
|
||||
src = f->area;
|
||||
v = src->view;
|
||||
if(!pt)
|
||||
return;
|
||||
for(tgt=v->area->next; tgt && !ispointinrect(pt->x, pt->y, &tgt->rect);
|
||||
tgt=tgt->next);
|
||||
if(tgt) {
|
||||
if(pt->x < 16) {
|
||||
if((src->frame && src->frame->anext) || (src != v->area->next)) {
|
||||
tgt = new_column(v, v->area->next, 0);
|
||||
send_to_area(tgt, src, f);
|
||||
}
|
||||
}
|
||||
else if(pt->x >= screen->rect.width - 16) {
|
||||
if((src->frame && src->frame->anext) || src->next) {
|
||||
for(tgt=src; tgt->next; tgt=tgt->next);
|
||||
tgt = new_column(v, tgt, 0);
|
||||
send_to_area(tgt, src, f);
|
||||
}
|
||||
}
|
||||
else if(src != tgt) {
|
||||
Client *c = f->client;
|
||||
Bool before;
|
||||
if(!(ft = frame_of_point(pt)) || (f == ft))
|
||||
return;
|
||||
before = pt->y < (ft->rect.y + ft->rect.height / 2);
|
||||
send_to_area(tgt, src, f);
|
||||
f = c->sel;
|
||||
remove_frame(f);
|
||||
if(before)
|
||||
insert_frame(ft, f, True);
|
||||
else
|
||||
insert_frame(ft, f, False);
|
||||
tgt->sel = f;
|
||||
arrange_column(tgt, False);
|
||||
}
|
||||
else { /* !tgt */
|
||||
if(!(ft = frame_of_point(pt)) || (f == ft))
|
||||
return;
|
||||
remove_frame(f);
|
||||
if(pt->y < (ft->rect.y + ft->rect.height / 2))
|
||||
insert_frame(ft, f, True);
|
||||
else
|
||||
insert_frame(ft, f, False);
|
||||
tgt->sel = f;
|
||||
arrange_column(tgt, False);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
resize_column(Client *c, XRectangle *r, XPoint *pt) {
|
||||
Frame *f = c->sel;
|
||||
if((f->rect.width == r->width) && (f->rect.height == r->height))
|
||||
drop_move(f, r);
|
||||
else
|
||||
drop_resize(f, r);
|
||||
resize_column(Client *c, XRectangle *r) {
|
||||
drop_resize(c->sel, r);
|
||||
}
|
||||
|
||||
Area *
|
||||
|
|
37
mouse.c
37
mouse.c
|
@ -309,27 +309,29 @@ do_managed_move(Client *c) {
|
|||
void
|
||||
do_mouse_resize(Client *c, BlitzAlign align) {
|
||||
BlitzAlign grav;
|
||||
Cursor cur;
|
||||
int dx, dy, pt_x, pt_y, hr_x, hr_y, i;
|
||||
float rx, ry;
|
||||
Window dummy;
|
||||
Cursor cur;
|
||||
XEvent ev;
|
||||
unsigned int num = 0, di;
|
||||
Frame *f = c->sel;
|
||||
Bool floating = f->area->floating;
|
||||
int snap = floating ? screen->rect.height / 66 : 0;
|
||||
XRectangle *rects = floating ? rects_of_view(f->area->view, &num) : nil;
|
||||
XRectangle frect = f->rect, ofrect;
|
||||
XRectangle origin = frect;
|
||||
XPoint pt;
|
||||
XRectangle *rects, ofrect, frect, origin;
|
||||
int snap, dx, dy, pt_x, pt_y, hr_x, hr_y, i;
|
||||
unsigned int num, di;
|
||||
Bool floating;
|
||||
float rx, ry;
|
||||
Frame *f;
|
||||
|
||||
if(align == CENTER && !floating)
|
||||
floating = f->area->floating;
|
||||
origin = frect = f->rect;
|
||||
rects = floating ? rects_of_view(f->area->view, &num) : nil;
|
||||
snap = floating ? screen->rect.height / 66 : 0;
|
||||
cur = cursor[CurResize];
|
||||
f = c->sel;
|
||||
|
||||
if(!floating && (align == CENTER))
|
||||
return do_managed_move(c);
|
||||
|
||||
XQueryPointer(blz.dpy, c->framewin, &dummy, &dummy, &i, &i, &pt_x, &pt_y, &di);
|
||||
rx = (float)pt_x / frect.width;
|
||||
ry = (float)pt_y / frect.height;
|
||||
cur = cursor[CurResize];
|
||||
|
||||
if (align != CENTER) {
|
||||
pt_x = dx = frect.width / 2;
|
||||
|
@ -362,10 +364,8 @@ do_mouse_resize(Client *c, BlitzAlign align) {
|
|||
case ButtonRelease:
|
||||
draw_xor_border(&frect);
|
||||
|
||||
pt.x = pt_x;
|
||||
pt.y = pt_y;
|
||||
if(!floating)
|
||||
resize_column(c, &frect, (align == CENTER) ? &pt : nil);
|
||||
resize_column(c, &frect);
|
||||
else
|
||||
resize_client(c, &frect, False);
|
||||
|
||||
|
@ -398,19 +398,18 @@ do_mouse_resize(Client *c, BlitzAlign align) {
|
|||
dx -= pt_x;
|
||||
dy -= pt_y;
|
||||
}
|
||||
|
||||
pt_x += dx;
|
||||
pt_y += dy;
|
||||
|
||||
rect_morph_xy(&origin, dx, dy, &align);
|
||||
if(align != CENTER)
|
||||
check_frame_constraints(&origin);
|
||||
if(align != CENTER) check_frame_constraints(&origin);
|
||||
frect = origin;
|
||||
|
||||
if(floating)
|
||||
grav = snap_rect(rects, num, &frect, &align, snap);
|
||||
else
|
||||
grav = align ^ CENTER;
|
||||
|
||||
match_sizehints(c, &frect, floating, grav);
|
||||
|
||||
draw_xor_border(&ofrect);
|
||||
|
|
2
wmii.h
2
wmii.h
|
@ -289,7 +289,7 @@ extern void apply_tags(Client *c, const char *tags);
|
|||
/* column.c */
|
||||
extern void arrange_column(Area *a, Bool dirty);
|
||||
extern void scale_column(Area *a, float h);
|
||||
extern void resize_column(Client *c, XRectangle *r, XPoint *pt);
|
||||
extern void resize_column(Client *c, XRectangle *r);
|
||||
extern int column_mode_of_str(char *arg);
|
||||
extern char *str_of_column_mode(int mode);
|
||||
extern Area *new_column(View *v, Area *pos, unsigned int w);
|
||||
|
|
Loading…
Reference in New Issue