Skip to content

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

@nb-programmer

Description

@nb-programmer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions