Comments (20)
I'll take a look and see what's going on.
from sdl.
@Kontrabant, this is on iOS. Maybe we need some special consideration there for touch input?
from sdl.
I'm wondering if we even need it enabled by default on the non-desktop platforms, given that this is mainly to help legacy titles on platforms where constantly warping the pointer doesn't behave as expected?
from sdl.
JFYI it also affects Android builds (needing SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE=0
to work) after this change.
from sdl.
I'm wondering if we even need it enabled by default on the non-desktop platforms, given that this is mainly to help legacy titles on platforms where constantly warping the pointer doesn't behave as expected?
Probably not, but it sounds like a bug that if it's enabled for some reason (maybe someone sets it in their application?) it affects touch input.
from sdl.
The warp emulation wasn't being disabled when warping the mouse on fullscreen transitions. I'm pushing a fix to take care of that now.
from sdl.
@DominusExult, can you try the main branch now and see if your issue is fixed?
from sdl.
Just tried and it's not completely fixed. At first it seems to be but there are some things in our code that accidentally unhides the cursor again. When I then tap on the screen again, the cursor hides again but touch input is stuck on where I touched (that triggered the cursor hiding). So every time I touch the screen it only registers the touch on that one spot.
from sdl.
I'm having trouble getting a repro case here.
Are these the correct steps?
- Hide the cursor
- Warp the mouse to 0,0
- Mouse events no longer report change in position
Is that right?
At least with those steps, I'm seeing mouse relative mode being enabled and then touch moves the mouse.
Are there any other hints in play or something I'm missing?
from sdl.
Maybe itβs
- start with the mouse pointer hidden
- Unhide it
- Hide it again (maybe by touch)
- ..
from sdl.
Can you debug the SDL mouse code and see what's happening there? I can't repro with a simple test case.
from sdl.
I need some help with what you need to be logged where in SDL source and in which form, that's not my strength. (Or I can send a package with Exult source etc. and data to make it run on your end).
from sdl.
Yeah, a package with repro steps would be helpful, thanks!
from sdl.
I've sent you an email
from sdl.
I got it, thanks. However, I'm seeing different behavior.
Regardless of the value of the hint, the green cursor is stuck in the upper right area of the game, but clicking on the map shows a message "Clicked at tile (x, y)" and the values seem to match up with where I'm clicking. If I drag briefly the character will walk to the area I clicked. If I click on an object I get a dropdown menu of actions.
If I try to click on the map, the green cursor is outside the map and it just closes, I don't teleport at all.
As I said, this doesn't change based on the value of the hint. I haven't played this before, so I'm not sure whether this is correct behavior or not?
from sdl.
You have to double tap/click the map to get the cheat map (without the compass in the upper right) that teleports you to where you click on it.
The teleport part is important as this only triggers the odd behaviour.
from sdl.
So this is the issue. The mouse gets hidden, and then this code runs, which triggers the automatic relative mouse mode.
// teleported = 1;
// generate mousemotion event
float x;
float y;
SDL_GetMouseState(&x, &y);
SDL_WarpMouseInWindow(win->get_screen_window(), x, y);
@Kontrabant, do we need a better heuristic for entering relative mouse mode? Maybe repeated warps to the center?
from sdl.
Hmm, I wonder if we actually need this in Exult anymore. Commenting that whole part seems to make no difference and that code is essentially 23 years old.
We use SDL_WarpMouseInWindow() in our main mouse code as well https://github.com/exult/exult/blob/master/mouse.cc#L162 (edit: which also seems to do nothing of note these days)
from sdl.
The problem is fixed on our side by removing the one SDL_WarpMouseInWindow()
in our code that Sam pointed at. The other one is not affecting our mobile platforms.
Up to you to decide whether you need to follow up with a general fix for when SDL_WarpMouseInWindow()
is used on iOS/Android.
from sdl.
@Kontrabant, do we need a better heuristic for entering relative mouse mode? Maybe repeated warps to the center?
I think that would be a good idea. Maybe more than one warp to center within a certain timeframe (a 30ms window or so)?
from sdl.
Related Issues (20)
- SDL_CopyDirectory, SDL_RenameDirectory HOT 3
- SDL_SetSurfaceColorKey() sets wrong color HOT 4
- SDL_Init(SDL_INIT_AUDIO) randomly segfaults on init HOT 19
- NetBSD CI is down HOT 1
- SDL_GetHint does not work when not calling SDL_Init HOT 1
- main callbacks return enum values? HOT 1
- Missing Pen backends HOT 4
- SDL_AcquireCameraFrame returns frames at a higher FPS than specified on macOS 14.6.1 HOT 3
- SDL_ConvertSurfaceAndColorspace does not correctly palettize surfaces HOT 6
- SDL_Log not working on Windows with debugger attached HOT 10
- [SDL2] Gamepad Motion Sensors via Bluetooth don't work until you launch another SDL App with working Motion Sensors or swap older SDL2.dll files HOT 2
- Updates on dropping Apple frameworks not available on iOS? HOT 7
- Embed a SDL window by NativeControlHost control in AvaloniaUI, mouse cursor don't restore to default on Linux x11. HOT 1
- Feature request SDL_EVENT_FINGER_CANCELLED
- MFC window, pop a sdl window, break! HOT 1
- Decide and Document how planar data is stored in / accessed from Surfaces
- Always prefer downscaling in SDL_GetSurfaceImage HOT 3
- [SDL2] VITA: Can't create any render at all HOT 2
- [macos] HIDAPI device disconnected while opening
- testcamera prints irrelevant debug message on exit (Windows) HOT 1
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.