summaryrefslogtreecommitdiff
path: root/x.c
diff options
context:
space:
mode:
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;