mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-25 23:13:39 +00:00
[client] imgui: fix modifier key modification race
imgui really hates it when we update the modifier key state after igNewFrame. The result is: void ImGui::ErrorCheckEndFrameSanityChecks(): Assertion `(key_mod_flags == 0 || g.IO.KeyMods == key_mod_flags) && "Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods"' failed. Therefore, we buffer the modifier state information and update it in the IO object right before we call igNewFrame.
This commit is contained in:
parent
c0fa6c414c
commit
9bd205a527
@ -406,10 +406,10 @@ void app_handleKeyboardTyped(const char * typed)
|
||||
|
||||
void app_handleKeyboardModifiers(bool ctrl, bool shift, bool alt, bool super)
|
||||
{
|
||||
g_state.io->KeyCtrl = ctrl;
|
||||
g_state.io->KeyShift = shift;
|
||||
g_state.io->KeyAlt = alt;
|
||||
g_state.io->KeySuper = super;
|
||||
g_state.modCtrl = ctrl;
|
||||
g_state.modShift = shift;
|
||||
g_state.modAlt = alt;
|
||||
g_state.modSuper = super;
|
||||
}
|
||||
|
||||
void app_handleKeyboardLEDs(bool numLock, bool capsLock, bool scrollLock)
|
||||
@ -806,6 +806,11 @@ int app_renderOverlay(struct Rect * rects, int maxRects)
|
||||
struct Overlay * overlay;
|
||||
struct Rect buffer[MAX_OVERLAY_RECTS];
|
||||
|
||||
g_state.io->KeyCtrl = g_state.modCtrl;
|
||||
g_state.io->KeyShift = g_state.modShift;
|
||||
g_state.io->KeyAlt = g_state.modAlt;
|
||||
g_state.io->KeySuper = g_state.modSuper;
|
||||
|
||||
igNewFrame();
|
||||
|
||||
if (g_state.overlayInput)
|
||||
|
@ -56,6 +56,10 @@ struct AppState
|
||||
bool overlayInput;
|
||||
ImGuiMouseCursor cursorLast;
|
||||
char * imGuiIni;
|
||||
bool modCtrl;
|
||||
bool modShift;
|
||||
bool modAlt;
|
||||
bool modSuper;
|
||||
|
||||
bool alertShow;
|
||||
char * alertMessage;
|
||||
|
Loading…
Reference in New Issue
Block a user