From 4c06085e0f8e20bac1728418538baea314e6e469 Mon Sep 17 00:00:00 2001 From: coast Date: Thu, 29 May 2025 22:43:16 +0200 Subject: [PATCH] Upload files to ".suckless/patch" --- .suckless/patch/attachx.c | 20 +++++++++++++++++ .suckless/patch/attachx.h | 2 ++ .suckless/patch/bar.c | 39 +++++++++++++++++++++++++++++++++ .suckless/patch/bar.h | 2 ++ .suckless/patch/bar_alpha.c | 43 +++++++++++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 .suckless/patch/attachx.c create mode 100644 .suckless/patch/attachx.h create mode 100644 .suckless/patch/bar.c create mode 100644 .suckless/patch/bar.h create mode 100644 .suckless/patch/bar_alpha.c diff --git a/.suckless/patch/attachx.c b/.suckless/patch/attachx.c new file mode 100644 index 0000000..c683dce --- /dev/null +++ b/.suckless/patch/attachx.c @@ -0,0 +1,20 @@ +void +attachx(Client *c) +{ + Client *at; + + + unsigned int n; + for (at = c->mon->clients, n = 0; at; at = at->next) + if (!at->isfloating && ISVISIBLEONTAG(at, c->tags)) + if (++n >= c->mon->nmaster) + break; + + if (at && c->mon->nmaster) { + c->next = at->next; + at->next = c; + return; + } + attach(c); // master (default) +} + diff --git a/.suckless/patch/attachx.h b/.suckless/patch/attachx.h new file mode 100644 index 0000000..e522d27 --- /dev/null +++ b/.suckless/patch/attachx.h @@ -0,0 +1,2 @@ +static void attachx(Client *c); + diff --git a/.suckless/patch/bar.c b/.suckless/patch/bar.c new file mode 100644 index 0000000..65e1a69 --- /dev/null +++ b/.suckless/patch/bar.c @@ -0,0 +1,39 @@ +void +barhover(XEvent *e, Bar *bar) +{ + const BarRule *br; + Monitor *m = bar->mon; + XMotionEvent *ev = &e->xmotion; + BarArg barg = { 0, 0, 0, 0 }; + int r; + + for (r = 0; r < LENGTH(barrules); r++) { + br = &barrules[r]; + if (br->bar != bar->idx || (br->monitor == 'A' && m != selmon) || br->hoverfunc == NULL) + continue; + if (br->monitor != 'A' && br->monitor != -1 && br->monitor != bar->mon->num) + continue; + if (bar->x[r] > ev->x || ev->x > bar->x[r] + bar->w[r]) + continue; + + barg.x = ev->x - bar->x[r]; + barg.y = ev->y - bar->borderpx; + barg.w = bar->w[r]; + barg.h = bar->bh - 2 * bar->borderpx; + + br->hoverfunc(bar, &barg, ev); + break; + } +} + +Bar * +wintobar(Window win) +{ + Monitor *m; + Bar *bar; + for (m = mons; m; m = m->next) + for (bar = m->bar; bar; bar = bar->next) + if (bar->win == win) + return bar; + return NULL; +} diff --git a/.suckless/patch/bar.h b/.suckless/patch/bar.h new file mode 100644 index 0000000..3e006dc --- /dev/null +++ b/.suckless/patch/bar.h @@ -0,0 +1,2 @@ +static void barhover(XEvent *e, Bar *bar); +static Bar *wintobar(Window win); diff --git a/.suckless/patch/bar_alpha.c b/.suckless/patch/bar_alpha.c new file mode 100644 index 0000000..465f6f2 --- /dev/null +++ b/.suckless/patch/bar_alpha.c @@ -0,0 +1,43 @@ + +static int useargb = 0; +static Visual *visual; +static int depth; +static Colormap cmap; + +void +xinitvisual() +{ + XVisualInfo *infos; + XRenderPictFormat *fmt; + int nitems; + int i; + + XVisualInfo tpl = { + .screen = screen, + .depth = 32, + .class = TrueColor + }; + long masks = VisualScreenMask | VisualDepthMask | VisualClassMask; + + infos = XGetVisualInfo(dpy, masks, &tpl, &nitems); + visual = NULL; + for (i = 0; i < nitems; i ++) { + fmt = XRenderFindVisualFormat(dpy, infos[i].visual); + if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) { + visual = infos[i].visual; + depth = infos[i].depth; + cmap = XCreateColormap(dpy, root, visual, AllocNone); + useargb = 1; + break; + } + } + + XFree(infos); + + if (!visual) { + visual = DefaultVisual(dpy, screen); + depth = DefaultDepth(dpy, screen); + cmap = DefaultColormap(dpy, screen); + } +} +