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

macOS: al_show_mouse_cursor isn't reliable #936

Open
dos1 opened this issue Oct 12, 2018 · 3 comments
Open

macOS: al_show_mouse_cursor isn't reliable #936

dos1 opened this issue Oct 12, 2018 · 3 comments
Labels

Comments

@dos1
Copy link
Contributor

dos1 commented Oct 12, 2018

While it sometimes works well, sometimes after using al_show_mouse_cursor to show a previously hidden mouse cursor, it fails to do it properly.

The cursor stays hidden, even when moving it outside of the game window (usually when it's hidden it reappears after leaving the window). I can make it appear when I click somewhere outside of the window (but not inside) and afterwards I can return the cursor to the game window and it stays visible.

Tested on macOS 10.13.2

@fatcerberus
Copy link
Contributor

Your description of the issue makes it sound like this is an operating system bug. That's very bizarre.

@dos1
Copy link
Contributor Author

dos1 commented Oct 12, 2018

It could be, I don't know much about macOS tbh :)

@connorjclark
Copy link
Contributor

connorjclark commented Oct 17, 2022

On osx, cursor hide/show is like a stack - you gotta match n hides with n shows to get back to a visible cursor. see the docs. AFAICT, this is the only platform like this (I only checked windows and SDL). It forces you to be very careful about your logic for hiding/showing the cursor, which is a pretty big pain that I'm finding difficult to get just right.

osxgl.m also hides/shows the cursor for you on mouse enter/exit (given the value of show_cursor). I feel like this contributes to the problem somehow, but I can't quite articulate it now. Also, I checked the SDL backend and I don't think it does the same–should all platforms do this?

Perhaps allegro can paper over this unique-to-osx cursor behavior by preventing calls to [NSCursor hide] and [NSCursor show] when the cursor is already hidden/shown. A bit tricky, since these methods are for the current cursor, not sure if such state should be cleared whenever another cursor is made the default or if it'd have to be kept for each cursor created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants