aboutsummaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
Diffstat (limited to 'patches')
-rw-r--r--patches/alpha.diff122
-rw-r--r--patches/tabbed-autohide-0.6.diff50
-rw-r--r--patches/tabbed-bar-height-0.6.diff24
-rw-r--r--patches/tabbed-clientnumber-0.6.diff23
-rw-r--r--patches/tabbed-xresources-20210317-dabf6a2.diff178
5 files changed, 397 insertions, 0 deletions
diff --git a/patches/alpha.diff b/patches/alpha.diff
new file mode 100644
index 0000000..3ce77a7
--- /dev/null
+++ b/patches/alpha.diff
@@ -0,0 +1,122 @@
1diff --git a/config.mk b/config.mk
2index 3a71529..095cead 100644
3--- a/config.mk
4+++ b/config.mk
5@@ -9,7 +9,7 @@ MANPREFIX = ${PREFIX}/share/man
6
7 # includes and libs
8 INCS = -I. -I/usr/include -I/usr/include/freetype2
9-LIBS = -L/usr/lib -lc -lX11 -lfontconfig -lXft
10+LIBS = -L/usr/lib -lc -lX11 -lfontconfig -lXft -lXrender
11
12 # flags
13 CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE
14diff --git a/tabbed.c b/tabbed.c
15index 9a44795..b4d47d1 100644
16--- a/tabbed.c
17+++ b/tabbed.c
18@@ -170,6 +170,9 @@ static char **cmd;
19 static char *wmname = "tabbed";
20 static const char *geometry;
21
22+static Colormap cmap;
23+static Visual *visual = NULL;
24+
25 char *argv0;
26
27 /* configuration, allows nested code to access above variables */
28@@ -255,8 +258,8 @@ configurenotify(const XEvent *e)
29 ww = ev->width;
30 wh = ev->height;
31 XFreePixmap(dpy, dc.drawable);
32- dc.drawable = XCreatePixmap(dpy, root, ww, wh,
33- DefaultDepth(dpy, screen));
34+ dc.drawable = XCreatePixmap(dpy, win, ww, wh,
35+ 32);
36 if (sel > -1)
37 resize(sel, ww, wh - bh);
38 XSync(dpy, False);
39@@ -399,7 +402,7 @@ drawtext(const char *text, XftColor col[ColLast])
40 ;
41 }
42
43- d = XftDrawCreate(dpy, dc.drawable, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen));
44+ d = XftDrawCreate(dpy, dc.drawable, visual, cmap);
45 XftDrawStringUtf8(d, &col[ColFG], dc.font.xfont, x, y, (XftChar8 *) buf, len);
46 XftDrawDestroy(d);
47 }
48@@ -564,7 +567,7 @@ getcolor(const char *colstr)
49 {
50 XftColor color;
51
52- if (!XftColorAllocName(dpy, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen), colstr, &color))
53+ if (!XftColorAllocName(dpy, visual, cmap, colstr, &color))
54 die("%s: cannot allocate color '%s'\n", argv0, colstr);
55
56 return color;
57@@ -1016,18 +1019,60 @@ setup(void)
58 wy = dh + wy - wh - 1;
59 }
60
61+ XVisualInfo *vis;
62+ XRenderPictFormat *fmt;
63+ int nvi;
64+ int i;
65+
66+ XVisualInfo tpl = {
67+ .screen = screen,
68+ .depth = 32,
69+ .class = TrueColor
70+ };
71+
72+ vis = XGetVisualInfo(dpy, VisualScreenMask | VisualDepthMask | VisualClassMask, &tpl, &nvi);
73+ for(i = 0; i < nvi; i ++) {
74+ fmt = XRenderFindVisualFormat(dpy, vis[i].visual);
75+ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
76+ visual = vis[i].visual;
77+ break;
78+ }
79+ }
80+
81+ XFree(vis);
82+
83+ if (! visual) {
84+ fprintf(stderr, "Couldn't find ARGB visual.\n");
85+ exit(1);
86+ }
87+
88+ cmap = XCreateColormap( dpy, root, visual, None);
89 dc.norm[ColBG] = getcolor(normbgcolor);
90 dc.norm[ColFG] = getcolor(normfgcolor);
91 dc.sel[ColBG] = getcolor(selbgcolor);
92 dc.sel[ColFG] = getcolor(selfgcolor);
93 dc.urg[ColBG] = getcolor(urgbgcolor);
94 dc.urg[ColFG] = getcolor(urgfgcolor);
95- dc.drawable = XCreatePixmap(dpy, root, ww, wh,
96- DefaultDepth(dpy, screen));
97- dc.gc = XCreateGC(dpy, root, 0, 0);
98
99- win = XCreateSimpleWindow(dpy, root, wx, wy, ww, wh, 0,
100- dc.norm[ColFG].pixel, dc.norm[ColBG].pixel);
101+ XSetWindowAttributes attrs;
102+ attrs.background_pixel = dc.norm[ColBG].pixel;
103+ attrs.border_pixel = dc.norm[ColFG].pixel;
104+ attrs.bit_gravity = NorthWestGravity;
105+ attrs.event_mask = FocusChangeMask | KeyPressMask
106+ | ExposureMask | VisibilityChangeMask | StructureNotifyMask
107+ | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
108+ attrs.background_pixmap = None ;
109+ attrs.colormap = cmap;
110+
111+ win = XCreateWindow(dpy, root, wx, wy,
112+ ww, wh, 0, 32, InputOutput,
113+ visual, CWBackPixmap | CWBorderPixel | CWBitGravity
114+ | CWEventMask | CWColormap, &attrs);
115+
116+ dc.drawable = XCreatePixmap(dpy, win, ww, wh,
117+ 32);
118+ dc.gc = XCreateGC(dpy, dc.drawable, 0, 0);
119+
120 XMapRaised(dpy, win);
121 XSelectInput(dpy, win, SubstructureNotifyMask | FocusChangeMask |
122 ButtonPressMask | ExposureMask | KeyPressMask |
diff --git a/patches/tabbed-autohide-0.6.diff b/patches/tabbed-autohide-0.6.diff
new file mode 100644
index 0000000..fd641b4
--- /dev/null
+++ b/patches/tabbed-autohide-0.6.diff
@@ -0,0 +1,50 @@
1diff --git a/tabbed.c b/tabbed.c
2index ff3ada0..c41db0c 100644
3--- a/tabbed.c
4+++ b/tabbed.c
5@@ -152,7 +152,7 @@ static void (*handler[LASTEvent]) (const XEvent *) = {
6 [MapRequest] = maprequest,
7 [PropertyNotify] = propertynotify,
8 };
9-static int bh, wx, wy, ww, wh;
10+static int bh, wx, wy, ww, wh, vbh;
11 static unsigned int numlockmask = 0;
12 static Bool running = True, nextfocus, doinitspawn = True,
13 fillagain = False, closelastclient = False;
14@@ -307,6 +307,6 @@ void
15 drawbar(void) {
16 unsigned long *col;
17- int c, fc, width, n = 0;
18+ int c, fc, width, n = 0, nbh, i;
19 char *name = NULL;
20
21 if (nclients == 0) {
22@@ -314,10 +314,19 @@ drawbar(void)
23 dc.w = ww;
24 XFetchName(dpy, win, &name);
25 drawtext(name ? name : "", dc.norm);
26- XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, ww, bh, 0, 0);
27+ XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, ww, vbh, 0, 0);
28 XSync(dpy, False);
29
30 return;
31 }
32
33+ nbh = nclients > 1 ? vbh : 0;
34+ if (bh != nbh) {
35+ bh = nbh;
36+ for (i = 0; i < nclients; i++)
37+ XMoveResizeWindow(dpy, clients[i]->win, 0, bh, ww, wh - bh);
38+ }
39+ if (bh == 0)
40+ return;
41+
42 width = ww;
43@@ -920,6 +929,6 @@ setup(void)
44 screen = DefaultScreen(dpy);
45 root = RootWindow(dpy, screen);
46 initfont(font);
47- bh = dc.h = dc.font.height + 2;
48+ vbh = dc.h = dc.font.height + 2;
49
50 /* init atoms */
diff --git a/patches/tabbed-bar-height-0.6.diff b/patches/tabbed-bar-height-0.6.diff
new file mode 100644
index 0000000..fddcb28
--- /dev/null
+++ b/patches/tabbed-bar-height-0.6.diff
@@ -0,0 +1,24 @@
1diff --color -up tabbed-0.6-clean/config.def.h tabbed-0.6-modified/config.def.h
2--- tabbed-0.6-clean/config.def.h 2014-01-21 10:22:03.000000000 -0800
3+++ tabbed-0.6-modified/config.def.h 2021-03-30 20:23:45.752478278 -0700
4@@ -10,7 +10,7 @@ static const char before[] = "<";
5 static const char after[] = ">";
6 static const int tabwidth = 200;
7 static const Bool foreground = True;
8-
9+static const int barHeight = 24;
10 /*
11 * Where to place a new tab when it is opened. When npisrelative is True,
12 * then the current position is changed + newposition. If npisrelative
13diff --color -up tabbed-0.6-clean/tabbed.c tabbed-0.6-modified/tabbed.c
14--- tabbed-0.6-clean/tabbed.c 2014-01-21 10:22:03.000000000 -0800
15+++ tabbed-0.6-modified/tabbed.c 2021-03-30 20:24:23.712477426 -0700
16@@ -920,7 +920,7 @@ setup(void) {
17 screen = DefaultScreen(dpy);
18 root = RootWindow(dpy, screen);
19 initfont(font);
20- bh = dc.h = dc.font.height + 2;
21+ bh = dc.h = barHeight;
22
23 /* init atoms */
24 wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
diff --git a/patches/tabbed-clientnumber-0.6.diff b/patches/tabbed-clientnumber-0.6.diff
new file mode 100644
index 0000000..430245c
--- /dev/null
+++ b/patches/tabbed-clientnumber-0.6.diff
@@ -0,0 +1,23 @@
1diff --git a/tabbed.c b/tabbed.c
2index d30206b..70642cb 100644
3--- a/tabbed.c
4+++ b/tabbed.c
5@@ -308,6 +308,7 @@ drawbar(void) {
6 unsigned long *col;
7 int c, fc, width, n = 0;
8 char *name = NULL;
9+ char tabtitle[256];
10
11 if(nclients == 0) {
12 dc.x = 0;
13@@ -353,7 +354,9 @@ drawbar(void) {
14 } else {
15 col = dc.norm;
16 }
17- drawtext(clients[c]->name, col);
18+ snprintf(tabtitle, sizeof(tabtitle), "%d: %s",
19+ c + 1, clients[c]->name);
20+ drawtext(tabtitle, col);
21 dc.x += dc.w;
22 clients[c]->tabx = dc.x;
23 }
diff --git a/patches/tabbed-xresources-20210317-dabf6a2.diff b/patches/tabbed-xresources-20210317-dabf6a2.diff
new file mode 100644
index 0000000..15610a7
--- /dev/null
+++ b/patches/tabbed-xresources-20210317-dabf6a2.diff
@@ -0,0 +1,178 @@
1From 8c48f1564c555bbd21758a3a70a9984e61c34a35 Mon Sep 17 00:00:00 2001
2From: 6d6f7274686f6e <4648531+6d6f7274686f6e@users.noreply.github.com>
3Date: Wed, 17 Mar 2021 10:59:18 +0100
4Subject: [PATCH] xresources support
5
6---
7 config.def.h | 27 ++++++++++++++------
8 tabbed.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++
9 2 files changed, 89 insertions(+), 7 deletions(-)
10
11diff --git a/config.def.h b/config.def.h
12index defa426..244e288 100644
13--- a/config.def.h
14+++ b/config.def.h
15@@ -1,13 +1,13 @@
16 /* See LICENSE file for copyright and license details. */
17
18 /* appearance */
19-static const char font[] = "monospace:size=9";
20-static const char* normbgcolor = "#222222";
21-static const char* normfgcolor = "#cccccc";
22-static const char* selbgcolor = "#555555";
23-static const char* selfgcolor = "#ffffff";
24-static const char* urgbgcolor = "#111111";
25-static const char* urgfgcolor = "#cc0000";
26+static char font[] = "monospace:size=9";
27+static char* normbgcolor = "#222222";
28+static char* normfgcolor = "#cccccc";
29+static char* selbgcolor = "#555555";
30+static char* selfgcolor = "#ffffff";
31+static char* urgbgcolor = "#111111";
32+static char* urgfgcolor = "#cc0000";
33 static const char before[] = "<";
34 static const char after[] = ">";
35 static const char titletrim[] = "...";
36@@ -33,6 +33,19 @@ static Bool npisrelative = False;
37 } \
38 }
39
40+/*
41+ * Xresources preferences to load at startup
42+ */
43+ResourcePref resources[] = {
44+ { "font", STRING, &font },
45+ { "color0", STRING, &normbgcolor },
46+ { "color4", STRING, &normfgcolor },
47+ { "color4", STRING, &selbgcolor },
48+ { "color7", STRING, &selfgcolor },
49+ { "color2", STRING, &urgbgcolor },
50+ { "color3", STRING, &urgfgcolor },
51+};
52+
53 #define MODKEY ControlMask
54 static Key keys[] = {
55 /* modifier key function argument */
56diff --git a/tabbed.c b/tabbed.c
57index eafe28a..c5bffc7 100644
58--- a/tabbed.c
59+++ b/tabbed.c
60@@ -13,6 +13,7 @@
61 #include <X11/Xatom.h>
62 #include <X11/Xlib.h>
63 #include <X11/Xproto.h>
64+#include <X11/Xresource.h>
65 #include <X11/Xutil.h>
66 #include <X11/XKBlib.h>
67 #include <X11/Xft/Xft.h>
68@@ -85,11 +86,26 @@ typedef struct {
69 Bool urgent;
70 Bool closed;
71 } Client;
72+
73+/* Xresources preferences */
74+enum resource_type {
75+ STRING = 0,
76+ INTEGER = 1,
77+ FLOAT = 2
78+};
79+
80+typedef struct {
81+ char *name;
82+ enum resource_type type;
83+ void *dst;
84+} ResourcePref;
85+
86
87 /* function declarations */
88 static void buttonpress(const XEvent *e);
89 static void cleanup(void);
90 static void clientmessage(const XEvent *e);
91+static void config_init(void);
92 static void configurenotify(const XEvent *e);
93 static void configurerequest(const XEvent *e);
94 static void createnotify(const XEvent *e);
95@@ -120,6 +136,7 @@ static void move(const Arg *arg);
96 static void movetab(const Arg *arg);
97 static void propertynotify(const XEvent *e);
98 static void resize(int c, int w, int h);
99+static int resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst);
100 static void rotate(const Arg *arg);
101 static void run(void);
102 static void sendxembed(int c, long msg, long detail, long d1, long d2);
103@@ -245,6 +262,23 @@ clientmessage(const XEvent *e)
104 }
105 }
106
107+void
108+config_init(void)
109+{
110+ char *resm;
111+ XrmDatabase db;
112+ ResourcePref *p;
113+
114+ XrmInitialize();
115+ resm = XResourceManagerString(dpy);
116+ if (!resm)
117+ return;
118+
119+ db = XrmGetStringDatabase(resm);
120+ for (p = resources; p < resources + LENGTH(resources); p++)
121+ resource_load(db, p->name, p->type, p->dst);
122+}
123+
124 void
125 configurenotify(const XEvent *e)
126 {
127@@ -897,6 +931,40 @@ resize(int c, int w, int h)
128 (XEvent *)&ce);
129 }
130
131+int
132+resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst)
133+{
134+ char **sdst = dst;
135+ int *idst = dst;
136+ float *fdst = dst;
137+
138+ char fullname[256];
139+ char fullclass[256];
140+ char *type;
141+ XrmValue ret;
142+
143+ snprintf(fullname, sizeof(fullname), "%s.%s", "tabbed", name);
144+ snprintf(fullclass, sizeof(fullclass), "%s.%s", "tabbed", name);
145+ fullname[sizeof(fullname) - 1] = fullclass[sizeof(fullclass) - 1] = '\0';
146+
147+ XrmGetResource(db, fullname, fullclass, &type, &ret);
148+ if (ret.addr == NULL || strncmp("String", type, 64))
149+ return 1;
150+
151+ switch (rtype) {
152+ case STRING:
153+ *sdst = ret.addr;
154+ break;
155+ case INTEGER:
156+ *idst = strtoul(ret.addr, NULL, 10);
157+ break;
158+ case FLOAT:
159+ *fdst = strtof(ret.addr, NULL);
160+ break;
161+ }
162+ return 0;
163+}
164+
165 void
166 rotate(const Arg *arg)
167 {
168@@ -1354,6 +1422,7 @@ main(int argc, char *argv[])
169 if (!(dpy = XOpenDisplay(NULL)))
170 die("%s: cannot open display\n", argv0);
171
172+ config_init();
173 setup();
174 printf("0x%lx\n", win);
175 fflush(NULL);
176--
1772.30.2
178