mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
x11: check if window size/position has changed during SDL_ShowWindow.
Fixes #4216.
This commit is contained in:
@@ -1339,6 +1339,33 @@ void X11_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
|||||||
X11_SetKeyboardFocus(new_focus);
|
X11_SetKeyboardFocus(new_focus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if the window manager moved us somewhere unexpected, just in case. */
|
||||||
|
{
|
||||||
|
int (*prev_handler)(Display *, XErrorEvent *) = NULL;
|
||||||
|
Window childReturn, root, parent;
|
||||||
|
Window *children;
|
||||||
|
unsigned int childCount;
|
||||||
|
XWindowAttributes attrs;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
X11_XSync(display, False);
|
||||||
|
prev_handler = X11_XSetErrorHandler(X11_CatchAnyError);
|
||||||
|
caught_x11_error = SDL_FALSE;
|
||||||
|
X11_XQueryTree(display, data->xwindow, &root, &parent, &children, &childCount);
|
||||||
|
X11_XGetWindowAttributes(display, data->xwindow, &attrs);
|
||||||
|
X11_XTranslateCoordinates(display, parent, DefaultRootWindow(display),
|
||||||
|
attrs.x, attrs.y, &x, &y, &childReturn);
|
||||||
|
|
||||||
|
if (!caught_x11_error) {
|
||||||
|
/* if these values haven't changed from our current beliefs, these don't actually generate events. */
|
||||||
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, x, y);
|
||||||
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, attrs.width, attrs.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
X11_XSetErrorHandler(prev_handler);
|
||||||
|
caught_x11_error = SDL_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void X11_SetWindowActive(SDL_VideoDevice *_this, SDL_Window *window)
|
static void X11_SetWindowActive(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
|
Reference in New Issue
Block a user