commit c92b980a448c8501bc8d28d2ed5c31fd15bc4bd0
parent fa485df7c4f75ed7b1dfdf8df43b421d4b49b186
Author: stransky <stransky@redhat.com>
Date: Tue, 11 Nov 2025 10:42:33 +0000
Bug 1998949 [Wayland] Propagate correct window coordinates constraint to layout r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D271986
Diffstat:
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
@@ -1148,6 +1148,10 @@ void nsWindow::ResizeInt(const Maybe<DesktopIntPoint>& aMove,
return;
}
+ // TODO: Behave better if there's an active move-to-rect callback.
+ if (mWaitingForMoveToRectCallback) {
+ NS_WARNING("Resized during active move-to-rect callbak!");
+ }
NativeMoveResize(moved, resized);
}
@@ -2155,6 +2159,7 @@ void nsWindow::NativeMoveResizeWaylandPopupCallback(
newClientArea.y, newClientArea.width, newClientArea.height);
if (!needsSizeUpdate && !needsPositionUpdate) {
+ LOG(" Size/position is the same, quit.");
return;
}
if (needsSizeUpdate) {
@@ -2163,10 +2168,10 @@ void nsWindow::NativeMoveResizeWaylandPopupCallback(
// Beware that gtk_window_resize() requests sizes asynchronously and so
// newClientArea might not have the size from the most recent
// gtk_window_resize().
- if (mClientArea.width < mLastSizeRequest.width) {
+ if (newClientArea.width < mLastSizeRequest.width) {
mMoveToRectPopupSize.width = newClientArea.width;
}
- if (mClientArea.height < mLastSizeRequest.height) {
+ if (newClientArea.height < mLastSizeRequest.height) {
mMoveToRectPopupSize.height = newClientArea.height;
}
LOG(" mMoveToRectPopupSize set to [%d, %d]", mMoveToRectPopupSize.width,
@@ -3470,8 +3475,6 @@ void nsWindow::RecomputeBoundsX11(bool aMayChangeCsdMargin) {
#endif
#ifdef MOZ_WAYLAND
void nsWindow::RecomputeBoundsWayland(bool aMayChangeCsdMargin) {
- LOG("RecomputeBoundsWayland(%d)", aMayChangeCsdMargin);
-
auto GetBounds = [&](GdkWindow* aWin) {
GdkRectangle b{0};
gdk_window_get_position(aWin, &b.x, &b.y);
@@ -3481,8 +3484,14 @@ void nsWindow::RecomputeBoundsWayland(bool aMayChangeCsdMargin) {
};
const auto toplevelBounds = GetBounds(GetToplevelGdkWindow());
-
mClientArea = GetBounds(mGdkWindow);
+
+ LOG("RecomputeBoundsWayland(%d) GetBounds(mGdkWindow) [%d,%d] -> [%d x %d] "
+ "GetBounds(mShell) [%d,%d] -> [%d x %d]",
+ aMayChangeCsdMargin, mClientArea.x, mClientArea.y, mClientArea.width,
+ mClientArea.height, toplevelBounds.x, toplevelBounds.y,
+ toplevelBounds.width, toplevelBounds.height);
+
if (mClientArea.X() < 0 || mClientArea.Y() < 0 || mClientArea.Width() <= 1 ||
mClientArea.Height() <= 1) {
// If we don't have gdkwindow bounds, assume we take the whole toplevel.