-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDL_MouseMotionEvent with SDL_WINDOW_ALLOW_HIGHDPI flag #2999
Comments
Is it possible, in terms of ABI breakage, to add fields to Given SDL_Event is 56 bytes =14 x 4-byte values, and
Likewise for
|
Any progress on this? |
I actually did a quick prototype of this last year, for Wayland + macOS: https://github.com/ericwa/SDL/commits/float-mouse-coords |
Now that development on SDL3 has begun... I think there are two options here (assuming we stick with using DPI-scaled units, which I believe we tentatively decided to do): change all mouse APIs so coordinate values are in floats, or add additional APIs for precise float coordinates alongside the current integer APIs. I'm a fan of keeping things simple and having just a single set of APIs, but I can also imagine the mouse APIs are frequently used together with things like the window size and position APIs which don't really have good reason to have high precision float values, so there might be a lot of int <-> float conversions in people's code if mouse APIs only use floats for position. If the extra variant approach is taken, using a Here's a list of all the existing position-related mouse APIs that will need to change or have Precise variants: // In SDL_MouseMotionEvent:
Sint32 x
Sint32 y;
Sint32 xrel;
Sint32 yrel;
// In SDL_MouseButtonEvent:
Sint32 x;
Sint32 y;
// In SDL_MouseWheelEvent:
Sint32 mouseX;
Sint32 mouseY;
Uint32 SDL_GetMouseState(int *x, int *y);
Uint32 SDL_GetGlobalMouseState(int *x, int *y);
Uint32 SDL_GetRelativeMouseState(int *x, int *y);
void SDL_WarpMouseInWindow(SDL_Window * window, int x, int y);
int SDL_WarpMouseGlobal(int x, int y); |
just a thought, not sure if this has been said: currently touch event as reported to a window (and also within the window, i think).
So it seems to me it should be linked to a VideoDisplay instead, (but we only have ids for them), so maybe linked to the SDL_DisplayMode of the VideoDisplay. |
Direct touch event coordinates are relative to the window though rather than a screen, right? |
|
it is yes |
FYI, I'm working on this now. |
You can get sub-pixel mouse coordinates and motion depending on the platform and display scaling. Fixes libsdl-org#2999
You can get sub-pixel mouse coordinates and motion depending on the platform and display scaling. Fixes libsdl-org#2999
You can get sub-pixel mouse coordinates and motion depending on the platform and display scaling. Fixes libsdl-org#2999
You can get sub-pixel mouse coordinates and motion depending on the platform and display scaling. Fixes libsdl-org#2999
You can get sub-pixel mouse coordinates and motion depending on the platform and display scaling. Fixes libsdl-org#2999
You can get sub-pixel mouse coordinates and motion depending on the platform and display scaling. Fixes #2999
This bug report was migrated from our old Bugzilla tracker.
Reported in version: 2.0.8
Reported for operating system, platform: All, x86
Comments on the original bug report:
On 2018-10-01 14:18:37 +0000, SKOMAND wrote:
On 2019-02-12 11:43:31 +0000, ®om wrote:
The text was updated successfully, but these errors were encountered: