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

Bug: Windows "Asterisk" sound is played after adjusting dimension #684

Closed
sherief opened this issue Aug 26, 2020 · 6 comments · Fixed by #727
Closed

Bug: Windows "Asterisk" sound is played after adjusting dimension #684

sherief opened this issue Aug 26, 2020 · 6 comments · Fixed by #727

Comments

@sherief
Copy link

sherief commented Aug 26, 2020

System information

SolveSpace version: f952991

Operating system: Windows 10 x64

Expected behavior

When I double-click a dimension, type a number then press enter I don't expect the Asterisk sound as specified in Control Panel (Classic) / Sound / Sounds to play

Actual behavior

Every time I adjust the dimension and press enter, SolveSpace plays the Asterisk sound. It's counter to UI / UX expectation on the platform as this is not an exceptional event or indicative of an error.

Additional information

N/A

@sherief
Copy link
Author

sherief commented Aug 26, 2020

BTW, I wouldn't mind trying to fix this myself if you can provide pointers to where in the codebase I should start looking.

@whitequark
Copy link
Contributor

sherief added a commit to sherief/solvespace that referenced this issue Aug 26, 2020
@sherief
Copy link
Author

sherief commented Aug 26, 2020

EditorWindowProc() handles WM_KEYDOWN, but Windows also sends a WM_CHAR message with scancode == 0x1c (enter key) and once that gets into DispatchMessage() the unhandled sound plays.

Check out sherief@0f6e47c - I'm not sure whether that's a fix or a hack, is it safe to consume WM_CHAR into the void here?

@whitequark
Copy link
Contributor

whitequark commented Aug 26, 2020

I took a quick look--seems that this is the correct way to do it, conceptually speaking. See e.g. https://stackoverflow.com/questions/3588526/how-to-turn-off-beeping-when-pressing-enter-on-a-single-line-edit-control-under

@whitequark
Copy link
Contributor

Actually, I think that if you change WM_KEYDOWN to WM_CHAR here, you'll get the same effect in a slightly nicer way. sherief@0f6e47c#diff-99db0ce0039e3ba6b61036af47ff544fR1062

sherief added a commit to sherief/solvespace that referenced this issue Aug 26, 2020
@sherief
Copy link
Author

sherief commented Aug 26, 2020

OK, probably not gonna go through and read the CLA right now but I submitted a pull request and it's a trivial change that I just feel like throwing in the public domain - feel free to accept, reject, or re-implement it. Thanks for all the help!

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

Successfully merging a pull request may close this issue.

2 participants