Adding focusonclick patch

This commit is contained in:
bakkeby
2019-09-16 00:32:28 +02:00
parent dc5d77e95f
commit aee6e0edf6
4 changed files with 93 additions and 61 deletions

23
dwm.c
View File

@@ -265,7 +265,9 @@ static void detachstack(Client *c);
static Monitor *dirtomon(int dir);
static void drawbar(Monitor *m);
static void drawbars(void);
#if !FOCUSONCLICK_PATCH
static void enternotify(XEvent *e);
#endif // FOCUSONCLICK_PATCH
static void expose(XEvent *e);
static void focus(Client *c);
static void focusin(XEvent *e);
@@ -282,7 +284,9 @@ static void killclient(const Arg *arg);
static void manage(Window w, XWindowAttributes *wa);
static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e);
#if !FOCUSONCLICK_PATCH
static void motionnotify(XEvent *e);
#endif // FOCUSONCLICK_PATCH
static void movemouse(const Arg *arg);
static Client *nexttiled(Client *c);
#if !ZOOMSWAP_PATCH
@@ -360,7 +364,9 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[ConfigureRequest] = configurerequest,
[ConfigureNotify] = configurenotify,
[DestroyNotify] = destroynotify,
#if !FOCUSONCLICK_PATCH
[EnterNotify] = enternotify,
#endif // FOCUSONCLICK_PATCH
[Expose] = expose,
[FocusIn] = focusin,
[KeyPress] = keypress,
@@ -369,7 +375,9 @@ static void (*handler[LASTEvent]) (XEvent *) = {
#endif // COMBO_PATCH
[MappingNotify] = mappingnotify,
[MapRequest] = maprequest,
#if !FOCUSONCLICK_PATCH
[MotionNotify] = motionnotify,
#endif // FOCUSONCLICK_PATCH
[PropertyNotify] = propertynotify,
#if SYSTRAY_PATCH
[ResizeRequest] = resizerequest,
@@ -574,7 +582,11 @@ buttonpress(XEvent *e)
click = ClkRootWin;
/* focus monitor if necessary */
if ((m = wintomon(ev->window)) && m != selmon) {
if ((m = wintomon(ev->window)) && m != selmon
#if FOCUSONCLICK_PATCH
&& (focusonwheel || (ev->button != Button4 && ev->button != Button5))
#endif // FOCUSONCLICK_PATCH
) {
unfocus(selmon->sel, 1);
selmon = m;
focus(NULL);
@@ -622,8 +634,13 @@ buttonpress(XEvent *e)
click = ClkWinTitle;
#endif // AWESOMEBAR_PATCH
} else if ((c = wintoclient(ev->window))) {
#if FOCUSONCLICK_PATCH
if (focusonwheel || (ev->button != Button4 && ev->button != Button5))
focus(c);
#else
focus(c);
restack(selmon);
#endif // FOCUSONCLICK_PATCH
XAllowEvents(dpy, ReplayPointer, CurrentTime);
click = ClkClientWin;
}
@@ -1235,6 +1252,7 @@ drawbars(void)
#endif // SYSTRAY_PATCH
}
#if !FOCUSONCLICK_PATCH
void
enternotify(XEvent *e)
{
@@ -1253,6 +1271,7 @@ enternotify(XEvent *e)
return;
focus(c);
}
#endif // FOCUSONCLICK_PATCH
void
expose(XEvent *e)
@@ -1692,6 +1711,7 @@ maprequest(XEvent *e)
manage(ev->window, &wa);
}
#if !FOCUSONCLICK_PATCH
void
motionnotify(XEvent *e)
{
@@ -1708,6 +1728,7 @@ motionnotify(XEvent *e)
}
mon = m;
}
#endif // FOCUSONCLICK_PATCH
void
movemouse(const Arg *arg)