Skip to content

Add touchscreen keyboard and inverted pan actions#1522

Open
Nightwalker743 wants to merge 1 commit into
utkarshdalal:masterfrom
Nightwalker743:feature/touchscreen-action-options
Open

Add touchscreen keyboard and inverted pan actions#1522
Nightwalker743 wants to merge 1 commit into
utkarshdalal:masterfrom
Nightwalker743:feature/touchscreen-action-options

Conversation

@Nightwalker743

@Nightwalker743 Nightwalker743 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Description

This is a requested feature from here (asking for Insert):
https://discord.com/channels/1378308569287622737/1511122055574327356

Inverted arrow keys feature request here: https://discord.com/channels/1378308569287622737/1509675164273475685/1509675164273475685

This PR adds missing keyboard actions to the control action list, including END, INSERT, =, `, Print Screen, and missing numpad operator keys.

This also adds all keyboard actions to the touch gesture actions list as well.

Also adds inverted arrow keys, inverted WASD, inverted middle mouse pan actions to drag, 2F drag and 3F drag gestures.

Recording

Screen_Recording_20260604_195213_GameNative.mp4
Screen_Recording_20260604_223634_GameNative.mp4

Type of Change

  • Bug fix
  • Performance / stability improvement
  • Compatibility improvements
  • Other (requires prior approval)

Checklist

  • If I have access to #code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.
  • This change aligns with the current project scope (core functionality, stability, or performance). If not, it has been explicitly approved beforehand.
  • I have attached a recording of the change.
  • I have read and agree to the contribution guidelines in CONTRIBUTING.md.

Summary by cubic

Adds a touchscreen “Show Keyboard” action and inverted pan options to make touch navigation more flexible. Also expands the touch gesture action list with missing keys and clearer labels.

  • New Features
    • Two-finger drag: Inverted WASD, Inverted Arrow Keys, and Inverted Middle Mouse Pan.
    • Keyboard coverage: Added END, INSERT, Print Screen, grave (`), equal (=), and numpad divide/multiply/subtract/add/del.
    • Gesture picker: New categories (Navigation/Editing, Symbols, Numpad, Modifiers/Locks) and readable key labels sourced from Binding.

Written for commit f5d1364. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

New Features

  • Added inverted pan gesture options for camera control: inverted middle mouse panning, inverted WASD, and inverted arrow keys
  • Extended keyboard binding support with additional keys including numpad operators and symbol keys
  • Improved gesture settings interface with better organization of keyboard bindings into logical categories (Navigation/Editing, Symbols, Numpad, Modifiers)

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR extends GameNative's touch gesture system with inverted pan action variants and expanded keyboard binding support. New keyboard keys (symbol and numpad) are added to the Binding enum, inverted pan actions are defined in TouchGestureConfig, gesture handling is implemented in TouchpadView, the settings dialog is updated with new keyboard categories and binding-aware label resolution, and supporting localization strings are added.

Changes

Keyboard Binding and Pan Action Expansion

Layer / File(s) Summary
Keyboard bindings enum extension
app/src/main/java/com/winlator/inputcontrols/Binding.java
Binding enum gains KEY_END, KEY_GRAVE, KEY_EQUAL, and numpad operator keys (KEY_KP_DIVIDE, KEY_KP_MULTIPLY, KEY_KP_SUBTRACT, KEY_KP_DEL); KEY_PRTSCN is removed. toString() method now explicitly formats symbol and numpad operator labels for these new keys.
Pan action constants and configuration
app/src/main/java/app/gamenative/data/TouchGestureConfig.kt, app/src/main/java/app/gamenative/ui/component/dialog/TouchGestureSettingsDialog.kt (imports)
TouchGestureConfig introduces new pan action constants for inverted WASD, inverted arrow keys, and inverted middle mouse. PAN_ACTIONS list is expanded to include these inverted variants. TouchGestureSettingsDialog imports the new constants.
Pan gesture implementation
app/src/main/java/com/winlator/widget/TouchpadView.java
performPanAction() switch extends to handle inverted pan gesture variants: negating dx/dy for inverted middle mouse, swapping key directions for inverted WASD and inverted arrow keys.
Settings dialog UI and keyboard categories
app/src/main/java/app/gamenative/ui/component/dialog/TouchGestureSettingsDialog.kt
tapHoldActionLabel() detects key_... actions and resolves them to human-readable labels via binding-backed mapping. panActionLabel() expands to support inverted pan variants. buildActionCategories() adds four new keyboard sections: navigation/editing, symbols, numeric keypad, and modifiers/locks, each populated with keyboard binding actions.
Localization strings
app/src/main/res/values/strings.xml
New string resources added for inverted pan labels and keyboard category headers (navigation/editing, symbols, numpad, modifiers/locks).

Sequence Diagram(s)

User interaction with the inverted pan gesture system involves component interaction across the touch gesture settings dialog, binding resolution, and touchpad action handling. However, the changes constitute straightforward configuration and handler extension rather than multi-component sequential flows, so a sequence diagram is not applicable.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • utkarshdalal/GameNative#1276: Introduced the gesture-action infrastructure and pan-action plumbing that this PR extends with inverted variants and expanded keyboard binding support.

Suggested reviewers

  • utkarshdalal

Poem

🐰 Gesture config blooms with inverted grace,
Pan actions dance in every space,
WASD reversed, arrow keys aligned,
Keyboards mapped and keyed redesigned,
Settings drawer opens wide and bright!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main changes: adding touchscreen keyboard actions and inverted pan gesture options.
Description check ✅ Passed The description fully completes the template with detailed explanation, recordings, type of change selection, and all checklist items addressed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Nightwalker743 Nightwalker743 force-pushed the feature/touchscreen-action-options branch from 4c1bd04 to f5d1364 Compare June 5, 2026 03:26
@Nightwalker743 Nightwalker743 marked this pull request as ready for review June 5, 2026 03:42

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/src/main/java/com/winlator/inputcontrols/Binding.java (1)

76-85: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use explicit labels for Print Screen and numpad add in toString().

At Line 77 and Line 85, KEY_KP_ADD renders as "+" and KEY_PRTSCN falls back to "PRTSCN". Since UI search/display depends on Binding.toString(), these are harder to discover than the other explicit key labels.

🔧 Proposed fix
             case KEY_KP_ADD:
-                return "+";
+                return "NUMPAD +";
             case KEY_KP_DEL:
                 return "NUMPAD .";
+            case KEY_PRTSCN:
+                return "PRINT SCREEN";
             case SHOW_KEYBOARD:
                 return "SHOW KEYBOARD";
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/main/java/com/winlator/inputcontrols/Binding.java` around lines 76 -
85, The Binding.toString() fallback makes KEY_KP_ADD and KEY_PRTSCN hard to
discover; update Binding.toString() to add explicit case entries for KEY_KP_ADD
(map to a clear label like "NUMPAD +") and KEY_PRTSCN (map to "PRINT SCREEN")
instead of relying on the generic replace logic so the UI search/display shows
consistent, discoverable labels; modify the switch in Binding.toString() (the
method handling cases like KEY_KP_ADD, KEY_KP_DEL, SHOW_KEYBOARD, ALT_ENTER and
the default) to include these two explicit cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@app/src/main/java/com/winlator/inputcontrols/Binding.java`:
- Around line 76-85: The Binding.toString() fallback makes KEY_KP_ADD and
KEY_PRTSCN hard to discover; update Binding.toString() to add explicit case
entries for KEY_KP_ADD (map to a clear label like "NUMPAD +") and KEY_PRTSCN
(map to "PRINT SCREEN") instead of relying on the generic replace logic so the
UI search/display shows consistent, discoverable labels; modify the switch in
Binding.toString() (the method handling cases like KEY_KP_ADD, KEY_KP_DEL,
SHOW_KEYBOARD, ALT_ENTER and the default) to include these two explicit cases.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 863eb1fa-5502-4187-8c6c-eeef341215c9

📥 Commits

Reviewing files that changed from the base of the PR and between dc54857 and f5d1364.

📒 Files selected for processing (5)
  • app/src/main/java/app/gamenative/data/TouchGestureConfig.kt
  • app/src/main/java/app/gamenative/ui/component/dialog/TouchGestureSettingsDialog.kt
  • app/src/main/java/com/winlator/inputcontrols/Binding.java
  • app/src/main/java/com/winlator/widget/TouchpadView.java
  • app/src/main/res/values/strings.xml

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant