Created
December 28, 2024 08:21
-
-
Save VoodaGod/e4ac5363bd98b86cf7ab739101f852e5 to your computer and use it in GitHub Desktop.
gamescope mouse sensitivity <0 dead range fix
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
--- a/src/wlserver.cpp | |
+++ b/src/wlserver.cpp | |
@@ -2336,6 +2336,8 @@ static bool wlserver_apply_constraint( double *dx, double *dy ) | |
return true; | |
} | |
+static double rem_x = 0.0; | |
+static double rem_y = 0.0; | |
void wlserver_mousemotion( double dx, double dy, uint32_t time ) | |
{ | |
assert( wlserver_is_lock_held() ); | |
@@ -2343,6 +2345,14 @@ void wlserver_mousemotion( double dx, double dy, uint32_t time ) | |
dx *= g_mouseSensitivity; | |
dy *= g_mouseSensitivity; | |
+ dx += rem_x; | |
+ dy += rem_y; | |
+ rem_x = fmod(dx, 1.0); | |
+ rem_y = fmod(dy, 1.0); | |
+ dx -= rem_x; | |
+ dy -= rem_y; | |
+ if (abs(dx) <= 0 && abs(dy) <= 0) return; | |
+ | |
wlserver_perform_rel_pointer_motion( dx, dy ); | |
if ( !wlserver_apply_constraint( &dx, &dy ) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
adapted from ValveSoftware/gamescope#1521 (comment)