X-Original-To: alpine-aports@lists.alpinelinux.org Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) by lists.alpinelinux.org (Postfix) with ESMTP id E14A2F84F31 for ; Mon, 11 Mar 2019 18:37:10 +0000 (UTC) Received: by sdaoden.eu (Postfix, from userid 1000) id 93E5E1604A; Mon, 11 Mar 2019 19:37:09 +0100 (CET) Date: Mon, 11 Mar 2019 19:37:45 +0100 From: Steffen Nurpmeso To: alpine-aports@lists.alpinelinux.org Subject: [alpine-aports] [PATCH] testing/st-xrdb: new aport (based on main/st, with XRDB support) Message-ID: <624f35379c854dec233bfc17b7951e2b80944734.1552329465.git.steffen@sdaoden.eu> Mail-Followup-To: alpine-aports@lists.alpinelinux.org User-Agent: s-nail v14.9.13-dirty OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. Date: Mon, 11 Mar 2019 19:31:34 +0100 X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --- testing/st-xrdb/APKBUILD | 36 ++++++ testing/st-xrdb/st-xrdb.patch | 209 ++++++++++++++++++++++++++++++++++ 2 files changed, 245 insertions(+) create mode 100644 testing/st-xrdb/APKBUILD create mode 100644 testing/st-xrdb/st-xrdb.patch diff --git a/testing/st-xrdb/APKBUILD b/testing/st-xrdb/APKBUILD new file mode 100644 index 0000000..95239d8 --- /dev/null +++ b/testing/st-xrdb/APKBUILD @@ -0,0 +1,36 @@ +# Base-Contributor: S=C3=B6ren Tempel +# Base-Maintainer: Natanael Copa +# Maintainer: Steffen Nurpmeso +pkgname=3Dst-xrdb +pkgname_base=3Dst +pkgver=3D0.8.2 +pkgrel=3D0 +pkgdesc=3D"Simple terminal emulator for X, with X resource support" +url=3D"https://st.suckless.org" +arch=3D"all" +license=3D"MIT" +depends=3D"ncurses-terminfo" +makedepends=3D"fontconfig-dev freetype-dev libx11-dev libxext-dev libxft-d= ev" +subpackages=3D"$pkgname-doc $pkgname-dbg" +source=3D"https://dl.suckless.org/$pkgname_base/$pkgname_base-$pkgver.tar.= gz st-xrdb.patch" +options=3D"!check" +builddir=3D"$srcdir/$pkgname_base-$pkgver" + +prepare() { + default_prepare + cd "$builddir" + sed -i '/tic/d' Makefile +} + +build() { + make -C "$builddir" +} + +package() { + cd "$builddir" + + make install PREFIX=3D/usr DESTDIR=3D"$pkgdir" +} + +sha512sums=3D"eaaf5f2fe050ee768d16a9c8c295ba13315775b3a8a3201e020237a3dd21= 7bfb811832d58477249000596289a6cb3287fbb39d6327fc90986af1c363e4b5bf8d st-0.= 8.2.tar.gz +1b21e819d187eb186f940d92dd9055de5259bf18bc9c798b10884fde949ff3ab6b9ecf428c= 85ccd0bc0e20ddf42cc9d015535b36deb839a616d25ae2a047fe27 st-xrdb.patch" diff --git a/testing/st-xrdb/st-xrdb.patch b/testing/st-xrdb/st-xrdb.patch new file mode 100644 index 0000000..f953028 --- /dev/null +++ b/testing/st-xrdb/st-xrdb.patch @@ -0,0 +1,209 @@ +diff --git a/config.def.h b/config.def.h +index 0e01717..6a33ef7 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -60,7 +60,7 @@ static unsigned int cursorthickness =3D 2; + * bell volume. It must be a value between -100 and 100. Use 0 for disabl= ing + * it + */ +-static int bellvolume =3D 0; ++static int bellvolume =3D 100; +=20 + /* default TERM value */ + char *termname =3D "st-256color"; +@@ -109,6 +109,8 @@ static const char *colorname[] =3D { + /* more colors can be added after 255 to use with DefaultXX */ + "#cccccc", + "#555555", ++ "gray90", ++ "black" + }; +=20 +=20 +@@ -116,8 +118,8 @@ static const char *colorname[] =3D { + * Default colors (colorname index) + * foreground, background, cursor, reverse cursor + */ +-unsigned int defaultfg =3D 7; +-unsigned int defaultbg =3D 0; ++unsigned int defaultfg =3D 258; ++unsigned int defaultbg =3D 259; + static unsigned int defaultcs =3D 256; + static unsigned int defaultrcs =3D 257; +=20 +@@ -150,14 +152,51 @@ static unsigned int mousebg =3D 0; + */ + static unsigned int defaultattr =3D 11; +=20 ++/* ++ * Xresources preferences to load at startup ++ */ ++ResourcePref resources[] =3D { ++ { "font", STRING, &font }, ++ { "color0", STRING, &colorname[0] }, ++ { "color1", STRING, &colorname[1] }, ++ { "color2", STRING, &colorname[2] }, ++ { "color3", STRING, &colorname[3] }, ++ { "color4", STRING, &colorname[4] }, ++ { "color5", STRING, &colorname[5] }, ++ { "color6", STRING, &colorname[6] }, ++ { "color7", STRING, &colorname[7] }, ++ { "color8", STRING, &colorname[8] }, ++ { "color9", STRING, &colorname[9] }, ++ { "color10", STRING, &colorname[10] }, ++ { "color11", STRING, &colorname[11] }, ++ { "color12", STRING, &colorname[12] }, ++ { "color13", STRING, &colorname[13] }, ++ { "color14", STRING, &colorname[14] }, ++ { "color15", STRING, &colorname[15] }, ++ { "background", STRING, &colorname[259] }, ++ { "foreground", STRING, &colorname[258] }, ++ { "cursorColor", STRING, &colorname[256] }, ++ { "termname", STRING, &termname }, ++ { "shell", STRING, &shell }, ++ { "xfps", INTEGER, &xfps }, ++ { "actionfps", INTEGER, &actionfps }, ++ { "blinktimeout", INTEGER, &blinktimeout }, ++ { "bellvolume", INTEGER, &bellvolume }, ++ { "tabspaces", INTEGER, &tabspaces }, ++ { "cwscale", FLOAT, &cwscale }, ++ { "chscale", FLOAT, &chscale }, ++}; ++ + /* + * Internal mouse shortcuts. + * Beware that overloading Button1 will disable the selection. + */ + static MouseShortcut mshortcuts[] =3D { + /* button mask string */ ++ /* + { Button4, XK_ANY_MOD, "\031" }, + { Button5, XK_ANY_MOD, "\005" }, ++ */ + }; +=20 + /* Internal keyboard shortcuts. */ +diff --git a/x.c b/x.c +index 5828a3b..90f3614 100644 +--- a/x.c ++++ b/x.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include +=20 + static char *argv0; + #include "arg.h" +@@ -43,6 +44,19 @@ typedef struct { + signed char appcursor; /* application cursor */ + } Key; +=20 ++/* Xresources preferences */ ++enum resource_type { ++ STRING =3D 0, ++ INTEGER =3D 1, ++ FLOAT =3D 2 ++}; ++ ++typedef struct { ++ char *name; ++ enum resource_type type; ++ void *dst; ++} ResourcePref; ++ + /* X modifiers */ + #define XK_ANY_MOD UINT_MAX + #define XK_NO_MOD 0 +@@ -786,8 +800,8 @@ xclear(int x1, int y1, int x2, int y2) + void + xhints(void) + { +- XClassHint class =3D {opt_name ? opt_name : termname, +- opt_class ? opt_class : termname}; ++ XClassHint class =3D {opt_name ? opt_name : "st", ++ opt_class ? opt_class : "St"}; + XWMHints wm =3D {.flags =3D InputHint, .input =3D 1}; + XSizeHints *sizeh; +=20 +@@ -1045,8 +1059,6 @@ xinit(int cols, int rows) + pid_t thispid =3D getpid(); + XColor xmousefg, xmousebg; +=20 +- if (!(xw.dpy =3D XOpenDisplay(NULL))) +- die("can't open display\n"); + xw.scr =3D XDefaultScreen(xw.dpy); + xw.vis =3D XDefaultVisual(xw.dpy, xw.scr); +=20 +@@ -1901,6 +1913,59 @@ run(void) + } + } +=20 ++int ++resource_load(XrmDatabase db, char *name, enum resource_type rtype, void = *dst) ++{ ++ char **sdst =3D dst; ++ int *idst =3D dst; ++ float *fdst =3D dst; ++ ++ char fullname[256]; ++ char fullclass[256]; ++ char *type; ++ XrmValue ret; ++ ++ snprintf(fullname, sizeof(fullname), "%s.%s", ++ opt_name ? opt_name : "st", name); ++ snprintf(fullclass, sizeof(fullclass), "%s.%s", ++ opt_class ? opt_class : "St", name); ++ fullname[sizeof(fullname) - 1] =3D fullclass[sizeof(fullclass) - 1] =3D = '\0'; ++ ++ XrmGetResource(db, fullname, fullclass, &type, &ret); ++ if (ret.addr =3D=3D NULL || strncmp("String", type, 64)) ++ return 1; ++ ++ switch (rtype) { ++ case STRING: ++ *sdst =3D ret.addr; ++ break; ++ case INTEGER: ++ *idst =3D strtoul(ret.addr, NULL, 10); ++ break; ++ case FLOAT: ++ *fdst =3D strtof(ret.addr, NULL); ++ break; ++ } ++ return 0; ++} ++ ++void ++config_init(void) ++{ ++ char *resm; ++ XrmDatabase db; ++ ResourcePref *p; ++ ++ XrmInitialize(); ++ resm =3D XResourceManagerString(xw.dpy); ++ if (!resm) ++ return; ++ ++ db =3D XrmGetStringDatabase(resm); ++ for (p =3D resources; p < resources + LEN(resources); p++) ++ resource_load(db, p->name, p->type, p->dst); ++} ++ + void + usage(void) + { +@@ -1974,6 +2039,11 @@ run: +=20 + setlocale(LC_CTYPE, ""); + XSetLocaleModifiers(""); ++ ++ if(!(xw.dpy =3D XOpenDisplay(NULL))) ++ die("Can't open display\n"); ++ ++ config_init(); + cols =3D MAX(cols, 1); + rows =3D MAX(rows, 1); + tnew(cols, rows); --=20 2.21.0 --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---