Description
This bug report was migrated from our old Bugzilla tracker.
Reported in version: 2.0.3
Reported for operating system, platform: Linux, x86_64
Comments on the original bug report:
On 2015-04-21 23:59:20 +0000, Wouter van Oortmerssen wrote:
values in xrel/yrel range from 0..64k, and correspond to the extends of the linux desktop (not my SDL window), or 0 when no movement along the axis.
On Win/Mac I get correct relative values, as does Linux when SDL_SetRelativeMouseMode is not used.
On 2016-01-19 22:43:01 +0000, Anthony Birkett wrote:
Same issue on Debian.
In testing, this appears to be a problem when running on Wayland, or in a Virtual Machine.
Debian Jessie amd64
VMWare 12
X11 + Gnome
SDL_SetMouseRelativeMode(SDL_TRUE) - bad xrel and yrel values.Debian Sid amd64
Thinkpad W530 bare metal
X11 + Gnome
SDL_SetMouseRelativeMode(SDL_TRUE) - working fine.Debian Sid amd64
Thinkpad W530 bare metal
Wayland + Gnome
SDL_SetMouseRelativeMode(SDL_TRUE) - bad xrel and yrel values.Setting SDL_SetMouseRelativeMode(SDL_FALSE) seems to help, but defeats the point of capturing mouse movement.
On 2016-01-19 23:00:15 +0000, Anthony Birkett wrote:
To add,
SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1", SDL_HINT_OVERRIDE);
This does help, but doesn't seem to warp the mouse back to center.
On 2016-01-20 20:26:03 +0000, Philipp Wiesemann wrote:
There is currently no relative mouse mode and no warping implemented in SDL for Wayland.
SDL_SetRelativeMouseMode() should return -1 if there is no support for relative mouse mode.
The (later) bug # 3226 describes similar problems on Android where it is also not implemented.
On 2016-01-23 18:52:10 +0000, Wouter van Oortmerssen wrote:
Yes, for me this also happens in a VirtualBox VM (one that has been set up with 2d & 3d hardware accelleration, latest version, latest guest drivers).
Thing is, if SDL_SetMouseRelativeMode failing with -1 is the cause of the problem, why does it still affect the xrel/yrel values? These values seem to work fine if SDL_SetMouseRelativeMode is never called.
I'm not familiar with what kind of support SDL_SetMouseRelativeMode needs from the system, but wouldn't it be more useful if instead of failing it emulated relative mouse mode values to the best of its abilities (by supplying the delta between the last two mouse positions) rather than bogus values?
On 2018-09-29 21:32:52 +0000, wrote:
From https://bugzilla.libsdl.org/show_bug.cgi?id=2150 - this occurs on Ubuntu Linux 18.04.1 in a VMware Fusion virtual machine, the above workaround posted works however (also thanks to https://stackoverflow.com/questions/25576438/sdl-getrelativemousestate-strange-behaviour).
Example test program, uncomment hint to demonstrate the issue:
// cc sdlmotion.c -lSDL2 #include <SDL2/SDL.h> int main() { SDL_Window *window = SDL_CreateWindow("Demo Game", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_OPENGL); SDL_Event event; // https://stackoverflow.com/questions/25576438/sdl-getrelativemousestate-strange-behaviour SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1", SDL_HINT_OVERRIDE); printf("SDL_SetRelativeMouseMode = %d\n", SDL_SetRelativeMouseMode(SDL_TRUE)); do { while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_QUIT: exit(0); case SDL_MOUSEMOTION: printf("x=%d, y=%d, xrel=%d, yrel=%d\n", event.motion.x, event.motion.y, event.motion.xrel, event.motion.yrel); } } } while(1); }
On 2019-09-19 11:43:49 +0000, Stijn Volckaert wrote:
I am also seeing this issue with SDL 2.0.10. I'm testing on Ubuntu 18.04 in a VMWware Workstation 15 Player VM. The above workaround stops the extreme mouse warping but it still doesn't quite fix everything as the mouse input now lags a LOT. I did not see this issue on Mac.
On 2019-09-19 12:26:47 +0000, Stijn Volckaert wrote:
Additional information:
- This also happens on Ubuntu 14.04.6 LTS 32-bit (in a VMWare Workstation 15 Player VM)
- Even with the workaround, my xrel/yrel values make no sense. They're just absolute positions relative to the center of the window
- Once I reach the edge of the window, my xrel/yrel values become 0
On 2019-09-19 20:10:33 +0000, Stijn Volckaert wrote:
What Wouter said seems to apply to VMware in its default configuration. Setting vmmouse.present to false in my vm configuration solved this problem. I did not need the warp hint after doing this.