From b07a04992312f145932f6576c878d98a38ed8309 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 15 Mar 2023 10:35:26 -0700
Subject: [PATCH] Fixed window positioning in testpopup
---
test/testpopup.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/test/testpopup.c b/test/testpopup.c
index 8be2c2b050ac..3ee4587d1c1d 100644
--- a/test/testpopup.c
+++ b/test/testpopup.c
@@ -153,14 +153,10 @@ static void loop()
}
tooltip_timer = SDL_GetTicks() + TOOLTIP_DELAY;
- if (num_menus > 0) {
- int parent_x = 0, parent_y = 0;
- int x = event.motion.x;
- int y = event.motion.y;
-
- SDL_GetWindowPosition(menus[0].parent, &parent_x, &parent_y);
- x -= parent_x;
- y -= parent_y;
+ if (num_menus > 0 && event.motion.windowID == SDL_GetWindowID(menus[0].parent)) {
+ int x = (int)event.motion.x;
+ int y = (int)event.motion.y;
+
SDL_SetWindowPosition(menus[0].win, x, y);
}
} else if (event.type == SDL_EVENT_MOUSE_BUTTON_DOWN) {