Repository navigation
feat: Add hardware keyboard support, mouse mode selection, and input handling improvements - #56
Merged
Merged
Conversation
added 17 commits
November 10, 2026 11:51
- MainActivity: Add dispatchKeyEvent() to handle Bluetooth/USB keyboard input - MainActivity: Add detectInputDevices() for debugging connected input devices - MainActivity: Request focus in onCreate/onStart for hardware key events - CH9329MSKBMap: Fix scan code for | and \ (64 -> 31) - CH9329MSKBMap: Fix DEL key mapping to Backspace (4C -> 2A) - CH9329MSKBMap: Add numpad key mappings (ENTER, 1-9, DECIMAL)
- MouseMode enum, MouseModeManager state holder and MouseModePreferences persistence - CoordinateConverter for touch-to-content coordinate mapping - ZoomPanManager encapsulates portrait/landscape zoom and pan state - BlackBorderOverlayView keeps a transparent pointer over letterboxed areas so the system cursor never shows
- move single/multi-touch gesture logic out of CustomTouchListener - two-finger classifier now uses cumulative deltas with a 1.8x dominance ratio, 5px/8px thresholds, a 30-degree axis lock and a 100ms press gap before the right click - double tap uses a drag-candidate state: the first click is flushed on the second DOWN and the second click fires on UP, making double click reachable again - remove the long-press drag entry that hijacked slow cursor movement - BtMouseInputHandler owns BT mouse decoding without debug file writes
…aths - remove the SET_PARA_CFG path; connecting no longer writes chip configuration - gate per-frame absolute-move logging behind CH9329Function.DEBUG_SEND_LOG - skip hex formatting and per-packet logs while the debug switch is off - move baud-rate reconnect off the UI thread and release the FE0C interface before reopening - add back/forward button constants
- mouse control mode selector in the settings panel (absolute/relative) - portrait layout rework for the removed drawer plus new settings rows - Bluetooth mouse status hints and matching strings - skip the viewport-center move while a BT mouse is in use
- single tap and two-finger right click now send zero deltas; the old (x, y, 0, 0) form turned the view coordinate into a delta and the host cursor jumped up to 127px on every click in relative mode - BT mouse relative path: the first sample after (re)connect only learns the baseline, so the initial movement no longer jumps; btMouseRelInitialized was declared and reset but never read
- moveMouseToViewportCenter and releaseBtMouseButtons now log a single line instead of building an Exception on every call - gate the sendHexRelData trace behind DEBUG_SEND_LOG since it runs on every relative move frame
- getFloatingLabel() had no callers and the field was only assigned in the constructor - drop the always-gone floating_label TextView from the landscape layout; the portrait layout never had this id, so findViewById() returned null there anyway
- add DEBUG_KEY_LOG (off) and gate the live traces behind it - drop the eleven constant component dumps that ran before every key frame - sendKeyBoardPress, sendKeyBoardRelease and EmptyKeyboard logged 6-10 Log.e lines per keystroke; success paths are now silent and only real failures stay at error level
Hardware key down used to send press + auto-release while key up sent nothing, so the target only ever saw a complete tap and never entered the held state that USB HID auto-repeat depends on. Down now sends press only, up sends release, and onStop releases any key still held when focus is lost. Also drops the per-key verbose logging from the queued press/release path now that the hardware keyboard routes through it.
The press+release path logged seven lines per key on the error channel, including two messages that announced a successful send. Progress and parameter dumps are gone, success paths are silent, and the remaining trace output sits behind DEBUG_KEY_LOG. Failure paths keep their Log.e, and three device-not-connected checks that were logged at debug level now report as errors.
Sending a modifier on its own put E0/E1/E2 into the key field, which is the HID usage code for LeftControl/LeftShift/LeftAlt. Once presses stopped auto-releasing, that bogus key stayed held and the target discarded the next real key, so Ctrl+C and friends stopped working. Modifiers now emit no frame at all; their state travels in the modifier byte of the following key. getFunctionKey also builds the modifier byte bit by bit instead of returning after the first match, which restores Ctrl+Shift combinations and adds the Win key bit that was never handled.
- moveMouseToViewportCenter ignored the drawer scroll, so releasing the indicator put the cursor in the middle of the target desktop instead of the middle of the visible part. It now adds the scroll offset and sends the point through the same path a tap uses. - The indicator size was read from the portrait zoom scale, which stays at 1.0 in landscape, and from a PiP that has no measured size on the frame it appears, so it collapsed to the 20px floor. The size is now the PiP size divided by the real zoom (the drawer scale), re-applied on every pinch and once more after the first layout pass. - enlargeView no longer returns early when the binding view is missing, which used to skip the indicator setup entirely. Also folds in the E8 cleanup of ZoomLayoutDeal and DrawerLayoutDeal: hot-path logging and dead work removed, stale imports dropped, null guards added, the drawable-null mouse-mode gate corrected, DrawerLayoutDeal no longer pretends to be a Fragment, and one hardcoded string moved to resources.
…atic field ZoomLayoutDeal kept the activity, its window and the whole view tree alive through a static field. The members are instance members now and the activity holds the only instance, so the controller dies with the activity. Also rebuild the controller in reloadLayoutForOrientation: the local variable shadowed the field, so after rotation it still pointed at the discarded view tree.
Both entry points are live (touch pad settings button and the bottom settings tab), so the cards live in module_portrait_settings_inner.xml and this file keeps only the ScrollView and the settings_module_root container. This removes 40+ duplicated ids such as settings_theme_section and restores the mouse mode and bluetooth mouse section that this copy had missed.
- Rename updateBtMouseCursorState to applyBtMousePointerCapture - Fix isBtMouseConnected() misused as connection state - Remove scroll/move speed sliders from settings - Remove Bluetooth mouse toast and bt_mouse_* strings
- Fix doSendHexAbsData hardcoding SecNullData breaking drag - Remove sendMouseClick 30ms auto-release, enable keycap lock - Fix BT mouse relative mode sending zero delta - Widen double-tap window to 400ms/32px - Add gestureButtons/lockedButtons dual-mask mechanism
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces hardware keyboard support, absolute/relative mouse mode selection, and improvements to the input handling architecture. It also includes bug fixes and UI refinements for portrait and landscape layouts.
Key Features
Hardware Keyboard Support
Mouse Mode Selection
Input Handling Refactor
Bug Fixes
UI Improvements
Code Cleanup
Commits (17 total)
Testing Checklist