applied Sanders focus_* patches, removed the unnecessary clean-prefix from the new function names

master
Anselm R.Garbe 2006-08-21 09:03:14 +02:00
parent 08d85d6d66
commit 2272df9d31
2 changed files with 32 additions and 28 deletions

View File

@ -10,6 +10,19 @@
/* static functions */ /* static functions */
static void
grabbutton(Client *c, unsigned int button, unsigned int modifier)
{
XGrabButton(dpy, button, modifier, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, button, modifier | LockMask, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, button, modifier | numlockmask, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, button, modifier | numlockmask | LockMask, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
}
static void static void
resizetitle(Client *c) resizetitle(Client *c)
{ {
@ -31,6 +44,15 @@ resizetitle(Client *c)
} }
static void
ungrabbutton(Client *c, unsigned int button, unsigned int modifier)
{
XUngrabButton(dpy, button, modifier, c->win);
XUngrabButton(dpy, button, modifier | LockMask, c->win);
XUngrabButton(dpy, button, modifier | numlockmask, c->win);
XUngrabButton(dpy, button, modifier | numlockmask | LockMask, c->win);
}
static int static int
xerrordummy(Display *dsply, XErrorEvent *ee) xerrordummy(Display *dsply, XErrorEvent *ee)
{ {
@ -53,11 +75,14 @@ focus(Client *c)
if (!issel) if (!issel)
return; return;
if(sel && sel->ismax) if(sel && sel->ismax && sel != c)
togglemax(NULL); togglemax(NULL);
sel = c; sel = c;
if(old && old != c) if(old && old != c) {
grabbutton(old, AnyButton, 0);
drawtitle(old); drawtitle(old);
}
ungrabbutton(c, AnyButton, 0);
drawtitle(c); drawtitle(c);
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
} }
@ -230,32 +255,9 @@ manage(Window w, XWindowAttributes *wa)
c->next = clients; c->next = clients;
clients = c; clients = c;
XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK, grabbutton(c, Button1, MODKEY);
GrabModeAsync, GrabModeSync, None, None); grabbutton(c, Button2, MODKEY);
XGrabButton(dpy, Button1, MODKEY | LockMask, c->win, False, BUTTONMASK, grabbutton(c, Button3, MODKEY);
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button1, MODKEY | numlockmask, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button1, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button2, MODKEY, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button2, MODKEY | LockMask, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button2, MODKEY | numlockmask, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button2, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button3, MODKEY, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button3, MODKEY | LockMask, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button3, MODKEY | numlockmask, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button3, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
settags(c); settags(c);
if(!c->isfloat) if(!c->isfloat)

View File

@ -119,6 +119,8 @@ buttonpress(XEvent *e)
} }
else if((c = getclient(ev->window))) { else if((c = getclient(ev->window))) {
focus(c); focus(c);
if(CLEANMASK(ev->state) == 0)
return;
switch(ev->button) { switch(ev->button) {
default: default:
break; break;