-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Conversation
@Kontrabant, is there anything meaningful to do for the Wayland platform here? |
They keycode passed in the key and focus handlers is defined in the spec as "a platform-specific key code", so passing it through would work. |
Like that? |
Yep! |
Thanks! |
include/SDL3/SDL_events.h
Outdated
@@ -733,8 +733,7 @@ typedef struct SDL_PenButtonEvent | |||
* An event used to drop text or request a file open by the system | |||
* (event.drop.*) | |||
* | |||
* The `data` is owned by SDL and should be copied if the application wants to | |||
* hold onto it beyond the scope of handling this event. Do not free it! | |||
* The `source` and `data` are owned by SDL and should be copied if the application wants to hold onto them beyond the scope of handling this event. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with other headers (and so there's a link to the full documentation), can these change to:
"The source
and data
strings follow the SDL_GetStringRule."
src/events/SDL_events.c
Outdated
char *result = NULL; | ||
|
||
if (string) { | ||
size_t len = SDL_strlen(string) + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just:
if (string) {
return SDL_FreeLater(SDL_strdup(string));
}
return NULL;
Or even just:
return string ? SDL_FreeLater(SDL_strdup(string)) : NULL;
SDL_AllocateEventMemory isn't a mysterious interface we have to route this stuff through. :)
Based on the scancode list at https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values, which is correct for all other scancodes
This adds more app editing and audio control keys and removes keys that launch applications Work in progress on libsdl-org#6390
a074aa0
to
0d7ef95
Compare
@Kontrabant, can you add the Wayland code for querying the full keymap? You can look at the Cocoa and Windows implementations for examples. |
This allows applications to handle keys that SDL doesn't recognize, in a platform dependent way. Fixes libsdl-org#6390
a883a22
to
c535dd1
Compare
Sure, I'll take care of it. |
Thanks! I'll leave it as-is for now and you can add a PR once this is merged, or you can push a separate commit to this PR, whichever you prefer. |
f1578c5
to
a25daaf
Compare
@Kontrabant, can you also do the X11 code? I have the place where it needs to be done, I just don't know how to map from modifiers to level, and I suspect it'll be the same as the Wayland code. |
This allows applications to handle keys that SDL doesn't recognize, in a platform dependent way.
Fixes #6390