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

Mouse inputs are disabled after alt+tab #26

Open
fcturan20 opened this issue Mar 20, 2023 · 2 comments
Open

Mouse inputs are disabled after alt+tab #26

fcturan20 opened this issue Mar 20, 2023 · 2 comments

Comments

@fcturan20
Copy link

Hi, I implemented a camera system for our renderer but there is an issue. If user uses alt+tab while right-clicking, application stops getting inputs. Here's the implementation: Osman-Fatih-Cakir/DX12Renderer@7fc52a2 . How can we fix this?

@alaingalvan
Copy link
Owner

alaingalvan commented Mar 29, 2023

OK, this is a weird one!

I was able to reproduce it on my end in Win32 with DirectX 12 with ImGui.

EDIT: So it turned out that IO state was just stuck after alt-tabbing while right clicking, so one way to mitigate this is to clear your IO state, with ImGui this would be:

if (e.type == xwin::EventType::Focus)
{
    xwin::FocusData fd = e.data.focus;
    if (!fd.focused)
    {
        // Clear IO
        io.ClearInputKeys();
    }
}

Try clearing your IO state when losing focus in your application, so that would be your isRightClicked variable in AppWindow.cpp.

@fcturan20
Copy link
Author

It didn't work out for me. The problem seems to be event queue isn't clearing its elements. Event queue element count keeps increasing even though i clear them using pop().

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

2 participants