Bug fixes and improvements - dwm patches

This commit is contained in:
Ashish Kumar Yadav 2020-12-30 02:25:22 +05:30
parent 327029412d
commit 4dcb2a7310
2 changed files with 81 additions and 79 deletions

View file

@ -43,7 +43,7 @@ diff -ruN dwm-6.2-ori/config.def.h dwm-6.2/config.def.h
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
--- dwm-6.2-ori/dwm.c 2019-02-02 18:25:28.000000000 +0530 --- dwm-6.2-ori/dwm.c 2019-02-02 18:25:28.000000000 +0530
+++ dwm-6.2/dwm.c 2020-12-28 21:41:08.356370628 +0530 +++ dwm-6.2/dwm.c 2020-12-30 02:16:07.078564261 +0530
@@ -40,6 +40,7 @@ @@ -40,6 +40,7 @@
#include <X11/extensions/Xinerama.h> #include <X11/extensions/Xinerama.h>
#endif /* XINERAMA */ #endif /* XINERAMA */
@ -180,41 +180,43 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
int boxs = drw->fonts->h / 9; int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2; int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0; unsigned int i, occ = 0, urg = 0;
@@ -703,9 +718,30 @@ @@ -703,9 +718,32 @@
/* draw status first so it can be overdrawn by tags later */ /* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */ if (m == selmon) { /* status is only drawn on selected monitor */
- drw_setscheme(drw, scheme[SchemeNorm]); - drw_setscheme(drw, scheme[SchemeNorm]);
- sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ - sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
- drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0); - drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
+ char *ts = stextc; + char *stc = stextc;
+ char *tp = stextc; + char *stp = stextc;
+ char ctmp; + char tmp;
+ +
+ drw_setscheme(drw, scheme[SchemeNorm]); + drw_setscheme(drw, scheme[SchemeNorm]);
+ x = m->ww - wstext; + x = m->ww - wstext;
+ drw_rect(drw, x, 0, lrpad / 2, bh, 1, 1); x += lrpad / 2; /* to keep left padding clean */ + drw_rect(drw, x, 0, lrpad / 2, bh, 1, 1); x += lrpad / 2; /* to keep left padding clean */
+ for (;;) { + for (;;) {
+ if ((unsigned char)*ts > LENGTH(colors) + DELIMITERENDCHAR) { + if ((unsigned char)*stc >= ' ') {
+ ts++; + stc++;
+ continue; + continue;
+ } + }
+ ctmp = *ts; + tmp = *stc;
+ *ts = '\0'; + if (stp != stc) {
+ if (*tp != '\0') + *stc = '\0';
+ x = drw_text(drw, x, 0, TTEXTW(tp), bh, 0, tp, 0); + x = drw_text(drw, x, 0, TTEXTW(stp), bh, 0, stp, 0);
+ if (ctmp == '\0') + }
+ if (tmp == '\0')
+ break; + break;
+ drw_setscheme(drw, scheme[ctmp - DELIMITERENDCHAR - 1]); + if (tmp - DELIMITERENDCHAR - 1 < LENGTH(colors))
+ *ts = ctmp; + drw_setscheme(drw, scheme[tmp - DELIMITERENDCHAR - 1]);
+ tp = ++ts; + *stc = tmp;
+ stp = ++stc;
+ } + }
+ drw_setscheme(drw, scheme[SchemeNorm]); + drw_setscheme(drw, scheme[SchemeNorm]);
+ drw_rect(drw, x, 0, m->ww - x, bh, 1, 1); /* to keep right padding clean */ + drw_rect(drw, x, 0, m->ww - x, bh, 1, 1); /* to keep right padding clean */
} }
for (c = m->clients; c; c = c->next) { for (c = m->clients; c; c = c->next) {
@@ -724,11 +760,17 @@ @@ -724,11 +762,17 @@
urg & 1 << i); urg & 1 << i);
x += w; x += w;
} }
@ -234,7 +236,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
if (m->sel) { if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
@@ -1119,17 +1161,24 @@ @@ -1119,17 +1163,24 @@
motionnotify(XEvent *e) motionnotify(XEvent *e)
{ {
static Monitor *mon = NULL; static Monitor *mon = NULL;
@ -267,7 +269,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
} }
void void
@@ -1564,6 +1613,7 @@ @@ -1564,6 +1615,7 @@
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
/* init cursors */ /* init cursors */
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
@ -275,7 +277,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
cursor[CurResize] = drw_cur_create(drw, XC_sizing); cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur); cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */ /* init appearance */
@@ -1637,6 +1687,28 @@ @@ -1637,6 +1689,28 @@
} }
void void
@ -304,7 +306,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
spawn(const Arg *arg) spawn(const Arg *arg)
{ {
if (arg->v == dmenucmd) if (arg->v == dmenucmd)
@@ -1805,7 +1877,7 @@ @@ -1805,7 +1879,7 @@
XSetWindowAttributes wa = { XSetWindowAttributes wa = {
.override_redirect = True, .override_redirect = True,
.background_pixmap = ParentRelative, .background_pixmap = ParentRelative,
@ -313,39 +315,38 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
}; };
XClassHint ch = {"dwm", "dwm"}; XClassHint ch = {"dwm", "dwm"};
for (m = mons; m; m = m->next) { for (m = mons; m; m = m->next) {
@@ -1847,6 +1919,42 @@ @@ -1847,6 +1921,41 @@
(unsigned char *) &(c->win), 1); (unsigned char *) &(c->win), 1);
} }
+void +void
+updatedwmblockssig(int x) +updatedwmblockssig(int x)
+{ +{
+ char *ts = stexts; + char *sts = stexts;
+ char *tp = stexts; + char *stp = stexts;
+ char ctmp; + char tmp;
+ +
+ while (*ts != '\0') { + do {
+ if ((unsigned char)*ts > DELIMITERENDCHAR) { + if ((unsigned char)*sts >= ' ') {
+ ts++; + sts++;
+ continue; + continue;
+ } + }
+ ctmp = *ts; + tmp = *sts;
+ *ts = '\0'; + *sts = '\0';
+ x += TTEXTW(tp); + x += TTEXTW(stp);
+ *ts = ctmp; + *sts = tmp;
+ if (x >= 0) { + if (x > 0) {
+ if (ctmp == DELIMITERENDCHAR) + if (tmp == DELIMITERENDCHAR)
+ goto cursorondelim; + break;
+ if (!selmon->statushandcursor) { + if (!selmon->statushandcursor) {
+ selmon->statushandcursor = 1; + selmon->statushandcursor = 1;
+ XDefineCursor(dpy, selmon->barwin, cursor[CurHand]->cursor); + XDefineCursor(dpy, selmon->barwin, cursor[CurHand]->cursor);
+ } + }
+ dwmblockssig = ctmp; + dwmblockssig = tmp;
+ return; + return;
+ } + }
+ tp = ++ts; + stp = ++sts;
+ } + } while (*sts != '\0');
+cursorondelim:
+ if (selmon->statushandcursor) { + if (selmon->statushandcursor) {
+ selmon->statushandcursor = 0; + selmon->statushandcursor = 0;
+ XDefineCursor(dpy, selmon->barwin, cursor[CurNormal]->cursor); + XDefineCursor(dpy, selmon->barwin, cursor[CurNormal]->cursor);
@ -356,7 +357,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
int int
updategeom(void) updategeom(void)
{ {
@@ -1987,9 +2095,27 @@ @@ -1987,9 +2096,27 @@
void void
updatestatus(void) updatestatus(void)
{ {

View file

@ -43,7 +43,7 @@ diff -ruN dwm-6.2-ori/config.def.h dwm-6.2/config.def.h
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
--- dwm-6.2-ori/dwm.c 2020-08-17 23:51:19.057243495 +0530 --- dwm-6.2-ori/dwm.c 2020-08-17 23:51:19.057243495 +0530
+++ dwm-6.2/dwm.c 2020-12-28 21:48:30.327935787 +0530 +++ dwm-6.2/dwm.c 2020-12-30 02:16:17.865322278 +0530
@@ -40,6 +40,7 @@ @@ -40,6 +40,7 @@
#include <X11/extensions/Xinerama.h> #include <X11/extensions/Xinerama.h>
#endif /* XINERAMA */ #endif /* XINERAMA */
@ -187,7 +187,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
for (i = 0; i < LENGTH(buttons); i++) for (i = 0; i < LENGTH(buttons); i++)
if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
@@ -789,23 +805,45 @@ @@ -789,23 +805,47 @@
void void
drawbar(Monitor *m) drawbar(Monitor *m)
{ {
@ -209,28 +209,30 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
- drw_setscheme(drw, scheme[SchemeNorm]); - drw_setscheme(drw, scheme[SchemeNorm]);
- sw = TEXTW(stext) - lrpad / 2 + 2; /* 2px right padding */ - sw = TEXTW(stext) - lrpad / 2 + 2; /* 2px right padding */
- drw_text(drw, m->ww - sw - stw, 0, sw, bh, lrpad / 2 - 2, stext, 0); - drw_text(drw, m->ww - sw - stw, 0, sw, bh, lrpad / 2 - 2, stext, 0);
+ char *ts = stextc; + char *stc = stextc;
+ char *tp = stextc; + char *stp = stextc;
+ char ctmp; + char tmp;
+ +
+ wsbar = wbar; + wsbar = wbar;
+ drw_setscheme(drw, scheme[SchemeNorm]); + drw_setscheme(drw, scheme[SchemeNorm]);
+ x = wbar - wstext; + x = wbar - wstext;
+ drw_rect(drw, x, 0, lrpad / 2, bh, 1, 1); x += lrpad / 2; /* to keep left padding clean */ + drw_rect(drw, x, 0, lrpad / 2, bh, 1, 1); x += lrpad / 2; /* to keep left padding clean */
+ for (;;) { + for (;;) {
+ if ((unsigned char)*ts > LENGTH(colors) + DELIMITERENDCHAR) { + if ((unsigned char)*stc >= ' ') {
+ ts++; + stc++;
+ continue; + continue;
+ } + }
+ ctmp = *ts; + tmp = *stc;
+ *ts = '\0'; + if (stp != stc) {
+ if (*tp != '\0') + *stc = '\0';
+ x = drw_text(drw, x, 0, TTEXTW(tp), bh, 0, tp, 0); + x = drw_text(drw, x, 0, TTEXTW(stp), bh, 0, stp, 0);
+ if (ctmp == '\0') + }
+ if (tmp == '\0')
+ break; + break;
+ drw_setscheme(drw, scheme[ctmp - DELIMITERENDCHAR - 1]); + if (tmp - DELIMITERENDCHAR - 1 < LENGTH(colors))
+ *ts = ctmp; + drw_setscheme(drw, scheme[tmp - DELIMITERENDCHAR - 1]);
+ tp = ++ts; + *stc = tmp;
+ stp = ++stc;
+ } + }
+ drw_setscheme(drw, scheme[SchemeNorm]); + drw_setscheme(drw, scheme[SchemeNorm]);
+ drw_rect(drw, x, 0, wbar - x, bh, 1, 1); /* to keep right padding clean */ + drw_rect(drw, x, 0, wbar - x, bh, 1, 1); /* to keep right padding clean */
@ -240,7 +242,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
for (c = m->clients; c; c = c->next) { for (c = m->clients; c; c = c->next) {
occ |= c->tags; occ |= c->tags;
if (c->isurgent) if (c->isurgent)
@@ -822,11 +860,17 @@ @@ -822,11 +862,17 @@
urg & 1 << i); urg & 1 << i);
x += w; x += w;
} }
@ -260,7 +262,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
if (m->sel) { if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
@@ -837,7 +881,9 @@ @@ -837,7 +883,9 @@
drw_rect(drw, x, 0, w, bh, 1, 1); drw_rect(drw, x, 0, w, bh, 1, 1);
} }
} }
@ -271,7 +273,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
} }
void void
@@ -1243,17 +1289,24 @@ @@ -1243,17 +1291,24 @@
motionnotify(XEvent *e) motionnotify(XEvent *e)
{ {
static Monitor *mon = NULL; static Monitor *mon = NULL;
@ -304,7 +306,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
} }
void void
@@ -1750,6 +1803,7 @@ @@ -1750,6 +1805,7 @@
xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False); xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False);
/* init cursors */ /* init cursors */
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
@ -312,7 +314,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
cursor[CurResize] = drw_cur_create(drw, XC_sizing); cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur); cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */ /* init appearance */
@@ -1825,6 +1879,28 @@ @@ -1825,6 +1881,28 @@
} }
void void
@ -341,7 +343,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
spawn(const Arg *arg) spawn(const Arg *arg)
{ {
if (arg->v == dmenucmd) if (arg->v == dmenucmd)
@@ -2011,7 +2087,7 @@ @@ -2011,7 +2089,7 @@
XSetWindowAttributes wa = { XSetWindowAttributes wa = {
.override_redirect = True, .override_redirect = True,
.background_pixmap = ParentRelative, .background_pixmap = ParentRelative,
@ -350,39 +352,38 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
}; };
XClassHint ch = {"dwm", "dwm"}; XClassHint ch = {"dwm", "dwm"};
for (m = mons; m; m = m->next) { for (m = mons; m; m = m->next) {
@@ -2058,6 +2134,42 @@ @@ -2058,6 +2136,41 @@
(unsigned char *) &(c->win), 1); (unsigned char *) &(c->win), 1);
} }
+void +void
+updatedwmblockssig(int x) +updatedwmblockssig(int x)
+{ +{
+ char *ts = stexts; + char *sts = stexts;
+ char *tp = stexts; + char *stp = stexts;
+ char ctmp; + char tmp;
+ +
+ while (*ts != '\0') { + do {
+ if ((unsigned char)*ts > DELIMITERENDCHAR) { + if ((unsigned char)*sts >= ' ') {
+ ts++; + sts++;
+ continue; + continue;
+ } + }
+ ctmp = *ts; + tmp = *sts;
+ *ts = '\0'; + *sts = '\0';
+ x += TTEXTW(tp); + x += TTEXTW(stp);
+ *ts = ctmp; + *sts = tmp;
+ if (x >= 0) { + if (x > 0) {
+ if (ctmp == DELIMITERENDCHAR) + if (tmp == DELIMITERENDCHAR)
+ goto cursorondelim; + break;
+ if (!selmon->statushandcursor) { + if (!selmon->statushandcursor) {
+ selmon->statushandcursor = 1; + selmon->statushandcursor = 1;
+ XDefineCursor(dpy, selmon->barwin, cursor[CurHand]->cursor); + XDefineCursor(dpy, selmon->barwin, cursor[CurHand]->cursor);
+ } + }
+ dwmblockssig = ctmp; + dwmblockssig = tmp;
+ return; + return;
+ } + }
+ tp = ++ts; + stp = ++sts;
+ } + } while (*sts != '\0');
+cursorondelim:
+ if (selmon->statushandcursor) { + if (selmon->statushandcursor) {
+ selmon->statushandcursor = 0; + selmon->statushandcursor = 0;
+ XDefineCursor(dpy, selmon->barwin, cursor[CurNormal]->cursor); + XDefineCursor(dpy, selmon->barwin, cursor[CurNormal]->cursor);
@ -393,7 +394,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
int int
updategeom(void) updategeom(void)
{ {
@@ -2198,10 +2310,27 @@ @@ -2198,10 +2311,27 @@
void void
updatestatus(void) updatestatus(void)
{ {