Fix touchpad clicks and cursor movement in Passthru mode when switching profiles #102
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.
Fixes this issue: #87
Problem
When using a DualSense controller in Passthru touchpad mode, if the user switches profiles with touchpad, the touch state flags persist across the profile change. This causes unwanted mouse clicks and cursor movement to be generated when the profile switches to a mode that uses mouse simulation.
Root Cause
The
leftDowntouch flag is set when the touch begins in Passthru mode. When a profile switch occurs during the touch, the new profile's touchpad mode processes the ongoing touch event. SincesynthesizeMouseButtons()only checks the current mode (touchpadOutputMode == TouchpadOutMode.Passthru), it doesn't know the touch originated in Passthru mode and generates a click.Solution
Added a
touchStartedInPassthruflag to track the touchpad mode when a touch begins. This flag:truewhen touch activates in Passthru modesynthesizeMouseButtons()andtouchesMoved()TouchButtonUpFlags()This preserves the original intent: touches that start in Passthru mode should never generate mouse simulation, regardless of profile changes.
Changes
DS4Windows/DS4Control/Mouse.cstouchStartedInPassthrufield declaration (~line 47)TouchButtonUpFlags()to reset flag on touch end (~line 1661)TouchButtonCheckProcess()to set flag when touch activates in Passthru mode (~line 1782)synthesizeMouseButtons()to prevent clicks when flag is set (~line 1826)touchesMoved()Mouse mode section to prevent cursor movement when flag is set (~line 1107)touchesMoved()AbsoluteMouse mode section to prevent cursor movement when flag is set (~line 1161)Testing