commit 576075e75f86b83fdc9c45d7d30d8ee1f861be87
parent faa69a3a5f7114960e36f42847108a34d01a2ca9
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Wed, 18 Jan 2006 15:42:44 +0200
focus handling is up to the Layout now
Diffstat:
7 files changed, 42 insertions(+), 34 deletions(-)
diff --git a/cmd/wm/client.c b/cmd/wm/client.c
@@ -26,22 +26,6 @@ alloc_client(Window w)
}
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
set_client_state(Client * c, int state)
{
long data[2];
@@ -57,13 +41,12 @@ map_client(Client * c)
{
XMapRaised(dpy, c->win);
set_client_state(c, NormalState);
- /* grab_client(c, AnyModifier, AnyButton); */
}
void
unmap_client(Client * c)
{
- ungrab_client(c, AnyModifier, AnyButton);
+ ungrab_client(c, AnyModifier, AnyButton);
XUnmapWindow(dpy, c->win);
set_client_state(c, WithdrawnState);
}
@@ -78,15 +61,13 @@ reparent_client(Client * c, Window w, int x, int y)
void
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);
if((mod != AnyModifier) && num_lock_mask) {
- XGrabButton(dpy, button, mod | num_lock_mask, c->win, True,
- ButtonPressMask, GrabModeSync, GrabModeAsync, None,
- None);
+ XGrabButton(dpy, button, mod | num_lock_mask, c->win, False,
+ ButtonPressMask, GrabModeSync, GrabModeAsync, None, None);
XGrabButton(dpy, button, mod | num_lock_mask | LockMask, c->win,
- True, ButtonPressMask, GrabModeSync, GrabModeAsync,
- None, None);
+ True, ButtonPressMask, GrabModeSync, GrabModeAsync, None, None);
}
}
diff --git a/cmd/wm/event.c b/cmd/wm/event.c
@@ -66,7 +66,8 @@ handle_buttonpress(XEvent * e)
Layout *l = sel_layout();
if(l != 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;
if(ev->state & Mod1Mask) {
Align align;
diff --git a/cmd/wm/frame.c b/cmd/wm/frame.c
@@ -275,7 +275,7 @@ attach_client_to_frame(Frame * f, Client * client)
client->next = nil;
c->next = client;
}
- f->sel = client;
+ /*f->sel = client;*/
f->nclients++;
client->frame = f;
resize_frame(f, &f->rect, 0);
diff --git a/cmd/wm/layout_column.c b/cmd/wm/layout_column.c
@@ -417,19 +417,31 @@ static void
focus_col(Layout *l, Client *c, Bool raise)
{
Acme *acme = l->aux;
- Client *old = sel_col(l);
Cell *cell = c->frame->aux;
+ Client *old = sel_client();
+ c->frame->sel = c;
acme->sel = cell->col;
cell->col->sel = cell;
l->file[L_SEL_FRAME]->content = c->frame->file[F_PREFIX]->content;
+
if(raise)
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0,
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);
+ }
+ 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 *
diff --git a/cmd/wm/layout_float.c b/cmd/wm/layout_float.c
@@ -186,19 +186,30 @@ static void
focus_float(Layout *l, Client *c, Bool raise)
{
Float *fl = l->aux;
- Client *old = fl->sel->sel;
+ Client *old = sel_client();
+ c->frame->sel = c;
fl->sel = c->frame;
l->file[L_SEL_FRAME]->content = c->frame->file[F_PREFIX]->content;
+
if(raise) {
XRaiseWindow(dpy, c->frame->win);
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0,
c->rect.width / 2, c->rect.height / 2);
}
- focus_client(c);
- if(old && old != c)
- draw_frame(old->frame);
+
+ if(old && (old != c)) {
+ 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 *
diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h
@@ -222,7 +222,6 @@ void ungrab_client(Client * c, unsigned long mod, unsigned int button);
void unmap_client(Client * c);
void map_client(Client * c);
void reparent_client(Client * c, Window w, int x, int y);
-void focus_client(Client * c);
void attach_client(Client * c);
void detach_client(Client * c, Bool unmap);
Client *sel_client();
diff --git a/rc/quit b/rc/quit
@@ -1,4 +1,8 @@
#!9PREFIX/bin/rc
# quit wmii
+wmiir write /bar/ctl quit
+wmiir write /menu/ctl quit
+wmiir write /keys/ctl quit
wmiir write /wm/ctl quit
+wmiir write /ctl quit