summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 673aafd..92b948f 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -5448,9 +5448,9 @@ PrivateWindow::reparent ()
attr.border_pixel = 0;
attr.colormap = attrib.colormap;
- frame = XCreateWindow (dpy, screen->root (), sg.x (), sg.y (),
- sg.width (), sg.height (), 0, attrib.depth,
- InputOutput, attrib.visual, mask, &attr);
+ frame = XCreateWindow (dpy, screen->root (), 0, 0,
+ 1, 1, 0, attrib.depth,
+ InputOutput, attrib.visual, mask, &attr);
wrapper = XCreateWindow (dpy, frame, 0, 0,
sg.width (), sg.height (), 0, attrib.depth,
@@ -5460,6 +5460,10 @@ PrivateWindow::reparent ()
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
GrabModeSync, GrabModeSync, None, None);
+ xwc.stack_mode = Below;
+ xwc.sibling = id;
+ XConfigureWindow (dpy, frame, CWSibling | CWStackMode, &xwc);
+
XMapWindow (dpy, wrapper);
XReparentWindow (dpy, id, wrapper, 0, 0);
@@ -5495,6 +5499,8 @@ PrivateWindow::reparent ()
ExposureMask);
XUngrabServer (dpy);
+
+ XMoveResizeWindow (dpy, frame, sg.x (), sg.y (), sg.width (), sg.height ());
window->windowNotify (CompWindowNotifyReparent);
@@ -5507,6 +5513,7 @@ PrivateWindow::unreparent ()
Display *dpy = screen->dpy ();
XEvent e;
bool alive = true;
+ XWindowChanges xwc;
if (!frame)
return;
@@ -5527,8 +5534,11 @@ PrivateWindow::unreparent ()
XSelectInput (dpy, frame, NoEventMask);
XSelectInput (dpy, id, NoEventMask);
XSelectInput (dpy, screen->root (), NoEventMask);
- XReparentWindow (dpy, id, screen->root (), serverGeometry.x (),
- serverGeometry.y ());
+ XReparentWindow (dpy, id, screen->root (), 0, 0);
+
+ xwc.stack_mode = Below;
+ xwc.sibling = frame;
+ XConfigureWindow (dpy, id, CWSibling | CWStackMode, &xwc);
XUnmapWindow (dpy, frame);
@@ -5550,6 +5560,8 @@ PrivateWindow::unreparent ()
ExposureMask);
XUngrabServer (dpy);
+
+ XMoveWindow (dpy, id, serverGeometry.x (), serverGeometry.y ());
}
XDestroyWindow (dpy, wrapper);