foxygit / doom Log in
commit ce82099ff17328f1be9f37d14458866e06bb4fa3
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Wed Jan 18 00:46:34 2017 +0000
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Wed Jan 18 00:46:34 2017 +0000

    video: Always grab mouse when exiting main menu.

    When we exit the main menu we should grab the mouse and hide the mouse
    cursor, even if the cursor is currently pointing outside of the game
    window.

    It turned out that the logic to determine whether to grab the mouse was
    trying too hard to be well-behaved. While we should release mouse grab
    if the app loses focus (so the user can see their mouse cursor again and
    click on whatever popup has appeared), we don't need to do the same just
    because the mouse cursor is outside the game window's bounds.

    This fixes #798. Thanks @CapnClever.
---
 src/i_video.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/src/i_video.c b/src/i_video.c
index 73d906a5..97f97d23 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -231,9 +231,6 @@ void I_DisplayFPSDots(boolean dots_on)
     display_fps_dots = dots_on;
 }

-// Show or hide the mouse cursor. We have to use different techniques
-// depending on the OS.
-
 static void SetShowCursor(boolean show)
 {
     if (!screensaver_mode)
@@ -351,12 +348,10 @@ static void HandleWindowEvent(SDL_WindowEvent *event)
         // is removed if we lose focus (such as a popup window appearing),
         // and we dont move the mouse around if we aren't focused either.

-        case SDL_WINDOWEVENT_ENTER:
         case SDL_WINDOWEVENT_FOCUS_GAINED:
             window_focused = true;
             break;

-        case SDL_WINDOWEVENT_LEAVE:
         case SDL_WINDOWEVENT_FOCUS_LOST:
             window_focused = false;
             break;