Skip to content

Menu button alt layout - #6

Open
LAK132 wants to merge 5 commits into
LennardKittner:devfrom
LAK132:controller-layers
Open

Menu button alt layout#6
LAK132 wants to merge 5 commits into
LennardKittner:devfrom
LAK132:controller-layers

Conversation

@LAK132

@LAK132 LAK132 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

This is not finished but I figured I'd open this now to discuss how this should be implemented.
The basic idea is to treat the virtual controller ControllerInput as an idealised input rather than 1:1 the current state of the controller, and then handle the alt layout in steam_controller.rs.
I also propose using the menu button instead of the steam button for this, as the menu button has no equivalent on an xbox controller (which is what this is emulating) and it means the steam controller doesn't turn off if the alt layout button is held for too long.
This is currently just using an alt_mode boolean but I could imagine this being done with some kind of runtime modifiable map, which might also make it easier to allow custom bindings.

@LennardKittner

LennardKittner commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Ok, let us know if it is ready for review or if you have any questions.

The basic idea is to treat the virtual controller ControllerInput as an idealised input rather than 1:1 the current state of the controller, and then handle the alt layout in steam_controller.rs.

Sounds good.

I also propose using the menu button instead of the steam button for this, as the menu button has no equivalent on an xbox controller (which is what this is emulating) and it means the steam controller doesn't turn off if the alt layout button is held for too long.

I'd suggest making this configurable. I agree that the menu button is probably the better choice, but I would like to keep at least the default button combinations the same as under Steam.

@LAK132

LAK132 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

let us know if it is ready for review or if you have any questions.

I wouldn't mind your opinions on the state of it now. A bunch of the functions were made mutable which I am not keen on, but I'm not sure what the best way forward is

@LennardKittner

LennardKittner commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Correct me if I am wrong, but the only two functions causing all other functions to require mutability are get_buttons because of self.alt_mode = states.contains(Button::Menu) and handle_trackpads because of self.left_trackpad_prev = Some((left_x, left_y, left_force))

For the first one, we could generate a layer change event and propagate that up the call chain so only the function handling this event has to be mutable. We could perhaps also move the current layout into the device state.

For the handle_trackpads we could either change the wheel event to contain absolute positions instead of differences or also move the calculation of the difference up the call chain.

Regardless of the mutability "problem" it might also make sense to move all the handle_* functions that currently branch based on alt_mode to a new controller layout struct so it is easier to add layouts in the future.

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