From 0971af219a1ced153c19a94a687d70c51bdc9f43 Mon Sep 17 00:00:00 2001 From: stransky Date: Thu, 14 Apr 2022 13:34:28 +0000 Subject: [PATCH] Bug 1764319 [Wayland] Save initial position from nsWindow::Create() r=emilio Differential Revision: https://phabricator.services.mozilla.com/D143692 --- widget/gtk/nsWindow.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index cd4da40db05f..fbcd96b6875f 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -5602,11 +5602,14 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, // We need realized mShell at NativeMoveResize(). gtk_widget_realize(mShell); + // With popup windows, we want to set their position. + // Place them immediately on X11 and save initial popup position + // on Wayland as we place Wayland popup on show. if (GdkIsX11Display()) { - // With popup windows, we want to control their position, so don't - // wait for the window manager to place them (which wouldn't - // happen with override-redirect windows anyway). NativeMoveResize(/* move */ true, /* resize */ false); + } else if (AreBoundsSane()) { + GdkRectangle rect = DevicePixelsToGdkRectRoundOut(mBounds); + mPopupPosition = {rect.x, rect.y}; } } else { // must be eWindowType_toplevel mGtkWindowRoleName = "Toplevel";