Skip to content

Conversation

macsforme
Copy link
Member

@macsforme macsforme commented Nov 8, 2020

Several additional issues were discovered when validating the fixes for SDL2 window management in #251. This can serve as a repository for fixes for these additional issues as they are completed.

macsforme and others added 2 commits November 8, 2020 12:51
…call enableGrabMouse() if needed when mapping and unmapping the window so the cursor is actually released.

Also, if the cursor is confined to the mouse box, release it if the window is unmapped.

Fixes BZFlag-Dev#266.
The issue only occurs when running the game at a resolution that differs from
the desktop resolution and the game is minimized and then restored by clicking
on the application icon instead of the minimized window.

Fixes BZFlag-Dev#268.
@blast007
Copy link
Member

We'll ignore #267 for now. That's not release critical and overall is a pretty minor bug. We can worry about that one when/if we do further refactoring of our platform code.

@macsforme macsforme marked this pull request as ready for review January 24, 2021 22:12
@blast007
Copy link
Member

blast007 commented Feb 2, 2021

The changes in 766a58f are causing Linux and macOS to not confine the mouse to the window. I have a simpler fix that just disables confine to motion box if the window is unmapped and mouseClamp is true. I'll test that solution a bit more.

@blast007
Copy link
Member

blast007 commented Feb 2, 2021

The alternative fix I have is as follows:

diff --git a/src/bzflag/playing.cxx b/src/bzflag/playing.cxx
index 7c3801d0e..f6850682b 100644
--- a/src/bzflag/playing.cxx
+++ b/src/bzflag/playing.cxx
@@ -1175,6 +1175,8 @@ static void     doEvent(BzfDisplay *disply)
 
         unmapped = true;
         mainWindow->ungrabMouse();
+        if (BZDB.isTrue("mouseClamp"))
+            mainWindow->disableConfineToMotionbox();
         break;
 
     case BzfEvent::KeyUp:

@macsforme Would you prefer I fix this PR to use this, or should I just directly apply that fix and 4735b27 directly to our branch?

@macsforme
Copy link
Member Author

Let me test my fix again and compare it to yours. This was a while ago, but I remember there being at least two parts to the problem (the motion box clamp, and the window clamp).

@blast007
Copy link
Member

blast007 commented Feb 8, 2021

I'm actually not sure if my alternative fix above actually fixes it. I think when I was testing the issue just decided to stop happening. I will need to test some more.

@blast007 blast007 closed this Feb 12, 2021
@macsforme macsforme deleted the more_sdl2_window_fixes branch February 27, 2021 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants