Removed raw key events

They weren't adding any value over the existing keyboard events
This commit is contained in:
Sam Lantinga
2024-12-21 04:46:37 -08:00
parent c44fa5bb07
commit d07bb0e679
12 changed files with 4 additions and 78 deletions

View File

@@ -188,7 +188,6 @@ static void OnGCKeyboardConnected(GCKeyboard *keyboard) API_AVAILABLE(macos(11.0
keyboard.keyboardInput.keyChangedHandler = ^(GCKeyboardInput *kbrd, GCControllerButtonInput *key, GCKeyCode keyCode, BOOL pressed) {
Uint64 timestamp = SDL_GetTicksNS();
SDL_SendRawKeyboardKey(timestamp, keyboardID, 0, (SDL_Scancode)keyCode, pressed);
SDL_SendKeyboardKey(timestamp, keyboardID, 0, (SDL_Scancode)keyCode, pressed);
};

View File

@@ -1732,7 +1732,6 @@ static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
case SDLK_RGUI:
case SDLK_MODE:
Wayland_HandleModifierKeys(input, scancode, true);
SDL_SendRawKeyboardKey(timestamp, input->keyboard_id, *key, scancode, true);
SDL_SendKeyboardKeyIgnoreModifiers(timestamp, input->keyboard_id, *key, scancode, true);
break;
default:
@@ -1870,7 +1869,6 @@ static void keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
scancode = Wayland_get_scancode_from_key(input, key + 8);
Wayland_HandleModifierKeys(input, scancode, state == WL_KEYBOARD_KEY_STATE_PRESSED);
Uint64 timestamp = Wayland_GetKeyboardTimestamp(input, time);
SDL_SendRawKeyboardKey(timestamp, input->keyboard_id, key, scancode, (state == WL_KEYBOARD_KEY_STATE_PRESSED));
SDL_SendKeyboardKeyIgnoreModifiers(timestamp, input->keyboard_id, key, scancode, (state == WL_KEYBOARD_KEY_STATE_PRESSED));
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {

View File

@@ -721,6 +721,10 @@ static void WIN_HandleRawKeyboardInput(Uint64 timestamp, SDL_VideoData *data, HA
{
SDL_KeyboardID keyboardID = (SDL_KeyboardID)(uintptr_t)hDevice;
if (!data->raw_keyboard_enabled) {
return;
}
if (rawkeyboard->Flags & RI_KEY_E1) {
// First key in a Ctrl+{key} sequence
data->pending_E1_key_sequence = true;
@@ -764,12 +768,6 @@ static void WIN_HandleRawKeyboardInput(Uint64 timestamp, SDL_VideoData *data, HA
code = windows_scancode_table[index];
}
SDL_SendRawKeyboardKey(timestamp, keyboardID, rawcode, code, down);
if (!data->raw_keyboard_enabled) {
return;
}
if (down) {
SDL_Window *focus = SDL_GetKeyboardFocus();
if (!focus || focus->text_input_active) {

View File

@@ -383,14 +383,12 @@ static void GAMEINPUT_InitialKeyboardReading(WIN_GameInputData *data, SDL_Window
const bool *keyboard_state = SDL_GetKeyboardState(&num_scancodes);
for (int i = 0; i < num_scancodes; ++i) {
if (keyboard_state[i] && !KeysHaveScancode(keys, num_keys, (SDL_Scancode)i)) {
SDL_SendRawKeyboardKey(timestamp, keyboardID, keys[i].scanCode, (SDL_Scancode)i, false);
SDL_SendKeyboardKey(timestamp, keyboardID, keys[i].scanCode, (SDL_Scancode)i, false);
}
}
// Go through and send key down events for any key that's held down
for (uint32_t i = 0; i < num_keys; ++i) {
SDL_SendRawKeyboardKey(timestamp, keyboardID, keys[i].scanCode, GetScancodeFromKeyState(&keys[i]), true);
SDL_SendKeyboardKey(timestamp, keyboardID, keys[i].scanCode, GetScancodeFromKeyState(&keys[i]), true);
}
}
@@ -436,18 +434,15 @@ static void GAMEINPUT_HandleKeyboardDelta(WIN_GameInputData *data, SDL_Window *w
++index_keys;
} else {
// This key was released
SDL_SendRawKeyboardKey(timestamp, keyboardID, last[index_last].scanCode, GetScancodeFromKeyState(&last[index_last]), false);
SDL_SendKeyboardKey(timestamp, keyboardID, last[index_last].scanCode, GetScancodeFromKeyState(&last[index_last]), false);
++index_last;
}
} else if (index_last < num_last) {
// This key was released
SDL_SendRawKeyboardKey(timestamp, keyboardID, last[index_last].scanCode, GetScancodeFromKeyState(&last[index_last]), false);
SDL_SendKeyboardKey(timestamp, keyboardID, last[index_last].scanCode, GetScancodeFromKeyState(&last[index_last]), false);
++index_last;
} else {
// This key was pressed
SDL_SendRawKeyboardKey(timestamp, keyboardID, keys[index_keys].scanCode, GetScancodeFromKeyState(&keys[index_keys]), true);
SDL_SendKeyboardKey(timestamp, keyboardID, keys[index_keys].scanCode, GetScancodeFromKeyState(&keys[index_keys]), true);
++index_keys;
}

View File

@@ -827,11 +827,6 @@ void X11_HandleKeyEvent(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_
}
#endif // DEBUG SCANCODES
if (keyboardID != SDL_GLOBAL_KEYBOARD_ID) {
const bool down = (xevent->type == KeyPress);
SDL_SendRawKeyboardKey(timestamp, keyboardID, keycode, videodata->key_layout[keycode], down);
}
text[0] = '\0';
if (SDL_TextInputActive(windowdata->window)) {