summaryrefslogtreecommitdiff
path: root/x.c
diff options
context:
space:
mode:
authorAiden Gall <aiden@aidengall.xyz>2024-11-27 22:58:25 +0000
committerAiden Gall <aiden@aidengall.xyz>2024-11-27 22:58:25 +0000
commit2f55584aad1d25de361752831ef0ba0162289f53 (patch)
tree8bf7be3140b0312c6b380ee1b58e3a080e835e18 /x.c
parent6b1898dce6eb8bb32391a833f03abcf9404b9e5b (diff)
parenta0274bc20e11d8672bb2953fdd1d3010c0e708c5 (diff)
merge upstream
Diffstat (limited to 'x.c')
-rw-r--r--x.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/x.c b/x.c
index e524c0a..192c19b 100644
--- a/x.c
+++ b/x.c
@@ -1144,7 +1144,7 @@ xinit(int cols, int rows)
{
XGCValues gcvalues;
Cursor cursor;
- Window parent;
+ Window parent, root;
pid_t thispid = getpid();
XColor xmousefg, xmousebg;
XWindowAttributes attr;
@@ -1154,11 +1154,12 @@ xinit(int cols, int rows)
die("can't open display\n");
xw.scr = XDefaultScreen(xw.dpy);
+ root = XRootWindow(xw.dpy, xw.scr);
if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) {
- parent = XRootWindow(xw.dpy, xw.scr);
+ parent = root;
xw.depth = 32;
} else {
- XGetWindowAttributes(xw.dpy, parent, &attr);
+ XGetWindowAttributes(xw.dpy, root, &attr);
xw.depth = attr.depth;
}
@@ -1173,7 +1174,7 @@ xinit(int cols, int rows)
xloadfonts(usedfont, 0);
/* colors */
- xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None);
+ xw.cmap = XCreateColormap(xw.dpy, root, xw.vis, None);
xloadcols();
/* adjust fixed window geometry */
@@ -1193,10 +1194,12 @@ xinit(int cols, int rows)
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
xw.attrs.colormap = xw.cmap;
- xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
+ xw.win = XCreateWindow(xw.dpy, root, xw.l, xw.t,
win.w, win.h, 0, xw.depth, 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;