forked from mirror/dwm
applied sanders focus_ patches
This commit is contained in:
parent
2dd5212a79
commit
0a25fe9188
2 changed files with 49 additions and 26 deletions
63
client.c
63
client.c
|
@ -11,16 +11,42 @@
|
||||||
/* static functions */
|
/* static functions */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
grabbutton(Client *c, unsigned int button, unsigned int modifier)
|
grabbuttons(Client *c, Bool focus)
|
||||||
{
|
{
|
||||||
XGrabButton(dpy, button, modifier, c->win, False, BUTTONMASK,
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||||
|
|
||||||
|
if(focus) {
|
||||||
|
XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK,
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
GrabModeAsync, GrabModeSync, None, None);
|
||||||
XGrabButton(dpy, button, modifier | LockMask, c->win, False, BUTTONMASK,
|
XGrabButton(dpy, Button1, MODKEY | LockMask, c->win, False, BUTTONMASK,
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
GrabModeAsync, GrabModeSync, None, None);
|
||||||
XGrabButton(dpy, button, modifier | numlockmask, c->win, False, BUTTONMASK,
|
XGrabButton(dpy, Button1, MODKEY | numlockmask, c->win, False, BUTTONMASK,
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
GrabModeAsync, GrabModeSync, None, None);
|
||||||
XGrabButton(dpy, button, modifier | numlockmask | LockMask, c->win, False, BUTTONMASK,
|
XGrabButton(dpy, Button1, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK,
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
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);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, BUTTONMASK,
|
||||||
|
GrabModeAsync, GrabModeSync, None, None);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -40,15 +66,6 @@ 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)
|
||||||
{
|
{
|
||||||
|
@ -77,10 +94,10 @@ focus(Client *c)
|
||||||
if(sel->ismax)
|
if(sel->ismax)
|
||||||
togglemax(NULL);
|
togglemax(NULL);
|
||||||
sel = c;
|
sel = c;
|
||||||
grabbutton(old, AnyButton, 0);
|
grabbuttons(old, False);
|
||||||
drawtitle(old);
|
drawtitle(old);
|
||||||
}
|
}
|
||||||
ungrabbutton(c, AnyButton, 0);
|
grabbuttons(c, True);
|
||||||
drawtitle(c);
|
drawtitle(c);
|
||||||
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
||||||
}
|
}
|
||||||
|
@ -220,9 +237,7 @@ manage(Window w, XWindowAttributes *wa)
|
||||||
c->next = clients;
|
c->next = clients;
|
||||||
clients = c;
|
clients = c;
|
||||||
|
|
||||||
grabbutton(c, Button1, MODKEY);
|
grabbuttons(c, False);
|
||||||
grabbutton(c, Button2, MODKEY);
|
|
||||||
grabbutton(c, Button3, MODKEY);
|
|
||||||
|
|
||||||
if((tc = getclient(trans))) /* inherit tags */
|
if((tc = getclient(trans))) /* inherit tags */
|
||||||
for(i = 0; i < ntags; i++)
|
for(i = 0; i < ntags; i++)
|
||||||
|
@ -384,9 +399,13 @@ togglemax(Arg *arg)
|
||||||
void
|
void
|
||||||
unmanage(Client *c)
|
unmanage(Client *c)
|
||||||
{
|
{
|
||||||
|
Client *tc;
|
||||||
|
Window trans;
|
||||||
XGrabServer(dpy);
|
XGrabServer(dpy);
|
||||||
XSetErrorHandler(xerrordummy);
|
XSetErrorHandler(xerrordummy);
|
||||||
|
|
||||||
|
XGetTransientForHint(dpy, c->win, &trans);
|
||||||
|
|
||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||||
XDestroyWindow(dpy, c->twin);
|
XDestroyWindow(dpy, c->twin);
|
||||||
|
|
||||||
|
@ -396,8 +415,12 @@ unmanage(Client *c)
|
||||||
c->next->prev = c->prev;
|
c->next->prev = c->prev;
|
||||||
if(c == clients)
|
if(c == clients)
|
||||||
clients = c->next;
|
clients = c->next;
|
||||||
if(sel == c)
|
if(sel == c) {
|
||||||
|
if(trans && (tc = getclient(trans)) && isvisible(tc))
|
||||||
|
sel = tc;
|
||||||
|
else
|
||||||
sel = getnext(clients);
|
sel = getnext(clients);
|
||||||
|
}
|
||||||
free(c->tags);
|
free(c->tags);
|
||||||
free(c);
|
free(c);
|
||||||
|
|
||||||
|
|
2
event.c
2
event.c
|
@ -123,7 +123,7 @@ buttonpress(XEvent *e)
|
||||||
}
|
}
|
||||||
else if((c = getclient(ev->window))) {
|
else if((c = getclient(ev->window))) {
|
||||||
focus(c);
|
focus(c);
|
||||||
if(CLEANMASK(ev->state) == 0)
|
if(CLEANMASK(ev->state) != MODKEY)
|
||||||
return;
|
return;
|
||||||
switch(ev->button) {
|
switch(ev->button) {
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue