From 623147ed85d50e59fe08be61868dded61055d0bb Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Thu, 27 Apr 2006 18:32:37 +0200 Subject: [PATCH] updated client_grab --- cmd/wm/client.c | 17 +++++++++++++++++ cmd/wm/view.c | 8 +------- cmd/wm/wm.h | 1 + 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/cmd/wm/client.c b/cmd/wm/client.c index 88997270..ffb1a2ca 100644 --- a/cmd/wm/client.c +++ b/cmd/wm/client.c @@ -99,6 +99,18 @@ set_client_state(Client * c, int state) PropModeReplace, (unsigned char *) data, 2); } +void +update_client_grab(Client *c, Bool is_sel) +{ + if(is_sel) { + ungrab_mouse(c->framewin, AnyModifier, AnyButton); + grab_mouse(c->framewin, def.mod, Button1); + grab_mouse(c->framewin, def.mod, Button3); + } + else + grab_mouse(c->framewin, AnyModifier, Button1); +} + void focus_client(Client *c, Bool restack) { @@ -114,6 +126,11 @@ focus_client(Client *c, Bool restack) draw_client(old); if(restack) restack_view(v); + else { + if(old) + update_client_grab(old, False); + update_client_grab(c, True); + } XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); draw_client(c); diff --git a/cmd/wm/view.c b/cmd/wm/view.c index ecc18146..58fca52d 100644 --- a/cmd/wm/view.c +++ b/cmd/wm/view.c @@ -256,13 +256,7 @@ restack_view(View *v) wins[n++] = a->frame.data[a->sel]->client->framewin; for(j = a->frame.size - 1; j >= 0; j--) { Client *c = a->frame.data[j]->client; - if((v->sel == i) && (a->sel == j)) { - ungrab_mouse(c->framewin, AnyModifier, AnyButton); - grab_mouse(c->framewin, def.mod, Button1); - grab_mouse(c->framewin, def.mod, Button3); - } - else - grab_mouse(c->framewin, AnyModifier, Button1); + update_client_grab(c, (v->sel == i) && (a->sel == j)); if(j == a->sel) continue; wins[n++] = c->framewin; diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h index 8388aea6..af218cc9 100644 --- a/cmd/wm/wm.h +++ b/cmd/wm/wm.h @@ -232,6 +232,7 @@ Client *sel_client(); int idx_of_client_id(unsigned short id); Client *client_of_win(Window w); void draw_clients(); +void update_client_grab(Client *c, Bool is_sel); /* column.c */ void arrange_column(Area *a, Bool dirty);