mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 13:05:47 +00:00
* fix(gamescope): only the first finger drives the emulated mouse In the click touch modes every finger warped the X pointer and any finger lifting released the click, so a second finger made the pointer jump between both contacts and dropped whatever the first was dragging. The first finger of a gesture now owns the emulated mouse until it lifts, and later fingers are ignored until every finger is up. * fix(gamescope): motion into the screen edge does not decide the pointer hold A drawn-cursor game whose X pointer sat at the screen edge looked like it held the pointer whenever motion pushed outward, which kept the hold on and turned touch drags into relative motion. The sent motion is clamped to what the pointer can reach before the comparison. * fix(gamescope): touch warps do not decide the pointer hold * fix(gamescope): only touch-down warps are left out of the pointer hold Touch drags are real pointer motion, so they count toward releasing the hold again. Only the jump a touch-down makes is skipped.
74 lines
2.2 KiB
Diff
74 lines
2.2 KiB
Diff
diff --git a/src/wlserver.hpp b/src/wlserver.hpp
|
|
--- a/src/wlserver.hpp
|
|
+++ b/src/wlserver.hpp
|
|
@@ -173,6 +173,7 @@
|
|
double flFollowDY = 0.0;
|
|
double flSentDX = 0.0;
|
|
double flSentDY = 0.0;
|
|
+ uint64_t ulTouchDownWarps = 0;
|
|
|
|
bool button_held[ WLSERVER_BUTTON_COUNT ];
|
|
std::set <uint32_t> touch_down_ids;
|
|
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
|
|
--- a/src/wlserver.cpp
|
|
+++ b/src/wlserver.cpp
|
|
@@ -3429,6 +3429,7 @@
|
|
if ( eMode != gamescope::TouchClickModes::Trackpad )
|
|
{
|
|
wlserver_mousewarp( tx, ty, time, false, true );
|
|
+ wlserver.ulTouchDownWarps++;
|
|
}
|
|
|
|
uint32_t button = TouchClickModeToLinuxButton( eMode );
|
|
diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp
|
|
--- a/src/steamcompmgr.cpp
|
|
+++ b/src/steamcompmgr.cpp
|
|
@@ -3263,6 +3263,7 @@
|
|
static bool s_bHinted = false;
|
|
static const steamcompmgr_win_t *s_pWindow = nullptr;
|
|
static const struct wlr_pointer_constraint_v1 *s_pConstraint = nullptr;
|
|
+ static uint64_t s_ulTouchDownWarps = 0;
|
|
|
|
wlserver_lock();
|
|
const double flX = wlserver.mouse_surface_cursorx;
|
|
@@ -3272,8 +3273,12 @@
|
|
const struct wlr_pointer_constraint_v1 *pConstraint = wlserver.GetCursorConstraint();
|
|
wlserver.flSentDX = 0.0;
|
|
wlserver.flSentDY = 0.0;
|
|
+ const uint64_t ulTouchDownWarps = wlserver.ulTouchDownWarps;
|
|
wlserver_unlock();
|
|
|
|
+ const bool bTouchDown = ulTouchDownWarps != s_ulTouchDownWarps;
|
|
+ s_ulTouchDownWarps = ulTouchDownWarps;
|
|
+
|
|
if ( !bConstrained || !pFocus->cursor )
|
|
{
|
|
s_bTracking = false;
|
|
@@ -3314,19 +3319,19 @@
|
|
int nRootY = 0;
|
|
pFocus->cursor->QueryRootPosition( &nRootX, &nRootY );
|
|
|
|
- if ( s_bTracking )
|
|
+ if ( !s_bTracking )
|
|
+ {
|
|
+ s_Hold = PointerHold{};
|
|
+ s_Hold.bHeld = bHinted;
|
|
+ s_bPointerHeld = bHinted;
|
|
+ }
|
|
+ else if ( !bTouchDown )
|
|
{
|
|
const xwayland_ctx_t *pCtx = pFocus->cursor->getCtx();
|
|
const double flReachX = pointer_reach( s_nRootX, flDX, pCtx->root_width );
|
|
const double flReachY = pointer_reach( s_nRootY, flDY, pCtx->root_height );
|
|
s_bPointerHeld = pointer_hold_step( s_Hold, true, flReachX, flReachY, nRootX - s_nRootX, nRootY - s_nRootY, get_time_in_nanos() );
|
|
}
|
|
- else
|
|
- {
|
|
- s_Hold = PointerHold{};
|
|
- s_Hold.bHeld = bHinted;
|
|
- s_bPointerHeld = bHinted;
|
|
- }
|
|
|
|
s_bTracking = true;
|
|
s_flSeatX = flX;
|