Skip to content

Commit

Permalink
fix keystrokes
Browse files Browse the repository at this point in the history
  • Loading branch information
GameParrot authored Dec 25, 2024
1 parent ef9aa8b commit a91073a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/window_callbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void WindowCallbacks::onMouseButton(double x, double y, int btn, MouseButtonActi
if(btn < 1)
return;
#ifdef USE_IMGUI
if(ImGui::GetCurrentContext() && !window.getCursorDisabled()) {
if(ImGui::GetCurrentContext()) {
ImGuiIO& io = ImGui::GetIO();
io.AddMouseSourceEvent(ImGuiMouseSource_Mouse);
io.AddMouseButtonEvent(btn - 1, action != MouseButtonAction::RELEASE);
Expand All @@ -135,7 +135,7 @@ void WindowCallbacks::onMouseButton(double x, double y, int btn, MouseButtonActi
window.stopTextInput();
}
}
if(io.WantCaptureMouse) {
if(io.WantCaptureMouse && !window.getCursorDisabled()) {
return;
}
}
Expand Down Expand Up @@ -403,7 +403,7 @@ static ImGuiKey mapImGuiModKey(KeyCode code) {
void WindowCallbacks::onKeyboard(KeyCode key, KeyAction action) {
if(hasInputMode(InputMode::Mouse)) {
#ifdef USE_IMGUI
if(ImGui::GetCurrentContext() && !window.getCursorDisabled()) {
if(ImGui::GetCurrentContext()) {
ImGuiIO& io = ImGui::GetIO();
io.AddKeyEvent(mapImGuiModKey(key), action != KeyAction::RELEASE);
io.AddKeyEvent(mapImGuiKey(key), action != KeyAction::RELEASE);
Expand All @@ -415,7 +415,7 @@ void WindowCallbacks::onKeyboard(KeyCode key, KeyAction action) {
window.stopTextInput();
}
}
if(io.WantCaptureKeyboard || io.WantTextInput) {
if((io.WantCaptureKeyboard || io.WantTextInput) && !window.getCursorDisabled()) {
return;
}
}
Expand Down

0 comments on commit a91073a

Please sign in to comment.