Comments (7)
This is unlikely to ever be fixed in SDL2, as mouse coordinates are treated everywhere in the library as integers. SDL3 uses floats for pointer coordinates to avoid losing subpixel precision, including for warp destination coordinates.
SDL2 also doesn't implement setting the pointer position hint via the confinement protocol in the Wayland driver, so it won't appear to be affected because any warp functionality is a no-op.
from sdl.
Does this happen with SDL3, using the latest code in main?
from sdl.
Can I use SDL3 as a drop in in a proprietary game that currently uses SDL2? Otherwise, can you recommend some demo application that I can test SDL3 with?
Edit: It would have to be an application that uses absolute motion + warp to emulate relative motion. I believe that relative motion works as expected since it uses raw motion data that usually has no fractional component.
Edit: I tried sdl2-compat and in X11 mode the pointer is unable to move at all even if I move the mouse quickly so that the delta should be >=1. Wayland continues to work as expected.
from sdl.
Conceptually, I would think a warp would clear out any fractional mouse motion when it resets the position. I'm curious why this works on Wayland?
from sdl.
It appears that the wayland driver automatically switches into relative motion mode if the application tries to warp the cursor and the cursor is invisible.
from sdl.
That makes sense. I wonder if we should do that for other drivers?
from sdl.
Additionally, it looks like XWayland converts absolute pointer coordinates to integers internally: https://gitlab.freedesktop.org/xorg/xserver/-/blob/master/hw/xwayland/xwayland-input.c#L660
With SDL3 under a real X session, subpixel pointer coordinates are passed through. On XWayland, I'm only seeing integers.
That makes sense. I wonder if we should do that for other drivers?
It wouldn't be hard to move the activation logic to the mouse layer, and the Wayland SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP
hint could be repurposed for the general case. The one 'gotcha' case to watch out for is when SDL tries to warp the pointer during fullscreen transitions, as this has inadvertently activated the relative mode emulation when it shouldn't if the client has the system cursor hidden in favor of drawing their own software cursor.
e: Running testrelative with SDL_MOUSE_RELATIVE_MODE_WARP=1
shows just how badly the rounding affects the movement under XWayland.
from sdl.
Related Issues (20)
- [SDL3][audio] time to drop hardcoded channel maps for good? HOT 5
- Android `SDL_GetPreferredLocales` memory corruption HOT 1
- prerelease-3.x tags HOT 1
- Example build failing HOT 4
- Android safe area problems
- Android `setOrientationBis` issues HOT 6
- Automatic cleanup after 1 second in `SDL_FreeLater` can easily cause use after free bugs HOT 5
- Static compile on macOS with Swift with CMake HOT 10
- define of SDL_GetKeyboardState cannot avoid discarded-qualifiers warning HOT 4
- [Question - SDL2] Opt-out of "forcing X11" mech with GLEW&Co? HOT 4
- SDL3: SDL_GetDisplayBounds fails for 0th display HOT 1
- New temporary memory management can't work with threads HOT 1
- `SDL_GetWindowSizeInPixels` may fail HOT 1
- SDL_RenderTexture9Grid enhancement / freature request HOT 5
- Issue with FPS Capping at Monitor Refresh Rate Even When VSync is Disabled HOT 3
- Occasional segfault in testautomation: mouse_warpMouseInWindow HOT 7
- [SDL3] opengl issue HOT 2
- testautomation --filter render_testBlendModes fails with vulkan renderer HOT 1
- [SDL3] testffmpeg render issue HOT 1
- Window content does not exactly fit window size HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdl.