diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 84270567fd..3712484df3 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -215,32 +215,32 @@ static void EnsurePopupPositionIsValid(SDL_Window *window, int *x, int *y) int adj_count = 0; /* Per the xdg-positioner spec, child popup windows must intersect or at - * least be partially adjacent to the parent window. + * least be partially adjoining the parent window. * * Failure to ensure this on a compositor that enforces this restriction * can result in behavior ranging from the window being spuriously closed * to a protocol violation. */ - if (*x + window->w < 0) { + if (*x + window->w <= 0) { *x = -window->w; ++adj_count; } - if (*y + window->h < 0) { + if (*y + window->h <= 0) { *y = -window->h; ++adj_count; } - if (*x > window->parent->w) { + if (*x >= window->parent->w) { *x = window->parent->w; ++adj_count; } - if (*y > window->parent->h) { + if (*y >= window->parent->h) { *y = window->parent->h; ++adj_count; } /* If adjustment was required on the x and y axes, the popup is aligned with - * the parent corner-to-corner and is neither overlapping nor adjacent, so it - * must be nudged by 1 to be considered adjacent. + * the parent corner-to-corner and is neither overlapping nor adjoining, so it + * must be nudged by 1 to be considered adjoining. */ if (adj_count > 1) { *x += *x < 0 ? 1 : -1;