Skip to content

feat(event): implement touchpad and touchscreen button translation - #711

Merged
pastaq merged 2 commits into
ShadowBlip:mainfrom
nileshchakraborty:feat/touchpad-button-translation
Sep 14, 2026
Merged

feat(event): implement touchpad and touchscreen button translation#711
pastaq merged 2 commits into
ShadowBlip:mainfrom
nileshchakraborty:feat/touchpad-button-translation

Conversation

@nileshchakraborty

Copy link
Copy Markdown
Contributor

When configuring custom device profiles with touchpad button mappings (e.g. Touchpad:RightPad:Touch:Button:Press -> Mouse:Button:Left), translations previously failed with Translation not implemented for profile mapping.

Changes

  • Implement translate_touch_button() in src/input/event/value.rs to route Touch::Button events (Touch and Press) to mouse buttons, gamepad buttons, keyboard keys, and touchpad buttons.
  • Add unit tests verifying touchpad and touchscreen button translation across target types.

Fixes #692

Translate Touch::Button events to mouse buttons, gamepad buttons, keyboard keys, and touchpad buttons in custom profiles.

Fixes ShadowBlip#692
@nileshchakraborty

Copy link
Copy Markdown
Contributor Author

Testing & Validation

  1. Unit Tests (Fedora 44 container):

    • Added test_touchpad_button_translations() in src/input/event/value.rs verifying mappings from Touchpad(RightPad(Touch::Button(Press))) to:
      • Mouse(Button(Left))
      • Gamepad(Button(South))
      • Keyboard(KeyA)
      • Touchpad(CenterPad(Touch::Button(Touch)))
      • Touchscreen(Touch::Button(Press)) -> Mouse(Button(Right))
    • cargo test --all-targets passed (14/14 unit tests, 4/4 doc-tests).
  2. Clippy (Fedora 44 container):

    • cargo clippy --all-targets -- -D warnings passed with 0 warnings.

Comment thread src/input/event/value.rs Outdated
}
}

#[cfg(test)]

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.

Please make a new file, value_teat.rs, for all unit testing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. Extracted all unit tests into a dedicated src/input/event/value_test.rs file and verified test execution.

Comment thread src/input/event/value.rs
}
}

fn translate_touch_button(

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.

This is a bit of an anti-pattern but it does reduce nesting quite a bit. Probably a good direction for a refactor of older code at a later time. Not an ask, just making a note for myself.

@nileshchakraborty

Copy link
Copy Markdown
Contributor Author

@pastaq is there an automation that merges the changes, as I dont see an option to merge the PRs.

@pastaq

pastaq commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

No, I'll do it when I'm ready to publish a new release.

@pastaq
pastaq merged commit 1304ce8 into ShadowBlip:main Sep 14, 2026
3 checks passed
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.

Profile mappings: Touchpad Motion → Mouse Motion translation not implemented; Touchpad Button events cannot be translated at all

2 participants