Commit graph

50 commits

Author SHA1 Message Date
Sylvain Becker cb6b8b0132
Simplify flags testing (#7220) 2023-02-03 13:08:42 -08:00
Sam Lantinga 22c69bccdf Displays are now referenced by instance ID instead of index 2023-01-29 19:25:15 -08:00
Sam Lantinga 7b50bae524 Renamed SDL events for clarity
Fixes https://github.com/libsdl-org/SDL/issues/6877
2023-01-24 07:26:48 -08:00
Sam Lantinga fde78d12f2 Updated copyright for 2023 2023-01-09 09:41:41 -08:00
Sam Lantinga 66351fd4ba Replace tri-state functions SDL_EventState(), SDL_GetJoystickEventState(), SDL_GetGamepadEventState(), SDL_ShowCursor()
`SDL_QUERY`, `SDL_IGNORE`, `SDL_ENABLE`, and `SDL_DISABLE` have been removed.

SDL_EventState() has been replaced with SDL_SetEventEnabled()
SDL_GetEventState() has been replaced with SDL_EventEnabled()
SDL_GameControllerEventState has been replaced with SDL_SetGamepadEventsEnabled() and SDL_GamepadEventsEnabled()
SDL_JoystickEventState has been replaced with SDL_SetJoystickEventsEnabled() and SDL_JoystickEventsEnabled()

SDL_ShowCursor() has been split into three functions: SDL_ShowCursor(), SDL_HideCursor(), and SDL_CursorVisible()

Fixes https://github.com/libsdl-org/SDL/issues/6929
2022-12-28 17:49:34 -08:00
Sam Lantinga 63724c113b Removed the vi format comments from the source
Vim users can use the [editorconfig plugin](https://github.com/editorconfig/editorconfig-vim) to automatically set tab spacing for the SDL coding style.

Fixes https://github.com/libsdl-org/SDL/issues/6903
2022-12-26 11:17:23 -08:00
Frank Praznik abdfa809db Prepend key modifier enum values with 'SDL_' 2022-12-23 20:35:49 -08:00
Sam Lantinga 0a3262e819 Pass the OS event timestamp for keyboard, mouse, and touch events where possible
Currently implemented for Windows and Apple platforms
2022-12-02 12:37:41 -08:00
Pierre Wendling 3c501b963d
Clang-Tidy fixes (#6725) 2022-12-01 13:07:03 -08:00
Sam Lantinga 5750bcb174
Update for SDL3 coding style (#6717)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.

In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.

The script I ran for the src directory is added as build-scripts/clang-format-src.sh

This fixes:
#6592
#6593
#6594
2022-11-30 12:51:59 -08:00
Sam Lantinga c5790359fd
Added precompiled header support for Visual Studio and Xcode (#6710)
Fixes https://github.com/libsdl-org/SDL/issues/6704
2022-11-29 18:34:15 -08:00
Sam Lantinga c2675d74c5 Revert "cocoa: Discard the IME Candidate Window immediately when Escape is pressed"
This reverts commit 0d76e2a8a1, as it introduced other issues:
https://github.com/libsdl-org/SDL/pull/6486#issuecomment-1304684865
2022-11-06 10:52:20 -08:00
Edward Li 0d76e2a8a1 cocoa: Discard the IME Candidate Window immediately when Escape is pressed 2022-11-05 17:03:10 -07:00
Guldoman 084fa4c3fa cocoa: Reset IME when sending composed text
This will send an empty `TEXTEDITING` event that is used to signal the 
end of the composition.
2022-11-03 10:41:53 -07:00
Deve 7e1088167a Fixed command modifier on macOS 2022-10-17 16:49:21 -07:00
Sam Lantinga 91ff88451b Disable "The key you just pressed is not recognized by SDL." message by default 2022-10-13 23:56:17 -07:00
Cameron Gutman 8b438f7b51 keyboard: Only send SDL_KEYMAPCHANGED when the keymap actually changes 2022-07-31 14:02:28 -07:00
rohlem b085c18251 make SDL_SetTextInputRect take a pointer to const
The documentation doesn't state that the argument is ever modified,
and no implementation does so currently.
This is a non-breaking change to guarantee as much to callers.
2022-07-04 09:38:01 -07:00
Pierre Wendling 6c536afdb7 Fix C89 declaration for macOS modules.
Since Clang 14, `-Wdeclaration-after-statement` is enforced on every
standard.
2022-06-27 15:19:40 -07:00
Alex Szpakowski f871c178b9 macOS: remove dead code for supporting 10.6 at runtime. 2022-05-10 14:04:14 -07:00
Alex Szpakowski ec8fa57750 macOS: always use Objective-C ARC (automatic ref counting).
Change Cocoa SDL_VideoData and SDL_WindowData implementations from C structs to Objective-C objects, since bridging between C and ObjC is easier that way.
2022-05-09 21:53:40 -07:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Cameron Gutman 6f684f674e cocoa: Add keyboard grab support
CGSSetGlobalHotKeyOperatingMode() is not a public API, so we will only
compile this in if SDL_MAC_NO_SANDBOX=1 is defined during compilation.
2021-07-29 19:06:43 -07:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Sam Lantinga a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Sam Lantinga 20daf54fd8 Added new HIDAPI driver files to the Xcode projects 2019-12-19 15:18:50 -08:00
Ryan C. Gordon 57e08c27ef cocoa: Check for capslock in -[NSResponder flagsChanged], not with IOKit.
Using IOKit for this pops up a warning at startup on macOS 10.15 ("Catalina"),
asking the user to authorize the app to listen to all keyboard input in the
system, which is unacceptable.

I _think_ we were using IOKit under incorrect presumptions here; the Stack
Overflow link mentioned in it was complaining about not being able to use
flagsChanged to differentiate between left and right mod keys, but that's not
an issue for capslock.

It's also possible this code was trying to deal with capslock changing when
the window didn't have focus, but we handle this elsewhere now, if we didn't
at the time.
2019-06-26 13:21:43 -04:00
Sam Lantinga 5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Sam Lantinga e3cc5b2c6b Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga f4f9e39f62 Fixed bug 3874 - Compiler warnings SDL_Surface.c and SDL_cocoakeyboard.m 2017-10-12 08:41:11 -07:00
Alex Szpakowski 562473c1f4 macOS: Address more compiler warnings when building with a recent deployment target. 2017-07-13 23:09:37 -03:00
Alex Szpakowski bc3ede1ed0 macOS: Replace uses of deprecated Cocoa enum names with modern/consistent equivalents. 2017-07-13 22:59:02 -03:00
Philipp Wiesemann 90ed3daa3e Changed messages about not recognized keys to include discourse link. 2017-05-26 22:45:52 +02:00
Ryan C. Gordon ce2998b8b9 cocoa: Don't crash on messagebox keypress without a successful SDL_Init(). 2017-05-02 21:46:28 -04:00
Sam Lantinga 45b774e3f7 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga 6d67c98e70 Fixed crash on Mac OS X 10.10 and earlier 2016-10-19 20:39:12 -07:00
Sam Lantinga 267207ffca Worked around a crash on Mac OS X 10.10 and earlier, thanks to Eric Wasylishen. 2016-10-18 23:12:45 -07:00
Sam Lantinga 3a77b42de7 Fixed build warning 2016-10-12 18:45:56 -07:00
Sam Lantinga 351adf156a Fixed bug 2157 - Caps Lock key produces key down & key up events while key is still pressed.
Tim McDaniel

Using checkkeys test app:
* Press and hold Caps Lock key.
* checkkeys reports a CapsLock key pressed event and a CapsLock key released event.
* Release Caps Lock key.
* checkkeys reports no further events.

This patch fixes OSX Caps Lock up/down event detection by installing a HID callback.
2016-10-04 02:11:52 -07:00
Alex Szpakowski 86708c3cd8 Enable more compiler warnings in the Xcode projects (based on Xcode 8's suggestion), made some integer downcasts explicit. 2016-09-13 19:51:10 -03:00
Alex Szpakowski 0a4085a048 Mac: Fix a crash when SDL is compiled with SDL_MAC_NO_SANDBOX enabled, by increasing the stack size of the mouse tap thread back to OS X' default of 512 KB. 2016-05-21 12:09:23 -03:00
Alex Szpakowski 4a468739f8 Removed Mac OS 10.5 support (bug #3137). Also fixed a warning about deprecated Carbon code when using SDL_audio (bug #3127, thanks Dominik!) 2016-05-21 00:20:52 -03:00
Sam Lantinga 42065e785d Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Ryan C. Gordon 51c1d69d13 Mac: Whoops, lost legit Caps lock keypress events. Fixed. 2015-12-28 13:30:58 -05:00
Ryan C. Gordon 257b7af247 Sync up the caps/numlock state properly without sending key events.
Partially fixes Bugzilla #2736 and #3125.
2015-12-28 13:07:44 -05:00
Ryan C. Gordon faed05850e Mac: make sure SDL keyboard state reflects system capslock state at startup. 2015-12-27 16:46:12 -05:00
Alex Szpakowski a2235d7b29 Cocoa: Use NSTextInputClient instead of NSTextInput for text input handling. The latter was deprecated in OS X 10.6. 2015-12-10 22:17:22 -04:00
Alex Szpakowski 998a54f9c5 Mac: Fix a warning about implicit declaration of SDL_SendKeymapChangedEvent (bug #3167.) 2015-11-14 04:24:39 -04:00
Sam Lantinga 2b0140a91f Add a new SDL_KEYMAPCHANGED SDL event to abstract notification of keyboard layout or input language changes. 2015-10-27 11:17:32 -07: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