mirror of https://github.com/libsdl-org/SDL.git
x11: Don't wait for events when the connection errored out (#8392)
Calling `X11_XIfEvent` after the X11 connection errored out can result in hangs.
This commit is contained in:
parent
864bb65ce9
commit
a0b6c0fd8f
|
|
@ -100,6 +100,14 @@ static bool X11_IsWindowMapped(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool X11_IsDisplayOk(Display *display)
|
||||||
|
{
|
||||||
|
if (display->flags & XlibDisplayIOError) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static bool X11_IsActionAllowed(SDL_Window *window, Atom action)
|
static bool X11_IsActionAllowed(SDL_Window *window, Atom action)
|
||||||
{
|
{
|
||||||
|
|
@ -1453,7 +1461,7 @@ void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
/* Blocking wait for "MapNotify" event.
|
/* Blocking wait for "MapNotify" event.
|
||||||
* We use X11_XIfEvent because pXWindowEvent takes a mask rather than a type,
|
* We use X11_XIfEvent because pXWindowEvent takes a mask rather than a type,
|
||||||
* and XCheckTypedWindowEvent doesn't block */
|
* and XCheckTypedWindowEvent doesn't block */
|
||||||
if (!(window->flags & SDL_WINDOW_EXTERNAL)) {
|
if (!(window->flags & SDL_WINDOW_EXTERNAL) && X11_IsDisplayOk(display)) {
|
||||||
X11_XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);
|
X11_XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);
|
||||||
}
|
}
|
||||||
X11_XFlush(display);
|
X11_XFlush(display);
|
||||||
|
|
@ -1507,7 +1515,7 @@ void X11_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
if (X11_IsWindowMapped(_this, window)) {
|
if (X11_IsWindowMapped(_this, window)) {
|
||||||
X11_XWithdrawWindow(display, data->xwindow, screen);
|
X11_XWithdrawWindow(display, data->xwindow, screen);
|
||||||
// Blocking wait for "UnmapNotify" event
|
// Blocking wait for "UnmapNotify" event
|
||||||
if (!(window->flags & SDL_WINDOW_EXTERNAL)) {
|
if (!(window->flags & SDL_WINDOW_EXTERNAL) && X11_IsDisplayOk(display)) {
|
||||||
X11_XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);
|
X11_XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);
|
||||||
}
|
}
|
||||||
X11_XFlush(display);
|
X11_XFlush(display);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue