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:
@@ -929,9 +929,6 @@ void X11_UpdateWindowPosition(SDL_Window *window)
|
|||||||
|
|
||||||
if (!caught_x11_error) {
|
if (!caught_x11_error) {
|
||||||
if ((x != orig_x) || (y != orig_y)) {
|
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. */
|
break; /* window moved, time to go. */
|
||||||
} else if ((x == dest_x) && (y == dest_y)) {
|
} else if ((x == dest_x) && (y == dest_y)) {
|
||||||
break; /* we're at the place we wanted to be anyhow, drop out. */
|
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 (!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_MOVED, x, y);
|
||||||
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, attrs.width, attrs.height);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, attrs.width, attrs.height);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user