From a9bc8b7bb4ea62d503c928b1d280348afd34c414 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Mon, 9 Nov 2020 04:14:05 +0500 Subject: [PATCH] Fix the mouse cursor being constrained after leaving fullscreen. --- src/win/win_sdl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/win/win_sdl.c b/src/win/win_sdl.c index 4dbc95078..0224b65b0 100644 --- a/src/win/win_sdl.c +++ b/src/win/win_sdl.c @@ -326,7 +326,7 @@ sdl_init_common(int flags) wchar_t temp[128]; SDL_version ver; int w = 0, h = 0, x = 0, y = 0; - RECT rect; + RECT rect, oldclip; sdl_log("SDL: init (fs=%d)\n", fs); @@ -389,6 +389,8 @@ sdl_init_common(int flags) /* Now create the SDL window from that. */ sdl_win = SDL_CreateWindowFrom((void *)sdl_hwnd); + GetClipCursor(&oldclip); + old_capture = mouse_capture; GetWindowRect(sdl_hwnd, &rect); @@ -406,6 +408,8 @@ sdl_init_common(int flags) GetWindowRect(hwndRender, &rect); ClipCursor(&rect); + } else { + ClipCursor(&oldclip); } } if (sdl_win == NULL) {