commit 5e0efae3326c6e4fbc545cab16d5b8fb8678f239
Author: Giygas <none>
Date: Wed, 6 Nov 2024 11:45:27 +0100
Initial commit
Diffstat:
4 files changed, 439 insertions(+), 0 deletions(-)
diff --git a/README b/README
@@ -0,0 +1,13 @@
+My collection of acme patches.
+Patching plan9port-20240109p0
+
+Done:
+- colours
+
+To do:
+A lot...
+- Modified makefile that copies and patches the local plan9 source
+- Minor keyboard tweaks
+- Double-click, triple-click semantics
+
+Special shout-out to https://github.com/karahobny/acme2k
diff --git a/patch-acme3k b/patch-acme3k
@@ -0,0 +1,408 @@
+diff -u a/src/cmd/acme/acme.c b/src/cmd/acme/acme.c
+--- a/src/cmd/acme/acme.c Wed Nov 6 11:26:32 2024
++++ b/src/cmd/acme/acme.c Wed Nov 6 11:24:49 2024
+@@ -11,6 +11,7 @@
+ #include <libsec.h>
+ #include "dat.h"
+ #include "fns.h"
++#include "config.h"
+ /* for generating syms in mkfile only: */
+ #include <bio.h>
+ #include "edit.h"
+@@ -547,7 +548,7 @@
+ case MResize:
+ if(getwindow(display, Refnone) < 0)
+ error("attach to window");
+- draw(screen, screen->r, display->white, nil, ZP);
++ draw(screen, screen->r, framecols[BACK], nil, ZP);
+ iconinit();
+ scrlresize();
+ rowresize(&row, screen->clipr);
+@@ -1039,19 +1040,27 @@
+ Image *tmp;
+
+ if(tagcols[BACK] == nil) {
+- /* Blue */
+- tagcols[BACK] = allocimagemix(display, DPalebluegreen, DWhite);
+- tagcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPalegreygreen);
+- tagcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPurpleblue);
+- tagcols[TEXT] = display->black;
+- tagcols[HTEXT] = display->black;
++ tagcols[BACK] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, taghexcols[BACK]);
++ tagcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, taghexcols[HIGH]);
++ tagcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, taghexcols[BORD]);
++ tagcols[TEXT] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, taghexcols[TEXT]);
++ tagcols[HTEXT] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, taghexcols[HTEXT]);
+
+- /* Yellow */
+- textcols[BACK] = allocimagemix(display, DPaleyellow, DWhite);
+- textcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DDarkyellow);
+- textcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DYellowgreen);
+- textcols[TEXT] = display->black;
+- textcols[HTEXT] = display->black;
++ textcols[BACK] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, texthexcols[BACK]);
++ textcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, texthexcols[HIGH]);
++ textcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, texthexcols[BORD]);
++ textcols[TEXT] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, texthexcols[TEXT]);
++ textcols[HTEXT] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, texthexcols[HTEXT]);
++
++ framecols[BACK] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, framehexcols[BACK]);
++ framecols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, framehexcols[BORD]);
++ framecols[TEXT] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, framehexcols[TEXT]);
++
++ button2cols[BACK] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, button2hexcols[BACK]);
++ button2cols[TEXT] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, button2hexcols[TEXT]);
++
++ button3cols[BACK] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, button3hexcols[BACK]);
++ button3cols[TEXT] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, button3hexcols[TEXT]);
+ }
+
+ r = Rect(0, 0, Scrollwid, font->height+1);
+@@ -1066,22 +1075,19 @@
+
+ button = allocimage(display, r, screen->chan, 0, DNofill);
+ draw(button, r, tagcols[BACK], nil, r.min);
+- border(button, r, ButtonBorder, tagcols[BORD], ZP);
++ border(button, r, ButtonBorder, framecols[TEXT], ZP);
+
+ r = button->r;
+ modbutton = allocimage(display, r, screen->chan, 0, DNofill);
+ draw(modbutton, r, tagcols[BACK], nil, r.min);
+- border(modbutton, r, ButtonBorder, tagcols[BORD], ZP);
++ border(modbutton, r, ButtonBorder, framecols[TEXT], ZP);
+ r = insetrect(r, ButtonBorder);
+- tmp = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DMedblue);
++ tmp = allocimage(display, Rect(0,0,1,1), screen->chan, 1, framehexcols[HIGH]);
+ draw(modbutton, r, tmp, nil, ZP);
+ freeimage(tmp);
+
+ r = button->r;
+- colbutton = allocimage(display, r, screen->chan, 0, DPurpleblue);
+-
+- but2col = allocimage(display, r, screen->chan, 1, 0xAA0000FF);
+- but3col = allocimage(display, r, screen->chan, 1, 0x006600FF);
++ colbutton = allocimage(display, r, screen->chan, 0, framehexcols[HTEXT]);
+ }
+
+ /*
+diff -u a/src/cmd/acme/cols.c b/src/cmd/acme/cols.c
+--- a/src/cmd/acme/cols.c Wed Nov 6 11:26:32 2024
++++ b/src/cmd/acme/cols.c Wed Nov 6 11:24:49 2024
+@@ -29,7 +29,7 @@
+ Rectangle r1;
+ Text *t;
+
+- draw(screen, r, display->white, nil, ZP);
++ draw(screen, r, framecols[BACK], nil, ZP);
+ c->r = r;
+ c->w = nil;
+ c->nw = 0;
+@@ -42,7 +42,7 @@
+ t->what = Columntag;
+ r1.min.y = r1.max.y;
+ r1.max.y += Border;
+- draw(screen, r1, display->black, nil, ZP);
++ draw(screen, r1, framecols[BORD], nil, ZP);
+ textinsert(t, 0, Lheader, 38, TRUE);
+ textsetselect(t, t->file->b.nc, t->file->b.nc);
+ draw(screen, t->scrollr, colbutton, nil, colbutton->r.min);
+@@ -117,7 +117,7 @@
+ r1.max.y = min(y, v->body.fr.r.min.y+v->body.fr.nlines*v->body.fr.font->height);
+ r1.min.y = winresize(v, r1, FALSE, FALSE);
+ r1.max.y = r1.min.y+Border;
+- draw(screen, r1, display->black, nil, ZP);
++ draw(screen, r1, framecols[BORD], nil, ZP);
+
+ /*
+ * leave r with w's coordinates
+@@ -184,7 +184,7 @@
+ memmove(c->w+i, c->w+i+1, (c->nw-i)*sizeof(Window*));
+ c->w = realloc(c->w, c->nw*sizeof(Window*));
+ if(c->nw == 0){
+- draw(screen, r, display->white, nil, ZP);
++ draw(screen, r, framecols[BACK], nil, ZP);
+ return;
+ }
+ up = 0;
+@@ -246,7 +246,7 @@
+ draw(screen, c->tag.scrollr, colbutton, nil, colbutton->r.min);
+ r1.min.y = r1.max.y;
+ r1.max.y += Border;
+- draw(screen, r1, display->black, nil, ZP);
++ draw(screen, r1, framecols[BORD], nil, ZP);
+ r1.max.y = r.max.y;
+ new = Dy(r) - c->nw*(Border + font->height);
+ old = Dy(c->r) - c->nw*(Border + font->height);
+@@ -264,7 +264,7 @@
+ r1.max.y = max(r1.max.y, r1.min.y + Border+font->height);
+ r2 = r1;
+ r2.max.y = r2.min.y+Border;
+- draw(screen, r2, display->black, nil, ZP);
++ draw(screen, r2, framecols[BORD], nil, ZP);
+ r1.min.y = r2.max.y;
+ r1.min.y = winresize(w, r1, FALSE, i==c->nw-1);
+ }
+@@ -320,7 +320,7 @@
+ r.max.y = r.min.y+Dy(w->r)+Border;
+ r1 = r;
+ r1.max.y = r1.min.y+Border;
+- draw(screen, r1, display->black, nil, ZP);
++ draw(screen, r1, framecols[BORD], nil, ZP);
+ r.min.y = r1.max.y;
+ y = winresize(w, r, FALSE, i==c->nw-1);
+ }
+@@ -418,7 +418,7 @@
+ r.max.y += 1 + nl[j]*v->body.fr.font->height;
+ r.min.y = winresize(v, r, c->safe, FALSE);
+ r.max.y = r.min.y + Border;
+- draw(screen, r, display->black, nil, ZP);
++ draw(screen, r, framecols[BORD], nil, ZP);
+ y1 = r.max.y;
+ }
+ /* scan to see new size of everyone below */
+@@ -445,7 +445,7 @@
+ if(i < c->nw-1){
+ r.min.y = r.max.y;
+ r.max.y += Border;
+- draw(screen, r, display->black, nil, ZP);
++ draw(screen, r, framecols[BORD], nil, ZP);
+ for(j=i+1; j<c->nw; j++)
+ ny[j] -= (y2-r.max.y);
+ }
+@@ -462,7 +462,7 @@
+ if(j < c->nw-1){ /* no border on last window */
+ r.min.y = y1;
+ r.max.y += Border;
+- draw(screen, r, display->black, nil, ZP);
++ draw(screen, r, framecols[BORD], nil, ZP);
+ y1 = r.max.y;
+ }
+ }
+@@ -544,7 +544,7 @@
+ }
+ r.min.y = winresize(v, r, c->safe, FALSE);
+ r.max.y = r.min.y+Border;
+- draw(screen, r, display->black, nil, ZP);
++ draw(screen, r, framecols[BORD], nil, ZP);
+ r.min.y = r.max.y;
+ if(i == c->nw-1)
+ r.max.y = c->r.max.y;
+diff -u a/src/cmd/acme/dat.h b/src/cmd/acme/dat.h
+--- a/src/cmd/acme/dat.h Wed Nov 6 11:26:32 2024
++++ b/src/cmd/acme/dat.h Wed Nov 6 11:24:49 2024
+@@ -222,7 +222,7 @@
+ void textscroll(Text*, int);
+ void textselect(Text*);
+ int textselect2(Text*, uint*, uint*, Text**);
+-int textselect23(Text*, uint*, uint*, Image*, int);
++int textselect23(Text*, uint*, uint*, Image*, Image*, int);
+ int textselect3(Text*, uint*, uint*);
+ void textsetorigin(Text*, uint, int);
+ void textsetselect(Text*, uint, uint);
+@@ -522,8 +522,6 @@
+ Image *modbutton;
+ Image *colbutton;
+ Image *button;
+-Image *but2col;
+-Image *but3col;
+ Cursor boxcursor;
+ Cursor2 boxcursor2;
+ Row row;
+@@ -548,6 +546,9 @@
+ char *fontnames[2];
+ Image *tagcols[NCOL];
+ Image *textcols[NCOL];
++Image *framecols[NCOL];
++Image *button2cols[NCOL];
++Image *button3cols[NCOL];
+ extern char wdir[]; /* must use extern because no dimension given */
+ int editing;
+ int erroutfd;
+Common subdirectories: a/src/cmd/acme/mail and b/src/cmd/acme/mail
+diff -u a/src/cmd/acme/rows.c b/src/cmd/acme/rows.c
+--- a/src/cmd/acme/rows.c Wed Nov 6 11:26:32 2024
++++ b/src/cmd/acme/rows.c Wed Nov 6 11:24:49 2024
+@@ -28,7 +28,7 @@
+ Rectangle r1;
+ Text *t;
+
+- draw(screen, r, display->white, nil, ZP);
++ draw(screen, r, framecols[BACK], nil, ZP);
+ row->r = r;
+ row->col = nil;
+ row->ncol = 0;
+@@ -42,7 +42,7 @@
+ t->col = nil;
+ r1.min.y = r1.max.y;
+ r1.max.y += Border;
+- draw(screen, r1, display->black, nil, ZP);
++ draw(screen, r1, framecols[BORD], nil, ZP);
+ textinsert(t, 0, Lcolhdr, 29, TRUE);
+ textsetselect(t, t->file->b.nc, t->file->b.nc);
+ }
+@@ -73,7 +73,7 @@
+ r = d->r;
+ if(Dx(r) < 100)
+ return nil;
+- draw(screen, r, display->white, nil, ZP);
++ draw(screen, r, framecols[BACK], nil, ZP);
+ r1 = r;
+ r1.max.x = min(x-Border, r.max.x-50);
+ if(Dx(r1) < 50)
+@@ -81,7 +81,7 @@
+ colresize(d, r1);
+ r1.min.x = r1.max.x;
+ r1.max.x = r1.min.x+Border;
+- draw(screen, r1, display->black, nil, ZP);
++ draw(screen, r1, framecols[BORD], nil, ZP);
+ r.min.x = r1.max.x;
+ }
+ if(c == nil){
+@@ -115,7 +115,7 @@
+ textresize(&row->tag, r1, TRUE);
+ r1.min.y = r1.max.y;
+ r1.max.y += Border;
+- draw(screen, r1, display->black, nil, ZP);
++ draw(screen, r1, framecols[BORD], nil, ZP);
+ r.min.y = r1.max.y;
+ r1 = r;
+ r1.max.x = r1.min.x;
+@@ -130,7 +130,7 @@
+ if(i > 0){
+ r2 = r1;
+ r2.max.x = r2.min.x+Border;
+- draw(screen, r2, display->black, nil, ZP);
++ draw(screen, r2, framecols[BORD], nil, ZP);
+ r1.min.x = r2.max.x;
+ }
+ colresize(c, r1);
+@@ -191,14 +191,14 @@
+ p.x = c->r.max.x-80-Scrollwid;
+ r = d->r;
+ r.max.x = c->r.max.x;
+- draw(screen, r, display->white, nil, ZP);
++ draw(screen, r, framecols[BACK], nil, ZP);
+ r.max.x = p.x;
+ colresize(d, r);
+ r = c->r;
+ r.min.x = p.x;
+ r.max.x = r.min.x;
+ r.max.x += Border;
+- draw(screen, r, display->black, nil, ZP);
++ draw(screen, r, framecols[BORD], nil, ZP);
+ r.min.x = r.max.x;
+ r.max.x = c->r.max.x;
+ colresize(c, r);
+@@ -223,7 +223,7 @@
+ memmove(row->col+i, row->col+i+1, (row->ncol-i)*sizeof(Column*));
+ row->col = realloc(row->col, row->ncol*sizeof(Column*));
+ if(row->ncol == 0){
+- draw(screen, r, display->white, nil, ZP);
++ draw(screen, r, framecols[BACK], nil, ZP);
+ return;
+ }
+ if(i == row->ncol){ /* extend last column right */
+@@ -234,7 +234,7 @@
+ c = row->col[i];
+ r.max.x = c->r.max.x;
+ }
+- draw(screen, r, display->white, nil, ZP);
++ draw(screen, r, framecols[BACK], nil, ZP);
+ colresize(c, r);
+ }
+
+@@ -601,12 +601,12 @@
+ r2.min.x = x;
+ if(Dx(r1) < 50 || Dx(r2) < 50)
+ continue;
+- draw(screen, Rpt(r1.min, r2.max), display->white, nil, ZP);
++ draw(screen, Rpt(r1.min, r2.max), framecols[BACK], nil, ZP);
+ colresize(c1, r1);
+ colresize(c2, r2);
+ r2.min.x = x-Border;
+ r2.max.x = x;
+- draw(screen, r2, display->black, nil, ZP);
++ draw(screen, r2, framecols[BORD], nil, ZP);
+ }
+ if(i >= row->ncol)
+ rowadd(row, nil, x);
+diff -u a/src/cmd/acme/text.c b/src/cmd/acme/text.c
+--- a/src/cmd/acme/text.c Wed Nov 6 11:26:32 2024
++++ b/src/cmd/acme/text.c Wed Nov 6 11:24:49 2024
+@@ -1258,7 +1258,7 @@
+ };
+
+ uint
+-xselect(Frame *f, Mousectl *mc, Image *col, uint *p1p) /* when called, button is down */
++xselect(Frame *f, Mousectl *mc, Image *bgcol, Image *fgcol, uint *p1p) /* when called, button is down */
+ {
+ uint p0, p1, q, tmp;
+ ulong msec;
+@@ -1291,12 +1291,12 @@
+ pt1 = pt0;
+ reg = region(q, p0);
+ if(reg == 0)
+- frdrawsel0(f, pt0, p0, p1, col, display->white);
++ frdrawsel0(f, pt0, p0, p1, bgcol, fgcol);
+ }
+ qt = frptofchar(f, q);
+ if(reg > 0){
+ if(q > p1)
+- frdrawsel0(f, pt1, p1, q, col, display->white);
++ frdrawsel0(f, pt1, p1, q, bgcol, fgcol);
+
+ else if(q < p1)
+ selrestore(f, qt, q, p1);
+@@ -1304,7 +1304,7 @@
+ if(q > p1)
+ selrestore(f, pt1, p1, q);
+ else
+- frdrawsel0(f, qt, q, p1, col, display->white);
++ frdrawsel0(f, qt, q, p1, bgcol, fgcol);
+ }
+ p1 = q;
+ pt1 = qt;
+@@ -1341,12 +1341,12 @@
+ }
+
+ int
+-textselect23(Text *t, uint *q0, uint *q1, Image *high, int mask)
++textselect23(Text *t, uint *q0, uint *q1, Image *bgcol, Image *fgcol, int mask)
+ {
+ uint p0, p1;
+ int buts;
+
+- p0 = xselect(&t->fr, mousectl, high, &p1);
++ p0 = xselect(&t->fr, mousectl, bgcol, fgcol, &p1);
+ buts = mousectl->m.buttons;
+ if((buts & mask) == 0){
+ *q0 = p0+t->org;
+@@ -1364,7 +1364,7 @@
+ int buts;
+
+ *tp = nil;
+- buts = textselect23(t, q0, q1, but2col, 4);
++ buts = textselect23(t, q0, q1, button2cols[BACK], button2cols[TEXT], 4);
+ if(buts & 4)
+ return 0;
+ if(buts & 1){ /* pick up argument */
+@@ -1379,7 +1379,7 @@
+ {
+ int h;
+
+- h = (textselect23(t, q0, q1, but3col, 1|2) == 0);
++ h = (textselect23(t, q0, q1, button3cols[BACK], button3cols[TEXT], 1|2) == 0);
+ return h;
+ }
+
+diff -u a/src/cmd/acme/wind.c b/src/cmd/acme/wind.c
+--- a/src/cmd/acme/wind.c Wed Nov 6 11:26:32 2024
++++ b/src/cmd/acme/wind.c Wed Nov 6 11:24:49 2024
+@@ -235,7 +235,6 @@
+ r1.min.y = min(y, r.max.y);
+ r1.max.y = r.max.y;
+ }else{
+- draw(screen, r1, textcols[BACK], nil, ZP);
+ r1.min.y = y;
+ r1.max.y = y;
+ }
diff --git a/schemes/girlpoison.h b/schemes/girlpoison.h
@@ -0,0 +1,9 @@
+ /* BACK HIGH BORD TEXT HTEXT */
+static const int taghexcols[] = { 0x000000FF, 0xF855B1FF, 0xF855B1FF, 0xF855B1FF, 0x000000FF };
+static const int texthexcols[] = { 0x000000FF, 0xF855B1FF, 0xF855B1FF, 0xF855B1FF, 0x000000FF };
+ /* BACK HIGH BORD TEXT HTEXT */
+ /* (dirty marker) (row button) (column button) */
+static const int framehexcols[] = { 0x000000FF, 0xFBAAD1FF, 0xF855B1FF, 0xF855B1FF, 0xF855B1FF };
+ /* BACK .. TEXT */
+static const int button2hexcols[] = { 0xFBAAD1FF, 0, 0, 0x000000FF, 0 };
+static const int button3hexcols[] = { 0xFFFFFFFF, 0, 0, 0xF855B1FF, 0 };
diff --git a/schemes/monochrome.h b/schemes/monochrome.h
@@ -0,0 +1,9 @@
+ /* BACK HIGH BORD TEXT HTEXT */
+static const int taghexcols[] = { 0xFFFFFFFF, 0x000000FF, 0x000000FF, 0x000000FF, 0xFFFFFFFF };
+static const int texthexcols[] = { 0xFFFFFFFF, 0x000000FF, 0x000000FF, 0x000000FF, 0xFFFFFFFF };
+ /* BACK HIGH BORD TEXT HTEXT */
+ /* (dirty marker) (row button) (column button) */
+static const int framehexcols[] = { 0xFFFFFFFF, 0x000000FF, 0x000000FF, 0xFFFFFFFF, 0x000000FF };
+ /* BACK .. TEXT */
+static const int button2hexcols[] = { 0xFF0000FF, 0, 0, 0xFFFFFFFF, 0 };
+static const int button3hexcols[] = { 0x00FF00FF, 0, 0, 0xFFFFFFFF, 0 };