Fixed window positioning in testpopup
This commit is contained in:
@@ -153,14 +153,10 @@ static void loop()
|
|||||||
}
|
}
|
||||||
tooltip_timer = SDL_GetTicks() + TOOLTIP_DELAY;
|
tooltip_timer = SDL_GetTicks() + TOOLTIP_DELAY;
|
||||||
|
|
||||||
if (num_menus > 0) {
|
if (num_menus > 0 && event.motion.windowID == SDL_GetWindowID(menus[0].parent)) {
|
||||||
int parent_x = 0, parent_y = 0;
|
int x = (int)event.motion.x;
|
||||||
int x = event.motion.x;
|
int y = (int)event.motion.y;
|
||||||
int y = event.motion.y;
|
|
||||||
|
|
||||||
SDL_GetWindowPosition(menus[0].parent, &parent_x, &parent_y);
|
|
||||||
x -= parent_x;
|
|
||||||
y -= parent_y;
|
|
||||||
SDL_SetWindowPosition(menus[0].win, x, y);
|
SDL_SetWindowPosition(menus[0].win, x, y);
|
||||||
}
|
}
|
||||||
} else if (event.type == SDL_EVENT_MOUSE_BUTTON_DOWN) {
|
} else if (event.type == SDL_EVENT_MOUSE_BUTTON_DOWN) {
|
||||||
|
|||||||
Reference in New Issue
Block a user