|
|
@@ -70,6 +70,8 @@ static bool SDLCALL RemoveSupersededWindowEvents(void *userdata, SDL_Event *even
|
|
|
|
|
|
bool SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, int data1, int data2)
|
|
|
{
|
|
|
+ SDL_VideoDevice *_this;
|
|
|
+ bool post_event = true;
|
|
|
bool posted = false;
|
|
|
|
|
|
if (!window) {
|
|
|
@@ -220,6 +222,12 @@ bool SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, int data
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ // Only post if we are not currently quitting
|
|
|
+ _this = SDL_GetVideoDevice();
|
|
|
+ if (_this == NULL || _this->is_quitting) {
|
|
|
+ post_event = false;
|
|
|
+ }
|
|
|
+
|
|
|
// Post the event, if desired
|
|
|
SDL_Event event;
|
|
|
event.type = windowevent;
|
|
|
@@ -231,7 +239,7 @@ bool SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, int data
|
|
|
SDL_DispatchEventWatchList(&SDL_window_event_watchers[SDL_WINDOW_EVENT_WATCH_EARLY], &event);
|
|
|
SDL_DispatchEventWatchList(&SDL_window_event_watchers[SDL_WINDOW_EVENT_WATCH_NORMAL], &event);
|
|
|
|
|
|
- if (SDL_EventEnabled(windowevent)) {
|
|
|
+ if (post_event && SDL_EventEnabled(windowevent)) {
|
|
|
// Fixes queue overflow with move/resize events that aren't processed
|
|
|
if (windowevent == SDL_EVENT_WINDOW_MOVED ||
|
|
|
windowevent == SDL_EVENT_WINDOW_RESIZED ||
|
|
|
@@ -291,7 +299,7 @@ bool SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, int data
|
|
|
if (windowevent == SDL_EVENT_WINDOW_CLOSE_REQUESTED && !window->parent && !SDL_HasActiveTrays()) {
|
|
|
int toplevel_count = 0;
|
|
|
SDL_Window *n;
|
|
|
- for (n = SDL_GetVideoDevice()->windows; n; n = n->next) {
|
|
|
+ for (n = _this->windows; n; n = n->next) {
|
|
|
if (!n->parent && !(n->flags & SDL_WINDOW_HIDDEN)) {
|
|
|
++toplevel_count;
|
|
|
}
|