mirror of https://github.com/libsdl-org/SDL
Fix pop-up windows changing position for each HideWindow()/ShowWindow() cycle
When X11_UpdateWindowPosition() was called and the position didn't update we would fire an SDL_EVENT_WINDOW_MOVED event with the global x,y for the pop-up instead of the relative position for the pop-up. This change ensures we always have a relative position for pop-ups before sending the SDL_EVENT_WINDOW_MOVED event.
This commit is contained in:
parent
92821f7a82
commit
17bdea7a91
|
@ -929,9 +929,6 @@ void X11_UpdateWindowPosition(SDL_Window *window)
|
|||
|
||||
if (!caught_x11_error) {
|
||||
if ((x != orig_x) || (y != orig_y)) {
|
||||
if (SDL_WINDOW_IS_POPUP(window)) {
|
||||
SDL_GlobalToRelativeForWindow(window, x, y, &x, &y);
|
||||
}
|
||||
break; /* window moved, time to go. */
|
||||
} else if ((x == dest_x) && (y == dest_y)) {
|
||||
break; /* we're at the place we wanted to be anyhow, drop out. */
|
||||
|
@ -946,6 +943,10 @@ void X11_UpdateWindowPosition(SDL_Window *window)
|
|||
}
|
||||
|
||||
if (!caught_x11_error) {
|
||||
if (SDL_WINDOW_IS_POPUP(window)) {
|
||||
SDL_GlobalToRelativeForWindow(window, x, y, &x, &y);
|
||||
}
|
||||
|
||||
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, x, y);
|
||||
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, attrs.width, attrs.height);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue