Merge pull request #1074 from lemondrops/bugfix/fullscreen_mouse
Fix the mouse cursor being locked after leaving fullscreen mode
This commit is contained in:
@@ -326,7 +326,7 @@ sdl_init_common(int flags)
|
|||||||
wchar_t temp[128];
|
wchar_t temp[128];
|
||||||
SDL_version ver;
|
SDL_version ver;
|
||||||
int w = 0, h = 0, x = 0, y = 0;
|
int w = 0, h = 0, x = 0, y = 0;
|
||||||
RECT rect;
|
RECT rect, oldclip;
|
||||||
|
|
||||||
sdl_log("SDL: init (fs=%d)\n", fs);
|
sdl_log("SDL: init (fs=%d)\n", fs);
|
||||||
|
|
||||||
@@ -389,6 +389,8 @@ sdl_init_common(int flags)
|
|||||||
/* Now create the SDL window from that. */
|
/* Now create the SDL window from that. */
|
||||||
sdl_win = SDL_CreateWindowFrom((void *)sdl_hwnd);
|
sdl_win = SDL_CreateWindowFrom((void *)sdl_hwnd);
|
||||||
|
|
||||||
|
GetClipCursor(&oldclip);
|
||||||
|
|
||||||
old_capture = mouse_capture;
|
old_capture = mouse_capture;
|
||||||
|
|
||||||
GetWindowRect(sdl_hwnd, &rect);
|
GetWindowRect(sdl_hwnd, &rect);
|
||||||
@@ -406,6 +408,8 @@ sdl_init_common(int flags)
|
|||||||
GetWindowRect(hwndRender, &rect);
|
GetWindowRect(hwndRender, &rect);
|
||||||
|
|
||||||
ClipCursor(&rect);
|
ClipCursor(&rect);
|
||||||
|
} else {
|
||||||
|
ClipCursor(&oldclip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sdl_win == NULL) {
|
if (sdl_win == NULL) {
|
||||||
|
Reference in New Issue
Block a user