Compare commits

...

2 Commits

Author SHA1 Message Date
Ray Elliott e9ec60d532 Merge branch 'master' of ssh://git.rayelliott.dev:3222/dots/dwm 2020-03-25 16:41:06 +00:00
Ray Elliott 9739cedd39 Revert "revert focusonclick"
This reverts commit 70f88f8c81.
2020-03-25 16:40:09 +00:00
1 changed files with 21 additions and 0 deletions

21
dwm.c
View File

@ -170,6 +170,7 @@ static void detachstack(Client *c);
static Monitor *dirtomon(int dir); static Monitor *dirtomon(int dir);
static void drawbar(Monitor *m); static void drawbar(Monitor *m);
static void drawbars(void); static void drawbars(void);
static void enternotify(XEvent *e);
static void expose(XEvent *e); static void expose(XEvent *e);
static void focus(Client *c); static void focus(Client *c);
static void focusin(XEvent *e); static void focusin(XEvent *e);
@ -257,6 +258,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[ConfigureRequest] = configurerequest, [ConfigureRequest] = configurerequest,
[ConfigureNotify] = configurenotify, [ConfigureNotify] = configurenotify,
[DestroyNotify] = destroynotify, [DestroyNotify] = destroynotify,
[EnterNotify] = enternotify,
[Expose] = expose, [Expose] = expose,
[FocusIn] = focusin, [FocusIn] = focusin,
[KeyPress] = keypress, [KeyPress] = keypress,
@ -763,6 +765,25 @@ drawbars(void)
drawbar(m); drawbar(m);
} }
void
enternotify(XEvent *e)
{
Client *c;
Monitor *m;
XCrossingEvent *ev = &e->xcrossing;
if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
return;
c = wintoclient(ev->window);
m = c ? c->mon : wintomon(ev->window);
if (m != selmon) {
unfocus(selmon->sel, 1);
selmon = m;
} else if (!c || c == selmon->sel)
return;
focus(c);
}
void void
expose(XEvent *e) expose(XEvent *e)
{ {