Commit Graph

144 Commits

Author SHA1 Message Date
Cameron Cawley f5cf0e37f7 Remove unused and duplicate defines from SDL_dynapi_overrides.h 2022-05-19 17:23:24 +03:00
Sam Lantinga 94eeb587c1 First pass at extending virtual controller functionality
Added the ability to specify a name and the product VID/PID for a virtual controller

Also added a test case to testgamecontroller, if you pass --virtual as a parameter
2022-05-15 20:01:12 -07:00
Sam Lantinga e551384a99 Added functions to get the platform dependent name for a joystick or game controller 2022-04-26 14:54:14 -07:00
Ozkan Sezer e9ff4fdd49 add SDL_bsearch 2022-04-26 04:03:25 +03:00
Sylvain Becker c23a7ad38a
Add SDL_RenderGetWindow() API to get the window associated with a renderer (#5440)
Add SDL_RenderGetWindow() API to get the window associated with a renderer
2022-03-23 17:07:56 +01:00
Ryan C. Gordon d81fee7623
SDL_Rect: Added floating point versions of all the rectangle APIs.
Fixes #5110.
2022-03-19 10:35:24 -04:00
Zach Reedy d14a126383
IME Composition Truncation + SDL_IsTextInputShown + SDL_ClearComposition (#5398)
* Fixes for IME Composition Truncation + Addition of SDL_ClearComposition, SDL_IsTextInputShown

* Fixed: Documentation and code style issues raised during code review.
2022-03-11 14:45:17 -08:00
Sylvain e7e44df039
Dynapi: add SDL_GetTouchName() entry 2022-02-08 11:34:41 +01:00
Sylvain fe2ed6cf6f
Fixed bug #5221 - Add SDL_AndroidSendMessage() 2022-02-01 11:30:43 +01:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Sam Lantinga c97b721868 Added SDL_PremultiplyAlpha() to premultiply alpha on a block of SDL_PIXELFORMAT_ARGB8888 pixels 2021-11-21 12:18:10 -08:00
Sam Lantinga 9c3bcf8e8a Added SDL_hid_ble_scan() for pairing Steam Controllers on iOS and tvOS 2021-11-11 17:31:14 -08:00
Sam Lantinga 36b2690e40 Moved SDL HIDAPI functions into a single block for the ABI 2021-11-11 15:48:56 -08:00
Cameron Gutman fe09a4930a joystick: Add APIs to query rumble support 2021-11-11 15:10:08 -08:00
Sam Lantinga b15e880e73 Fixed open functions in the SDL_hidapi.h header 2021-11-11 13:50:16 -08:00
Sam Lantinga c9ada1c142 Made HIDAPI device change notifications available via SDL_hid_device_change_count() 2021-11-11 12:46:10 -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 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
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
Sam Lantinga 5b646cd19e Build hidapi code into SDL as a new public API
This prevents conflicts with hidapi linked with applications, as well as allowing applications to make use of HIDAPI on Android and other platforms that might not normally have an implementation available.
2021-11-07 23:00:59 -08:00
Sam Lantinga e14358265e Cleanup sfSymbolName support and add them to the dynamic API functions 2021-11-07 11:16:48 -08:00
Frank Praznik 43ddc59fa8
Export SDL_LinuxSetThreadPriorityAndPolicy() function (#4877)
It's marked as being a public symbol internally, however, it was missing from the header files and not visible in the shared library.  This adds it to the necessary headers and to the DynAPI list to expose it for use by applications.

Co-authored-by: Frank Praznik <frank.praznik@oh.rr.com>
2021-11-02 13:56:14 -07:00
Ryan C. Gordon 99c9727dc0 timer: Added SDL_GetTicks64(), for a timer that doesn't wrap every ~49 days.
Note that this removes the timeGetTime() fallback on Windows; it is a
32-bit counter and SDL2 should never choose to use it, as it only is needed
if QueryPerformanceCounter() isn't available, and QPC is _always_ available
on Windows XP and later.

OS/2 has a similar situation, but since it isn't clear to me that similar
promises can be made about DosTmrQueryTime() even in modern times, I decided
to leave the fallback in, with some heroic measures added to try to provide a
true 64-bit tick counter despite the 49-day wraparound. That approach can
migrate to Windows too, if we discover some truly broken install that doesn't
have QPC and still depends on timeGetTime().

Fixes #4870.
2021-11-01 14:28:00 -04:00
Cacodemon345 19dee1cd16
Add SDL_GetWindowICCProfile(). (#4314)
* Add SDL_GetWindowICCProfile

* Add new SDL display events

* Implement ICC profile change event for macOS

* Implement ICC profile notification for Windows

* Fix SDL_GetWindowICCProfile() for X11

* Fix compile errors
2021-10-21 17:37:20 -07:00
Sylvain 8b1a2fe860
backout SDL_AndroidSetInputType() 2021-10-17 23:47:59 +02:00
Sylvain 6ef3bc5688
Add Dynapi for SDL_AndroidSetInputType() 2021-10-17 23:40:36 +02:00
Cameron Cawley 25a614bc3e Add SDL_asprintf and SDL_vasprintf 2021-09-22 11:53:46 -07:00
Misa 4549769d7d Add `SDL_RenderSetVSync()`
Currently, if an application wants to toggle VSync, they'd have to tear
down the renderer and recreate it. This patch fixes that by letting
applications call SDL_RenderSetVSync().

This is the same as the patch in #3673, except it applies to all
renderers (including PSP, even thought it seems that the VSync flag is
disabled for that renderer). Furthermore, the renderer flags also change
as well, which #3673 didn't do. It is also an API instead of using hint
callbacks (which could be potentially dangerous).

Closes #3673.
2021-09-14 09:56:29 -07:00
Sylvain 08d6a4653e Fix dynapi prototypes 2021-08-19 00:10:59 +02:00
Sylvain cc37c38e30 Add SDL_RenderGeometry based on SDL_RenderGeometryRaw 2021-08-19 00:10:59 +02:00
Sylvain e481261173 Move to SDL_RenderGeometryRaw prototype with separate xy/uv/color pointer parameters 2021-08-19 00:10:59 +02:00
Sylvain 9eab5195fe Update dynapi files 2021-08-19 00:10:59 +02:00
Sam Lantinga f5794f9eeb Added SDL_SetTextureUserData() and SDL_GetTextureUserData() to associate a user-specified pointer with an SDL texture 2021-08-10 15:17:59 -07:00
Sam Lantinga a186a503e7 Added SDL_GameControllerGetSensorDataRate() to get the sensor update rate for a controller. 2021-07-29 06:43:39 -07:00
Sam Lantinga d135c0762f Added SDL_GameControllerSendEffect() and SDL_JoystickSendEffect() to allow applications to send custom effects to the PS4 and PS5 controllers
See testgamecontroller.c for an example of a custom PS5 trigger effect
2021-07-08 13:22:41 -07:00
Jupeyy 64724db0a1 Implement bare minimum for SDL_FlashWindow 2021-06-04 15:07:55 -07:00
Joseph Lyncheski a0a5da5d91 Add SDL_SetWindowAlwaysOnTop() 2021-04-20 08:45:28 -07:00
Xing Ji fb283a732a Squashed commit of the following:
commit 6b8f933589aa3925978a23e77a305a7e89c6ae4a
Author: Xing Ji <jixingcn@gmail.com>
Date:   Wed Mar 24 22:31:29 2021 +0800

    update the dynapi by `gendynapi.pl`

commit ebd1790c19983b652713f40ab1e139e485e1a2b7
Author: Xing Ji <jixingcn@gmail.com>
Date:   Wed Mar 24 22:17:48 2021 +0800

    revert the change in src/dynapi

commit 734b5f85c1613070081e39238e84198128971b53
Merge: 5a56e5a8 5ac6bd54
Author: Xing Ji <jixingcn@gmail.com>
Date:   Wed Mar 24 22:14:40 2021 +0800

    Merge remote-tracking branch 'libsdl/main' into jixingcn

commit 5a56e5a8227d9cff6b497b681c618a76bec1cae1
Author: Xing Ji <jixingcn@gmail.com>
Date:   Mon Mar 22 23:55:10 2021 +0800

    Fix #3596, can call the `SDL_TLSCleanup` to cleanup the TLS data when closing the application
2021-03-29 08:54:41 -07:00
Ethan Lee 67e8522d31 Add SDL_GetAudioDeviceSpec.
This API is supported by pipewire, pulseaudio, coreaudio, wasapi, and disk.
2021-03-05 12:03:07 -08:00
Ozkan Sezer 686935542e dos2unix SDL_dynapi_*.h 2021-03-04 23:50:40 +03:00
Amir 360740ac76 correct dynapi 2021-02-20 23:05:09 -08:00
Amir 1a924bc0bb add SDL_AndroidShowToast for https://developer.android.com/reference/android/widget/Toast 2021-02-20 23:05:09 -08:00
Misa dfe219ec71 Add all missing "is characteristic" stdlib functions
SDL has been missing a bunch of these 'isX' functions for some time,
where X is some characteristic of a given character.

This commit adds the rest of them to the SDL stdlib, so now we have:
- SDL_isalpha()
- SDL_isalnum()
- SDL_isblank()
- SDL_iscntrl()
- SDL_isxdigit()
- SDL_ispunct()
- SDL_isprint()
- SDL_isgraph()
2021-02-13 11:42:13 -08:00
Cameron Gutman 6b057c6783 Expose separate keyboard and mouse grab support
This adds SDL_SetWindowKeyboardGrab(), SDL_GetWindowKeyboardGrab(),
SDL_SetWindowMouseGrab(), SDL_GetWindowMouseGrab(), and new
SDL_WINDOW_KEYBOARD_GRABBED flag. It also updates the test harness to exercise
this functionality and makes a minor fix to X11 that I missed in
https://hg.libsdl.org/SDL/rev/02a2d609369b

To fit in with this new support, SDL_WINDOW_INPUT_CAPTURE has been renamed to
SDL_WINDOW_MOUSE_CAPTURE with the old name remaining as an alias for backwards
compatibility with older code.
2021-02-10 10:22:17 -05:00
Ozkan Sezer 516042b4d6 ran gendynapi.pl after SDL_UpdateNVTexture addition 2021-01-05 15:15:50 +03:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Sam Lantinga 223af86c62 Added SDL_RenderGetD3D11Device() to get access to the device associated with the D3D11 renderer 2021-01-01 11:12:30 -08:00
Sam Lantinga 93ccdee8c1 Fixed bug 5404 - stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf
Cameron Cawley

stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf

The default implementation is based on the one used in the Windows RT video driver.
2020-12-23 13:47:49 -08:00
Ozkan Sezer 15fea33915 ran gendynapi.pl after addition of SDL_SoftStretchLinear 2020-12-23 23:47:10 +03:00
Sam Lantinga 46a844786b Added SDL_wcscasecmp() and SDL_wcsncasecmp() 2020-11-24 12:43:01 -08:00