mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 14:11:33 +00:00
Add hacks for SDL+Mutter interaction bugs
This commit is contained in:
@@ -1024,7 +1024,11 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||||||
// This prevents the mouse from becoming trapped inside
|
// This prevents the mouse from becoming trapped inside
|
||||||
// Moonlight when it's halted at a debug break.
|
// Moonlight when it's halted at a debug break.
|
||||||
if (m_Preferences->windowMode != StreamingPreferences::WM_WINDOWED) {
|
if (m_Preferences->windowMode != StreamingPreferences::WM_WINDOWED) {
|
||||||
m_InputHandler->setCaptureActive(true);
|
// HACK: This doesn't work on Wayland until we render a frame, so
|
||||||
|
// just don't do it for now.
|
||||||
|
if (strcmp(SDL_GetCurrentVideoDriver(), "wayland") != 0) {
|
||||||
|
m_InputHandler->setCaptureActive(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1268,6 +1272,25 @@ DispatchDeferredCleanup:
|
|||||||
m_VideoDecoder = nullptr;
|
m_VideoDecoder = nullptr;
|
||||||
SDL_AtomicUnlock(&m_DecoderLock);
|
SDL_AtomicUnlock(&m_DecoderLock);
|
||||||
|
|
||||||
|
if (strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) {
|
||||||
|
// HACK: SDL (as of 2.0.10) has a bug that causes Mutter not to destroy the window
|
||||||
|
// surface when in full-screen unless we render more frames after we request
|
||||||
|
// to exit full-screen. The amount of frames required is variable but 500 ms
|
||||||
|
// of frames seems sufficient in my testing.
|
||||||
|
SDL_SetWindowFullscreen(m_Window, 0);
|
||||||
|
SDL_Renderer* renderer = SDL_CreateRenderer(m_Window, -1, SDL_RENDERER_PRESENTVSYNC);
|
||||||
|
if (renderer != nullptr) {
|
||||||
|
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
SDL_RenderClear(renderer);
|
||||||
|
SDL_RenderPresent(renderer);
|
||||||
|
SDL_Delay(50);
|
||||||
|
}
|
||||||
|
SDL_DestroyRenderer(renderer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This must be called after the decoder is deleted, because
|
// This must be called after the decoder is deleted, because
|
||||||
// the renderer may want to interact with the window
|
// the renderer may want to interact with the window
|
||||||
SDL_DestroyWindow(m_Window);
|
SDL_DestroyWindow(m_Window);
|
||||||
|
|||||||
Reference in New Issue
Block a user