Skip to content

Instantly share code, notes, and snippets.

@VoodaGod
Last active June 24, 2026 14:32
Show Gist options
  • Select an option

  • Save VoodaGod/e4ac5363bd98b86cf7ab739101f852e5 to your computer and use it in GitHub Desktop.

Select an option

Save VoodaGod/e4ac5363bd98b86cf7ab739101f852e5 to your computer and use it in GitHub Desktop.
gamescope mouse sensitivity <0 dead range fix
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
index 75fa37c6..20d64c8e 100644
--- a/src/wlserver.cpp
+++ b/src/wlserver.cpp
@@ -2753,6 +2753,16 @@ void wlserver_mousemotion( double dx, double dy, uint32_t time )
dx *= g_mouseSensitivity;
dy *= g_mouseSensitivity;
+
+ static double rem_x = 0.0;
+ static double rem_y = 0.0;
+ 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 );
@VoodaGod

VoodaGod commented Dec 28, 2024

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment