summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonsykkel <jonrevold@gmail.com>2021-01-05 19:39:44 +0100
committerjonsykkel <jonrevold@gmail.com>2021-01-05 19:39:44 +0100
commitb0ba8ae51bc24ca8c0e9c1dec41c29074e30cd3b (patch)
tree6d76aa555b1c9e7c4b69805c373f3651f32764e2
parent4f8fdcb35e8a31057e5bb7127a3b12fb4bc665a9 (diff)
downloaddwm-b0ba8ae51bc24ca8c0e9c1dec41c29074e30cd3b.tar.gz
foij??????f0
-rw-r--r--config.h1
-rw-r--r--dwm.c53
2 files changed, 8 insertions, 46 deletions
diff --git a/config.h b/config.h
index eb8a148..8028cec 100644
--- a/config.h
+++ b/config.h
@@ -5,6 +5,7 @@ static const unsigned int borderpx = 0; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
+static const int focusonwheel = 0;
static const char *fonts[] = { "xos4 Terminus:pixelsize=16:antialias=false" };
static const char dmenufont[] = "xos4 Terminus:pixelsize=16:antialias=false";
static const char col_gray1[] = "#222222";
diff --git a/dwm.c b/dwm.c
index d381cf3..c1d98f5 100644
--- a/dwm.c
+++ b/dwm.c
@@ -165,7 +165,6 @@ static void detachstack(Client *c);
static Monitor *dirtomon(int dir);
static void drawbar(Monitor *m);
static void drawbars(void);
-static void enternotify(XEvent *e);
static void expose(XEvent *e);
static void focus(Client *c);
static void focusin(XEvent *e);
@@ -184,7 +183,6 @@ static void manage(Window w, XWindowAttributes *wa);
static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e);
static void monocle(Monitor *m);
-static void motionnotify(XEvent *e);
static void movemouse(const Arg *arg);
static Client *nexttiled(Client *c);
static void pop(Client *);
@@ -257,13 +255,11 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[ConfigureRequest] = configurerequest,
[ConfigureNotify] = configurenotify,
[DestroyNotify] = destroynotify,
- [EnterNotify] = enternotify,
[Expose] = expose,
[FocusIn] = focusin,
[KeyPress] = keypress,
[MappingNotify] = mappingnotify,
[MapRequest] = maprequest,
- [MotionNotify] = motionnotify,
[PropertyNotify] = propertynotify,
[UnmapNotify] = unmapnotify
};
@@ -432,7 +428,8 @@ buttonpress(XEvent *e)
click = ClkRootWin;
/* focus monitor if necessary */
- if ((m = wintomon(ev->window)) && m != selmon) {
+ if ((m = wintomon(ev->window)) && m != selmon
+ && (focusonwheel || (ev->button != Button4 && ev->button != Button5))) {
unfocus(selmon->sel, 1);
selmon = m;
focus(NULL);
@@ -452,10 +449,10 @@ buttonpress(XEvent *e)
else
click = ClkWinTitle;
} else if ((c = wintoclient(ev->window))) {
- focus(c);
- restack(selmon);
- XAllowEvents(dpy, ReplayPointer, CurrentTime);
- click = ClkClientWin;
+ if (focusonwheel || (ev->button != Button4 && ev->button != Button5))
+ focus(c);
+ XAllowEvents(dpy, ReplayPointer, CurrentTime);
+ click = ClkClientWin;
}
for (i = 0; i < LENGTH(buttons); i++)
if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
@@ -784,25 +781,6 @@ drawbars(void)
}
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
expose(XEvent *e)
{
Monitor *m;
@@ -979,7 +957,7 @@ grabbuttons(Client *c, int focused)
XGrabButton(dpy, buttons[i].button,
buttons[i].mask | modifiers[j],
c->win, False, BUTTONMASK,
- GrabModeAsync, GrabModeSync, None, None);
+ GrabModeSync, GrabModeSync, None, None);
}
}
@@ -1154,23 +1132,6 @@ monocle(Monitor *m)
}
void
-motionnotify(XEvent *e)
-{
- static Monitor *mon = NULL;
- Monitor *m;
- XMotionEvent *ev = &e->xmotion;
-
- if (ev->window != root)
- return;
- if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
- unfocus(selmon->sel, 1);
- selmon = m;
- focus(NULL);
- }
- mon = m;
-}
-
-void
movemouse(const Arg *arg)
{
int x, y, ocx, ocy, nx, ny;