diff --git a/README.md b/README.md index 67cce1e..031778d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.9.2 (5dbcca4, 2024-05-01) project has a different take on st patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. +Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.9.2 (a0274bc, 2024-08-09) project has a different take on st patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. For example to include the `alpha` patch then you would only need to flip this setting from 0 to 1 in [patches.h](https://github.com/bakkeby/st-flexipatch/blob/master/patches.def.h): ```c diff --git a/x.c b/x.c index 16eb15c..be1a6ba 100644 --- a/x.c +++ b/x.c @@ -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;