x11: Cancel the mode switch timer immediately upon success

Prevents erroneous timeout error messages if the window is moved to another display before the timeout period elapses.
main
Frank Praznik 2024-04-10 14:18:26 -04:00
parent 037a62add5
commit 01195c5d32
1 changed files with 2 additions and 3 deletions

View File

@ -1992,11 +1992,10 @@ void X11_PumpEvents(SDL_VideoDevice *_this)
* fullscreen. If there is no fullscreen window past the elapsed timeout, revert the mode switch. * fullscreen. If there is no fullscreen window past the elapsed timeout, revert the mode switch.
*/ */
for (i = 0; i < _this->num_displays; ++i) { for (i = 0; i < _this->num_displays; ++i) {
if (_this->displays[i]->driverdata->mode_switch_deadline_ns && if (_this->displays[i]->driverdata->mode_switch_deadline_ns) {
SDL_GetTicksNS() >= _this->displays[i]->driverdata->mode_switch_deadline_ns) {
if (_this->displays[i]->fullscreen_window) { if (_this->displays[i]->fullscreen_window) {
_this->displays[i]->driverdata->mode_switch_deadline_ns = 0; _this->displays[i]->driverdata->mode_switch_deadline_ns = 0;
} else { } else if (SDL_GetTicksNS() >= _this->displays[i]->driverdata->mode_switch_deadline_ns) {
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, SDL_LogError(SDL_LOG_CATEGORY_VIDEO,
"Time out elapsed after mode switch on display %" SDL_PRIu32 " with no window becoming fullscreen; reverting", _this->displays[i]->id); "Time out elapsed after mode switch on display %" SDL_PRIu32 " with no window becoming fullscreen; reverting", _this->displays[i]->id);
SDL_SetDisplayModeForDisplay(_this->displays[i], NULL); SDL_SetDisplayModeForDisplay(_this->displays[i], NULL);