Commit Graph

41 Commits

Author SHA1 Message Date
Sam Lantinga
e7c2cf107a Fixed bug 4704 - SDL_HINT_ANDROID_SEPERATE_MOUSE_AND_TOUCH on Windows?
superfury

I notice that, somehow, when locking the mouse into place(using SDL_SetRelativeMouseMode), somehow at least the movement information gets through to both mouse movement and touch movement events?

My app handles both, so when moving a touched finger accross the app(using RDP from an Android device) I see the mouse moving inside the app when it shouldn't(meaning that the touch movement is ignored properly by the app(press-location dependant) but the mouse movement is still performed due to the mouse movement events)?
2019-07-15 09:36:53 -07:00
Sylvain Becker
6625203514 SDL_Mouse/Touch: discard synthetic events when hints are not set.
Those are generated/flagged by platform layer.
2019-07-09 11:46:42 +02:00
Ryan C. Gordon
e841b066fd cocoa: Another attempt at mouse vs touch support.
This time, we make anything we think is a MacBook trackpad report its touches
as SDL_MOUSE_TOUCHID, even though they're not _actually_ synthesized events,
and let all mouse input--even if the OS synthesized it from a multitouch
trackpad on our behalf--look like physical input. This is backwards from
reality, but produces the results most apps will expect.

Note that if you have a real touch device that doesn't appear to be the
trackpad, it'll produce real touch events with unique device ids, so it's
not a total loss here, but also note that the way we decide if it was the
trackpad is an imperfect heuristic; it happens to work out right now, but
it's not impossible that a real touchscreen could come to the Mac at some
point and (incorrectly?) call it a "mouse" input, etc.

But for now, good enough.

Fixes Bugzilla #4690.
2019-07-08 13:41:01 -04:00
Sam Lantinga
8ab907baa6 Only warp the mouse to set focus if we're definitely going into relative mode 2019-06-18 14:24:26 -07:00
Ryan C. Gordon
d9a2eff26f cocoa: Another attempt at synthesized mouse/touch events. 2019-06-13 21:31:03 -04:00
Ryan C. Gordon
294574647d cocoa: Revised synthesized mouse/touch event strategy.
I _think_ I understand what Sylvain is working on here now, so hopefully I
got this right.

Fixes Bugzilla #4576.

(I think!)
2019-06-13 01:57:13 -04:00
Sam Lantinga
e401b95025 Return an error if both mouse relative mode and mouse warping are unavailable, instead of asserting. 2019-05-23 11:32:36 -07:00
Sylvain Becker
eb7affeeb8 SDL_HINT_MOUSE_TOUCH_EVENTS: move tracking appart in case of 'window' is null 2019-04-06 21:52:51 +02:00
Sam Lantinga
9eac91dd29 Set SDL_HINT_MOUSE_TOUCH_EVENTS for iPhone and iPad as well 2019-04-05 08:10:12 -07:00
Sylvain Becker
b470cd9b09 Android: default SDL_HINT_MOUSE_TOUCH_EVENTS to 1 as previous behaviour 2019-04-05 08:36:31 +02:00
Sylvain Becker
e41576188d Add hint SDL_HINT_MOUSE_TOUCH_EVENTS for mouse events to generate touch events
controlling whether mouse events should generate synthetic touch events
By default SDL will *not* generate touch events for mouse events
2019-04-04 16:51:50 +02:00
Sylvain Becker
ab03892ddf Bug 4576: track both FingerId and TrackId 2019-04-04 15:19:00 +02:00
Sam Lantinga
b8bd0aa0bd Fixed bug 4450 - SDL_mouse.c fails to compile with CMake generated Visual Studio files if SDL_VIDEO_VULKAN 0/undefined
Max Waine

SDL_mouse.c, if compiled for Windows, requires GetDoubleClickTime to compile (available from winuser.h). Without Vulkan present this fails to compile as the include chain for winuser.h is the following.

SDL_mouse.c -> SDL_sysvideo.h -> SDL_vulkan_internal.h -> SDL_windows.h -> windows.h -> winuser.h.
Problem is that SDL_vulkan_internal.h doesn't include SDL_windows.h if Vulkan isn't present, so under MinGW/GCC it will give a -Wimplicit-function-declaration warning for GetDoubleClickTime, and under MSVC fails to compile completely.

The solution to this would be to simplify the include chain: including SDL_windows.h under the same condition as GetDoubleClickTime (#ifdef __WIN32__) in SDL_mouse.c (or another file that isn't quite so indirectly included).
2019-03-16 19:07:34 -07:00
Sylvain Becker
28f54ee439 SDL_MouseQuit(): clear mouse->cur_cursor (Bug 4530) 2019-03-11 15:31:46 +01:00
Sam Lantinga
5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Sam Lantinga
898644d18e Made it more clear that the values being compared are floats 2018-12-06 09:09:05 -08:00
Sylvain Becker
252dc85e95 Fix warnings detected on Android build 2018-12-06 09:22:00 +01:00
Sam Lantinga
6b3e893105 Added hints SDL_HINT_MOUSE_DOUBLE_CLICK_TIME and SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS to allow tuning double-click sensitivity.
Also increased the default double-click radius to 32 pixels to be more forgiving for touch interfaces
2018-09-14 19:26:26 -07:00
Sam Lantinga
a515853569 Added support for external mouse in Samsung DeX mode
relative mode doesn't work, but absolute coordinates are functional
2018-06-18 13:14:02 -07:00
Sam Lantinga
2dedbc7262 Add Android support for relative mouse mode to SDL. 2018-06-05 12:46:11 -07:00
Sam Lantinga
e3cc5b2c6b Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Ryan C. Gordon
5cc46f3d30 mouse: remove assert for unimplemented platforms (thanks, tomwardio!).
Fixes Bugzilla #3946.
2017-11-06 15:29:24 -05:00
Sam Lantinga
a223560a7f Fixed bug 3880 - X Error upon quit since rev. 11607
Ozkan Sezer

Since changeset 11607:60cd425a2f14, I am getting the following
error upon quit.  Running testsprite2, clicking the mouse, and
quiting it is enough to trigger it.  This is on my old Fedora9
x86-Linux:

X Error of failed request:  BadCursor (invalid Cursor parameter)
  Major opcode of failed request:  2 (X_ChangeWindowAttributes)
  Resource id in failed request:  0xb057340
  Serial number of failed request:  905
  Current serial number in output stream:  906

Reverting  https://hg.libsdl.org/SDL/rev/60cd425a2f14  removes
the error.
2017-10-13 19:30:34 -07:00
Sam Lantinga
1887c54c68 Fixed memory leak in Cocoa mouse code
The video quit call cleans up the mouse cursor driver data, which happens after mouse quit
2017-10-12 13:28:48 -07:00
Ryan C. Gordon
7a9b9e05e0 SDL_mouse.c doesn't need default_cursor.h. 2017-08-17 20:47:16 -04:00
Sam Lantinga
a4cfa93670 Fixed bug 2293 - Precise scrolling events
Martijn Courteaux

I implemented precise scrolling events. I have been through all the folders in /src/video/[platform] to implement where possible. This works on OS X, but I can't speak for others. Build farm will figure that out, I guess. I think this patch should introduce precise scrolling on OS X, Wayland, Mir, Windows, Android, Nacl, Windows RT.

The way I provide precise scrolling events is by adding two float fields to the SDL_MouseWheelScrollEvent datastructure, called "preciseX" and "preciseY". The old integer fields "x" and "y" are still present. The idea is that every platform specific code normalises the scroll amounts and forwards them to the SDL_SendMouseWheel function. It is this function that will now accumulate these (using a static variable, as I have seen how it was implemented in the Windows specific code) and once we hit a unit size, set the traditional integer "x" and "y" fields.

I believe this is pretty solid way of doing it, although I'm not the expert here.

There is also a fix in the patch for a typo recently introduced, that might need to be taken away by the time anybody merges this in. There is also a file in Nacl which I have stripped a horrible amount of trailing whitespaces. (Leave that part out if you want).
2017-08-14 21:28:04 -07:00
Sam Lantinga
de91b1248f Fixed bug 3745 - specify SDLCALL as the calling convention for API callbacks
Patches contributed by Ozkan Sezer
2017-08-14 06:28:21 -07:00
Sam Lantinga
bfd5a13473 Fixed bug 2931 - Large relative mouse motion jumps when using touch input 2017-08-12 20:25:49 -07:00
Sam Lantinga
56cab6d452 Added a hint SDL_HINT_TOUCH_MOUSE_EVENTS to control whether touch events generate synthetic mouse events. 2017-08-03 09:48:44 -07:00
Ryan C. Gordon
61a3ba303c Replaced a few single-line "//" comments. 2017-01-07 17:09:14 -05:00
Sam Lantinga
45b774e3f7 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga
54188c8b9e Fixed crash at startup 2016-12-03 09:59:43 -08:00
Sam Lantinga
16074e6749 Fixed compile warning on Visual Studio 2016-12-02 22:18:05 -08:00
Sam Lantinga
4eda58ba6a Added SDL_HINT_MOUSE_NORMAL_SPEED_SCALE and SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE to scale the speed of the mouse.
This currently doesn't affect absolute motion, which would need to be implemented on each windowing system so the cursor matches the reported mouse coordinates.
2016-12-02 21:01:13 -08:00
Sam Lantinga
57d01d7d67 Patch from Sylvain to fix clang warnings 2016-11-13 22:57:41 -08:00
Sam Lantinga
27d4f09929 Implemented SDL_GetHintBoolean() to make it easier to check boolean hints 2016-10-07 23:40:44 -07:00
Philipp Wiesemann
7b23eef3b0 Fixed crash if allocating memory for mouse clicks failed. 2016-09-30 23:30:54 +02:00
Alex Szpakowski
450fa8cdf9 Use OS-provided click counts on macOS and iOS for mouse press and release events. 2016-09-24 18:46:34 -03:00
Sam Lantinga
42065e785d Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Ryan C. Gordon
e346f14277 SDL_WarpMouseGlobal() should return non-void.
There are platforms it isn't implemented on (and currently can't be
implemented on!), and there's currently no way for an app to know this.

This shouldn't break ABI on apps that moved to a revision between 2.0.3 and
2.0.4.
2015-07-17 21:03:58 -04:00
Philipp Wiesemann
0e45984fa0 Fixed crash if initialization of EGL failed but was tried again later.
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().
2015-06-21 17:33:46 +02:00