dwm-focusonclick-20170104-bb3bd6f.diff - sites - public wiki contents of suckle… | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-focusonclick-20170104-bb3bd6f.diff (4047B) | |
--- | |
1 commit da0e506c6bf3a01d240904f53ae5cbd7c424ebf5 | |
2 Author: Markus Teich <[email protected]> | |
3 Date: Thu Dec 22 03:16:35 2016 +0100 | |
4 | |
5 focusonclick | |
6 | |
7 diff --git a/config.def.h b/config.def.h | |
8 index ab00f4c..897e852 100644 | |
9 --- a/config.def.h | |
10 +++ b/config.def.h | |
11 @@ -5,6 +5,7 @@ static const unsigned int borderpx = 1; /* borde… | |
12 static const unsigned int snap = 32; /* snap pixel */ | |
13 static const int showbar = 1; /* 0 means no bar */ | |
14 static const int topbar = 1; /* 0 means bottom bar */ | |
15 +static const int focusonwheel = 0; | |
16 static const char *fonts[] = { "monospace:size=10" }; | |
17 static const char dmenufont[] = "monospace:size=10"; | |
18 static const char col_gray1[] = "#222222"; | |
19 diff --git a/dwm.c b/dwm.c | |
20 index 7cd8d18..4697618 100644 | |
21 --- a/dwm.c | |
22 +++ b/dwm.c | |
23 @@ -164,7 +164,6 @@ static void detachstack(Client *c); | |
24 static Monitor *dirtomon(int dir); | |
25 static void drawbar(Monitor *m); | |
26 static void drawbars(void); | |
27 -static void enternotify(XEvent *e); | |
28 static void expose(XEvent *e); | |
29 static void focus(Client *c); | |
30 static void focusin(XEvent *e); | |
31 @@ -182,7 +181,6 @@ static void manage(Window w, XWindowAttributes *wa); | |
32 static void mappingnotify(XEvent *e); | |
33 static void maprequest(XEvent *e); | |
34 static void monocle(Monitor *m); | |
35 -static void motionnotify(XEvent *e); | |
36 static void movemouse(const Arg *arg); | |
37 static Client *nexttiled(Client *c); | |
38 static void pop(Client *); | |
39 @@ -252,13 +250,11 @@ static void (*handler[LASTEvent]) (XEvent *) = { | |
40 [ConfigureRequest] = configurerequest, | |
41 [ConfigureNotify] = configurenotify, | |
42 [DestroyNotify] = destroynotify, | |
43 - [EnterNotify] = enternotify, | |
44 [Expose] = expose, | |
45 [FocusIn] = focusin, | |
46 [KeyPress] = keypress, | |
47 [MappingNotify] = mappingnotify, | |
48 [MapRequest] = maprequest, | |
49 - [MotionNotify] = motionnotify, | |
50 [PropertyNotify] = propertynotify, | |
51 [UnmapNotify] = unmapnotify | |
52 }; | |
53 @@ -427,7 +423,8 @@ buttonpress(XEvent *e) | |
54 | |
55 click = ClkRootWin; | |
56 /* focus monitor if necessary */ | |
57 - if ((m = wintomon(ev->window)) && m != selmon) { | |
58 + if ((m = wintomon(ev->window)) && m != selmon | |
59 + && (focusonwheel || (ev->button != Button4 && ev->button !=… | |
60 unfocus(selmon->sel, 1); | |
61 selmon = m; | |
62 focus(NULL); | |
63 @@ -447,7 +444,9 @@ buttonpress(XEvent *e) | |
64 else | |
65 click = ClkWinTitle; | |
66 } else if ((c = wintoclient(ev->window))) { | |
67 - focus(c); | |
68 + if (focusonwheel || (ev->button != Button4 && ev->butto… | |
69 + focus(c); | |
70 + XAllowEvents(dpy, ReplayPointer, CurrentTime); | |
71 click = ClkClientWin; | |
72 } | |
73 for (i = 0; i < LENGTH(buttons); i++) | |
74 @@ -755,25 +754,6 @@ drawbars(void) | |
75 } | |
76 | |
77 void | |
78 -enternotify(XEvent *e) | |
79 -{ | |
80 - Client *c; | |
81 - Monitor *m; | |
82 - XCrossingEvent *ev = &e->xcrossing; | |
83 - | |
84 - if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) … | |
85 - return; | |
86 - c = wintoclient(ev->window); | |
87 - m = c ? c->mon : wintomon(ev->window); | |
88 - if (m != selmon) { | |
89 - unfocus(selmon->sel, 1); | |
90 - selmon = m; | |
91 - } else if (!c || c == selmon->sel) | |
92 - return; | |
93 - focus(c); | |
94 -} | |
95 - | |
96 -void | |
97 expose(XEvent *e) | |
98 { | |
99 Monitor *m; | |
100 @@ -945,10 +925,10 @@ grabbuttons(Client *c, int focused) | |
101 XGrabButton(dpy, button… | |
102 buttons[i].… | |
103 c->win, Fal… | |
104 - GrabModeAsy… | |
105 + GrabModeSyn… | |
106 } else | |
107 XGrabButton(dpy, AnyButton, AnyModifier, c->win… | |
108 - BUTTONMASK, GrabModeAsync, GrabMode… | |
109 + BUTTONMASK, GrabModeSync, GrabModeS… | |
110 } | |
111 } | |
112 | |
113 @@ -1123,23 +1103,6 @@ monocle(Monitor *m) | |
114 } | |
115 | |
116 void | |
117 -motionnotify(XEvent *e) | |
118 -{ | |
119 - static Monitor *mon = NULL; | |
120 - Monitor *m; | |
121 - XMotionEvent *ev = &e->xmotion; | |
122 - | |
123 - if (ev->window != root) | |
124 - return; | |
125 - if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon… | |
126 - unfocus(selmon->sel, 1); | |
127 - selmon = m; | |
128 - focus(NULL); | |
129 - } | |
130 - mon = m; | |
131 -} | |
132 - | |
133 -void | |
134 movemouse(const Arg *arg) | |
135 { | |
136 int x, y, ocx, ocy, nx, ny; |