From 461498821f7d2437553e5bebb63be5ad6b38ab03 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 22 May 2024 23:33:28 -0400 Subject: [PATCH] Replace "no border patch" with remove border patch This reverts commit e6862bb55b66d33bdf32bb252d03c946b9444f68. --- dwm.c | 33 +++++------- ...selflickerfix-2022042627-d93ff48803f0.diff | 53 ------------------- .../dwm-removeborder-20220626-d3f93c7.diff | 31 +++++++++++ 3 files changed, 45 insertions(+), 72 deletions(-) delete mode 100644 patches/appearance/dwm-noborderselflickerfix-2022042627-d93ff48803f0.diff create mode 100644 patches/appearance/dwm-removeborder-20220626-d3f93c7.diff diff --git a/dwm.c b/dwm.c index f1fedf5..e7557ce 100644 --- a/dwm.c +++ b/dwm.c @@ -245,7 +245,6 @@ static void showwin(Client *c); static void showhide(Client *c); static void sighup(int unused); static void sigterm(int unused); -static int solitary(Client *c); static void spawn(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); @@ -1093,11 +1092,7 @@ focus(Client *c) detachstack(c); attachstack(c); grabbuttons(c, 1); - /* Avoid flickering when another client appears and the border - * is restored */ - if (!solitary(c)) { - XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); - } + XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); setfocus(c); } else { XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); @@ -1751,17 +1746,26 @@ void resizeclient(Client *c, int x, int y, int w, int h) { XWindowChanges wc; + unsigned int n; + Client *nbc; c->oldx = c->x; c->x = wc.x = x; c->oldy = c->y; c->y = wc.y = y; c->oldw = c->w; c->w = wc.width = w; c->oldh = c->h; c->h = wc.height = h; wc.border_width = c->bw; - if (solitary(c)) { - c->w = wc.width += c->bw * 2; - c->h = wc.height += c->bw * 2; - wc.border_width = 0; + + for (n = 0, nbc = nexttiled(c->mon->clients); nbc; nbc = nexttiled(nbc->next), n++); + + if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) { + } else { + if (c->mon->lt[c->mon->sellt]->arrange == monocle || n == 1) { + wc.border_width = 0; + c->w = wc.width += c->bw * 2; + c->h = wc.height += c->bw * 2; + } } + XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); configure(c); XSync(dpy, False); @@ -2264,15 +2268,6 @@ sigterm(int unused) quit(&a); } -int -solitary(Client *c) -{ - return ((nexttiled(c->mon->clients) == c && !nexttiled(c->next)) - || &monocle == c->mon->lt[c->mon->sellt]->arrange) - && !c->isfullscreen && !c->isfloating - && NULL != c->mon->lt[c->mon->sellt]->arrange; -} - void spawn(const Arg *arg) { diff --git a/patches/appearance/dwm-noborderselflickerfix-2022042627-d93ff48803f0.diff b/patches/appearance/dwm-noborderselflickerfix-2022042627-d93ff48803f0.diff deleted file mode 100644 index 5a82b33..0000000 --- a/patches/appearance/dwm-noborderselflickerfix-2022042627-d93ff48803f0.diff +++ /dev/null @@ -1,53 +0,0 @@ -diff --git dwm.c dwm.c -index 0fc328a..4a767bd 100644 ---- dwm.c -+++ dwm.c -@@ -206,6 +206,7 @@ static void setup(void); - static void seturgent(Client *c, int urg); - static void showhide(Client *c); - static void sigchld(int unused); -+static int solitary(Client *c); - static void spawn(const Arg *arg); - static void tag(const Arg *arg); - static void tagmon(const Arg *arg); -@@ -802,7 +803,11 @@ focus(Client *c) - detachstack(c); - attachstack(c); - grabbuttons(c, 1); -- XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); -+ /* Avoid flickering when another client appears and the border -+ * is restored */ -+ if (!solitary(c)) { -+ XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); -+ } - setfocus(c); - } else { - XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); -@@ -1288,6 +1293,11 @@ resizeclient(Client *c, int x, int y, int w, int h) - c->oldw = c->w; c->w = wc.width = w; - c->oldh = c->h; c->h = wc.height = h; - wc.border_width = c->bw; -+ if (solitary(c)) { -+ c->w = wc.width += c->bw * 2; -+ c->h = wc.height += c->bw * 2; -+ wc.border_width = 0; -+ } - XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); - configure(c); - XSync(dpy, False); -@@ -1642,6 +1652,15 @@ sigchld(int unused) - while (0 < waitpid(-1, NULL, WNOHANG)); - } - -+int -+solitary(Client *c) -+{ -+ return ((nexttiled(c->mon->clients) == c && !nexttiled(c->next)) -+ || &monocle == c->mon->lt[c->mon->sellt]->arrange) -+ && !c->isfullscreen && !c->isfloating -+ && NULL != c->mon->lt[c->mon->sellt]->arrange; -+} -+ - void - spawn(const Arg *arg) - { diff --git a/patches/appearance/dwm-removeborder-20220626-d3f93c7.diff b/patches/appearance/dwm-removeborder-20220626-d3f93c7.diff new file mode 100644 index 0000000..9193a77 --- /dev/null +++ b/patches/appearance/dwm-removeborder-20220626-d3f93c7.diff @@ -0,0 +1,31 @@ +diff --git a/dwm.c b/dwm.c +index 5646a5c..27e29df 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -1283,12 +1283,26 @@ void + resizeclient(Client *c, int x, int y, int w, int h) + { + XWindowChanges wc; ++ unsigned int n; ++ Client *nbc; + + c->oldx = c->x; c->x = wc.x = x; + c->oldy = c->y; c->y = wc.y = y; + c->oldw = c->w; c->w = wc.width = w; + c->oldh = c->h; c->h = wc.height = h; + wc.border_width = c->bw; ++ ++ for (n = 0, nbc = nexttiled(c->mon->clients); nbc; nbc = nexttiled(nbc->next), n++); ++ ++ if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) { ++ } else { ++ if (c->mon->lt[c->mon->sellt]->arrange == monocle || n == 1) { ++ wc.border_width = 0; ++ c->w = wc.width += c->bw * 2; ++ c->h = wc.height += c->bw * 2; ++ } ++ } ++ + XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); + configure(c); + XSync(dpy, False);