diff --git a/Source/utils/display.cpp b/Source/utils/display.cpp index 520faa09e..9958b49f6 100644 --- a/Source/utils/display.cpp +++ b/Source/utils/display.cpp @@ -243,11 +243,14 @@ bool SpawnWindow(const char *lpWindowName) flags |= SDL_WINDOW_FULLSCREEN; } - if (*sgOptions.Gameplay.grabInput) { - flags |= SDL_WINDOW_INPUT_GRABBED; - } - ghMainWnd = SDL_CreateWindow(lpWindowName, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, windowSize.width, windowSize.height, flags); + + // Note: https://github.com/libsdl-org/SDL/issues/962 + // This is a solution to a problem related to SDL mouse grab. + // See https://github.com/diasurgical/devilutionX/issues/4251 + if (ghMainWnd != nullptr) + SDL_SetWindowGrab(ghMainWnd, *sgOptions.Gameplay.grabInput ? SDL_TRUE : SDL_FALSE); + #endif if (ghMainWnd == nullptr) { ErrSdl();