From a17ad65f2b99785554ef60fd75135b5859b86ddd Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 14 Mar 2023 14:53:54 -0700
Subject: [PATCH] Revert "Popup window parent defaults to the first toplevel
window"
This reverts commit e8e2c8175cfe269cdf94c0c47c70f27f3a033050.
Conceptually tooltips and context menus always have parent windows
---
src/video/SDL_video.c | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 4b6d8bd5638e..705ce074f1e5 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -1939,28 +1939,12 @@ SDL_Window *SDL_CreateWindow(const char *title, int w, int h, Uint32 flags)
SDL_Window *SDL_CreatePopupWindow(SDL_Window *parent, int offset_x, int offset_y, int w, int h, Uint32 flags)
{
- if (!_this) {
- SDL_UninitializedVideo();
- return NULL;
- }
-
if (!(_this->quirk_flags & VIDEO_DEVICE_QUIRK_HAS_POPUP_WINDOW_SUPPORT)) {
SDL_Unsupported();
return NULL;
}
/* Parent must be a valid window */
- if (!parent) {
- /* Use the first toplevel window by default */
- for (parent = _this->windows; parent; parent = parent->next) {
- if (!SDL_WINDOW_IS_POPUP(parent)) {
- /* Adjust the offset to be relative to this window */
- offset_x -= parent->x;
- offset_y -= parent->y;
- break;
- }
- }
- }
CHECK_WINDOW_MAGIC(parent, NULL);
/* Popups must specify either the tooltip or popup menu window flags */