Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OS X 10.9] Cmd+Tab app switching breaks out of relative mouse mode #1633

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: Mac OS X (All), x86

Comments on the original bug report:

On 2014-09-05 01:22:59 +0000, Eric Wasylishen wrote:

Steps to reproduce:

  • launch testdraw2 or testgl2 with the default settings (windowed mode)

  • press Ctrl+R to enter relative mouse mode. The cursor hides and is locked inside the sdl window.

  • switch to another app with command+tab. The cursor reappears and you can use the second application normally.

  • switch back to the SDL test app with command+tab

  • expected: the cursor re-hides and is locked inside the SDL windows since relative mouse mode is still enabled.

  • actual: the cursor re-hides, but if you move the cursor you can move it out of the window and it re-appears - Relative mouse mode is broken. If you press Ctrl+R twice (once to disable, once to re-enable), relative mouse mode works again as expected.

I guess SDL needs to detect when a window regains focus and reacquire its grab on the mouse if needed?

Tested on sdl2 hg cd6696d55781 (Sept 2, 2014), on 15" macbook pro retina (2880x1800), OS X 10.9.4

On 2015-01-24 02:17:01 +0000, Eric Wasylishen wrote:

Still happening with OS X 10.10.1, SDL2 HG as of today (8d826bc39a45).

The same bug also affects SDL_WINDOW_FULLSCREEN_DESKTOP windows; if you switch to a different desktop Space using Control+Left/Right, or using Mission Control, and then return to the SDL fullscreen desktop space, the relative mouse mode is messed up (the cursor isn't really grabbed, so you stop getting relative mouse events when the cursor reaches the edge of the screen.) This can be seen using the "testrelative" sammple, and going into fullscreen-desktop mode with Alt+Enter.

On 2015-01-24 02:34:55 +0000, Eric Wasylishen wrote:

Created attachment 2001
Proposed fix

Ok, I think I have a fix..
In the -windowDidBecomeKey: method in SDL_cocoawindow.m, there was a call to mouse->SetRelativeMouseMode to restore relative mouse mode. But that was bailing out and not doing anything on SDL_cocoamouse.m:244, because SDL_GetMouseFocus() was returning NULL.

I moved the SDL_SetKeyboardFocus() call in -windowDidBecomeKey: to before the SetRelativeMouseMode() call, and this seemed to fix the issue.

On 2015-01-31 03:18:42 +0000, Eric Wasylishen wrote:

In addition to testing on 10.10, I just tried OS X 10.6, and my fix works there as well (the bug also affected 10.6).

On 2015-02-05 23:03:48 +0000, Martijn Courteaux wrote:

Thanks for this fix. It works for me as well! I'm on OS X 10.10.2. I'm not an SDL expert, but I think it's safe to merge this patch in the main source.

On 2015-02-19 05:22:18 +0000, Ryan C. Gordon wrote:

Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry if you got a lot of email from this. This is to help me sort through some bugs in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4, though!

On 2015-04-07 04:57:57 +0000, Ryan C. Gordon wrote:

(sorry if you get a lot of copies of this email, I'm marking several bugs at once)

Marking bugs for the (mostly) final 2.0.4 TODO list. This means we're hoping to resolve this bug before 2.0.4 ships if possible. In a perfect world, the open bug count with the target-2.0.4 keyword is zero when we ship.

(Note that closing a bug report as WONTFIX, INVALID or WORKSFORME might still happen.)

--ryan.

On 2015-05-26 15:49:58 +0000, Ryan C. Gordon wrote:

Your patch is now https://hg.libsdl.org/SDL/rev/065e4ddc8753, thanks!

--ryan.

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

No branches or pull requests

1 participant