On Thu, Nov 07, 2024 at 11:18:03AM +0000, stefan11111 wrote:
> On 2024-11-05 10:37, stefan11111 wrote:
> >
> > Looks like git st works.
>
> Looked into it a bit more, and it turns out that the reason it failed
> like that
> is not because of code from st, but because of the alpha patch for st.
>
> XftColorAllocName() fails(likely not implemented in tinyx), which kills
> st.
>
> Is there a way to get st to ignore/handle that error and not have it
> kill the app?
The alpha patch actually reverts the upstream fix. This part:
> @@ -1118,11 +1127,23 @@ xinit(int cols, int rows)
> Window parent;
> pid_t thispid = getpid();
> XColor xmousefg, xmousebg;
> + XWindowAttributes attr;
> + XVisualInfo vis;
>
> if (!(xw.dpy = XOpenDisplay(NULL)))
> die("can't open display\n");
> xw.scr = XDefaultScreen(xw.dpy);
> - xw.vis = XDefaultVisual(xw.dpy, xw.scr);
> +
> + if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) {
> + parent = XRootWindow(xw.dpy, xw.scr);
> + xw.depth = 32;
> + } else {
> + XGetWindowAttributes(xw.dpy, parent, &attr);
> + xw.depth = attr.depth;
> + }
> +
> + XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis);
> + xw.vis = vis.visual;
>
> /* font */
> if (!FcInit())
> @@ -1132,7 +1153,7 @@ xinit(int cols, int rows)
> xloadfonts(usedfont, 0);
>
> /* colors */
> - xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
> + xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None);
> xloadcols();
The depth is hard-coded to 32, which might not be supported,
and the return value from XMatchVisualInfo() is not checked.
If I run this on Xephyr with display depth set to 8-bit, st actually segfaults.
You can see what display depth/class combinations are supported in the output
of xdpyinfo.
--
Storkman