mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-28 09:31:36 +00:00
Prepend key modifier enum values with 'SDL_'
This commit is contained in:
committed by
Sam Lantinga
parent
b7ac14f2bd
commit
abdfa809db
@@ -307,7 +307,7 @@ void Cocoa_InitKeyboard(_THIS)
|
||||
SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command");
|
||||
|
||||
data.modifierFlags = (unsigned int)[NSEvent modifierFlags];
|
||||
SDL_ToggleModState(KMOD_CAPS, (data.modifierFlags & NSEventModifierFlagCapsLock) != 0);
|
||||
SDL_ToggleModState(SDL_KMOD_CAPS, (data.modifierFlags & NSEventModifierFlagCapsLock) != 0);
|
||||
}
|
||||
|
||||
void Cocoa_StartTextInput(_THIS)
|
||||
|
||||
@@ -868,7 +868,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
|
||||
{
|
||||
const unsigned int newflags = [NSEvent modifierFlags] & NSEventModifierFlagCapsLock;
|
||||
_data.videodata.modifierFlags = (_data.videodata.modifierFlags & ~NSEventModifierFlagCapsLock) | newflags;
|
||||
SDL_ToggleModState(KMOD_CAPS, newflags != 0);
|
||||
SDL_ToggleModState(SDL_KMOD_CAPS, newflags != 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1131,7 +1131,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
|
||||
/* Also note that SDL_SendKeyboardKey expects all capslock events to be
|
||||
keypresses; it won't toggle the mod state if you send a keyrelease. */
|
||||
const SDL_bool osenabled = ([theEvent modifierFlags] & NSEventModifierFlagCapsLock) ? SDL_TRUE : SDL_FALSE;
|
||||
const SDL_bool sdlenabled = (SDL_GetModState() & KMOD_CAPS) ? SDL_TRUE : SDL_FALSE;
|
||||
const SDL_bool sdlenabled = (SDL_GetModState() & SDL_KMOD_CAPS) ? SDL_TRUE : SDL_FALSE;
|
||||
if (osenabled ^ sdlenabled) {
|
||||
SDL_SendKeyboardKey(0, SDL_PRESSED, SDL_SCANCODE_CAPSLOCK);
|
||||
SDL_SendKeyboardKey(0, SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);
|
||||
|
||||
@@ -148,9 +148,9 @@ int RISCOS_InitEvents(_THIS)
|
||||
}
|
||||
|
||||
status = (_kernel_osbyte(202, 0, 255) & 0xFF);
|
||||
SDL_ToggleModState(KMOD_NUM, (status & (1 << 2)) == 0);
|
||||
SDL_ToggleModState(KMOD_CAPS, (status & (1 << 4)) == 0);
|
||||
SDL_ToggleModState(KMOD_SCROLL, (status & (1 << 1)) != 0);
|
||||
SDL_ToggleModState(SDL_KMOD_NUM, (status & (1 << 2)) == 0);
|
||||
SDL_ToggleModState(SDL_KMOD_CAPS, (status & (1 << 4)) == 0);
|
||||
SDL_ToggleModState(SDL_KMOD_SCROLL, (status & (1 << 1)) != 0);
|
||||
|
||||
_kernel_swi(OS_Mouse, ®s, ®s);
|
||||
driverdata->last_mouse_buttons = regs.r[2];
|
||||
|
||||
@@ -1319,7 +1319,7 @@ static void keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
|
||||
}
|
||||
|
||||
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||
if (has_text && !(SDL_GetModState() & KMOD_CTRL)) {
|
||||
if (has_text && !(SDL_GetModState() & SDL_KMOD_CTRL)) {
|
||||
Wayland_data_device_set_serial(input->data_device, serial);
|
||||
Wayland_primary_selection_device_set_serial(input->primary_selection_device, serial);
|
||||
if (!handled_by_ime) {
|
||||
@@ -1344,15 +1344,15 @@ static void keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
|
||||
WAYLAND_xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched,
|
||||
mods_locked, 0, 0, group);
|
||||
|
||||
SDL_ToggleModState(KMOD_NUM, modstate & input->xkb.idx_num);
|
||||
SDL_ToggleModState(KMOD_CAPS, modstate & input->xkb.idx_caps);
|
||||
SDL_ToggleModState(SDL_KMOD_NUM, modstate & input->xkb.idx_num);
|
||||
SDL_ToggleModState(SDL_KMOD_CAPS, modstate & input->xkb.idx_caps);
|
||||
|
||||
/* Toggle the modifier states for virtual keyboards, as they may not send key presses. */
|
||||
if (input->keyboard_is_virtual) {
|
||||
SDL_ToggleModState(KMOD_SHIFT, modstate & input->xkb.idx_shift);
|
||||
SDL_ToggleModState(KMOD_CTRL, modstate & input->xkb.idx_ctrl);
|
||||
SDL_ToggleModState(KMOD_ALT, modstate & input->xkb.idx_alt);
|
||||
SDL_ToggleModState(KMOD_GUI, modstate & input->xkb.idx_gui);
|
||||
SDL_ToggleModState(SDL_KMOD_SHIFT, modstate & input->xkb.idx_shift);
|
||||
SDL_ToggleModState(SDL_KMOD_CTRL, modstate & input->xkb.idx_ctrl);
|
||||
SDL_ToggleModState(SDL_KMOD_ALT, modstate & input->xkb.idx_alt);
|
||||
SDL_ToggleModState(SDL_KMOD_GUI, modstate & input->xkb.idx_gui);
|
||||
}
|
||||
|
||||
/* If a key is repeating, update the text to apply the modifier. */
|
||||
|
||||
@@ -534,9 +534,9 @@ static void WIN_UpdateFocus(SDL_Window *window, SDL_bool expect_focus)
|
||||
*/
|
||||
WIN_CheckClipboardUpdate(data->videodata);
|
||||
|
||||
SDL_ToggleModState(KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0);
|
||||
SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0);
|
||||
SDL_ToggleModState(KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) != 0);
|
||||
SDL_ToggleModState(SDL_KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0);
|
||||
SDL_ToggleModState(SDL_KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0);
|
||||
SDL_ToggleModState(SDL_KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) != 0);
|
||||
|
||||
WIN_UpdateWindowICCProfile(data->window, SDL_TRUE);
|
||||
} else {
|
||||
|
||||
@@ -108,9 +108,9 @@ void WIN_InitKeyboard(_THIS)
|
||||
SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Windows");
|
||||
|
||||
/* Are system caps/num/scroll lock active? Set our state to match. */
|
||||
SDL_ToggleModState(KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0);
|
||||
SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0);
|
||||
SDL_ToggleModState(KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) != 0);
|
||||
SDL_ToggleModState(SDL_KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0);
|
||||
SDL_ToggleModState(SDL_KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0);
|
||||
SDL_ToggleModState(SDL_KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) != 0);
|
||||
}
|
||||
|
||||
void WIN_UpdateKeymap(SDL_bool send_event)
|
||||
|
||||
@@ -413,9 +413,9 @@ void X11_ReconcileKeyboardState(_THIS)
|
||||
|
||||
/* Sync up the keyboard modifier state */
|
||||
if (X11_XQueryPointer(display, DefaultRootWindow(display), &junk_window, &junk_window, &x, &y, &x, &y, &mask)) {
|
||||
SDL_ToggleModState(KMOD_CAPS, (mask & LockMask) != 0);
|
||||
SDL_ToggleModState(KMOD_NUM, (mask & X11_GetNumLockModifierMask(_this)) != 0);
|
||||
SDL_ToggleModState(KMOD_SCROLL, (mask & X11_GetScrollLockModifierMask(_this)) != 0);
|
||||
SDL_ToggleModState(SDL_KMOD_CAPS, (mask & LockMask) != 0);
|
||||
SDL_ToggleModState(SDL_KMOD_NUM, (mask & X11_GetNumLockModifierMask(_this)) != 0);
|
||||
SDL_ToggleModState(SDL_KMOD_SCROLL, (mask & X11_GetScrollLockModifierMask(_this)) != 0);
|
||||
}
|
||||
|
||||
keyboardState = SDL_GetKeyboardState(0);
|
||||
|
||||
Reference in New Issue
Block a user