From beccf8b0fbc9745e24faa53a829ead624a0a48b5 Mon Sep 17 00:00:00 2001 From: Lucas de Sena Date: Thu, 19 Feb 2026 20:46:57 +0000 Subject: [PATCH] do not reparent client window; fix amiwm#29 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit reparenting the client's window creates a few issues: • We get bogus UnmapNotify and MapNotify events that are ultimately generated by amiwm itself. • We do not get button events from the window, since its frame (c->parent) that we have called XGrabButtons(3) onto, is not its parent anymore. To fix this, do not reparent the client window, but its frame window. And keep the client window always inside the frame. --- client.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client.c b/client.c index b152df1..5126a94 100644 --- a/client.c +++ b/client.c @@ -149,10 +149,12 @@ void checksizehints(Client *c) void open_fscrn(Client *c) { - XUnmapWindow(dpy, c->parent); c->fsscr = scr = openscreen(NULL, scr->root); c->reparenting = 1; - XReparentWindow(dpy, c->window, scr->back, 0, 0); + XReparentWindow(dpy, c->parent, c->fsscr->back, 0, 0); + XRaiseWindow(dpy, c->window); + XMoveResizeWindow(dpy, c->parent, 0, 0, c->fsscr->width, c->fsscr->height); + XMoveResizeWindow(dpy, c->window, 0, 0, c->fsscr->width, c->fsscr->height); for (Client *dialog = clients; dialog != NULL; dialog = dialog->next) if (dialog->leader == c) reparent_client(c->fsscr, dialog); @@ -171,7 +173,9 @@ void close_fscrn(Client *c, int state) { if (c->fsscr == NULL) return; - XReparentWindow(dpy, c->window, c->parent, 4, c->scr->bh); + XReparentWindow(dpy, c->parent, c->scr, c->x, c->y); + XMoveResizeWindow(dpy, c->parent, c->x, c->y, c->pwidth, c->pheight); + XMoveResizeWindow(dpy, c->window, 4, c->scr->bh, c->pwidth-c->framewidth, c->pheight-c->frameheight); XResizeWindow(dpy, c->window, c->pwidth-c->framewidth, c->pheight-c->frameheight); XLowerWindow(dpy, c->window); scr = c->fsscr;