Skip to content

feat(tao): forward back/forward mouse buttons to Compose - #728

Merged
kdroidFilter merged 1 commit into
NucleusFramework:nucleus-2.6from
skyecodes:feature/navigation_mouse_buttons
Sep 25, 2026
Merged

kdroidFilter merged 1 commit into
NucleusFramework:nucleus-2.6from
skyecodes:feature/navigation_mouse_buttons

Conversation

@skyecodes

Copy link
Copy Markdown

🚀 Description

Passes the mouse back/forward side buttons through to Compose as PointerButton.Back / PointerButton.Forward on the Tao backend.

Kotlin

  • TaoMouseButton: adds BACK = 3 and FORWARD = 4, and moves OTHER from 3 to 5.
  • AbstractTaoComposeSceneHost.mapButton and TaoPopupSceneLayerLinux: map the new codes to PointerButton.Back / PointerButton.Forward.

Native

  • events.rs: the Rust MOUSE_BUTTON_* codes now match Kotlin (BACK = 3, FORWARD = 4, OTHER = 5). MouseButton::Other(n) is mapped per OS: Windows XBUTTON1/XBUTTON2 (1/2), Linux GDK buttons 8/9, macOS NSEvent.buttonNumber 3/4.
  • Vendored tao (macOS): otherMouseDown: / otherMouseUp: read NSEvent.buttonNumber instead of always reporting Middle.
  • nucleus_tao_linux_widget.c: the NativeView capture boxes map GDK buttons 8/9 to back/forward. Before, the raw number went through and Kotlin treated it as a Primary click.

Tests / API

  • TaoMouseButtonWireDriftTest (new): fails if the events.rs MOUSE_BUTTON_* values and TaoMouseButton stop matching.
  • API dump updated for the new TaoMouseButton.BACK / FORWARD fields.

Not covered: the X11/macOS native popup panels (WIRE_BUTTON_*) and the Windows NativeView blending overlay still only handle primary/secondary/tertiary, so side buttons are dropped there.

📄 Motivation and Context

Side buttons are the usual way to go back/forward in apps with history (browsers, file managers, docs viewers). On Tao they never reached Compose correctly:

  • Windows / Linux: every extra button arrived as the same code, so Forward was indistinguishable from Back.
  • macOS: all extra buttons were reported as Middle.

🧪 How Has This Been Tested?

On Linux (x64):

  • cargo check of the native crate passes.
  • The Linux natives rebuild through buildNativeLinux.
  • :decorated-window-tao:test --tests '*TaoMouseButtonWireDriftTest*' passes.
  • :decorated-window-tao:detekt and ktlintCheck pass.
  • apiDump has been regenerated.
  • Manual check with a real mouse's side buttons on Linux

Not yet tested:

  • macOS and Windows native builds (the macOS change uses NSEvent::buttonNumber() from objc2-app-kit)
  • Manual check with a real mouse's side buttons on Windows and macOS

📦 Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

⚠️ TaoMouseButton.OTHER changes from 3 to 5. It's a const val, so code compiled against the old value inlines 3 (now BACK) until it is recompiled.

✅ Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@kdroidFilter

Copy link
Copy Markdown
Collaborator

Can you target the nucleus 2.6 branch? Thank you very much!

@skyecodes
skyecodes changed the base branch from main to nucleus-2.6 September 25, 2026 12:20
@skyecodes
skyecodes force-pushed the feature/navigation_mouse_buttons branch from ace865f to c784a88 Compare September 25, 2026 12:47
@skyecodes

Copy link
Copy Markdown
Author

Rebased onto nucleus-2.6 and changed the target branch.

@kdroidFilter
kdroidFilter merged commit 899a883 into NucleusFramework:nucleus-2.6 Sep 25, 2026
4 of 8 checks passed
@kdroidFilter

Copy link
Copy Markdown
Collaborator

thank you very much, you will be able to test it soon in the dev version 2.6.0-dev-202609251324

@skyecodes

Copy link
Copy Markdown
Author

thank you very much, you will be able to test it soon in the dev version 2.6.0-dev-202609251324

Thanks for the dev release! I tested it on my application on Linux & Windows and it works fine 👍 I don't have a macOS machine so I couldn't test it on macOS unfortunately.

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.

2 participants