tabbed

tabbed
git clone git@git.zachrice.app:repos/tabbed.git
Log | Files | Refs | README | LICENSE

commit 08588562070909388340f5d043789369fbdbcc47
parent e65146d2918e0072fc09b3dfb06785e170787164
Author: Zach Rice <bynxmusic@gmail.com>
Date:   Mon, 18 May 2026 19:57:56 -0400

Add click to drag patch

Diffstat:
A.gitignore | 4++++
Apatches/tabbed-drag-20230128-41e2b8f.diff | 83+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mtabbed.c | 39++++++++++++++++++++++++++++++++++++++-
3 files changed, 125 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,4 @@ +config.h +*.o +tabbed +xembed diff --git a/patches/tabbed-drag-20230128-41e2b8f.diff b/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.c b/tabbed.c @@ -89,6 +89,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; @@ -210,6 +212,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) { int i; @@ -1065,7 +1102,7 @@ setup(void) XSelectInput(dpy, win, SubstructureNotifyMask | FocusChangeMask | ButtonPressMask | ExposureMask | KeyPressMask | PropertyChangeMask | StructureNotifyMask | - SubstructureRedirectMask); + SubstructureRedirectMask | ButtonMotionMask); xerrorxlib = XSetErrorHandler(xerror); class_hint.res_name = wmname;