Skip to content
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

Add the raw platform specific key code to SDL_Keysym #10057

Merged
merged 7 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions VisualC-GDK/SDL/SDL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@
<ClInclude Include="..\..\src\events\SDL_dropevents_c.h" />
<ClInclude Include="..\..\src\events\SDL_events_c.h" />
<ClInclude Include="..\..\src\events\SDL_keyboard_c.h" />
<ClInclude Include="..\..\src\events\SDL_keymap_c.h" />
<ClInclude Include="..\..\src\events\SDL_mouse_c.h" />
<ClInclude Include="..\..\src\events\SDL_touch_c.h" />
<ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
Expand Down Expand Up @@ -634,6 +635,7 @@
<ClCompile Include="..\..\src\events\SDL_dropevents.c" />
<ClCompile Include="..\..\src\events\SDL_events.c" />
<ClCompile Include="..\..\src\events\SDL_keyboard.c" />
<ClCompile Include="..\..\src\events\SDL_keymap.c" />
<ClCompile Include="..\..\src\events\SDL_mouse.c" />
<ClCompile Include="..\..\src\events\SDL_pen.c" />
<ClCompile Include="..\..\src\events\SDL_quit.c" />
Expand Down
2 changes: 2 additions & 0 deletions VisualC-GDK/SDL/SDL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<ClCompile Include="..\..\src\events\SDL_dropevents.c" />
<ClCompile Include="..\..\src\events\SDL_events.c" />
<ClCompile Include="..\..\src\events\SDL_keyboard.c" />
<ClCompile Include="..\..\src\events\SDL_keymap.c" />
<ClCompile Include="..\..\src\events\SDL_mouse.c" />
<ClCompile Include="..\..\src\events\SDL_pen.c" />
<ClCompile Include="..\..\src\events\SDL_quit.c" />
Expand Down Expand Up @@ -326,6 +327,7 @@
<ClInclude Include="..\..\src\events\SDL_dropevents_c.h" />
<ClInclude Include="..\..\src\events\SDL_events_c.h" />
<ClInclude Include="..\..\src\events\SDL_keyboard_c.h" />
<ClInclude Include="..\..\src\events\SDL_keymap_c.h" />
<ClInclude Include="..\..\src\events\SDL_mouse_c.h" />
<ClInclude Include="..\..\src\events\SDL_touch_c.h" />
<ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
Expand Down
2 changes: 2 additions & 0 deletions VisualC-WinRT/SDL-UWP.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
<ClInclude Include="..\src\events\SDL_dropevents_c.h" />
<ClInclude Include="..\src\events\SDL_events_c.h" />
<ClInclude Include="..\src\events\SDL_keyboard_c.h" />
<ClInclude Include="..\src\events\SDL_keymap_c.h" />
<ClInclude Include="..\src\events\SDL_mouse_c.h" />
<ClInclude Include="..\src\events\SDL_touch_c.h" />
<ClInclude Include="..\src\events\SDL_windowevents_c.h" />
Expand Down Expand Up @@ -320,6 +321,7 @@
<ClCompile Include="..\src\events\SDL_dropevents.c" />
<ClCompile Include="..\src\events\SDL_events.c" />
<ClCompile Include="..\src\events\SDL_keyboard.c" />
<ClCompile Include="..\src\events\SDL_keymap.c" />
<ClCompile Include="..\src\events\SDL_mouse.c" />
<ClCompile Include="..\src\events\SDL_pen.c" />
<ClCompile Include="..\src\events\SDL_quit.c" />
Expand Down
6 changes: 6 additions & 0 deletions VisualC-WinRT/SDL-UWP.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@
<ClInclude Include="..\src\events\SDL_keyboard_c.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\src\events\SDL_keymap_c.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\src\events\SDL_mouse_c.h">
<Filter>Source Files</Filter>
</ClInclude>
Expand Down Expand Up @@ -585,6 +588,9 @@
<ClCompile Include="..\src\events\SDL_keyboard.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\events\SDL_keymap.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\events\SDL_mouse.c">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down
2 changes: 2 additions & 0 deletions VisualC/SDL/SDL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@
<ClInclude Include="..\..\src\events\SDL_dropevents_c.h" />
<ClInclude Include="..\..\src\events\SDL_events_c.h" />
<ClInclude Include="..\..\src\events\SDL_keyboard_c.h" />
<ClInclude Include="..\..\src\events\SDL_keymap_c.h" />
<ClInclude Include="..\..\src\events\SDL_mouse_c.h" />
<ClInclude Include="..\..\src\events\SDL_touch_c.h" />
<ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
Expand Down Expand Up @@ -524,6 +525,7 @@
<ClCompile Include="..\..\src\events\SDL_dropevents.c" />
<ClCompile Include="..\..\src\events\SDL_events.c" />
<ClCompile Include="..\..\src\events\SDL_keyboard.c" />
<ClCompile Include="..\..\src\events\SDL_keymap.c" />
<ClCompile Include="..\..\src\events\SDL_mouse.c" />
<ClCompile Include="..\..\src\events\SDL_pen.c" />
<ClCompile Include="..\..\src\events\SDL_quit.c" />
Expand Down
6 changes: 6 additions & 0 deletions VisualC/SDL/SDL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,9 @@
<ClInclude Include="..\..\src\events\SDL_keyboard_c.h">
<Filter>events</Filter>
</ClInclude>
<ClInclude Include="..\..\src\events\SDL_keymap_c.h">
<Filter>events</Filter>
</ClInclude>
<ClInclude Include="..\..\src\events\SDL_mouse_c.h">
<Filter>events</Filter>
</ClInclude>
Expand Down Expand Up @@ -1000,6 +1003,9 @@
<ClCompile Include="..\..\src\events\SDL_keyboard.c">
<Filter>events</Filter>
</ClCompile>
<ClCompile Include="..\..\src\events\SDL_keymap.c">
<Filter>events</Filter>
</ClCompile>
<ClCompile Include="..\..\src\events\SDL_mouse.c">
<Filter>events</Filter>
</ClCompile>
Expand Down
8 changes: 8 additions & 0 deletions Xcode/SDL/SDL.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@
F310138D2C1F2CB700FBE946 /* SDL_getenv_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F310138A2C1F2CB700FBE946 /* SDL_getenv_c.h */; };
F310138E2C1F2CB700FBE946 /* SDL_random.c in Sources */ = {isa = PBXBuildFile; fileRef = F310138B2C1F2CB700FBE946 /* SDL_random.c */; };
F310138F2C1F2CB700FBE946 /* SDL_sysstdlib.h in Headers */ = {isa = PBXBuildFile; fileRef = F310138C2C1F2CB700FBE946 /* SDL_sysstdlib.h */; };
F31013C72C24E98200FBE946 /* SDL_keymap.c in Sources */ = {isa = PBXBuildFile; fileRef = F31013C52C24E98200FBE946 /* SDL_keymap.c */; };
F31013C82C24E98200FBE946 /* SDL_keymap_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F31013C62C24E98200FBE946 /* SDL_keymap_c.h */; };
F316ABD82B5C3185002EF551 /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F316ABD62B5C3185002EF551 /* SDL_memset.c */; };
F316ABD92B5C3185002EF551 /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F316ABD72B5C3185002EF551 /* SDL_memcpy.c */; };
F316ABDB2B5CA721002EF551 /* SDL_memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = F316ABDA2B5CA721002EF551 /* SDL_memmove.c */; };
Expand Down Expand Up @@ -915,6 +917,8 @@
F310138A2C1F2CB700FBE946 /* SDL_getenv_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_getenv_c.h; sourceTree = "<group>"; };
F310138B2C1F2CB700FBE946 /* SDL_random.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_random.c; sourceTree = "<group>"; };
F310138C2C1F2CB700FBE946 /* SDL_sysstdlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysstdlib.h; sourceTree = "<group>"; };
F31013C52C24E98200FBE946 /* SDL_keymap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_keymap.c; sourceTree = "<group>"; };
F31013C62C24E98200FBE946 /* SDL_keymap_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_keymap_c.h; sourceTree = "<group>"; };
F316ABD62B5C3185002EF551 /* SDL_memset.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_memset.c; sourceTree = "<group>"; };
F316ABD72B5C3185002EF551 /* SDL_memcpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_memcpy.c; sourceTree = "<group>"; };
F316ABDA2B5CA721002EF551 /* SDL_memmove.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_memmove.c; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2183,6 +2187,8 @@
A7D8A93523E2514000DCD162 /* SDL_events.c */,
A7D8A93D23E2514000DCD162 /* SDL_keyboard_c.h */,
A7D8A93823E2514000DCD162 /* SDL_keyboard.c */,
F31013C62C24E98200FBE946 /* SDL_keymap_c.h */,
F31013C52C24E98200FBE946 /* SDL_keymap.c */,
A7D8A92B23E2514000DCD162 /* SDL_mouse_c.h */,
A7D8A92A23E2514000DCD162 /* SDL_mouse.c */,
63134A232A7902FD0021E9A6 /* SDL_pen_c.h */,
Expand Down Expand Up @@ -2422,6 +2428,7 @@
F3F7D9392933074E00816151 /* SDL_opengles2_gl2ext.h in Headers */,
F3F7D9692933074E00816151 /* SDL_opengles2_gl2platform.h in Headers */,
F3F7D9092933074E00816151 /* SDL_opengles2_khrplatform.h in Headers */,
F31013C82C24E98200FBE946 /* SDL_keymap_c.h in Headers */,
63134A222A7902CF0021E9A6 /* SDL_pen.h in Headers */,
63134A252A7902FD0021E9A6 /* SDL_pen_c.h in Headers */,
F36C34312C0F876500991150 /* SDL_offscreenvulkan.h in Headers */,
Expand Down Expand Up @@ -2675,6 +2682,7 @@
A7D8BAC723E2514500DCD162 /* e_pow.c in Sources */,
A7D8B41C23E2514300DCD162 /* SDL_systls.c in Sources */,
9846B07C287A9020000C35C8 /* SDL_hidapi_shield.c in Sources */,
F31013C72C24E98200FBE946 /* SDL_keymap.c in Sources */,
A7D8BBD923E2574800DCD162 /* SDL_uikitmessagebox.m in Sources */,
F32DDAD42AB795A30041EAA5 /* SDL_audioresample.c in Sources */,
F3FA5A212B59ACE000FEAD97 /* yuv_rgb_std.c in Sources */,
Expand Down
72 changes: 72 additions & 0 deletions build-scripts/SDL_migration.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -3312,3 +3312,75 @@ typedef SDL_Colour, SDL_Color;
- SDL_SwapBE64
+ SDL_Swap64BE
(...)
@@
@@
- SDL_SCANCODE_AUDIOMUTE
+ SDL_SCANCODE_MUTE
@@
@@
- SDLK_AUDIOMUTE
+ SDLK_MUTE
@@
@@
- SDL_SCANCODE_EJECT
+ SDL_SCANCODE_MEDIA_EJECT
@@
@@
- SDLK_EJECT
+ SDLK_MEDIA_EJECT
@@
@@
- SDL_SCANCODE_AUDIONEXT
+ SDL_SCANCODE_MEDIA_NEXT_TRACK
@@
@@
- SDLK_AUDIONEXT
+ SDLK_MEDIA_NEXT_TRACK
@@
@@
- SDL_SCANCODE_AUDIOPREV
+ SDL_SCANCODE_MEDIA_PREVIOUS_TRACK
@@
@@
- SDLK_AUDIOPREV
+ SDLK_MEDIA_PREVIOUS_TRACK
@@
@@
- SDL_SCANCODE_AUDIOSTOP
+ SDL_SCANCODE_MEDIA_STOP
@@
@@
- SDLK_AUDIOSTOP
+ SDLK_MEDIA_STOP
@@
@@
- SDL_SCANCODE_AUDIOPLAY
+ SDL_SCANCODE_MEDIA_PLAY
@@
@@
- SDLK_AUDIOPLAY
+ SDLK_MEDIA_PLAY
@@
@@
- SDL_SCANCODE_AUDIOREWIND
+ SDL_SCANCODE_MEDIA_REWIND
@@
@@
- SDLK_AUDIOREWIND
+ SDLK_MEDIA_REWIND
@@
@@
- SDL_SCANCODE_AUDIOFASTFORWARD
+ SDL_SCANCODE_MEDIA_FAST_FORWARD
@@
@@
- SDLK_AUDIOFASTFORWARD
+ SDLK_MEDIA_FAST_FORWARD
@@
@@
- SDL_SCANCODE_MEDIASELECT
+ SDL_SCANCODE_MEDIA_SELECT
@@
@@
- SDLK_MEDIASELECT
+ SDLK_MEDIA_SELECT
69 changes: 69 additions & 0 deletions docs/README-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,21 @@ The SDL_EVENT_WINDOW_RESIZED event is always sent, even in response to SDL_SetWi

The SDL_EVENT_WINDOW_SIZE_CHANGED event has been removed, and you can use SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED to detect window backbuffer size changes.

The keysym field of key events has been removed to remove one level of indirection, and `sym` has been renamed `key`.

Code that looked like this:
```c
SDL_Event event;
SDL_Keycode key = event.key.keysym.sym;
SDL_Keymod mod = event.key.keysym.mod;
```
now looks like this:
```c
SDL_Event event;
SDL_Keycode key = event.key.key;
SDL_Keymod mod = event.key.mod;
```

The gamepad event structures caxis, cbutton, cdevice, ctouchpad, and csensor have been renamed gaxis, gbutton, gdevice, gtouchpad, and gsensor.

The mouseX and mouseY fields of SDL_MouseWheelEvent have been renamed mouse_x and mouse_y.
Expand Down Expand Up @@ -890,20 +905,38 @@ The following symbols have been removed:

Text input is no longer automatically enabled when initializing video, you should call SDL_StartTextInput() when you want to receive text input and call SDL_StopTextInput() when you are done. Starting text input may shown an input method editor (IME) and cause key up/down events to be skipped, so should only be enabled when the application wants text input.

SDL_GetDefaultKeyFromScancode(), SDL_GetKeyFromScancode(), and SDL_GetScancodeFromKey() take an SDL_Keymod parameter and use that to provide the correct result based on keyboard modifier state.

The following functions have been renamed:
* SDL_IsScreenKeyboardShown() => SDL_ScreenKeyboardShown()
* SDL_IsTextInputActive() => SDL_TextInputActive()

The following functions have been removed:
* SDL_IsTextInputShown()

The following structures have been removed:
* SDL_Keysym

## SDL_keycode.h

SDL_Keycode is now Uint32 and the SDLK_* constants are now defines instead of an enum, to more clearly reflect that they are a subset of the possible values of an SDL_Keycode.

The following symbols have been removed:

* KMOD_RESERVED - No replacement. A bit named "RESERVED" probably shouldn't be used in an app, but if you need it, this was equivalent to KMOD_SCROLL (0x8000) in SDL2.
* SDLK_WWW
* SDLK_MAIL
* SDLK_CALCULATOR
* SDLK_COMPUTER
* SDLK_BRIGHTNESSDOWN
* SDLK_BRIGHTNESSUP
* SDLK_DISPLAYSWITCH
* SDLK_KBDILLUMTOGGLE
* SDLK_KBDILLUMDOWN
* SDLK_KBDILLUMUP
* SDLK_APP1
* SDLK_APP2


The following symbols have been renamed:
* KMOD_ALT => SDL_KMOD_ALT
Expand All @@ -923,7 +956,16 @@ The following symbols have been renamed:
* KMOD_RSHIFT => SDL_KMOD_RSHIFT
* KMOD_SCROLL => SDL_KMOD_SCROLL
* KMOD_SHIFT => SDL_KMOD_SHIFT
* SDLK_AUDIOFASTFORWARD => SDLK_MEDIA_FAST_FORWARD
* SDLK_AUDIOMUTE => SDLK_MUTE
* SDLK_AUDIONEXT => SDLK_MEDIA_NEXT_TRACK
* SDLK_AUDIOPLAY => SDLK_MEDIA_PLAY
* SDLK_AUDIOPREV => SDLK_MEDIA_PREVIOUS_TRACK
* SDLK_AUDIOREWIND => SDLK_MEDIA_REWIND
* SDLK_AUDIOSTOP => SDLK_MEDIA_STOP
* SDLK_BACKQUOTE => SDLK_GRAVE
* SDLK_EJECT => SDLK_MEDIA_EJECT
* SDLK_MEDIASELECT => SDLK_MEDIA_SELECT
* SDLK_QUOTE => SDLK_APOSTROPHE
* SDLK_QUOTEDBL => SDLK_DBLAPOSTROPHE

Expand Down Expand Up @@ -1423,6 +1465,33 @@ The following functions have been renamed:
The following structures have been renamed:
* SDL_RWops => SDL_IOStream

## SDL_scancode.h

The following symbols have been removed:
* SDL_SCANCODE_WWW
* SDL_SCANCODE_MAIL
* SDL_SCANCODE_CALCULATOR
* SDL_SCANCODE_COMPUTER
* SDL_SCANCODE_BRIGHTNESSDOWN
* SDL_SCANCODE_BRIGHTNESSUP
* SDL_SCANCODE_DISPLAYSWITCH
* SDL_SCANCODE_KBDILLUMTOGGLE
* SDL_SCANCODE_KBDILLUMDOWN
* SDL_SCANCODE_KBDILLUMUP
* SDL_SCANCODE_APP1
* SDL_SCANCODE_APP2

The following symbols have been renamed:
* SDL_SCANCODE_AUDIOFASTFORWARD => SDL_SCANCODE_MEDIA_FAST_FORWARD
* SDL_SCANCODE_AUDIOMUTE => SDL_SCANCODE_MUTE
* SDL_SCANCODE_AUDIONEXT => SDL_SCANCODE_MEDIA_NEXT_TRACK
* SDL_SCANCODE_AUDIOPLAY => SDL_SCANCODE_MEDIA_PLAY
* SDL_SCANCODE_AUDIOPREV => SDL_SCANCODE_MEDIA_PREVIOUS_TRACK
* SDL_SCANCODE_AUDIOREWIND => SDL_SCANCODE_MEDIA_REWIND
* SDL_SCANCODE_AUDIOSTOP => SDL_SCANCODE_MEDIA_STOP
* SDL_SCANCODE_EJECT => SDL_SCANCODE_MEDIA_EJECT
* SDL_SCANCODE_MEDIASELECT => SDL_SCANCODE_MEDIA_SELECT

## SDL_sensor.h

SDL_SensorID has changed from Sint32 to Uint32, with an invalid ID being 0.
Expand Down
Loading
Loading