summaryrefslogtreecommitdiff
path: root/tabbed/patches
diff options
context:
space:
mode:
Diffstat (limited to 'tabbed/patches')
-rw-r--r--tabbed/patches/alpha.diff122
-rw-r--r--tabbed/patches/tabbed-0.6-xft.diff233
-rw-r--r--tabbed/patches/tabbed-autohide-20201222-dabf6a2.diff54
-rw-r--r--tabbed/patches/tabbed-bar-height-0.6.diff24
-rw-r--r--tabbed/patches/tabbed-basenames-0.7.diff104
-rw-r--r--tabbed/patches/tabbed-drag-20230128-41e2b8f.diff83
-rw-r--r--tabbed/patches/tabbed-hidetabs-20191216-b5f9ec6.diff105
-rw-r--r--tabbed/patches/tabbed-keyrelease-20191216-b5f9ec6.diff96
-rw-r--r--tabbed/patches/tabbed-move-clamped-20200404-e2ca5f9.diff19
-rw-r--r--tabbed/patches/tabbed-ungrabkey-0.8.diff33
10 files changed, 873 insertions, 0 deletions
diff --git a/tabbed/patches/alpha.diff b/tabbed/patches/alpha.diff
new file mode 100644
index 0000000..3ce77a7
--- /dev/null
+++ b/tabbed/patches/alpha.diff
@@ -0,0 +1,122 @@
+diff --git a/config.mk b/config.mk
+index 3a71529..095cead 100644
+--- a/config.mk
++++ b/config.mk
+@@ -9,7 +9,7 @@ MANPREFIX = ${PREFIX}/share/man
+
+ # includes and libs
+ INCS = -I. -I/usr/include -I/usr/include/freetype2
+-LIBS = -L/usr/lib -lc -lX11 -lfontconfig -lXft
++LIBS = -L/usr/lib -lc -lX11 -lfontconfig -lXft -lXrender
+
+ # flags
+ CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE
+diff --git a/tabbed.c b/tabbed.c
+index 9a44795..b4d47d1 100644
+--- a/tabbed.c
++++ b/tabbed.c
+@@ -170,6 +170,9 @@ static char **cmd;
+ static char *wmname = "tabbed";
+ static const char *geometry;
+
++static Colormap cmap;
++static Visual *visual = NULL;
++
+ char *argv0;
+
+ /* configuration, allows nested code to access above variables */
+@@ -255,8 +258,8 @@ configurenotify(const XEvent *e)
+ ww = ev->width;
+ wh = ev->height;
+ XFreePixmap(dpy, dc.drawable);
+- dc.drawable = XCreatePixmap(dpy, root, ww, wh,
+- DefaultDepth(dpy, screen));
++ dc.drawable = XCreatePixmap(dpy, win, ww, wh,
++ 32);
+ if (sel > -1)
+ resize(sel, ww, wh - bh);
+ XSync(dpy, False);
+@@ -399,7 +402,7 @@ drawtext(const char *text, XftColor col[ColLast])
+ ;
+ }
+
+- d = XftDrawCreate(dpy, dc.drawable, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen));
++ d = XftDrawCreate(dpy, dc.drawable, visual, cmap);
+ XftDrawStringUtf8(d, &col[ColFG], dc.font.xfont, x, y, (XftChar8 *) buf, len);
+ XftDrawDestroy(d);
+ }
+@@ -564,7 +567,7 @@ getcolor(const char *colstr)
+ {
+ XftColor color;
+
+- if (!XftColorAllocName(dpy, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen), colstr, &color))
++ if (!XftColorAllocName(dpy, visual, cmap, colstr, &color))
+ die("%s: cannot allocate color '%s'\n", argv0, colstr);
+
+ return color;
+@@ -1016,18 +1019,60 @@ setup(void)
+ wy = dh + wy - wh - 1;
+ }
+
++ XVisualInfo *vis;
++ XRenderPictFormat *fmt;
++ int nvi;
++ int i;
++
++ XVisualInfo tpl = {
++ .screen = screen,
++ .depth = 32,
++ .class = TrueColor
++ };
++
++ vis = XGetVisualInfo(dpy, VisualScreenMask | VisualDepthMask | VisualClassMask, &tpl, &nvi);
++ for(i = 0; i < nvi; i ++) {
++ fmt = XRenderFindVisualFormat(dpy, vis[i].visual);
++ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
++ visual = vis[i].visual;
++ break;
++ }
++ }
++
++ XFree(vis);
++
++ if (! visual) {
++ fprintf(stderr, "Couldn't find ARGB visual.\n");
++ exit(1);
++ }
++
++ cmap = XCreateColormap( dpy, root, visual, None);
+ dc.norm[ColBG] = getcolor(normbgcolor);
+ dc.norm[ColFG] = getcolor(normfgcolor);
+ dc.sel[ColBG] = getcolor(selbgcolor);
+ dc.sel[ColFG] = getcolor(selfgcolor);
+ dc.urg[ColBG] = getcolor(urgbgcolor);
+ dc.urg[ColFG] = getcolor(urgfgcolor);
+- dc.drawable = XCreatePixmap(dpy, root, ww, wh,
+- DefaultDepth(dpy, screen));
+- dc.gc = XCreateGC(dpy, root, 0, 0);
+
+- win = XCreateSimpleWindow(dpy, root, wx, wy, ww, wh, 0,
+- dc.norm[ColFG].pixel, dc.norm[ColBG].pixel);
++ XSetWindowAttributes attrs;
++ attrs.background_pixel = dc.norm[ColBG].pixel;
++ attrs.border_pixel = dc.norm[ColFG].pixel;
++ attrs.bit_gravity = NorthWestGravity;
++ attrs.event_mask = FocusChangeMask | KeyPressMask
++ | ExposureMask | VisibilityChangeMask | StructureNotifyMask
++ | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
++ attrs.background_pixmap = None ;
++ attrs.colormap = cmap;
++
++ win = XCreateWindow(dpy, root, wx, wy,
++ ww, wh, 0, 32, InputOutput,
++ visual, CWBackPixmap | CWBorderPixel | CWBitGravity
++ | CWEventMask | CWColormap, &attrs);
++
++ dc.drawable = XCreatePixmap(dpy, win, ww, wh,
++ 32);
++ dc.gc = XCreateGC(dpy, dc.drawable, 0, 0);
++
+ XMapRaised(dpy, win);
+ XSelectInput(dpy, win, SubstructureNotifyMask | FocusChangeMask |
+ ButtonPressMask | ExposureMask | KeyPressMask |
diff --git a/tabbed/patches/tabbed-0.6-xft.diff b/tabbed/patches/tabbed-0.6-xft.diff
new file mode 100644
index 0000000..7ec00fb
--- /dev/null
+++ b/tabbed/patches/tabbed-0.6-xft.diff
@@ -0,0 +1,233 @@
+diff --git a/config.def.h b/config.def.h
+index ceda9f7..bc7cfe2 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -1,7 +1,7 @@
+ /* See LICENSE file for copyright and license details. */
+
+ /* appearance */
+-static const char font[] = "-*-*-medium-*-*-*-14-*-*-*-*-*-*-*";
++static const char font[] = "monospace-9";
+ static const char* normbgcolor = "#222222";
+ static const char* normfgcolor = "#cccccc";
+ static const char* selbgcolor = "#555555";
+diff --git a/config.mk b/config.mk
+index 5279711..037f9d7 100644
+--- a/config.mk
++++ b/config.mk
+@@ -8,8 +8,8 @@ PREFIX = /usr/local
+ MANPREFIX = ${PREFIX}/share/man
+
+ # includes and libs
+-INCS = -I. -I/usr/include
+-LIBS = -L/usr/lib -lc -lX11
++INCS = -I. -I/usr/include -I/usr/include/freetype2
++LIBS = -L/usr/lib -lc -lX11 -lfontconfig -lXft
+
+ # flags
+ CPPFLAGS = -DVERSION=\"${VERSION}\" -D_BSD_SOURCE
+diff --git a/tabbed.c b/tabbed.c
+index d30206b..d08348c 100644
+--- a/tabbed.c
++++ b/tabbed.c
+@@ -15,6 +15,7 @@
+ #include <X11/Xproto.h>
+ #include <X11/Xutil.h>
+ #include <X11/XKBlib.h>
++#include <X11/Xft/Xft.h>
+
+ #include "arg.h"
+
+@@ -64,16 +65,15 @@ typedef struct {
+
+ typedef struct {
+ int x, y, w, h;
+- unsigned long norm[ColLast];
+- unsigned long sel[ColLast];
++ XftColor norm[ColLast];
++ XftColor sel[ColLast];
+ Drawable drawable;
+ GC gc;
+ struct {
+ int ascent;
+ int descent;
+ int height;
+- XFontSet set;
+- XFontStruct *xfont;
++ XftFont *xfont;
+ } font;
+ } DC; /* draw context */
+
+@@ -95,7 +95,7 @@ static void createnotify(const XEvent *e);
+ static void destroynotify(const XEvent *e);
+ static void die(const char *errstr, ...);
+ static void drawbar(void);
+-static void drawtext(const char *text, unsigned long col[ColLast]);
++static void drawtext(const char *text, XftColor col[ColLast]);
+ static void *emallocz(size_t size);
+ static void *erealloc(void *o, size_t size);
+ static void expose(const XEvent *e);
+@@ -105,7 +105,7 @@ static void focusonce(const Arg *arg);
+ static void fullscreen(const Arg *arg);
+ static char* getatom(int a);
+ static int getclient(Window w);
+-static unsigned long getcolor(const char *colstr);
++static XftColor getcolor(const char *colstr);
+ static int getfirsttab(void);
+ static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
+ static void initfont(const char *fontstr);
+@@ -219,12 +219,6 @@ cleanup(void) {
+ free(clients);
+ clients = NULL;
+
+- if(dc.font.set) {
+- XFreeFontSet(dpy, dc.font.set);
+- } else {
+- XFreeFont(dpy, dc.font.xfont);
+- }
+-
+ XFreePixmap(dpy, dc.drawable);
+ XFreeGC(dpy, dc.gc);
+ XDestroyWindow(dpy, win);
+@@ -305,7 +299,7 @@ die(const char *errstr, ...) {
+
+ void
+ drawbar(void) {
+- unsigned long *col;
++ XftColor *col;
+ int c, fc, width, n = 0;
+ char *name = NULL;
+
+@@ -362,12 +356,13 @@ drawbar(void) {
+ }
+
+ void
+-drawtext(const char *text, unsigned long col[ColLast]) {
++drawtext(const char *text, XftColor col[ColLast]) {
+ int i, x, y, h, len, olen;
+ char buf[256];
++ XftDraw *d;
+ XRectangle r = { dc.x, dc.y, dc.w, dc.h };
+
+- XSetForeground(dpy, dc.gc, col[ColBG]);
++ XSetForeground(dpy, dc.gc, col[ColBG].pixel);
+ XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
+ if(!text)
+ return;
+@@ -388,13 +383,10 @@ drawtext(const char *text, unsigned long col[ColLast]) {
+ for(i = len; i && i > len - 3; buf[--i] = '.');
+ }
+
+- XSetForeground(dpy, dc.gc, col[ColFG]);
+- if(dc.font.set) {
+- XmbDrawString(dpy, dc.drawable, dc.font.set,
+- dc.gc, x, y, buf, len);
+- } else {
+- XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len);
+- }
++ d = XftDrawCreate(dpy, dc.drawable, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen));
++
++ XftDrawStringUtf8(d, &col[ColFG], dc.font.xfont, x, y, (XftChar8 *) buf, len);
++ XftDrawDestroy(d);
+ }
+
+ void *
+@@ -524,15 +516,14 @@ getclient(Window w) {
+ return -1;
+ }
+
+-unsigned long
++XftColor
+ getcolor(const char *colstr) {
+- Colormap cmap = DefaultColormap(dpy, screen);
+- XColor color;
++ XftColor color;
+
+- if(!XAllocNamedColor(dpy, cmap, colstr, &color, &color))
++ if(!XftColorAllocName(dpy, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen), colstr, &color))
+ die("tabbed: cannot allocate color '%s'\n", colstr);
+
+- return color.pixel;
++ return color;
+ }
+
+ int
+@@ -585,41 +576,12 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size) {
+
+ void
+ initfont(const char *fontstr) {
+- char *def, **missing, **font_names;
+- int i, n;
+- XFontStruct **xfonts;
+-
+- missing = NULL;
+- if(dc.font.set)
+- XFreeFontSet(dpy, dc.font.set);
+-
+- dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
+- if(missing) {
+- while(n--)
+- fprintf(stderr, "tabbed: missing fontset: %s\n", missing[n]);
+- XFreeStringList(missing);
+- }
++ if(!(dc.font.xfont = XftFontOpenName(dpy, screen, fontstr))
++ && !(dc.font.xfont = XftFontOpenName(dpy, screen, "fixed")))
++ die("error, cannot load font: '%s'\n", fontstr);
+
+- if(dc.font.set) {
+- dc.font.ascent = dc.font.descent = 0;
+- n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names);
+- for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) {
+- dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent);
+- dc.font.descent = MAX(dc.font.descent,(*xfonts)->descent);
+- xfonts++;
+- }
+- } else {
+- if(dc.font.xfont)
+- XFreeFont(dpy, dc.font.xfont);
+- dc.font.xfont = NULL;
+- if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr))
+- && !(dc.font.xfont = XLoadQueryFont(dpy, "fixed"))) {
+- die("tabbed: cannot load font: '%s'\n", fontstr);
+- }
+-
+- dc.font.ascent = dc.font.xfont->ascent;
+- dc.font.descent = dc.font.xfont->descent;
+- }
++ dc.font.ascent = dc.font.xfont->ascent;
++ dc.font.descent = dc.font.xfont->descent;
+ dc.font.height = dc.font.ascent + dc.font.descent;
+ }
+
+@@ -972,11 +934,9 @@ setup(void) {
+ dc.drawable = XCreatePixmap(dpy, root, ww, wh,
+ DefaultDepth(dpy, screen));
+ dc.gc = XCreateGC(dpy, root, 0, 0);
+- if(!dc.font.set)
+- XSetFont(dpy, dc.gc, dc.font.xfont->fid);
+
+ win = XCreateSimpleWindow(dpy, root, wx, wy, ww, wh, 0,
+- dc.norm[ColFG], dc.norm[ColBG]);
++ dc.norm[ColFG].pixel, dc.norm[ColBG].pixel);
+ XMapRaised(dpy, win);
+ XSelectInput(dpy, win, SubstructureNotifyMask|FocusChangeMask|
+ ButtonPressMask|ExposureMask|KeyPressMask|PropertyChangeMask|
+@@ -1040,15 +1000,9 @@ spawn(const Arg *arg) {
+
+ int
+ textnw(const char *text, unsigned int len) {
+- XRectangle r;
+-
+- if(dc.font.set) {
+- XmbTextExtents(dc.font.set, text, len, NULL, &r);
+-
+- return r.width;
+- }
+-
+- return XTextWidth(dc.font.xfont, text, len);
++ XGlyphInfo ext;
++ XftTextExtentsUtf8(dpy, dc.font.xfont, (XftChar8 *) text, len, &ext);
++ return ext.xOff;
+ }
+
+ void
diff --git a/tabbed/patches/tabbed-autohide-20201222-dabf6a2.diff b/tabbed/patches/tabbed-autohide-20201222-dabf6a2.diff
new file mode 100644
index 0000000..d9f71ba
--- /dev/null
+++ b/tabbed/patches/tabbed-autohide-20201222-dabf6a2.diff
@@ -0,0 +1,54 @@
+diff --git a/tabbed.c b/tabbed.c
+index eafe28a..b0b9662 100644
+--- a/tabbed.c
++++ b/tabbed.c
+@@ -152,7 +152,7 @@ static void (*handler[LASTEvent]) (const XEvent *) = {
+ [MapRequest] = maprequest,
+ [PropertyNotify] = propertynotify,
+ };
+-static int bh, obh, wx, wy, ww, wh;
++static int bh, obh, wx, wy, ww, wh, vbh;
+ static unsigned int numlockmask;
+ static Bool running = True, nextfocus, doinitspawn = True,
+ fillagain = False, closelastclient = False,
+@@ -324,7 +324,7 @@ void
+ drawbar(void)
+ {
+ XftColor *col;
+- int c, cc, fc, width;
++ int c, cc, fc, width, nbh, i;
+ char *name = NULL;
+
+ if (nclients == 0) {
+@@ -332,12 +332,21 @@ drawbar(void)
+ dc.w = ww;
+ XFetchName(dpy, win, &name);
+ drawtext(name ? name : "", dc.norm);
+- XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, ww, bh, 0, 0);
++ XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, ww, vbh, 0, 0);
+ XSync(dpy, False);
+
+ return;
+ }
+
++ nbh = nclients > 1 ? vbh : 0;
++ if (bh != nbh) {
++ bh = nbh;
++ for (i = 0; i < nclients; i++)
++ XMoveResizeWindow(dpy, clients[i]->win, 0, bh, ww, wh - bh);
++ }
++ if (bh == 0)
++ return;
++
+ width = ww;
+ cc = ww / tabwidth;
+ if (nclients > cc)
+@@ -984,7 +993,7 @@ setup(void)
+ screen = DefaultScreen(dpy);
+ root = RootWindow(dpy, screen);
+ initfont(font);
+- bh = dc.h = dc.font.height + 2;
++ vbh = dc.h = dc.font.height + 2;
+
+ /* init atoms */
+ wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
diff --git a/tabbed/patches/tabbed-bar-height-0.6.diff b/tabbed/patches/tabbed-bar-height-0.6.diff
new file mode 100644
index 0000000..fddcb28
--- /dev/null
+++ b/tabbed/patches/tabbed-bar-height-0.6.diff
@@ -0,0 +1,24 @@
+diff --color -up tabbed-0.6-clean/config.def.h tabbed-0.6-modified/config.def.h
+--- tabbed-0.6-clean/config.def.h 2014-01-21 10:22:03.000000000 -0800
++++ tabbed-0.6-modified/config.def.h 2021-03-30 20:23:45.752478278 -0700
+@@ -10,7 +10,7 @@ static const char before[] = "<";
+ static const char after[] = ">";
+ static const int tabwidth = 200;
+ static const Bool foreground = True;
+-
++static const int barHeight = 24;
+ /*
+ * Where to place a new tab when it is opened. When npisrelative is True,
+ * then the current position is changed + newposition. If npisrelative
+diff --color -up tabbed-0.6-clean/tabbed.c tabbed-0.6-modified/tabbed.c
+--- tabbed-0.6-clean/tabbed.c 2014-01-21 10:22:03.000000000 -0800
++++ tabbed-0.6-modified/tabbed.c 2021-03-30 20:24:23.712477426 -0700
+@@ -920,7 +920,7 @@ setup(void) {
+ screen = DefaultScreen(dpy);
+ root = RootWindow(dpy, screen);
+ initfont(font);
+- bh = dc.h = dc.font.height + 2;
++ bh = dc.h = barHeight;
+
+ /* init atoms */
+ wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
diff --git a/tabbed/patches/tabbed-basenames-0.7.diff b/tabbed/patches/tabbed-basenames-0.7.diff
new file mode 100644
index 0000000..5995ba9
--- /dev/null
+++ b/tabbed/patches/tabbed-basenames-0.7.diff
@@ -0,0 +1,104 @@
+From a682145f0daf599b6d2f6c1326f064ec67b30f73 Mon Sep 17 00:00:00 2001
+From: Jacob Fong <jacobcfong@gmail.com>
+Date: Mon, 5 Jun 2023 15:57:54 -0700
+Subject: [PATCH] Added `-b` to display only basenames of tab titles.
+
+---
+ tabbed.1 | 3 +++
+ tabbed.c | 24 ++++++++++++++++++++++--
+ 2 files changed, 25 insertions(+), 2 deletions(-)
+
+diff --git a/tabbed.1 b/tabbed.1
+index 07bdbd7..4a9c110 100644
+--- a/tabbed.1
++++ b/tabbed.1
+@@ -106,6 +106,9 @@ defines the urgent background color.
+ .BI \-U " urgfgbcol"
+ defines the urgent foreground color.
+ .TP
++.BI \-b
++print only basenames of tab titles.
++.TP
+ .B \-v
+ prints version information to stderr, then exits.
+ .SH USAGE
+diff --git a/tabbed.c b/tabbed.c
+index eafe28a..03b0c8c 100644
+--- a/tabbed.c
++++ b/tabbed.c
+@@ -80,6 +80,7 @@ typedef struct {
+
+ typedef struct {
+ char name[256];
++ char *basename;
+ Window win;
+ int tabx;
+ Bool urgent;
+@@ -106,6 +107,7 @@ static void focusonce(const Arg *arg);
+ static void focusurgent(const Arg *arg);
+ static void fullscreen(const Arg *arg);
+ static char *getatom(int a);
++static char *getbasename(const char *name);
+ static int getclient(Window w);
+ static XftColor getcolor(const char *colstr);
+ static int getfirsttab(void);
+@@ -156,7 +158,7 @@ static int bh, obh, wx, wy, ww, wh;
+ static unsigned int numlockmask;
+ static Bool running = True, nextfocus, doinitspawn = True,
+ fillagain = False, closelastclient = False,
+- killclientsfirst = False;
++ killclientsfirst = False, basenametitles = False;
+ static Display *dpy;
+ static DC dc;
+ static Atom wmatom[WMLast];
+@@ -367,7 +369,10 @@ drawbar(void)
+ } else {
+ col = clients[c]->urgent ? dc.urg : dc.norm;
+ }
+- drawtext(clients[c]->name, col);
++ if (basenametitles)
++ drawtext(clients[c]->basename, col);
++ else
++ drawtext(clients[c]->name, col);
+ dc.x += dc.w;
+ clients[c]->tabx = dc.x;
+ }
+@@ -557,6 +562,16 @@ getatom(int a)
+ return buf;
+ }
+
++char *
++getbasename(const char *name)
++{
++ char *pos = strrchr(name, '/');
++ if (pos)
++ return pos+1;
++ else
++ return (char *)name;
++}
++
+ int
+ getclient(Window w)
+ {
+@@ -1217,6 +1232,8 @@ updatetitle(int c)
+ sizeof(clients[c]->name)))
+ gettextprop(clients[c]->win, XA_WM_NAME, clients[c]->name,
+ sizeof(clients[c]->name));
++ if (basenametitles)
++ clients[c]->basename = getbasename(clients[c]->name);
+ if (sel == c)
+ xsettitle(win, clients[c]->name);
+ drawbar();
+@@ -1333,6 +1350,9 @@ main(int argc, char *argv[])
+ case 'u':
+ urgbgcolor = EARGF(usage());
+ break;
++ case 'b':
++ basenametitles = True;
++ break;
+ case 'v':
+ die("tabbed-"VERSION", © 2009-2016 tabbed engineers, "
+ "see LICENSE for details.\n");
+--
+2.40.0
+
diff --git a/tabbed/patches/tabbed-drag-20230128-41e2b8f.diff b/tabbed/patches/tabbed-drag-20230128-41e2b8f.diff
new file mode 100644
index 0000000..30af15c
--- /dev/null
+++ b/tabbed/patches/tabbed-drag-20230128-41e2b8f.diff
@@ -0,0 +1,83 @@
+From caf61ed5c47b32938bea4a0577f4f6953ddd1578 Mon Sep 17 00:00:00 2001
+From: Casey Fitzpatrick <kcghost@gmail.com>
+Date: Fri, 27 Jan 2023 19:46:05 -0500
+Subject: [PATCH] Support draggable tabs
+
+---
+ tabbed.c | 39 ++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 38 insertions(+), 1 deletion(-)
+
+diff --git a/tabbed.c b/tabbed.c
+index eafe28a..2e3b61a 100644
+--- a/tabbed.c
++++ b/tabbed.c
+@@ -88,6 +88,7 @@ typedef struct {
+
+ /* function declarations */
+ static void buttonpress(const XEvent *e);
++static void motionnotify(const XEvent *e);
+ static void cleanup(void);
+ static void clientmessage(const XEvent *e);
+ static void configurenotify(const XEvent *e);
+@@ -151,6 +152,7 @@ static void (*handler[LASTEvent]) (const XEvent *) = {
+ [KeyPress] = keypress,
+ [MapRequest] = maprequest,
+ [PropertyNotify] = propertynotify,
++ [MotionNotify] = motionnotify,
+ };
+ static int bh, obh, wx, wy, ww, wh;
+ static unsigned int numlockmask;
+@@ -209,6 +211,41 @@ buttonpress(const XEvent *e)
+ }
+ }
+
++void
++motionnotify(const XEvent *e)
++{
++ const XMotionEvent *ev = &e->xmotion;
++ int i, fc;
++ Arg arg;
++
++ if (ev->y < 0 || ev->y > bh)
++ return;
++
++ if (! (ev->state & Button1Mask)) {
++ return;
++ }
++
++ if (((fc = getfirsttab()) > 0 && ev->x < TEXTW(before)) || ev->x < 0)
++ return;
++
++ if (sel < 0)
++ return;
++
++ for (i = fc; i < nclients; i++) {
++ if (clients[i]->tabx > ev->x) {
++ if (i == sel+1) {
++ arg.i = 1;
++ movetab(&arg);
++ }
++ if (i == sel-1) {
++ arg.i = -1;
++ movetab(&arg);
++ }
++ break;
++ }
++ }
++}
++
+ void
+ cleanup(void)
+ {
+@@ -1046,7 +1083,7 @@ setup(void)
+ XSelectInput(dpy, win, SubstructureNotifyMask | FocusChangeMask |
+ ButtonPressMask | ExposureMask | KeyPressMask |
+ PropertyChangeMask | StructureNotifyMask |
+- SubstructureRedirectMask);
++ SubstructureRedirectMask | ButtonMotionMask);
+ xerrorxlib = XSetErrorHandler(xerror);
+
+ class_hint.res_name = wmname;
+--
+2.25.1
+
diff --git a/tabbed/patches/tabbed-hidetabs-20191216-b5f9ec6.diff b/tabbed/patches/tabbed-hidetabs-20191216-b5f9ec6.diff
new file mode 100644
index 0000000..424519d
--- /dev/null
+++ b/tabbed/patches/tabbed-hidetabs-20191216-b5f9ec6.diff
@@ -0,0 +1,105 @@
+From 52708d468acace9543d01e6d8afae799f8d6fccd Mon Sep 17 00:00:00 2001
+From: LeelaPakanati <leela.pakanati@gmail.com>
+Date: Mon, 16 Dec 2019 18:57:32 -0500
+Subject: [PATCH] Add hide tabs feature
+
+---
+ config.def.h | 7 +++++--
+ tabbed.c | 24 +++++++++++++++++++++---
+ 2 files changed, 26 insertions(+), 5 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 7bfda30..bb7ef0e 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -63,10 +63,13 @@ static Key keys[] = {
+ { MODKEY|ShiftMask, XK_u, toggle, { .v = (void*) &urgentswitch } },
+
+ { 0, XK_F11, fullscreen, { 0 } },
++
++ { MODKEY, XK_Shift_L, showbar, { .i = 1 } },
++ { ShiftMask, XK_Control_L, showbar, { .i = 1 } },
+ };
+
+ static Key keyreleases[] = {
+ /* modifier key function argument */
+- { 0, XK_Shift_L, NULL, { 0 } },
+-
++ { MODKEY|ShiftMask, XK_Shift_L, showbar, { .i = 0 } },
++ { MODKEY|ShiftMask, XK_Control_L, showbar, { .i = 0 } },
+ };
+diff --git a/tabbed.c b/tabbed.c
+index fe38b9d..352dab2 100644
+--- a/tabbed.c
++++ b/tabbed.c
+@@ -127,6 +127,7 @@ static void sendxembed(int c, long msg, long detail, long d1, long d2);
+ static void setcmd(int argc, char *argv[], int);
+ static void setup(void);
+ static void sigchld(int unused);
++static void showbar(const Arg *arg);
+ static void spawn(const Arg *arg);
+ static int textnw(const char *text, unsigned int len);
+ static void toggle(const Arg *arg);
+@@ -154,7 +155,7 @@ static void (*handler[LASTEvent]) (const XEvent *) = {
+ [MapRequest] = maprequest,
+ [PropertyNotify] = propertynotify,
+ };
+-static int bh, wx, wy, ww, wh;
++static int bh, wx, wy, ww, wh, vbh;
+ static unsigned int numlockmask;
+ static Bool running = True, nextfocus, doinitspawn = True,
+ fillagain = False, closelastclient = False,
+@@ -171,6 +172,7 @@ static char winid[64];
+ static char **cmd;
+ static char *wmname = "tabbed";
+ static const char *geometry;
++static Bool barvisibility = False;
+
+ char *argv0;
+
+@@ -317,9 +319,18 @@ void
+ drawbar(void)
+ {
+ XftColor *col;
+- int c, cc, fc, width;
++ int c, cc, fc, width, nbh;
+ char *name = NULL;
+
++ nbh = barvisibility ? vbh : 0;
++ if (nbh != bh) {
++ bh = nbh;
++ for (c = 0; c < nclients; c++)
++ XMoveResizeWindow(dpy, clients[c]->win, 0, bh, ww, wh-bh);
++ }
++
++ if (bh == 0) return;
++
+ if (nclients == 0) {
+ dc.x = 0;
+ dc.w = ww;
+@@ -1003,7 +1014,7 @@ setup(void)
+ screen = DefaultScreen(dpy);
+ root = RootWindow(dpy, screen);
+ initfont(font);
+- bh = dc.h = dc.font.height + 2;
++ vbh = dc.h = dc.font.height + 2;
+
+ /* init atoms */
+ wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
+@@ -1096,6 +1107,13 @@ setup(void)
+ focus(-1);
+ }
+
++void
++showbar(const Arg *arg)
++{
++ barvisibility = arg->i;
++ drawbar();
++}
++
+ void
+ sigchld(int unused)
+ {
+--
+2.24.0
+
diff --git a/tabbed/patches/tabbed-keyrelease-20191216-b5f9ec6.diff b/tabbed/patches/tabbed-keyrelease-20191216-b5f9ec6.diff
new file mode 100644
index 0000000..143a008
--- /dev/null
+++ b/tabbed/patches/tabbed-keyrelease-20191216-b5f9ec6.diff
@@ -0,0 +1,96 @@
+From 6c58b480b7b6ce6a28beafc60a096069fbd51532 Mon Sep 17 00:00:00 2001
+From: LeelaPakanati <LeelaPakanati.gmail.com>
+Date: Fri, 13 Dec 2019 16:56:42 -0500
+Subject: [PATCH] Add function handling at keyrelease
+
+---
+ config.def.h | 6 ++++++
+ tabbed.c | 30 +++++++++++++++++++++++++++++-
+ 2 files changed, 35 insertions(+), 1 deletion(-)
+
+diff --git a/config.def.h b/config.def.h
+index defa426..7bfda30 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -64,3 +64,9 @@ static Key keys[] = {
+
+ { 0, XK_F11, fullscreen, { 0 } },
+ };
++
++static Key keyreleases[] = {
++ /* modifier key function argument */
++ { 0, XK_Shift_L, NULL, { 0 } },
++
++};
+diff --git a/tabbed.c b/tabbed.c
+index ff3ada0..fe38b9d 100644
+--- a/tabbed.c
++++ b/tabbed.c
+@@ -113,6 +113,7 @@ static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
+ static void initfont(const char *fontstr);
+ static Bool isprotodel(int c);
+ static void keypress(const XEvent *e);
++static void keyrelease(const XEvent *e);
+ static void killclient(const Arg *arg);
+ static void manage(Window win);
+ static void maprequest(const XEvent *e);
+@@ -149,6 +150,7 @@ static void (*handler[LASTEvent]) (const XEvent *) = {
+ [Expose] = expose,
+ [FocusIn] = focusin,
+ [KeyPress] = keypress,
++ [KeyRelease] = keyrelease,
+ [MapRequest] = maprequest,
+ [PropertyNotify] = propertynotify,
+ };
+@@ -664,6 +666,22 @@ keypress(const XEvent *e)
+ }
+ }
+
++void
++keyrelease(const XEvent *e)
++{
++ const XKeyEvent *ev = &e->xkey;
++ unsigned int i;
++ KeySym keysym;
++
++ keysym = XkbKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0, 0);
++ for (i = 0; i < LENGTH(keyreleases); i++) {
++ if (keysym == keyreleases[i].keysym &&
++ CLEANMASK(keyreleases[i].mod) == CLEANMASK(ev->state) &&
++ keyreleases[i].func)
++ keyreleases[i].func(&(keyreleases[i].arg));
++ }
++}
++
+ void
+ killclient(const Arg *arg)
+ {
+@@ -714,6 +732,16 @@ manage(Window w)
+ }
+ }
+
++ for (i = 0; i < LENGTH(keyreleases); i++) {
++ if ((code = XKeysymToKeycode(dpy, keyreleases[i].keysym))) {
++ for (j = 0; j < LENGTH(modifiers); j++) {
++ XGrabKey(dpy, code, keyreleases[i].mod |
++ modifiers[j], w, True,
++ GrabModeAsync, GrabModeAsync);
++ }
++ }
++ }
++
+ c = ecalloc(1, sizeof *c);
+ c->win = w;
+
+@@ -1036,7 +1064,7 @@ setup(void)
+ XMapRaised(dpy, win);
+ XSelectInput(dpy, win, SubstructureNotifyMask | FocusChangeMask |
+ ButtonPressMask | ExposureMask | KeyPressMask |
+- PropertyChangeMask | StructureNotifyMask |
++ KeyReleaseMask | PropertyChangeMask | StructureNotifyMask |
+ SubstructureRedirectMask);
+ xerrorxlib = XSetErrorHandler(xerror);
+
+--
+2.24.0
+
diff --git a/tabbed/patches/tabbed-move-clamped-20200404-e2ca5f9.diff b/tabbed/patches/tabbed-move-clamped-20200404-e2ca5f9.diff
new file mode 100644
index 0000000..b62f0e9
--- /dev/null
+++ b/tabbed/patches/tabbed-move-clamped-20200404-e2ca5f9.diff
@@ -0,0 +1,19 @@
+diff --git a/tabbed.c b/tabbed.c
+index eafe28a..e2ca5f9 100644
+--- a/tabbed.c
++++ b/tabbed.c
+@@ -787,8 +787,12 @@ maprequest(const XEvent *e)
+ void
+ move(const Arg *arg)
+ {
+- if (arg->i >= 0 && arg->i < nclients)
+- focus(arg->i);
++ int i;
++
++ i = arg->i < nclients ? arg->i : nclients - 1;
++
++ if (i >= 0)
++ focus(i);
+ }
+
+ void
diff --git a/tabbed/patches/tabbed-ungrabkey-0.8.diff b/tabbed/patches/tabbed-ungrabkey-0.8.diff
new file mode 100644
index 0000000..14a1d70
--- /dev/null
+++ b/tabbed/patches/tabbed-ungrabkey-0.8.diff
@@ -0,0 +1,33 @@
+Author: Chris Noxz <chris@noxz.tech>
+
+diff -upN tabbed-0.8-a/tabbed.c tabbed-0.8-b/tabbed.c
+--- tabbed-0.8-a/tabbed.c 2024-03-19 12:23:17.000000000 +0100
++++ tabbed-0.8-b/tabbed.c 2024-06-11 20:07:21.814961956 +0200
+@@ -1132,6 +1132,11 @@ toggle(const Arg *arg)
+ void
+ unmanage(int c)
+ {
++ int i, j;
++ unsigned int modifiers[] = { 0, LockMask, numlockmask,
++ numlockmask | LockMask };
++ KeyCode code;
++
+ if (c < 0 || c >= nclients) {
+ drawbar();
+ XSync(dpy, False);
+@@ -1141,6 +1146,15 @@ unmanage(int c)
+ if (!nclients)
+ return;
+
++ /* ungrab keys */
++ for (i = 0; i < LENGTH(keys); i++) {
++ if ((code = XKeysymToKeycode(dpy, keys[i].keysym))) {
++ for (j = 0; j < LENGTH(modifiers); j++) {
++ XUngrabKey(dpy, code, keys[i].mod | modifiers[j], clients[c]->win);
++ }
++ }
++ }
++
+ if (c == 0) {
+ /* First client. */
+ nclients--;