Fixed frame bug from the mailing list plus other frame related cleanup.

This commit is contained in:
Kris Maglione 2006-06-30 02:02:44 -04:00
parent 4c6e737870
commit 0a5aa6a6a4
7 changed files with 32 additions and 36 deletions

View File

@ -229,11 +229,8 @@ attach_to_area(Area *a, Frame *f, Bool send)
if(!c->floating) { /* column */
f->rect.height = h;
arrange_column(a, False);
}
else { /* floating */
}else /* floating */
place_client(a, c);
resize_client(c, &f->rect, True);
}
}
void
@ -344,6 +341,5 @@ select_area(Area *a, char *arg)
v->sel = new;
if(a->floating != new->floating)
v->revert = a;
draw_frames();
return nil;
}

View File

@ -62,8 +62,6 @@ void
resize_bar(WMScreen *s)
{
View *v;
Area *a;
Frame *f;
s->brect = s->rect;
s->brect.height = height_of_bar();
@ -72,15 +70,8 @@ resize_bar(WMScreen *s)
XSync(blz.display, False);
draw_bar(s);
for(v=view; v; v=v->next) {
for(a = v->area; a; a=a->next) {
a->rect.height = s->rect.height - s->brect.height;
arrange_column(a, False);
}
for(f=v->area->frame; f; f=f->anext) {
resize_client(f->client, &f->rect, False);
}
}
for(v=view; v; v=v->next)
arrange_view(v);
}
void

View File

@ -158,21 +158,23 @@ update_client_grab(Client *c, Bool is_sel)
void
focus_client(Client *c, Bool restack)
{
Client *old_in_area;
Client *old;
Frame *f;
Client *old_in_area;
View *v;
if(!sel_screen)
return;
old = sel_client();
f = c->sel;
old_in_area = sel_client_of_area(f->area);
v = f->area->view;
old = sel_client();
old_in_area = sel_client_of_area(f->area);
v->sel = f->area;
f->area->sel = f;
c->floating = f->area->floating;
if(restack)
restack_view(v);
else {
@ -555,6 +557,7 @@ resize_client(Client *c, XRectangle *r, Bool ignore_xcall)
XMoveResizeWindow(blz.display, c->win, c->rect.x, c->rect.y,
c->rect.width, c->rect.height);
configure_client(c);
draw_frame(c->sel);
}
}
@ -686,6 +689,10 @@ send_client(Frame *f, char *arg)
return Ebadvalue;
flush_masked_events(EnterWindowMask);
update_views();
if(f->view == screen->sel) {
focus_client(f->client, False);
focus_view(screen, f->view);
}
return nil;
}
@ -733,6 +740,7 @@ update_client_views(Client *c, char **tags)
tags++;
}
}
focus_view(screen, screen->sel);
}
static int

View File

@ -66,7 +66,7 @@ relax_column(Area *a)
for(f=a->frame; f; f=f->anext) {
f->rect.x = a->rect.x + (a->rect.width - f->rect.width) / 2;
f->rect.y = a->rect.y + (a->rect.height - f->rect.height) / 2;
resize_client(f->client, &f->rect, True);
//resize_client(f->client, &f->rect, True);
}
return;
}
@ -89,7 +89,7 @@ relax_column(Area *a)
for(f=a->frame; f && (hx < hdiff); f=f->anext) {
unsigned int tmp = f->rect.height;
f->rect.height += hx;
resize_client(f->client, &f->rect, True);
//resize_client(f->client, &f->rect, True);
hdiff -= (f->rect.height - tmp);
}
}
@ -104,7 +104,7 @@ relax_column(Area *a)
f->rect.x = a->rect.x + (a->rect.width - f->rect.width) / 2;
yoff = f->rect.y + f->rect.height + hdiff;
}
resize_client(f->client, &f->rect, True);
//resize_client(f->client, &f->rect, True);
}
}
@ -175,7 +175,7 @@ arrange_column(Area *a, Bool dirty)
f->rect.y = yoff;
f->rect.width = a->rect.width;
yoff += f->rect.height;
resize_client(f->client, &f->rect, True);
//resize_client(f->client, &f->rect, True);
}
break;
case Colstack:
@ -190,7 +190,7 @@ arrange_column(Area *a, Bool dirty)
else
f->rect.height = height_of_bar();
yoff += f->rect.height;
resize_client(f->client, &f->rect, True);
//resize_client(f->client, &f->rect, True);
}
break;
Fallthrough:
@ -198,7 +198,7 @@ Fallthrough:
for(f=a->frame; f; f=f->anext) {
f->rect = a->rect;
if(f != a->sel) f->rect.x = screen->rect.width * 2;
resize_client(f->client, &f->rect, True);
//resize_client(f->client, &f->rect, True);
}
break;
default:
@ -206,7 +206,6 @@ Fallthrough:
}
relax_column(a);
focus_view(screen, a->view);
flush_masked_events(EnterWindowMask);
}
@ -218,7 +217,7 @@ match_horiz(Area *a, XRectangle *r)
for(f=a->frame; f; f=f->anext) {
f->rect.x = r->x;
f->rect.width = r->width;
resize_client(f->client, &f->rect, True);
//resize_client(f->client, &f->rect, True);
}
}
@ -309,16 +308,16 @@ AfterHorizontal:
north->rect.height = new->y - north->rect.y;
f->rect.height += f->rect.y - new->y;
f->rect.y = new->y;
resize_client(north->client, &north->rect, True);
resize_client(f->client, &f->rect, True);
//resize_client(north->client, &north->rect, True);
//resize_client(f->client, &f->rect, True);
}
if(south && (new->y + new->height != f->rect.y + f->rect.height)) {
south->rect.height -= new->y + new->height - south->rect.y;
south->rect.y = new->y + new->height;
f->rect.y = new->y;
f->rect.height = new->height;
resize_client(f->client, &f->rect, False);
resize_client(south->client, &south->rect, True);
//resize_client(f->client, &f->rect, False);
//resize_client(south->client, &south->rect, True);
}
AfterVertical:

View File

@ -89,7 +89,6 @@ handle_motionnotify(XEvent *e)
{
Frame *f;
XMotionEvent *ev = &e->xmotion;
if((f = frame_of_win(ev->window))) {
if(blitz_bmotion_input(&f->tagbar, ev->x, ev->y))
draw_frame(f);
@ -248,10 +247,11 @@ handle_expose(XEvent *e)
{
XExposeEvent *ev = &e->xexpose;
static Frame *f;
if(ev->count == 0) {
if(ev->window == screen->barwin)
draw_bar(screen);
else if((f = frame_of_win(ev->window)))
else if((f = frame_of_win(ev->window)) && f->view == screen->sel)
draw_frame(f);
}
}

View File

@ -94,7 +94,9 @@ draw_frame(Frame *f)
Frame *p;
unsigned int fidx, size, w;
for(fidx=0, p=f->area->frame; p && p != f; p=p->anext, fidx++);
fidx = 0;
for(p=f->area->frame; p != f; p=p->anext)
fidx++;
for(size=fidx; p; p=p->anext, size++);
if(def.border) {
@ -139,7 +141,7 @@ draw_frames()
{
Client *c;
for(c=client; c; c=c->next)
if(c->sel && (c->sel->area->view == screen->sel)) {
if(c->sel && c->sel->view == screen->sel) {
update_frame_widget_colors(c->sel);
draw_frame(c->sel);
}

View File

@ -130,8 +130,8 @@ focus_view(WMScreen *s, View *v)
for(c=client; c; c=c->next)
if((f = c->sel)) {
if(f->view == v) {
XMoveWindow(blz.display, c->framewin, f->rect.x, f->rect.y);
resize_client(c, &f->rect, False);
//XMoveWindow(blz.display, c->framewin, f->rect.x, f->rect.y);
}else
XMoveWindow(blz.display, c->framewin, 2 * s->rect.width + f->rect.x,
f->rect.y);