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

Fixed issue where mouse clicks were always reported as separate button down and button up events. #308

Merged
merged 1 commit into from
Oct 26, 2023

Conversation

Lyle-Tafoya
Copy link
Contributor

SDL_PollEvent was always returning 0, which meant we never set action = BUTTON_CLICKED. Using SDL_WaitEventTimeout instead of napms followed by SDL_PollEvent seems to fix this.
I mentioned this bug in issue #117.

@Bill-Gray Bill-Gray merged commit d4e69e6 into Bill-Gray:master Oct 26, 2023
4 checks passed
@Bill-Gray
Copy link
Owner

As noted under issue #117, I'm not seeing the problem. I am reasonably sure that not getting mouse clicks would be breaking various bits of code and would be reported... but there are so many variations between SDL 2.x.x and SDL 2.y.y that I could easily imagine the problem you report showing up in a version I'm not using.

The fix you propose is quite straightforward and works on my machine. I don't see any reason it wouldn't work on other machines, so I'm pulling it.

That said... I am wondering if the underlying problem is that napms() is broken on the SDL2 you're using? If you call napms( 2000), for example, do things pause for two seconds? (If not, we've yet another bit to fix...)

Thanks!

@Lyle-Tafoya
Copy link
Contributor Author

Yes, if I call napms(2000), it does indeed pause for 2 seconds (and the click is still reported as separate button press and button release events). I had reached the conclusion that sleeping must interfere with the ability for input events to be processed, which makes me more confused now that I know you were unable to reproduce this problem. I am using the version of SDL that PDCursesMod builds automatically (2.26.2)

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