Skip to content

Commit

Permalink
Don't unfocus textbox while pressing tab
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherHX committed Feb 16, 2024
1 parent 43be7df commit 8464ca9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/window_callbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,13 @@ void WindowCallbacks::onKeyboard(KeyCode key, KeyAction action) {
return;
}

if(action == KeyAction::PRESS && jniSupport.getTextInputHandler().isEnabled() && !jniSupport.getTextInputHandler().isMultiline() && (key == KeyCode::TAB || key == KeyCode::UP || key == KeyCode::DOWN)) {

if(action == KeyAction::PRESS && jniSupport.getTextInputHandler().isEnabled() && !jniSupport.getTextInputHandler().isMultiline() && (lastKey == KeyCode::TAB || lastKey == KeyCode::UP || lastKey == KeyCode::DOWN) && !(key == KeyCode::TAB || key == KeyCode::UP || key == KeyCode::DOWN)) {
jniSupport.onBackPressed();
}

lastKey = key;

if(action == KeyAction::PRESS)
inputQueue.addEvent(FakeKeyEvent(AKEY_EVENT_ACTION_DOWN, mapMinecraftToAndroidKey(key)));
else if(action == KeyAction::RELEASE)
Expand Down
1 change: 1 addition & 0 deletions src/window_callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class WindowCallbacks {
FakeInputQueue &inputQueue;
std::unordered_map<int, GamepadData> gamepads;
int32_t buttonState = 0;
KeyCode lastKey = (KeyCode)0;
bool useDirectMouseInput, useDirectKeyboardInput;
bool modCTRL = false;
bool needsQueueGamepadInput = true;
Expand Down

0 comments on commit 8464ca9

Please sign in to comment.