CrossWindow
CrossWindow copied to clipboard
Mouse inputs are disabled after alt+tab
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: https://github.com/Osman-Fatih-Cakir/DX12Renderer/pull/7/commits/7fc52a2edf97be8351ef0c0f87c531821b26863c . How can we fix this?
~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.
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().