Skip to content

hwcomposer: Add touchpad pinch-to-zoom gesture support#66

Open
supechicken wants to merge 1 commit into
waydroid:lineage-20from
WayDroid-ATV:touchpad
Open

hwcomposer: Add touchpad pinch-to-zoom gesture support#66
supechicken wants to merge 1 commit into
waydroid:lineage-20from
WayDroid-ATV:touchpad

Conversation

@supechicken

@supechicken supechicken commented Oct 7, 2025

Copy link
Copy Markdown
Contributor

Fixes waydroid/waydroid#905
Fixes waydroid/waydroid#1180
Partially fixes waydroid/waydroid#1953

This works by mapping the touchpad pinch gesture to touch movements, which sounds much easier compared to patching AOSP sources :)

However, when the cursor is close to the edge of window, this might not work due to the lack of space for mapping the gesture (can be mitigated by setting a lower value in persist.waydroid.zoom_sensitivity, but this also affects the sensitivity as well)

The sensibility can be adjusted by these two props; a higher value means faster zoom-in/out speed when the gesture is performed, and vice versa (and more screen space is needed to perform the gesture):

  • persist.waydroid.zoom_sensitivity (default: 120)

@supechicken supechicken changed the title hwcomposor: Add touchpad pinch-to-zoom gesture support hwcomposer: Add touchpad pinch-to-zoom gesture support Oct 7, 2025
Comment thread hwcomposer/wayland-hwc.cpp Outdated
Comment thread hwcomposer/wayland-hwc.cpp Outdated
Comment thread hwcomposer/wayland-hwc.cpp Outdated
Signed-off-by: SupeChicken666 <me@supechicken666.dev>
@supechicken

Copy link
Copy Markdown
Contributor Author

Changes in 8090f77

  • Sensitivity is set via persist.waydroid.zoom_sensitivity now, stored in display struct (default: 120), which is then multiplied by the current display scale
  • Fixed indentation

@supechicken

Copy link
Copy Markdown
Contributor Author

/gemini start

@gemini-code-assist

Copy link
Copy Markdown

Thank you for the update. I have reviewed the implementation of the touchpad pinch-to-zoom gesture support. The approach of mapping pinch gestures to touch events using zwp_pointer_gestures_v1 is a clever way to avoid patching AOSP. I have a few observations regarding the implementation:

  1. Error Handling: In gesture_pinch_update, you are checking the return value of write and logging an error if it fails. This is good practice. However, consider if there are scenarios where a partial write could occur, or if the input_fd might be closed unexpectedly, which could lead to inconsistent state in the InputFlinger.

  2. Resource Management: In seat_handle_capabilities, you are creating a pipe for INPUT_TOUCH if it doesn't exist. Ensure that this pipe is properly cleaned up or closed when the display is destroyed or the capability is lost to prevent file descriptor leaks.

  3. Maintainability: The gesture_pinch_update function is becoming quite large. While it is functional, consider if parts of the event construction logic could be refactored into smaller helper functions to improve readability.

Overall, the logic seems sound for the intended purpose. Please ensure you have tested this across different Wayland compositors to verify the gesture behavior remains consistent.

@supechicken supechicken requested a review from aleasto May 10, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants