fixed several issues in column layout reported by tube

This commit is contained in:
Anselm R. Garbe 2006-01-19 16:02:18 +02:00
parent d8daa2fe96
commit ace9b63747
4 changed files with 24 additions and 26 deletions

View File

@ -36,6 +36,24 @@ set_client_state(Client * c, int state)
(unsigned char *) data, 2); (unsigned char *) data, 2);
} }
void
focus_client(Client *new, Client *old)
{
if(old && (old != new)) {
ungrab_client(old, AnyModifier, AnyButton);
grab_client(old, AnyModifier, AnyButton);
draw_frame(old->frame);
}
ungrab_client(new, AnyModifier, AnyButton);
grab_client(new, Mod1Mask, Button1);
grab_client(new, Mod1Mask, Button3);
XRaiseWindow(dpy, new->win);
XSetInputFocus(dpy, new->win, RevertToPointerRoot, CurrentTime);
draw_frame(new->frame);
invoke_wm_event(def[WM_EVENT_CLIENT_UPDATE]);
XSync(dpy, False);
}
void void
map_client(Client * c) map_client(Client * c)
{ {

View File

@ -180,6 +180,7 @@ detach_frame(Layout *l, Frame * old)
acme->frames = old->next; acme->frames = old->next;
if(old->next) if(old->next)
old->next->prev = old->prev; old->next->prev = old->prev;
old->prev = old->next = nil;
old->aux = nil; old->aux = nil;
detach_frame_from_layout(old); detach_frame_from_layout(old);
acme->nframes--; acme->nframes--;
@ -424,19 +425,7 @@ focus_col(Layout *l, Client *c, Bool raise)
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, XWarpPointer(dpy, None, c->win, 0, 0, 0, 0,
c->rect.width / 2, c->rect.height / 2); c->rect.width / 2, c->rect.height / 2);
if(old && (old != c)) { focus_client(c, old);
ungrab_client(old, AnyModifier, AnyButton);
grab_client(old, AnyModifier, AnyButton);
draw_frame(old->frame);
}
ungrab_client(c, AnyModifier, AnyButton);
grab_client(c, Mod1Mask, Button1);
grab_client(c, Mod1Mask, Button3);
XRaiseWindow(dpy, c->win);
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
draw_frame(c->frame);
invoke_wm_event(def[WM_EVENT_CLIENT_UPDATE]);
XSync(dpy, False);
} }
static Frame * static Frame *
@ -504,7 +493,7 @@ select_frame(void *obj, char *arg)
for(cell = col->cells; cell && i != idx; cell = cell->next) for(cell = col->cells; cell && i != idx; cell = cell->next)
i++; i++;
} }
if(cell && cell != col) if(cell && cell != col->sel)
focus_col(l, cell->frame->sel, True); focus_col(l, cell->frame->sel, True);
} }

View File

@ -108,6 +108,7 @@ detach_frame(Layout *l, Frame * old)
if(fl->sel == old) if(fl->sel == old)
fl->sel = fl->frames; fl->sel = fl->frames;
old->prev = old->next = nil;
detach_frame_from_layout(old); detach_frame_from_layout(old);
fl->nframes--; fl->nframes--;
} }
@ -193,18 +194,7 @@ focus_float(Layout *l, Client *c, Bool raise)
c->rect.width / 2, c->rect.height / 2); c->rect.width / 2, c->rect.height / 2);
} }
if(old && (old != c)) { focus_client(c, old);
grab_client(old, AnyModifier, AnyButton);
draw_frame(old->frame);
}
ungrab_client(c, AnyModifier, AnyButton);
grab_client(c, Mod1Mask, Button1);
grab_client(c, Mod1Mask, Button3);
XRaiseWindow(dpy, c->win);
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
draw_frame(c->frame);
invoke_wm_event(def[WM_EVENT_CLIENT_UPDATE]);
XSync(dpy, False);
} }
static Frame * static Frame *

View File

@ -229,6 +229,7 @@ Client *sel_client();
Client *clientat(Client * clients, size_t idx); Client *clientat(Client * clients, size_t idx);
void detach_detached(Client * c); void detach_detached(Client * c);
void attach_detached(Client * c); void attach_detached(Client * c);
void focus_client(Client *new, Client *old);
/* frame.c */ /* frame.c */
Frame *win_to_frame(Window w); Frame *win_to_frame(Window w);