Xinqi Bao's Git
projects
/
dwm.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
implemented reapply for re-applying the tagging rules during runtime, Mod-r
[dwm.git]
/
dwm.c
diff --git
a/dwm.c
b/dwm.c
index
1529372
..
0af37d6
100644
(file)
--- a/
dwm.c
+++ b/
dwm.c
@@
-137,6
+137,7
@@
void eprint(const char *errstr, ...);
void expose(XEvent *e);
void floating(void); /* default floating layout */
void focus(Client *c);
void expose(XEvent *e);
void floating(void); /* default floating layout */
void focus(Client *c);
+void focusin(XEvent *e);
void focusnext(const char *arg);
void focusprev(const char *arg);
Client *getclient(Window w);
void focusnext(const char *arg);
void focusprev(const char *arg);
Client *getclient(Window w);
@@
-160,6
+161,7
@@
void movemouse(Client *c);
Client *nexttiled(Client *c);
void propertynotify(XEvent *e);
void quit(const char *arg);
Client *nexttiled(Client *c);
void propertynotify(XEvent *e);
void quit(const char *arg);
+void reapply(const char *arg);
void resize(Client *c, int x, int y, int w, int h, Bool sizehints);
void resizemouse(Client *c);
void restack(void);
void resize(Client *c, int x, int y, int w, int h, Bool sizehints);
void resizemouse(Client *c);
void restack(void);
@@
-206,9
+208,10
@@
void (*handler[LASTEvent]) (XEvent *) = {
[ConfigureNotify] = configurenotify,
[DestroyNotify] = destroynotify,
[EnterNotify] = enternotify,
[ConfigureNotify] = configurenotify,
[DestroyNotify] = destroynotify,
[EnterNotify] = enternotify,
- [LeaveNotify] = leavenotify,
[Expose] = expose,
[Expose] = expose,
+ [FocusIn] = focusin,
[KeyPress] = keypress,
[KeyPress] = keypress,
+ [LeaveNotify] = leavenotify,
[MappingNotify] = mappingnotify,
[MapRequest] = maprequest,
[PropertyNotify] = propertynotify,
[MappingNotify] = mappingnotify,
[MapRequest] = maprequest,
[PropertyNotify] = propertynotify,
@@
-709,6
+712,14
@@
focus(Client *c) {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
}
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
}
+void
+focusin(XEvent *e) { /* there are some broken focus acquiring clients */
+ XFocusChangeEvent *ev = &e->xfocus;
+
+ if(sel && ev->window != sel->win)
+ XSetInputFocus(dpy, sel->win, RevertToPointerRoot, CurrentTime);
+}
+
void
focusnext(const char *arg) {
Client *c;
void
focusnext(const char *arg) {
Client *c;
@@
-1026,8
+1037,7
@@
manage(Window w, XWindowAttributes *wa) {
XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
configure(c); /* propagates border_width, if size doesn't change */
updatesizehints(c);
XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
configure(c); /* propagates border_width, if size doesn't change */
updatesizehints(c);
- XSelectInput(dpy, w,
- StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
+ XSelectInput(dpy, w, EnterWindowMask | FocusChangeMask | PropertyChangeMask | StructureNotifyMask);
grabbuttons(c, False);
updatetitle(c);
if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
grabbuttons(c, False);
updatetitle(c);
if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
@@
-1150,6
+1160,17
@@
quit(const char *arg) {
readin = running = False;
}
readin = running = False;
}
+void
+reapply(const char *arg) {
+ static Bool zerotags[LENGTH(tags)] = { 0 };
+ Client *c;
+
+ for(c = clients; c; c = c->next) {
+ memcpy(c->tags, zerotags, sizeof zerotags);
+ applyrules(c);
+ }
+ arrange();
+}
void
resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
void
resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
@@
-1514,6
+1535,7
@@
setup(void) {
/* multihead support */
selscreen = XQueryPointer(dpy, root, &w, &w, &d, &d, &d, &d, &mask);
/* multihead support */
selscreen = XQueryPointer(dpy, root, &w, &w, &d, &d, &d, &d, &mask);
+
}
void
}
void