-
Notifications
You must be signed in to change notification settings - Fork 35
add Steam Deck L/R touchpad support #500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
GloriousEggroll
wants to merge
1
commit into
ShadowBlip:main
Choose a base branch
from
GloriousEggroll:steam_deck_touchpad_support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,11 +153,11 @@ func populate_gamepad_mappings_for(capabilities: PackedStringArray, gamepad_icon | |
| if capability.begins_with("Gamepad:Gyro"): | ||
| gyro_events.append(capability) | ||
| continue | ||
| if capability.begins_with("TouchPad:"): | ||
| if capability.begins_with("Touchpad:") or capability.begins_with("TouchPad:"): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oof, we should fix that in InputPlumber... |
||
| touchpad_events.append(capability) | ||
| continue | ||
| logger.warn("Unhandled capability: " + capability) | ||
|
|
||
| # Create all the button mappings | ||
| var label := $%ButtonsLabel | ||
| label.visible = button_events.size() > 0 | ||
|
|
@@ -197,6 +197,10 @@ func populate_mouse_mappings_for(caps: PackedStringArray) -> void: | |
| for capability in caps: | ||
| if capability.begins_with("Mouse:"): | ||
| mouse_capabilities.append(capability) | ||
| continue | ||
| if capability.begins_with("Touchpad:") or capability.begins_with("TouchPad:"): | ||
| mouse_capabilities.append(capability) | ||
| continue | ||
|
|
||
| logger.debug("Found target capabilities for mouse: " + str(mouse_capabilities)) | ||
|
|
||
|
|
@@ -209,13 +213,27 @@ func populate_mouse_mappings_for(caps: PackedStringArray) -> void: | |
| var motion_events := PackedStringArray() | ||
| for capability: String in mouse_capabilities: | ||
| logger.debug("Capability: " + capability) | ||
|
|
||
| # Mouse native | ||
| if capability.begins_with("Mouse:Button"): | ||
| button_events.append(capability) | ||
| continue | ||
| if capability.begins_with("Mouse:Motion"): | ||
| motion_events.append(capability) | ||
| continue | ||
|
|
||
| # Touchpad -> treat as mouse-like sources | ||
| if capability.begins_with("Touchpad:") or capability.begins_with("TouchPad:"): | ||
| if capability.find(":Touch:Motion") != -1: | ||
| motion_events.append(capability) | ||
| continue | ||
| if capability.find(":Touch:Button:Press") != -1: | ||
| button_events.append(capability) | ||
| continue | ||
| if capability.find(":Touch:Button:Touch") != -1: | ||
| button_events.append(capability) | ||
| continue | ||
|
|
||
| # Delete any old buttons | ||
| for child in mouse_input_container.get_children(): | ||
| if child is CardInputIconButton or child is CardButton: | ||
|
|
@@ -241,18 +259,32 @@ func _add_button_for_capability(capability: String, parent: Node, neighbor: Node | |
|
|
||
| var button := card_button_scene.instantiate() as CardInputIconButton | ||
| button.name = capability | ||
| var on_button_ready := func(): | ||
| button.input_icon.max_width = 64 | ||
| button.set_target_device_icon_mapping(gamepad_icons_type) | ||
| button.input_icon.force_type = 1 # Force type to keyboard/mouse | ||
| var button_parent := button.get_parent() | ||
| if button.set_target_icon(capability) != OK: | ||
| logger.debug("Failed to set icon for capability: " + capability) | ||
| button_parent.remove_child(button) | ||
| button.queue_free() | ||
| if button.input_icon.textures.is_empty(): | ||
| button_parent.remove_child(button) | ||
| button.queue_free() | ||
| var on_button_ready := func(): | ||
| button.input_icon.max_width = 64 | ||
| button.set_target_device_icon_mapping(gamepad_icons_type) | ||
|
|
||
| # Only force keyboard/mouse icons for the Mouse tab (you pass "" there) | ||
| if gamepad_icons_type.is_empty(): | ||
| button.input_icon.force_type = 1 # keyboard/mouse | ||
| else: | ||
| # Let it behave normally for gamepad icon mapping / dropdown | ||
| # (do NOT set force_type at all, or set it to the default value if your widget needs it) | ||
| pass | ||
|
|
||
| var button_parent := button.get_parent() | ||
|
|
||
| # Keep the original behavior: if we cannot render an icon at all, remove the row | ||
| if button.set_target_icon(capability) != OK: | ||
| logger.debug("Failed to set icon for capability: " + capability) | ||
| button_parent.remove_child(button) | ||
| button.queue_free() | ||
| return | ||
|
|
||
| if button.input_icon.textures.is_empty(): | ||
| button_parent.remove_child(button) | ||
| button.queue_free() | ||
| return | ||
|
|
||
| button.ready.connect(on_button_ready) | ||
|
|
||
| # Update the mapping with the selected capability | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, the deck's build in touchpads should work as touchpads within steam and on the desktop when steam is running. What problem is this solving?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats the problem. if we just pass through the touchpad motions we get both sides acting as touchpads instead of how they are supposed to behave in the inputplumber driver, BUT since touchpad target is never passed through, they do nothing:
Expected from steam:
When inputplumber is running and deck or deck-uhid is NOT being used, we get SteamOS behavior. which is leftpad dpad right pad nothing.
Current problem:
When inputplumber is running and deck or deck-uhid IS being used, we're currently just passing the touchpad
motions through, which means both of them act like mouse touchpads, HOWEVER because ogui doesnt pass touchpad as a target device, neither touchpad works.
This fix:
When inputplumber is running and deck or deck-uhid IS being used, we pass both devices through as touchpad motion, and use our driver to map the left as a dpad, this is enhanced better than SteamOS because we also get right pad as a touchpad instead of nothing.