Compare commits

..

3 Commits

Author SHA1 Message Date
mintycube
9b7c9fe907 Merge remote-tracking branch 'upstream/master' 2024-08-11 12:48:43 +05:00
Bakkeby
8a024a15b0 fix BadMatch error when embedding on some windows
When embedded, st fails with BadMatch error if the embedder's window has
non-default colormap/depth/visual.  This commit fixes that by creating
st's window inside root and then reparent it into embedder.

The reference window for dc.gc is also changed to match root's visuals.

A similar commit had been made for dmenu[1].
See this issue[2] on github for context.

[1]: https://git.suckless.org/dmenu/commit/0fe460dbd469a1d5b6a7140d0e1801935e4a923b.html
[2]: https://github.com/phillbush/xfiles/issues/47

Ref.
https://git.suckless.org/st/commit/a0274bc20e11d8672bb2953fdd1d3010c0e708c5.html
2024-08-09 22:06:40 +02:00
veltza
714fcffaa8
Fix issue with columns and reflow that breaks sixels (#146)
Fixes #145
2024-08-09 09:12:51 +02:00
2 changed files with 8 additions and 5 deletions

2
st.c
View File

@ -2748,7 +2748,7 @@ strhandle(void)
} else {
term.images = newimages;
}
#if COLUMNS_PATCH && !REFLOW
#if COLUMNS_PATCH && !REFLOW_PATCH
x2 = MIN(x2, term.maxcol) - 1;
#else
x2 = MIN(x2, term.col) - 1;

11
x.c
View File

@ -1426,7 +1426,7 @@ xinit(int cols, int rows)
#elif !SWAPMOUSE_PATCH
Cursor cursor;
#endif // HIDECURSOR_PATCH
Window parent;
Window parent, root;
pid_t thispid = getpid();
#if !SWAPMOUSE_PATCH
XColor xmousefg, xmousebg;
@ -1524,11 +1524,12 @@ xinit(int cols, int rows)
xw.attrs.event_mask |= PointerMotionMask;
#endif // OPENURLONCLICK_PATCH
root = XRootWindow(xw.dpy, xw.scr);
#if !ALPHA_PATCH
if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
parent = XRootWindow(xw.dpy, xw.scr);
parent = root;
#endif // ALPHA_PATCH
xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
xw.win = XCreateWindow(xw.dpy, root, xw.l, xw.t,
#if ALPHA_PATCH
win.w, win.h, 0, xw.depth, InputOutput,
#else
@ -1536,6 +1537,8 @@ xinit(int cols, int rows)
#endif // ALPHA_PATCH
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
| CWEventMask | CWColormap, &xw.attrs);
if (parent != root)
XReparentWindow(xw.dpy, xw.win, parent, xw.l, xw.t);
memset(&gcvalues, 0, sizeof(gcvalues));
gcvalues.graphics_exposures = False;
@ -1548,7 +1551,7 @@ xinit(int cols, int rows)
#endif // SINGLE_DRAWABLE_BUFFER_PATCH
dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues);
#else
dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures,
dc.gc = XCreateGC(xw.dpy, xw.win, GCGraphicsExposures,
&gcvalues);
#if SINGLE_DRAWABLE_BUFFER_PATCH
xw.buf = xw.win;