Simple Directmedia Layer

Removed raw key events

They weren't adding any value over the existing keyboard events

+4 -78
-19
include/SDL3/SDL_events.h
··· 174 174 SDL_EVENT_KEYBOARD_ADDED, /**< A new keyboard has been inserted into the system */ 175 175 SDL_EVENT_KEYBOARD_REMOVED, /**< A keyboard has been removed */ 176 176 SDL_EVENT_TEXT_EDITING_CANDIDATES, /**< Keyboard text editing candidates */ 177 - SDL_EVENT_RAW_KEY_DOWN, /**< Key pressed (raw key press) */ 178 - SDL_EVENT_RAW_KEY_UP, /**< Key released (raw key release) */ 179 177 180 178 /* Mouse events */ 181 179 SDL_EVENT_MOUSE_MOTION = 0x400, /**< Mouse moved */ ··· 367 365 bool down; /**< true if the key is pressed */ 368 366 bool repeat; /**< true if this is a key repeat */ 369 367 } SDL_KeyboardEvent; 370 - 371 - /** 372 - * Raw keyboard button event structure (event.raw_key.*) 373 - * 374 - * \since This struct is available since SDL 3.1.8. 375 - */ 376 - typedef struct SDL_RawKeyboardEvent 377 - { 378 - SDL_EventType type; /**< SDL_EVENT_RAW_KEY_DOWN or SDL_EVENT_RAW_KEY_UP */ 379 - Uint32 reserved; 380 - Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ 381 - SDL_KeyboardID which; /**< The keyboard instance id */ 382 - SDL_Scancode scancode; /**< SDL physical key code */ 383 - Uint16 raw; /**< The platform dependent scancode for this event */ 384 - bool down; /**< true if the key is pressed */ 385 - } SDL_RawKeyboardEvent; 386 368 387 369 /** 388 370 * Keyboard text editing event structure (event.edit.*) ··· 1061 1043 SDL_WindowEvent window; /**< Window event data */ 1062 1044 SDL_KeyboardDeviceEvent kdevice; /**< Keyboard device change event data */ 1063 1045 SDL_KeyboardEvent key; /**< Keyboard event data */ 1064 - SDL_RawKeyboardEvent raw_key; /**< Raw keyboard event data */ 1065 1046 SDL_TextEditingEvent edit; /**< Text editing event data */ 1066 1047 SDL_TextEditingCandidatesEvent edit_candidates; /**< Text editing candidates event data */ 1067 1048 SDL_TextInputEvent text; /**< Text input event data */
-2
src/core/linux/SDL_evdev.c
··· 373 373 Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event); 374 374 scancode = SDL_EVDEV_translate_keycode(event->code); 375 375 if (event->value == 0) { 376 - SDL_SendRawKeyboardKey(timestamp, (SDL_KeyboardID)item->fd, event->code, scancode, false); 377 376 SDL_SendKeyboardKey(timestamp, (SDL_KeyboardID)item->fd, event->code, scancode, false); 378 377 } else if (event->value == 1 || event->value == 2 /* key repeated */) { 379 - SDL_SendRawKeyboardKey(timestamp, (SDL_KeyboardID)item->fd, event->code, scancode, true); 380 378 SDL_SendKeyboardKey(timestamp, (SDL_KeyboardID)item->fd, event->code, scancode, true); 381 379 } 382 380 SDL_EVDEV_kbd_keycode(_this->kbd, event->code, event->value);
-4
src/core/openbsd/SDL_wscons_kbd.c
··· 573 573 } 574 574 for (i = 0; i < SDL_arraysize(conversion_table); i++) { 575 575 if (conversion_table[i].sourcekey == group[0]) { 576 - SDL_SendRawKeyboardKey(timestamp, input->keyboardID, group[0], conversion_table[i].targetKey, (type == WSCONS_EVENT_KEY_DOWN)); 577 576 SDL_SendKeyboardKey(timestamp, input->keyboardID, group[0], conversion_table[i].targetKey, (type == WSCONS_EVENT_KEY_DOWN)); 578 577 return; 579 578 } 580 579 } 581 - SDL_SendRawKeyboardKey(timestamp, input->keyboardID, group[0], SDL_SCANCODE_UNKNOWN, (type == WSCONS_EVENT_KEY_DOWN)); 582 580 SDL_SendKeyboardKey(timestamp, input->keyboardID, group[0], SDL_SCANCODE_UNKNOWN, (type == WSCONS_EVENT_KEY_DOWN)); 583 581 } 584 582 ··· 820 818 } break; 821 819 case WSCONS_EVENT_ALL_KEYS_UP: 822 820 for (i = 0; i < SDL_SCANCODE_COUNT; i++) { 823 - SDL_SendRawKeyboardKey(timestamp, input->keyboardID, 0, (SDL_Scancode)i, false); 824 821 SDL_SendKeyboardKey(timestamp, input->keyboardID, 0, (SDL_Scancode)i, false); 825 822 } 826 823 break; ··· 829 826 } 830 827 831 828 if (input->type == WSKBD_TYPE_USB && events[i].value <= 0xE7) { 832 - SDL_SendRawKeyboardKey(timestamp, input->keyboardID, 0, (SDL_Scancode)events[i].value, (type == WSCONS_EVENT_KEY_DOWN)); 833 829 SDL_SendKeyboardKey(timestamp, input->keyboardID, 0, (SDL_Scancode)events[i].value, (type == WSCONS_EVENT_KEY_DOWN)); 834 830 } else { 835 831 Translate_to_keycode(input, type, events[i].value, timestamp);
-2
src/events/SDL_categories.c
··· 62 62 63 63 case SDL_EVENT_KEY_DOWN: 64 64 case SDL_EVENT_KEY_UP: 65 - case SDL_EVENT_RAW_KEY_DOWN: 66 - case SDL_EVENT_RAW_KEY_UP: 67 65 return SDL_EVENTCATEGORY_KEY; 68 66 69 67 case SDL_EVENT_TEXT_EDITING:
-13
src/events/SDL_events.c
··· 535 535 break; 536 536 #undef PRINT_KEY_EVENT 537 537 538 - #define PRINT_RAW_KEY_EVENT(event) \ 539 - (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%u state=%s scancode=%u)", \ 540 - (uint)event->raw_key.timestamp, (uint)event->raw_key.which, \ 541 - event->raw_key.down ? "pressed" : "released", \ 542 - (uint)event->raw_key.scancode); 543 - SDL_EVENT_CASE(SDL_EVENT_RAW_KEY_DOWN) 544 - PRINT_RAW_KEY_EVENT(event); 545 - break; 546 - SDL_EVENT_CASE(SDL_EVENT_RAW_KEY_UP) 547 - PRINT_RAW_KEY_EVENT(event); 548 - break; 549 - #undef PRINT_RAW_KEY_EVENT 550 - 551 538 SDL_EVENT_CASE(SDL_EVENT_TEXT_EDITING) 552 539 (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u text='%s' start=%d length=%d)", 553 540 (uint)event->edit.timestamp, (uint)event->edit.windowID,
-16
src/events/SDL_keyboard.c
··· 690 690 return SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_AUTORELEASE, SDL_GLOBAL_KEYBOARD_ID, 0, scancode, true); 691 691 } 692 692 693 - void SDL_SendRawKeyboardKey(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, bool down) 694 - { 695 - const SDL_EventType type = down ? SDL_EVENT_RAW_KEY_DOWN : SDL_EVENT_RAW_KEY_UP; 696 - 697 - if (SDL_EventEnabled(type)) { 698 - SDL_Event event; 699 - event.type = type; 700 - event.common.timestamp = timestamp; 701 - event.raw_key.which = keyboardID; 702 - event.raw_key.scancode = scancode; 703 - event.raw_key.raw = rawcode; 704 - event.raw_key.down = down; 705 - SDL_PushEvent(&event); 706 - } 707 - } 708 - 709 693 void SDL_ReleaseAutoReleaseKeys(void) 710 694 { 711 695 SDL_Keyboard *keyboard = &SDL_keyboard;
-3
src/events/SDL_keyboard_c.h
··· 63 63 Most platforms should prefer to optionally call SDL_SetKeymap and then use SDL_SendKeyboardKey. */ 64 64 extern bool SDL_SendKeyboardKeyAndKeycode(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, SDL_Keycode keycode, bool down); 65 65 66 - // Send a raw keyboard key event 67 - extern void SDL_SendRawKeyboardKey(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, bool down); 68 - 69 66 // Release all the autorelease keys 70 67 extern void SDL_ReleaseAutoReleaseKeys(void); 71 68
-1
src/video/uikit/SDL_uikitevents.m
··· 188 188 189 189 keyboard.keyboardInput.keyChangedHandler = ^(GCKeyboardInput *kbrd, GCControllerButtonInput *key, GCKeyCode keyCode, BOOL pressed) { 190 190 Uint64 timestamp = SDL_GetTicksNS(); 191 - SDL_SendRawKeyboardKey(timestamp, keyboardID, 0, (SDL_Scancode)keyCode, pressed); 192 191 SDL_SendKeyboardKey(timestamp, keyboardID, 0, (SDL_Scancode)keyCode, pressed); 193 192 }; 194 193
-2
src/video/wayland/SDL_waylandevents.c
··· 1732 1732 case SDLK_RGUI: 1733 1733 case SDLK_MODE: 1734 1734 Wayland_HandleModifierKeys(input, scancode, true); 1735 - SDL_SendRawKeyboardKey(timestamp, input->keyboard_id, *key, scancode, true); 1736 1735 SDL_SendKeyboardKeyIgnoreModifiers(timestamp, input->keyboard_id, *key, scancode, true); 1737 1736 break; 1738 1737 default: ··· 1870 1869 scancode = Wayland_get_scancode_from_key(input, key + 8); 1871 1870 Wayland_HandleModifierKeys(input, scancode, state == WL_KEYBOARD_KEY_STATE_PRESSED); 1872 1871 Uint64 timestamp = Wayland_GetKeyboardTimestamp(input, time); 1873 - SDL_SendRawKeyboardKey(timestamp, input->keyboard_id, key, scancode, (state == WL_KEYBOARD_KEY_STATE_PRESSED)); 1874 1872 SDL_SendKeyboardKeyIgnoreModifiers(timestamp, input->keyboard_id, key, scancode, (state == WL_KEYBOARD_KEY_STATE_PRESSED)); 1875 1873 1876 1874 if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
+4 -6
src/video/windows/SDL_windowsevents.c
··· 721 721 { 722 722 SDL_KeyboardID keyboardID = (SDL_KeyboardID)(uintptr_t)hDevice; 723 723 724 + if (!data->raw_keyboard_enabled) { 725 + return; 726 + } 727 + 724 728 if (rawkeyboard->Flags & RI_KEY_E1) { 725 729 // First key in a Ctrl+{key} sequence 726 730 data->pending_E1_key_sequence = true; ··· 762 766 index |= 0x80; 763 767 } 764 768 code = windows_scancode_table[index]; 765 - } 766 - 767 - SDL_SendRawKeyboardKey(timestamp, keyboardID, rawcode, code, down); 768 - 769 - if (!data->raw_keyboard_enabled) { 770 - return; 771 769 } 772 770 773 771 if (down) {
-5
src/video/windows/SDL_windowsgameinput.c
··· 383 383 const bool *keyboard_state = SDL_GetKeyboardState(&num_scancodes); 384 384 for (int i = 0; i < num_scancodes; ++i) { 385 385 if (keyboard_state[i] && !KeysHaveScancode(keys, num_keys, (SDL_Scancode)i)) { 386 - SDL_SendRawKeyboardKey(timestamp, keyboardID, keys[i].scanCode, (SDL_Scancode)i, false); 387 386 SDL_SendKeyboardKey(timestamp, keyboardID, keys[i].scanCode, (SDL_Scancode)i, false); 388 387 } 389 388 } 390 389 391 390 // Go through and send key down events for any key that's held down 392 391 for (uint32_t i = 0; i < num_keys; ++i) { 393 - SDL_SendRawKeyboardKey(timestamp, keyboardID, keys[i].scanCode, GetScancodeFromKeyState(&keys[i]), true); 394 392 SDL_SendKeyboardKey(timestamp, keyboardID, keys[i].scanCode, GetScancodeFromKeyState(&keys[i]), true); 395 393 } 396 394 } ··· 436 434 ++index_keys; 437 435 } else { 438 436 // This key was released 439 - SDL_SendRawKeyboardKey(timestamp, keyboardID, last[index_last].scanCode, GetScancodeFromKeyState(&last[index_last]), false); 440 437 SDL_SendKeyboardKey(timestamp, keyboardID, last[index_last].scanCode, GetScancodeFromKeyState(&last[index_last]), false); 441 438 ++index_last; 442 439 } 443 440 } else if (index_last < num_last) { 444 441 // This key was released 445 - SDL_SendRawKeyboardKey(timestamp, keyboardID, last[index_last].scanCode, GetScancodeFromKeyState(&last[index_last]), false); 446 442 SDL_SendKeyboardKey(timestamp, keyboardID, last[index_last].scanCode, GetScancodeFromKeyState(&last[index_last]), false); 447 443 ++index_last; 448 444 } else { 449 445 // This key was pressed 450 - SDL_SendRawKeyboardKey(timestamp, keyboardID, keys[index_keys].scanCode, GetScancodeFromKeyState(&keys[index_keys]), true); 451 446 SDL_SendKeyboardKey(timestamp, keyboardID, keys[index_keys].scanCode, GetScancodeFromKeyState(&keys[index_keys]), true); 452 447 ++index_keys; 453 448 }
-5
src/video/x11/SDL_x11events.c
··· 827 827 } 828 828 #endif // DEBUG SCANCODES 829 829 830 - if (keyboardID != SDL_GLOBAL_KEYBOARD_ID) { 831 - const bool down = (xevent->type == KeyPress); 832 - SDL_SendRawKeyboardKey(timestamp, keyboardID, keycode, videodata->key_layout[keycode], down); 833 - } 834 - 835 830 text[0] = '\0'; 836 831 837 832 if (SDL_TextInputActive(windowdata->window)) {