mirror of https://github.com/0intro/wmii
focus handling is up to the Layout now
This commit is contained in:
parent
faa69a3a5f
commit
576075e75f
|
@ -25,22 +25,6 @@ alloc_client(Window w)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
focus_client(Client * c)
|
|
||||||
{
|
|
||||||
Client *old = sel_client();
|
|
||||||
|
|
||||||
if(old)
|
|
||||||
ungrab_client(old, AnyModifier, AnyButton);
|
|
||||||
grab_client(c, Mod1Mask, Button1);
|
|
||||||
grab_client(c, Mod1Mask, Button3);
|
|
||||||
c->frame->sel = c;
|
|
||||||
XRaiseWindow(dpy, c->win);
|
|
||||||
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
|
||||||
XSync(dpy, False);
|
|
||||||
invoke_wm_event(def[WM_EVENT_CLIENT_UPDATE]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
set_client_state(Client * c, int state)
|
set_client_state(Client * c, int state)
|
||||||
{
|
{
|
||||||
|
@ -57,13 +41,12 @@ map_client(Client * c)
|
||||||
{
|
{
|
||||||
XMapRaised(dpy, c->win);
|
XMapRaised(dpy, c->win);
|
||||||
set_client_state(c, NormalState);
|
set_client_state(c, NormalState);
|
||||||
/* grab_client(c, AnyModifier, AnyButton); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
unmap_client(Client * c)
|
unmap_client(Client * c)
|
||||||
{
|
{
|
||||||
ungrab_client(c, AnyModifier, AnyButton);
|
ungrab_client(c, AnyModifier, AnyButton);
|
||||||
XUnmapWindow(dpy, c->win);
|
XUnmapWindow(dpy, c->win);
|
||||||
set_client_state(c, WithdrawnState);
|
set_client_state(c, WithdrawnState);
|
||||||
}
|
}
|
||||||
|
@ -78,15 +61,13 @@ reparent_client(Client * c, Window w, int x, int y)
|
||||||
void
|
void
|
||||||
grab_client(Client * c, unsigned long mod, unsigned int button)
|
grab_client(Client * c, unsigned long mod, unsigned int button)
|
||||||
{
|
{
|
||||||
XGrabButton(dpy, button, mod, c->win, True,
|
XGrabButton(dpy, button, mod, c->win, False,
|
||||||
ButtonPressMask, GrabModeSync, GrabModeAsync, None, None);
|
ButtonPressMask, GrabModeSync, GrabModeAsync, None, None);
|
||||||
if((mod != AnyModifier) && num_lock_mask) {
|
if((mod != AnyModifier) && num_lock_mask) {
|
||||||
XGrabButton(dpy, button, mod | num_lock_mask, c->win, True,
|
XGrabButton(dpy, button, mod | num_lock_mask, c->win, False,
|
||||||
ButtonPressMask, GrabModeSync, GrabModeAsync, None,
|
ButtonPressMask, GrabModeSync, GrabModeAsync, None, None);
|
||||||
None);
|
|
||||||
XGrabButton(dpy, button, mod | num_lock_mask | LockMask, c->win,
|
XGrabButton(dpy, button, mod | num_lock_mask | LockMask, c->win,
|
||||||
True, ButtonPressMask, GrabModeSync, GrabModeAsync,
|
True, ButtonPressMask, GrabModeSync, GrabModeAsync, None, None);
|
||||||
None, None);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,8 @@ handle_buttonpress(XEvent * e)
|
||||||
Layout *l = sel_layout();
|
Layout *l = sel_layout();
|
||||||
if(l != c->frame->layout)
|
if(l != c->frame->layout)
|
||||||
focus_layout(c->frame->layout);
|
focus_layout(c->frame->layout);
|
||||||
focus_client(c);
|
l = c->frame->layout;
|
||||||
|
l->def->focus(l, c, False);
|
||||||
ev->state &= valid_mask;
|
ev->state &= valid_mask;
|
||||||
if(ev->state & Mod1Mask) {
|
if(ev->state & Mod1Mask) {
|
||||||
Align align;
|
Align align;
|
||||||
|
|
|
@ -275,7 +275,7 @@ attach_client_to_frame(Frame * f, Client * client)
|
||||||
client->next = nil;
|
client->next = nil;
|
||||||
c->next = client;
|
c->next = client;
|
||||||
}
|
}
|
||||||
f->sel = client;
|
/*f->sel = client;*/
|
||||||
f->nclients++;
|
f->nclients++;
|
||||||
client->frame = f;
|
client->frame = f;
|
||||||
resize_frame(f, &f->rect, 0);
|
resize_frame(f, &f->rect, 0);
|
||||||
|
|
|
@ -417,19 +417,31 @@ static void
|
||||||
focus_col(Layout *l, Client *c, Bool raise)
|
focus_col(Layout *l, Client *c, Bool raise)
|
||||||
{
|
{
|
||||||
Acme *acme = l->aux;
|
Acme *acme = l->aux;
|
||||||
Client *old = sel_col(l);
|
|
||||||
Cell *cell = c->frame->aux;
|
Cell *cell = c->frame->aux;
|
||||||
|
Client *old = sel_client();
|
||||||
|
|
||||||
|
c->frame->sel = c;
|
||||||
acme->sel = cell->col;
|
acme->sel = cell->col;
|
||||||
cell->col->sel = cell;
|
cell->col->sel = cell;
|
||||||
l->file[L_SEL_FRAME]->content = c->frame->file[F_PREFIX]->content;
|
l->file[L_SEL_FRAME]->content = c->frame->file[F_PREFIX]->content;
|
||||||
|
|
||||||
if(raise)
|
if(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);
|
||||||
focus_client(c);
|
|
||||||
if(old && old != c)
|
if(old && (old != c)) {
|
||||||
|
ungrab_client(old, AnyModifier, AnyButton);
|
||||||
|
grab_client(old, AnyModifier, AnyButton);
|
||||||
draw_frame(old->frame);
|
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);
|
draw_frame(c->frame);
|
||||||
|
invoke_wm_event(def[WM_EVENT_CLIENT_UPDATE]);
|
||||||
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Frame *
|
static Frame *
|
||||||
|
|
|
@ -186,19 +186,30 @@ static void
|
||||||
focus_float(Layout *l, Client *c, Bool raise)
|
focus_float(Layout *l, Client *c, Bool raise)
|
||||||
{
|
{
|
||||||
Float *fl = l->aux;
|
Float *fl = l->aux;
|
||||||
Client *old = fl->sel->sel;
|
Client *old = sel_client();
|
||||||
|
|
||||||
|
c->frame->sel = c;
|
||||||
fl->sel = c->frame;
|
fl->sel = c->frame;
|
||||||
l->file[L_SEL_FRAME]->content = c->frame->file[F_PREFIX]->content;
|
l->file[L_SEL_FRAME]->content = c->frame->file[F_PREFIX]->content;
|
||||||
|
|
||||||
if(raise) {
|
if(raise) {
|
||||||
XRaiseWindow(dpy, c->frame->win);
|
XRaiseWindow(dpy, c->frame->win);
|
||||||
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);
|
||||||
}
|
}
|
||||||
focus_client(c);
|
|
||||||
if(old && old != c)
|
if(old && (old != c)) {
|
||||||
draw_frame(old->frame);
|
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);
|
draw_frame(c->frame);
|
||||||
|
invoke_wm_event(def[WM_EVENT_CLIENT_UPDATE]);
|
||||||
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Frame *
|
static Frame *
|
||||||
|
|
|
@ -222,7 +222,6 @@ void ungrab_client(Client * c, unsigned long mod, unsigned int button);
|
||||||
void unmap_client(Client * c);
|
void unmap_client(Client * c);
|
||||||
void map_client(Client * c);
|
void map_client(Client * c);
|
||||||
void reparent_client(Client * c, Window w, int x, int y);
|
void reparent_client(Client * c, Window w, int x, int y);
|
||||||
void focus_client(Client * c);
|
|
||||||
void attach_client(Client * c);
|
void attach_client(Client * c);
|
||||||
void detach_client(Client * c, Bool unmap);
|
void detach_client(Client * c, Bool unmap);
|
||||||
Client *sel_client();
|
Client *sel_client();
|
||||||
|
|
Loading…
Reference in New Issue