summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2026-03-20 18:01:08 -0400
committerVictor Kareh <[email protected]>2026-05-27 15:59:34 -0400
commit220296b67ec2355128a6f98dfc6252d093465c0c (patch)
treebddbe3799935ae43d144a1a8e29deb5201c302a9 /src/core
parent3183b187ea00e255193720c7c44b0c4ece81a8cf (diff)
downloadmarco-220296b67ec2355128a6f98dfc6252d093465c0c.tar.bz2
marco-220296b67ec2355128a6f98dfc6252d093465c0c.tar.xz
frame: Preserve client position when removing decorations
Windows using StaticGravity (like Qt apps) would shift up and left by the visible frame border size each time they were hidden to system tray and restored. The position drift compounded with each cycle. This changes those windows to use the client's actual root position. Fixes #534
Diffstat (limited to 'src/core')
-rw-r--r--src/core/frame.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/core/frame.c b/src/core/frame.c
index a8ba65c0..caf8af94 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -170,6 +170,7 @@ meta_window_destroy_frame (MetaWindow *window)
{
MetaFrame *frame;
MetaFrameBorders borders;
+ int offset_x, offset_y;
if (window->frame == NULL)
return;
@@ -198,6 +199,24 @@ meta_window_destroy_frame (MetaWindow *window)
"Incrementing unmaps_pending on %s for reparent back to root\n", window->desc);
window->unmaps_pending += 1;
}
+
+ /* Account for window gravity when choosing where to place the client
+ * on the root window, so that re-managing it doesn't shift its
+ * position. StaticGravity clients (e.g. Qt) expect the client's own
+ * position; other gravities need the visible frame corner so that
+ * adjust_for_gravity() can add the borders back correctly.
+ */
+ if (window->size_hints.win_gravity == StaticGravity)
+ {
+ offset_x = frame->child_x;
+ offset_y = frame->child_y;
+ }
+ else
+ {
+ offset_x = borders.invisible.left;
+ offset_y = borders.invisible.top;
+ }
+
XReparentWindow (window->display->xdisplay,
window->xwindow,
window->screen->xroot,
@@ -205,8 +224,8 @@ meta_window_destroy_frame (MetaWindow *window)
* coordinates here means we'll need to ensure a configure
* notify event is sent; see bug 399552.
*/
- window->frame->rect.x + borders.invisible.left,
- window->frame->rect.y + borders.invisible.top);
+ window->frame->rect.x + offset_x,
+ window->frame->rect.y + offset_y);
meta_error_trap_pop (window->display, FALSE);
meta_ui_destroy_frame_window (window->screen->ui, frame->xwindow);