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

Window focus loss at app launch causes mouse lock to remain active. #1

Open
nb-programmer opened this issue Apr 28, 2023 · 0 comments

Comments

@nb-programmer
Copy link
Owner

During app startup, Panda3D calls the SetForegroundWindow() winapi call, but somehow fails and logs the following:

:display:windisplay(warning): SetForegroundWindow() failed!

This can be reproduced by launching the app and immediately clicking somewhere. The app launches without focus, Windows tries to bring it to focus but fails, and without any error (or even events of failure) continues as if nothing happened, and mouse lock remains and puts the mouse in the middle of the screen on the other window, unable to move.

Hooking window-event gives an event with the WindowProperties's foreground property still being True despite actually not being in focus.

We somehow need to detect this problem and unlock the mouse. Already the window-event hook does it when the window loses focus, but due to this issue it doesn't capture the window blur.

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