diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-08-08 13:47:03 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-08-08 13:47:03 +0200 |
commit | 735332a5048f90869a7f8cf62a19717220f78dea (patch) | |
tree | 06cc9b275d0cf2121627320804541adaa9cec175 | |
parent | 9b45bbe7a2061d46fb4a062c2e30ba2fbfae1219 (diff) | |
download | st-fork-patches.tar.gz |
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
See: https://lists.suckless.org/hackers/2408/19158.html#start19158
-rw-r--r-- | x.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1286,7 +1286,7 @@ xinit(int cols, int rows) { XGCValues gcvalues; Cursor cursor; - Window parent; + Window parent, root; pid_t thispid = getpid(); XColor xmousefg, xmousebg; @@ -1324,16 +1324,19 @@ xinit(int cols, int rows) | SubstructureNotifyMask | SubstructureRedirectMask; xw.attrs.colormap = xw.cmap; + root = XRootWindow(xw.dpy, xw.scr); if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) - parent = XRootWindow(xw.dpy, xw.scr); - xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t, + parent = root; + xw.win = XCreateWindow(xw.dpy, root, xw.l, xw.t, win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, 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; - dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, + dc.gc = XCreateGC(xw.dpy, xw.win, GCGraphicsExposures, &gcvalues); xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, DefaultDepth(xw.dpy, xw.scr)); |