Commit Graph

8212 Commits

Author SHA1 Message Date
Sam Lantinga
3a31a45028 End the scene before resetting the D3D device, since we'll start with BeginScene after that.
If we don't do this, we'll end up with unbalanced Begin/End scene pairs which causes D3DERR_INVALIDCALL in the present.

Fixes https://github.com/libsdl-org/SDL/issues/4933
2021-11-10 05:24:31 -08:00
Cameron Gutman
6b64c47b69 haptics: Enumerate XInput/DInput joysticks after haptic init
Since the haptic subsystem is usually initialized after the joystick subsystem,
the initial calls to HapticMaybeAddDevice() from inside SDL_JoystickInit() will
arrive too early to be handled by the haptic subsystem. We need to add those
haptic devices for those already present joysticks ourselves.
2021-11-09 23:46:34 -06:00
Sam Lantinga
6f9909b609 These functions made it into 2.0.18 2021-11-09 21:11:19 -08:00
Eric Wasylishen
0d98793693
testwm2: Fix video modes menu hit detection when highdpi or logical size used (#4936)
* SDLTest_CommonDrawWindowInfo: log SDL_RenderGetScale, SDL_RenderGetLogicalSize

* testwm2: fix video modes menu hit detection in High DPI cases

- also when logical size is specified, e.g.
  `--logical 640x480 --resizable --allow-highdpi`

* add function to determine logical coordinates of renderer point when given window point

* change since to the targeted milestone

* fix typo

* rename for consistency

* Change logical coordinate type to float, since we can render with floating point precision.

* add function to convert logical to window coordinates

* testwm2: use new SDL_RenderWindowToLogical

* SDL_render.c: alternate SDL_RenderWindowToLogical/SDL_RenderLogicalToWindow

Co-authored-by: John Blat <johnblat64@protonmail.com>
Co-authored-by: John Blat <47202511+johnblat64@users.noreply.github.com>
2021-11-09 21:03:42 -08:00
Sam Lantinga
27ce914463 Send absolute mouse motion when in normal mouse mode and relative mouse motion when in relative mode on iOS
This keeps the SDL cursor in sync with the visible cursor when in normal mouse mode.
2021-11-09 20:51:42 -08:00
Sam Lantinga
19c129faba Added documentation that the UIApplicationSupportsIndirectInputEvents key must be set to true
in your application's Info.plist in order to get real Bluetooth mouse events.
2021-11-09 20:32:16 -08:00
Sam Lantinga
a7e2e3a329 Fixed rendering in the iOS touch demo 2021-11-09 13:36:44 -08:00
Sam Lantinga
7681929cb4 Don't send the initial joystick axis event if the application is in the background 2021-11-09 12:30:37 -08:00
Sam Lantinga
d31f90d9e1 Don't send game controller touchpad or sensor events unless the application has focus
Fixes https://github.com/libsdl-org/SDL/issues/4891
2021-11-09 12:09:01 -08:00
Sam Lantinga
d2f756360e When making the window centered it should use windowed mode size since it doesn't affect fullscreen windows
Fixes bug https://github.com/libsdl-org/SDL/issues/4750
2021-11-09 11:55:02 -08:00
Susko3
1fc25bd839 Properly position the IME window(s) on windows 2021-11-09 11:00:46 -08:00
Ryan C. Gordon
04f42e0468 metal: Deal better with -[CAMetalLayer nextDrawable] returning nil.
Fixes #4863.
2021-11-09 12:03:12 -05:00
Ryan C. Gordon
8f63e9ff68
cmake: use generated SDL_config.h to build SDLmain static lib
Thanks to @toazz for the patch!

Fixes #4829.
2021-11-09 11:13:52 -05:00
Ryan C. Gordon
3a82e432f0
cmake: Moved back to requiring merely CMake 3.0.0.
This means it now works with any CMake released since 2014 instead of 2018.

This was mostly just readding some special cases, and requiring 3.11.0 only
for Windows Stores apps, which isn't unreasonable. The biggest concern is
a Linux distribution not having a recent CMake; most other places will be
manually downloading and installing their own CMake.

Fixes #4930.
2021-11-09 11:06:33 -05:00
Ryan C. Gordon
cfdbd6acca
docs: Modernized README-macosx.md and cleaned up the Markdown a little.
Reference #960.
2021-11-09 10:51:02 -05:00
Sam Lantinga
0f2bf62935 Fixed building hidapi when libusb is available 2021-11-09 06:20:46 -08:00
Sam Lantinga
7b9fe52e1a We're no longer building a separate shared library for hidapi 2021-11-09 05:40:57 -08:00
Sylvain
e8731933cc
Fixed warning: macro is not used 2021-11-09 13:33:25 +01:00
Sylvain
c7065bf42f
Fix warning: declaration shadows a local variable 2021-11-09 13:33:24 +01:00
Cameron Gutman
715e7bda22 haptic: Don't enumerate joysticks if the joystick subsystem is active
The joystick subsystem has complex precedence logic to deal multiple competing
backends like XInput, RawInput, and WGI. Let it fire the MaybeAdd callbacks
for joystick devices, since it knows which backend will end up managing them.

This resolves a situation where the RawInput joystick backend would take
control of an XInput device but the XInput haptic backend would still create
a haptic device. Since the XInput joystick backend didn't own the underlying
joystick device, we'd end up with an orphaned haptic device that didn't work
with SDL_HapticOpenFromJoystick() on the associated joystick device.
2021-11-09 01:43:44 -06:00
Ozkan Sezer
b2ce22a077 added src/hidapi/*.c to sources in standalone makefiles 2021-11-09 10:00:24 +03:00
Ethan Lee
ae67c7d2da Implemented SDL_SetWindowMouseRect() on Wayland 2021-11-09 01:34:02 -05:00
Sam Lantinga
18e69827aa Fixed Linux build 2021-11-08 22:29:02 -08:00
Yufei Huang
881f747d5c Always destroy icon 2021-11-08 22:20:50 -08:00
Yufei Huang
7fea557b99 SDL_windowsmouse.c: Remove LR_COPYDELETEORG flag 2021-11-08 22:20:50 -08:00
Sam Lantinga
67c42cb44c Fixed Windows build 2021-11-08 22:16:01 -08:00
Sam Lantinga
fd79607eb0 Added SDL_GetWindowMouseRect()
Also guarantee that we won't get mouse movement outside the confining area, even if the OS implementation allows it (e.g. macOS)
2021-11-08 21:34:48 -08:00
Sam Lantinga
4db546b092 Implemented SDL_SetWindowMouseRect() on macOS 2021-11-08 20:35:56 -08:00
Sam Lantinga
037030a7a2 Install SDL_hidapi.h 2021-11-08 20:35:56 -08:00
Cameron Gutman
9c95c2491c x11: Use XCheckIfEvent() instead of XNextEvent() for thread-safety
A racing reader could read from our fd between SDL_IOReady()/X11_Pending()
and our call to XNextEvent() which will cause XNextEvent() to block for
more data. Avoid this by using XCheckIfEvent() which will never block.

This also fixes a bug where we could poll() for data, even when events were
already read and pending in the queue. Unlike the Wayland implementation,
this isn't totally thread-safe because nothing prevents a racing reader
from reading events into the queue between our XCheckIfEvent() and
SDL_IOReady() calls, but I think this is the best we can do with Xlib.
2021-11-08 19:17:18 -08:00
Cameron Gutman
e9dae813d9 CI: disable fail-fast to avoid aborting build when one platform fails 2021-11-08 20:14:08 -06:00
Sam Lantinga
2d23d66a61 Fixed SetWindowMouseRect return value on Windows 2021-11-08 16:33:50 -08:00
Sam Lantinga
7d21322df1 Implemented SDL_SetWindowMouseRect() on Windows 2021-11-08 16:29:19 -08:00
Ozkan Sezer
684b3b312a regenerated configure script. 2021-11-09 02:30:28 +03:00
Ethan Lee
4b42c05ba1 video: Add SDL_SetWindowMouseRect.
This API and implementation comes from the Unreal Engine branch of SDL, which
originally called this "SDL_ConfineCursor".

Some minor cleanup and changes for consistency with the rest of SDL_video, but
there are two major changes:

1. The coordinate system has been changed so that `rect` is _window_ relative
   and not _screen_ relative, making it easier to implement without having
   global access to the display.
2. The UE version unset all rects when passing `NULL` as a parameter for
   `window`, this has been removed as it was an unused feature anyhow.

Currently this is only implemented for X, but can be supported on Wayland and
Windows at minimum too.
2021-11-08 14:16:54 -08:00
Ryan C. Gordon
1a98dcb6aa
Revert "include: Updated SDL_config_emscripten.h from emscripten-ports."
Apparently we already had the newer version, sorry!

This reverts commit 6657cbce8d.

Reference issue #4623.
2021-11-08 15:16:18 -05:00
Ozkan Sezer
dcc919096f autotools: initial adjustments after the recent hidapi changes. 2021-11-08 22:28:00 +03:00
Ozkan Sezer
2636d839e3 cmake: add hidapi to 'SDL_SUBSYSTEMS' 2021-11-08 22:25:32 +03:00
Ozkan Sezer
1739ef3ee1 sdlchecks.cmake: remove libusb/hid.c and SDL_hidapi.c additions to srcs 2021-11-08 22:00:02 +03:00
Ozkan Sezer
36067fa129 cmake: include hid.cpp in android sources 2021-11-08 21:35:24 +03:00
Ozkan Sezer
84138b7719 minor update to os2 config file. 2021-11-08 21:15:04 +03:00
Ozkan Sezer
001aa4dab8 cmake: more hidapi fixes. 2021-11-08 21:12:02 +03:00
Sam Lantinga
a3e8fd49e6 Cancel any accumulated mouse wheel motion in the opposite direction when the wheel direction changes
Fixes https://github.com/libsdl-org/SDL/issues/2912
2021-11-08 09:58:11 -08:00
Sam Lantinga
5dbbc8e61f Added mouse wheel deltas with floating point precision
Fixes https://github.com/libsdl-org/SDL/issues/4888
2021-11-08 09:44:31 -08:00
Sam Lantinga
d95a52c9a5 Fixed comment typo 2021-11-08 09:39:21 -08:00
Ethan Lee
fc998b8ec9
wayland: Return true for HasScreenKeyboardSupport only if no physical keyboard exists 2021-11-08 12:37:10 -05:00
Sam Lantinga
4bbbe5f84c Fixed CMake build by adding hidapi files
This needs more work to remove the hidapi shared library build, but at least Linux builds are unblocked
2021-11-08 09:28:36 -08:00
Sam Lantinga
b8327a4a48 Added SDL_HIDAPI_DISABLED so it can be disabled like other SDL subsystems 2021-11-08 07:19:45 -08:00
Sam Lantinga
2a6feb5011 Removed accidental debugging commit (thanks @DomGries!) 2021-11-08 07:10:38 -08:00
Sam Lantinga
6c56e27511 Set both _NET_WM_NAME and WM_NAME so SDL windows can be shared in the browser.
Fixes https://github.com/libsdl-org/SDL/issues/4924
2021-11-08 07:05:17 -08:00