Prepend key modifier enum values with 'SDL_'

This commit is contained in:
Frank Praznik 2022-12-23 20:52:46 -05:00 committed by Sam Lantinga
parent b7ac14f2bd
commit abdfa809db
23 changed files with 280 additions and 199 deletions

View File

@ -47,3 +47,22 @@ General:
* The timestamp member of the SDL_Event structure is now in nanoseconds, filled in with the time the event was generated, or the time it was queued if that's not available
* The `SDL_DISPLAYEVENT_*` and `SDL_WINDOWEVENT_*` events have been moved to top level events
* Intrinsic headers are no longer included in the public SDL headers
* The following enums have been renamed:
* KMOD_ALT => SDL_KMOD_ALT
* KMOD_CAPS => SDL_KMOD_CAPS
* KMOD_CTRL => SDL_KMOD_CTRL
* KMOD_GUI => SDL_KMOD_GUI
* KMOD_LALT => SDL_KMOD_LALT
* KMOD_LCTRL => SDL_KMOD_LCTRL
* KMOD_LGUI => SDL_KMOD_LGUI
* KMOD_LSHIFT => SDL_KMOD_LSHIFT
* KMOD_MODE => SDL_KMOD_MODE
* KMOD_NONE => SDL_KMOD_NONE
* KMOD_NUM => SDL_KMOD_NUM
* KMOD_RALT => SDL_KMOD_RALT
* KMOD_RCTRL => SDL_KMOD_RCTRL
* KMOD_RESERVED => SDL_KMOD_RESERVED
* KMOD_RGUI => SDL_KMOD_RGUI
* KMOD_RSHIFT => SDL_KMOD_RSHIFT
* KMOD_SCROLL => SDL_KMOD_SCROLL
* KMOD_SHIFT => SDL_KMOD_SHIFT

View File

@ -39,39 +39,39 @@ typedef struct
#define TABLE_SIZE 51 /* size of our table which maps keys and modifiers to font indices */
/* Below is the table that defines the mapping between scancodes and modifiers to indices in the
bitmap font. As an example, then line '{ SDL_SCANCODE_A, 1, KMOD_SHIFT, 33 }' means, map
bitmap font. As an example, then line '{ SDL_SCANCODE_A, 1, SDL_KMOD_SHIFT, 33 }' means, map
the key A (which has scancode SDL_SCANCODE_A) to index 33 in the font (which is a picture of an A),
The '1' means that the mapping is valid even if there are no modifiers, and KMOD_SHIFT means the
The '1' means that the mapping is valid even if there are no modifiers, and SDL_KMOD_SHIFT means the
mapping is also valid if the user is holding shift.
*/
fontMapping map[TABLE_SIZE] = {
{SDL_SCANCODE_A, 1, KMOD_SHIFT, 33}, /* A */
{SDL_SCANCODE_B, 1, KMOD_SHIFT, 34}, /* B */
{SDL_SCANCODE_C, 1, KMOD_SHIFT, 35}, /* C */
{SDL_SCANCODE_D, 1, KMOD_SHIFT, 36}, /* D */
{SDL_SCANCODE_E, 1, KMOD_SHIFT, 37}, /* E */
{SDL_SCANCODE_F, 1, KMOD_SHIFT, 38}, /* F */
{SDL_SCANCODE_G, 1, KMOD_SHIFT, 39}, /* G */
{SDL_SCANCODE_H, 1, KMOD_SHIFT, 40}, /* H */
{SDL_SCANCODE_I, 1, KMOD_SHIFT, 41}, /* I */
{SDL_SCANCODE_J, 1, KMOD_SHIFT, 42}, /* J */
{SDL_SCANCODE_K, 1, KMOD_SHIFT, 43}, /* K */
{SDL_SCANCODE_L, 1, KMOD_SHIFT, 44}, /* L */
{SDL_SCANCODE_M, 1, KMOD_SHIFT, 45}, /* M */
{SDL_SCANCODE_N, 1, KMOD_SHIFT, 46}, /* N */
{SDL_SCANCODE_O, 1, KMOD_SHIFT, 47}, /* O */
{SDL_SCANCODE_P, 1, KMOD_SHIFT, 48}, /* P */
{SDL_SCANCODE_Q, 1, KMOD_SHIFT, 49}, /* Q */
{SDL_SCANCODE_R, 1, KMOD_SHIFT, 50}, /* R */
{SDL_SCANCODE_S, 1, KMOD_SHIFT, 51}, /* S */
{SDL_SCANCODE_T, 1, KMOD_SHIFT, 52}, /* T */
{SDL_SCANCODE_U, 1, KMOD_SHIFT, 53}, /* U */
{SDL_SCANCODE_V, 1, KMOD_SHIFT, 54}, /* V */
{SDL_SCANCODE_W, 1, KMOD_SHIFT, 55}, /* W */
{SDL_SCANCODE_X, 1, KMOD_SHIFT, 56}, /* X */
{SDL_SCANCODE_Y, 1, KMOD_SHIFT, 57}, /* Y */
{SDL_SCANCODE_Z, 1, KMOD_SHIFT, 58}, /* Z */
{SDL_SCANCODE_A, 1, SDL_KMOD_SHIFT, 33}, /* A */
{SDL_SCANCODE_B, 1, SDL_KMOD_SHIFT, 34}, /* B */
{SDL_SCANCODE_C, 1, SDL_KMOD_SHIFT, 35}, /* C */
{SDL_SCANCODE_D, 1, SDL_KMOD_SHIFT, 36}, /* D */
{SDL_SCANCODE_E, 1, SDL_KMOD_SHIFT, 37}, /* E */
{SDL_SCANCODE_F, 1, SDL_KMOD_SHIFT, 38}, /* F */
{SDL_SCANCODE_G, 1, SDL_KMOD_SHIFT, 39}, /* G */
{SDL_SCANCODE_H, 1, SDL_KMOD_SHIFT, 40}, /* H */
{SDL_SCANCODE_I, 1, SDL_KMOD_SHIFT, 41}, /* I */
{SDL_SCANCODE_J, 1, SDL_KMOD_SHIFT, 42}, /* J */
{SDL_SCANCODE_K, 1, SDL_KMOD_SHIFT, 43}, /* K */
{SDL_SCANCODE_L, 1, SDL_KMOD_SHIFT, 44}, /* L */
{SDL_SCANCODE_M, 1, SDL_KMOD_SHIFT, 45}, /* M */
{SDL_SCANCODE_N, 1, SDL_KMOD_SHIFT, 46}, /* N */
{SDL_SCANCODE_O, 1, SDL_KMOD_SHIFT, 47}, /* O */
{SDL_SCANCODE_P, 1, SDL_KMOD_SHIFT, 48}, /* P */
{SDL_SCANCODE_Q, 1, SDL_KMOD_SHIFT, 49}, /* Q */
{SDL_SCANCODE_R, 1, SDL_KMOD_SHIFT, 50}, /* R */
{SDL_SCANCODE_S, 1, SDL_KMOD_SHIFT, 51}, /* S */
{SDL_SCANCODE_T, 1, SDL_KMOD_SHIFT, 52}, /* T */
{SDL_SCANCODE_U, 1, SDL_KMOD_SHIFT, 53}, /* U */
{SDL_SCANCODE_V, 1, SDL_KMOD_SHIFT, 54}, /* V */
{SDL_SCANCODE_W, 1, SDL_KMOD_SHIFT, 55}, /* W */
{SDL_SCANCODE_X, 1, SDL_KMOD_SHIFT, 56}, /* X */
{SDL_SCANCODE_Y, 1, SDL_KMOD_SHIFT, 57}, /* Y */
{SDL_SCANCODE_Z, 1, SDL_KMOD_SHIFT, 58}, /* Z */
{SDL_SCANCODE_0, 1, 0, 16}, /* 0 */
{SDL_SCANCODE_1, 1, 0, 17}, /* 1 */
{SDL_SCANCODE_2, 1, 0, 18}, /* 2 */
@ -83,18 +83,18 @@ fontMapping map[TABLE_SIZE] = {
{SDL_SCANCODE_8, 1, 0, 24}, /* 8 */
{SDL_SCANCODE_9, 1, 0, 25}, /* 9 */
{SDL_SCANCODE_SPACE, 1, 0, 0}, /* ' ' */
{SDL_SCANCODE_1, 0, KMOD_SHIFT, 1}, /* ! */
{SDL_SCANCODE_SLASH, 0, KMOD_SHIFT, 31}, /* ? */
{SDL_SCANCODE_1, 0, SDL_KMOD_SHIFT, 1}, /* ! */
{SDL_SCANCODE_SLASH, 0, SDL_KMOD_SHIFT, 31}, /* ? */
{SDL_SCANCODE_SLASH, 1, 0, 15}, /* / */
{SDL_SCANCODE_COMMA, 1, 0, 12}, /* , */
{SDL_SCANCODE_SEMICOLON, 1, 0, 27}, /* ; */
{SDL_SCANCODE_SEMICOLON, 0, KMOD_SHIFT, 26}, /* : */
{SDL_SCANCODE_SEMICOLON, 0, SDL_KMOD_SHIFT, 26}, /* : */
{SDL_SCANCODE_PERIOD, 1, 0, 14}, /* . */
{SDL_SCANCODE_MINUS, 1, 0, 13}, /* - */
{SDL_SCANCODE_EQUALS, 0, KMOD_SHIFT, 11}, /* = */
{SDL_SCANCODE_EQUALS, 0, SDL_KMOD_SHIFT, 11}, /* = */
{SDL_SCANCODE_APOSTROPHE, 1, 0, 7}, /* ' */
{SDL_SCANCODE_APOSTROPHE, 0, KMOD_SHIFT, 2}, /* " */
{SDL_SCANCODE_5, 0, KMOD_SHIFT, 5}, /* % */
{SDL_SCANCODE_APOSTROPHE, 0, SDL_KMOD_SHIFT, 2}, /* " */
{SDL_SCANCODE_5, 0, SDL_KMOD_SHIFT, 5}, /* % */
};

View File

@ -96,6 +96,28 @@ The following hints have been removed:
* Renamed hints 'SDL_HINT_VIDEODRIVER' and 'SDL_HINT_AUDIODRIVER' to 'SDL_HINT_VIDEO_DRIVER' and 'SDL_HINT_AUDIO_DRIVER'
* Renamed environment variables 'SDL_VIDEODRIVER' and 'SDL_AUDIODRIVER' to 'SDL_VIDEO_DRIVER' and 'SDL_AUDIO_DRIVER'
## SDL_keycode.h
The following enums have been renamed:
* KMOD_ALT => SDL_KMOD_ALT
* KMOD_CAPS => SDL_KMOD_CAPS
* KMOD_CTRL => SDL_KMOD_CTRL
* KMOD_GUI => SDL_KMOD_GUI
* KMOD_LALT => SDL_KMOD_LALT
* KMOD_LCTRL => SDL_KMOD_LCTRL
* KMOD_LGUI => SDL_KMOD_LGUI
* KMOD_LSHIFT => SDL_KMOD_LSHIFT
* KMOD_MODE => SDL_KMOD_MODE
* KMOD_NONE => SDL_KMOD_NONE
* KMOD_NUM => SDL_KMOD_NUM
* KMOD_RALT => SDL_KMOD_RALT
* KMOD_RCTRL => SDL_KMOD_RCTRL
* KMOD_RESERVED => SDL_KMOD_RESERVED
* KMOD_RGUI => SDL_KMOD_RGUI
* KMOD_RSHIFT => SDL_KMOD_RSHIFT
* KMOD_SCROLL => SDL_KMOD_SCROLL
* KMOD_SHIFT => SDL_KMOD_SHIFT
## SDL_main.h
SDL3 doesn't have a static libSDLmain to link against anymore.

View File

@ -331,26 +331,26 @@ typedef enum
*/
typedef enum
{
KMOD_NONE = 0x0000,
KMOD_LSHIFT = 0x0001,
KMOD_RSHIFT = 0x0002,
KMOD_LCTRL = 0x0040,
KMOD_RCTRL = 0x0080,
KMOD_LALT = 0x0100,
KMOD_RALT = 0x0200,
KMOD_LGUI = 0x0400,
KMOD_RGUI = 0x0800,
KMOD_NUM = 0x1000,
KMOD_CAPS = 0x2000,
KMOD_MODE = 0x4000,
KMOD_SCROLL = 0x8000,
SDL_KMOD_NONE = 0x0000,
SDL_KMOD_LSHIFT = 0x0001,
SDL_KMOD_RSHIFT = 0x0002,
SDL_KMOD_LCTRL = 0x0040,
SDL_KMOD_RCTRL = 0x0080,
SDL_KMOD_LALT = 0x0100,
SDL_KMOD_RALT = 0x0200,
SDL_KMOD_LGUI = 0x0400,
SDL_KMOD_RGUI = 0x0800,
SDL_KMOD_NUM = 0x1000,
SDL_KMOD_CAPS = 0x2000,
SDL_KMOD_MODE = 0x4000,
SDL_KMOD_SCROLL = 0x8000,
KMOD_CTRL = KMOD_LCTRL | KMOD_RCTRL,
KMOD_SHIFT = KMOD_LSHIFT | KMOD_RSHIFT,
KMOD_ALT = KMOD_LALT | KMOD_RALT,
KMOD_GUI = KMOD_LGUI | KMOD_RGUI,
SDL_KMOD_CTRL = SDL_KMOD_LCTRL | SDL_KMOD_RCTRL,
SDL_KMOD_SHIFT = SDL_KMOD_LSHIFT | SDL_KMOD_RSHIFT,
SDL_KMOD_ALT = SDL_KMOD_LALT | SDL_KMOD_RALT,
SDL_KMOD_GUI = SDL_KMOD_LGUI | SDL_KMOD_RGUI,
KMOD_RESERVED = KMOD_SCROLL /* This is for source-level compatibility with SDL 2.0.0. */
SDL_KMOD_RESERVED = SDL_KMOD_SCROLL /* This is for source-level compatibility with SDL 2.0.0. */
} SDL_Keymod;
#endif /* SDL_keycode_h_ */

View File

@ -37,6 +37,26 @@
*/
#ifdef SDL_ENABLE_OLD_NAMES
/* ##SDL_keycode.h */
#define KMOD_ALT SDL_KMOD_ALT
#define KMOD_CAPS SDL_KMOD_CAPS
#define KMOD_CTRL SDL_KMOD_CTRL
#define KMOD_GUI SDL_KMOD_GUI
#define KMOD_LALT SDL_KMOD_LALT
#define KMOD_LCTRL SDL_KMOD_LCTRL
#define KMOD_LGUI SDL_KMOD_LGUI
#define KMOD_LSHIFT SDL_KMOD_LSHIFT
#define KMOD_MODE SDL_KMOD_MODE
#define KMOD_NONE SDL_KMOD_NONE
#define KMOD_NUM SDL_KMOD_NUM
#define KMOD_RALT SDL_KMOD_RALT
#define KMOD_RCTRL SDL_KMOD_RCTRL
#define KMOD_RESERVED SDL_KMOD_RESERVED
#define KMOD_RGUI SDL_KMOD_RGUI
#define KMOD_RSHIFT SDL_KMOD_RSHIFT
#define KMOD_SCROLL SDL_KMOD_SCROLL
#define KMOD_SHIFT SDL_KMOD_SHIFT
/* ##SDL_platform.h */
#define __IPHONEOS__ __IOS__
#define __MACOSX__ __MACOS__
@ -48,6 +68,26 @@
#else /* !SDL_ENABLE_OLD_NAMES */
/* ##SDL_keycode.h */
#define KMOD_ALT KMOD_ALT_renamed_SDL_KMOD_ALT
#define KMOD_CAPS KMOD_CAPS_renamed_SDL_KMOD_CAPS
#define KMOD_CTRL KMOD_CTRL_renamed_SDL_KMOD_CTRL
#define KMOD_GUI KMOD_GUI_renamed_SDL_KMOD_GUI
#define KMOD_LALT KMOD_LALT_renamed_SDL_KMOD_LALT
#define KMOD_LCTRL KMOD_LCTRL_renamed_SDL_KMOD_LCTRL
#define KMOD_LGUI KMOD_LGUI_renamed_SDL_KMOD_LGUI
#define KMOD_LSHIFT KMOD_LSHIFT_renamed_SDL_KMOD_LSHIFT
#define KMOD_MODE KMOD_MODE_renamed_SDL_KMOD_MODE
#define KMOD_NONE KMOD_NONE_renamed_SDL_KMOD_NONE
#define KMOD_NUM KMOD_NUM_renamed_SDL_KMOD_NUM
#define KMOD_RALT KMOD_RALT_renamed_SDL_KMOD_RALT
#define KMOD_RCTRL KMOD_RCTRL_renamed_SDL_KMOD_RCTRL
#define KMOD_RESERVED KMOD_RESERVED_renamed_SDL_KMOD_RESERVED
#define KMOD_RGUI KMOD_RGUI_renamed_SDL_KMOD_RGUI
#define KMOD_RSHIFT KMOD_RSHIFT_renamed_SDL_KMOD_RSHIFT
#define KMOD_SCROLL KMOD_SCROLL_renamed_SDL_KMOD_SCROLL
#define KMOD_SHIFT KMOD_SHIFT_renamed_SDL_KMOD_SHIFT
/* ##SDL_platform.h */
#define __IPHONEOS__ __IPHONEOS___renamed___IOS__
#define __MACOSX__ __MACOSX___renamed___MACOS__

View File

@ -336,7 +336,7 @@ typedef enum
SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered
* by any of the above, but since there's a
* special KMOD_MODE for it I'm adding it here
* special SDL_KMOD_MODE for it I'm adding it here
*/
/* @} *//* Usage page 0x07 */

View File

@ -339,28 +339,28 @@ static Uint32 Fcitx_ModState(void)
Uint32 fcitx_mods = 0;
SDL_Keymod sdl_mods = SDL_GetModState();
if (sdl_mods & KMOD_SHIFT) {
if (sdl_mods & SDL_KMOD_SHIFT) {
fcitx_mods |= (1 << 0);
}
if (sdl_mods & KMOD_CAPS) {
if (sdl_mods & SDL_KMOD_CAPS) {
fcitx_mods |= (1 << 1);
}
if (sdl_mods & KMOD_CTRL) {
if (sdl_mods & SDL_KMOD_CTRL) {
fcitx_mods |= (1 << 2);
}
if (sdl_mods & KMOD_ALT) {
if (sdl_mods & SDL_KMOD_ALT) {
fcitx_mods |= (1 << 3);
}
if (sdl_mods & KMOD_NUM) {
if (sdl_mods & SDL_KMOD_NUM) {
fcitx_mods |= (1 << 4);
}
if (sdl_mods & KMOD_MODE) {
if (sdl_mods & SDL_KMOD_MODE) {
fcitx_mods |= (1 << 7);
}
if (sdl_mods & KMOD_LGUI) {
if (sdl_mods & SDL_KMOD_LGUI) {
fcitx_mods |= (1 << 6);
}
if (sdl_mods & KMOD_RGUI) {
if (sdl_mods & SDL_KMOD_RGUI) {
fcitx_mods |= (1 << 28);
}

View File

@ -62,28 +62,28 @@ static Uint32 IBus_ModState(void)
SDL_Keymod sdl_mods = SDL_GetModState();
/* Not sure about MOD3, MOD4 and HYPER mappings */
if (sdl_mods & KMOD_LSHIFT) {
if (sdl_mods & SDL_KMOD_LSHIFT) {
ibus_mods |= IBUS_SHIFT_MASK;
}
if (sdl_mods & KMOD_CAPS) {
if (sdl_mods & SDL_KMOD_CAPS) {
ibus_mods |= IBUS_LOCK_MASK;
}
if (sdl_mods & KMOD_LCTRL) {
if (sdl_mods & SDL_KMOD_LCTRL) {
ibus_mods |= IBUS_CONTROL_MASK;
}
if (sdl_mods & KMOD_LALT) {
if (sdl_mods & SDL_KMOD_LALT) {
ibus_mods |= IBUS_MOD1_MASK;
}
if (sdl_mods & KMOD_NUM) {
if (sdl_mods & SDL_KMOD_NUM) {
ibus_mods |= IBUS_MOD2_MASK;
}
if (sdl_mods & KMOD_MODE) {
if (sdl_mods & SDL_KMOD_MODE) {
ibus_mods |= IBUS_MOD5_MASK;
}
if (sdl_mods & KMOD_LGUI) {
if (sdl_mods & SDL_KMOD_LGUI) {
ibus_mods |= IBUS_SUPER_MASK;
}
if (sdl_mods & KMOD_RGUI) {
if (sdl_mods & SDL_KMOD_RGUI) {
ibus_mods |= IBUS_META_MASK;
}

View File

@ -850,46 +850,46 @@ static int SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint8 source, Uint8 sta
/* Update modifiers state if applicable */
switch (keycode) {
case SDLK_LCTRL:
modifier = KMOD_LCTRL;
modifier = SDL_KMOD_LCTRL;
break;
case SDLK_RCTRL:
modifier = KMOD_RCTRL;
modifier = SDL_KMOD_RCTRL;
break;
case SDLK_LSHIFT:
modifier = KMOD_LSHIFT;
modifier = SDL_KMOD_LSHIFT;
break;
case SDLK_RSHIFT:
modifier = KMOD_RSHIFT;
modifier = SDL_KMOD_RSHIFT;
break;
case SDLK_LALT:
modifier = KMOD_LALT;
modifier = SDL_KMOD_LALT;
break;
case SDLK_RALT:
modifier = KMOD_RALT;
modifier = SDL_KMOD_RALT;
break;
case SDLK_LGUI:
modifier = KMOD_LGUI;
modifier = SDL_KMOD_LGUI;
break;
case SDLK_RGUI:
modifier = KMOD_RGUI;
modifier = SDL_KMOD_RGUI;
break;
case SDLK_MODE:
modifier = KMOD_MODE;
modifier = SDL_KMOD_MODE;
break;
default:
modifier = KMOD_NONE;
modifier = SDL_KMOD_NONE;
break;
}
if (SDL_KEYDOWN == type) {
switch (keycode) {
case SDLK_NUMLOCKCLEAR:
keyboard->modstate ^= KMOD_NUM;
keyboard->modstate ^= SDL_KMOD_NUM;
break;
case SDLK_CAPSLOCK:
keyboard->modstate ^= KMOD_CAPS;
keyboard->modstate ^= SDL_KMOD_CAPS;
break;
case SDLK_SCROLLLOCK:
keyboard->modstate ^= KMOD_SCROLL;
keyboard->modstate ^= SDL_KMOD_SCROLL;
break;
default:
keyboard->modstate |= modifier;
@ -919,7 +919,7 @@ static int SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint8 source, Uint8 sta
has explicitly opted out of this behavior. */
if (keycode == SDLK_TAB &&
state == SDL_PRESSED &&
(keyboard->modstate & KMOD_ALT) &&
(keyboard->modstate & SDL_KMOD_ALT) &&
keyboard->focus &&
(keyboard->focus->flags & SDL_WINDOW_KEYBOARD_GRABBED) &&
(keyboard->focus->flags & SDL_WINDOW_FULLSCREEN) &&
@ -942,7 +942,7 @@ int SDL_SendKeyboardUnicodeKey(Uint64 timestamp, Uint32 ch)
mod = SDL_ASCIIKeyInfoTable[ch].mod;
}
if (mod & KMOD_SHIFT) {
if (mod & SDL_KMOD_SHIFT) {
/* If the character uses shift, press shift down */
SDL_SendKeyboardKey(timestamp, SDL_PRESSED, SDL_SCANCODE_LSHIFT);
}
@ -951,7 +951,7 @@ int SDL_SendKeyboardUnicodeKey(Uint64 timestamp, Uint32 ch)
SDL_SendKeyboardKey(timestamp, SDL_PRESSED, code);
SDL_SendKeyboardKey(timestamp, SDL_RELEASED, code);
if (mod & KMOD_SHIFT) {
if (mod & SDL_KMOD_SHIFT) {
/* If the character uses shift, release shift */
SDL_SendKeyboardKey(timestamp, SDL_RELEASED, SDL_SCANCODE_LSHIFT);
}

View File

@ -67,17 +67,17 @@ static ASCIIKeyInfo SDL_ASCIIKeyInfoTable[] = {
/* 30 */ { SDL_SCANCODE_UNKNOWN, 0 },
/* 31 */ { SDL_SCANCODE_UNKNOWN, 0 },
/* 32 */ { SDL_SCANCODE_SPACE, 0 },
/* 33 */ { SDL_SCANCODE_1, KMOD_SHIFT }, /* plus shift modifier '!' */
/* 34 */ { SDL_SCANCODE_APOSTROPHE, KMOD_SHIFT }, /* plus shift modifier '"' */
/* 35 */ { SDL_SCANCODE_3, KMOD_SHIFT }, /* plus shift modifier '#' */
/* 36 */ { SDL_SCANCODE_4, KMOD_SHIFT }, /* plus shift modifier '$' */
/* 37 */ { SDL_SCANCODE_5, KMOD_SHIFT }, /* plus shift modifier '%' */
/* 38 */ { SDL_SCANCODE_7, KMOD_SHIFT }, /* plus shift modifier '&' */
/* 33 */ { SDL_SCANCODE_1, SDL_KMOD_SHIFT }, /* plus shift modifier '!' */
/* 34 */ { SDL_SCANCODE_APOSTROPHE, SDL_KMOD_SHIFT }, /* plus shift modifier '"' */
/* 35 */ { SDL_SCANCODE_3, SDL_KMOD_SHIFT }, /* plus shift modifier '#' */
/* 36 */ { SDL_SCANCODE_4, SDL_KMOD_SHIFT }, /* plus shift modifier '$' */
/* 37 */ { SDL_SCANCODE_5, SDL_KMOD_SHIFT }, /* plus shift modifier '%' */
/* 38 */ { SDL_SCANCODE_7, SDL_KMOD_SHIFT }, /* plus shift modifier '&' */
/* 39 */ { SDL_SCANCODE_APOSTROPHE, 0 }, /* ''' */
/* 40 */ { SDL_SCANCODE_9, KMOD_SHIFT }, /* plus shift modifier '(' */
/* 41 */ { SDL_SCANCODE_0, KMOD_SHIFT }, /* plus shift modifier ')' */
/* 42 */ { SDL_SCANCODE_8, KMOD_SHIFT }, /* '*' */
/* 43 */ { SDL_SCANCODE_EQUALS, KMOD_SHIFT }, /* plus shift modifier '+' */
/* 40 */ { SDL_SCANCODE_9, SDL_KMOD_SHIFT }, /* plus shift modifier '(' */
/* 41 */ { SDL_SCANCODE_0, SDL_KMOD_SHIFT }, /* plus shift modifier ')' */
/* 42 */ { SDL_SCANCODE_8, SDL_KMOD_SHIFT }, /* '*' */
/* 43 */ { SDL_SCANCODE_EQUALS, SDL_KMOD_SHIFT }, /* plus shift modifier '+' */
/* 44 */ { SDL_SCANCODE_COMMA, 0 }, /* ',' */
/* 45 */ { SDL_SCANCODE_MINUS, 0 }, /* '-' */
/* 46 */ { SDL_SCANCODE_PERIOD, 0 }, /* '.' */
@ -92,45 +92,45 @@ static ASCIIKeyInfo SDL_ASCIIKeyInfoTable[] = {
/* 55 */ { SDL_SCANCODE_7, 0 },
/* 56 */ { SDL_SCANCODE_8, 0 },
/* 57 */ { SDL_SCANCODE_9, 0 },
/* 58 */ { SDL_SCANCODE_SEMICOLON, KMOD_SHIFT }, /* plus shift modifier ';' */
/* 58 */ { SDL_SCANCODE_SEMICOLON, SDL_KMOD_SHIFT }, /* plus shift modifier ';' */
/* 59 */ { SDL_SCANCODE_SEMICOLON, 0 },
/* 60 */ { SDL_SCANCODE_COMMA, KMOD_SHIFT }, /* plus shift modifier '<' */
/* 60 */ { SDL_SCANCODE_COMMA, SDL_KMOD_SHIFT }, /* plus shift modifier '<' */
/* 61 */ { SDL_SCANCODE_EQUALS, 0 },
/* 62 */ { SDL_SCANCODE_PERIOD, KMOD_SHIFT }, /* plus shift modifier '>' */
/* 63 */ { SDL_SCANCODE_SLASH, KMOD_SHIFT }, /* plus shift modifier '?' */
/* 64 */ { SDL_SCANCODE_2, KMOD_SHIFT }, /* plus shift modifier '@' */
/* 65 */ { SDL_SCANCODE_A, KMOD_SHIFT }, /* all the following need shift modifiers */
/* 66 */ { SDL_SCANCODE_B, KMOD_SHIFT },
/* 67 */ { SDL_SCANCODE_C, KMOD_SHIFT },
/* 68 */ { SDL_SCANCODE_D, KMOD_SHIFT },
/* 69 */ { SDL_SCANCODE_E, KMOD_SHIFT },
/* 70 */ { SDL_SCANCODE_F, KMOD_SHIFT },
/* 71 */ { SDL_SCANCODE_G, KMOD_SHIFT },
/* 72 */ { SDL_SCANCODE_H, KMOD_SHIFT },
/* 73 */ { SDL_SCANCODE_I, KMOD_SHIFT },
/* 74 */ { SDL_SCANCODE_J, KMOD_SHIFT },
/* 75 */ { SDL_SCANCODE_K, KMOD_SHIFT },
/* 76 */ { SDL_SCANCODE_L, KMOD_SHIFT },
/* 77 */ { SDL_SCANCODE_M, KMOD_SHIFT },
/* 78 */ { SDL_SCANCODE_N, KMOD_SHIFT },
/* 79 */ { SDL_SCANCODE_O, KMOD_SHIFT },
/* 80 */ { SDL_SCANCODE_P, KMOD_SHIFT },
/* 81 */ { SDL_SCANCODE_Q, KMOD_SHIFT },
/* 82 */ { SDL_SCANCODE_R, KMOD_SHIFT },
/* 83 */ { SDL_SCANCODE_S, KMOD_SHIFT },
/* 84 */ { SDL_SCANCODE_T, KMOD_SHIFT },
/* 85 */ { SDL_SCANCODE_U, KMOD_SHIFT },
/* 86 */ { SDL_SCANCODE_V, KMOD_SHIFT },
/* 87 */ { SDL_SCANCODE_W, KMOD_SHIFT },
/* 88 */ { SDL_SCANCODE_X, KMOD_SHIFT },
/* 89 */ { SDL_SCANCODE_Y, KMOD_SHIFT },
/* 90 */ { SDL_SCANCODE_Z, KMOD_SHIFT },
/* 62 */ { SDL_SCANCODE_PERIOD, SDL_KMOD_SHIFT }, /* plus shift modifier '>' */
/* 63 */ { SDL_SCANCODE_SLASH, SDL_KMOD_SHIFT }, /* plus shift modifier '?' */
/* 64 */ { SDL_SCANCODE_2, SDL_KMOD_SHIFT }, /* plus shift modifier '@' */
/* 65 */ { SDL_SCANCODE_A, SDL_KMOD_SHIFT }, /* all the following need shift modifiers */
/* 66 */ { SDL_SCANCODE_B, SDL_KMOD_SHIFT },
/* 67 */ { SDL_SCANCODE_C, SDL_KMOD_SHIFT },
/* 68 */ { SDL_SCANCODE_D, SDL_KMOD_SHIFT },
/* 69 */ { SDL_SCANCODE_E, SDL_KMOD_SHIFT },
/* 70 */ { SDL_SCANCODE_F, SDL_KMOD_SHIFT },
/* 71 */ { SDL_SCANCODE_G, SDL_KMOD_SHIFT },
/* 72 */ { SDL_SCANCODE_H, SDL_KMOD_SHIFT },
/* 73 */ { SDL_SCANCODE_I, SDL_KMOD_SHIFT },
/* 74 */ { SDL_SCANCODE_J, SDL_KMOD_SHIFT },
/* 75 */ { SDL_SCANCODE_K, SDL_KMOD_SHIFT },
/* 76 */ { SDL_SCANCODE_L, SDL_KMOD_SHIFT },
/* 77 */ { SDL_SCANCODE_M, SDL_KMOD_SHIFT },
/* 78 */ { SDL_SCANCODE_N, SDL_KMOD_SHIFT },
/* 79 */ { SDL_SCANCODE_O, SDL_KMOD_SHIFT },
/* 80 */ { SDL_SCANCODE_P, SDL_KMOD_SHIFT },
/* 81 */ { SDL_SCANCODE_Q, SDL_KMOD_SHIFT },
/* 82 */ { SDL_SCANCODE_R, SDL_KMOD_SHIFT },
/* 83 */ { SDL_SCANCODE_S, SDL_KMOD_SHIFT },
/* 84 */ { SDL_SCANCODE_T, SDL_KMOD_SHIFT },
/* 85 */ { SDL_SCANCODE_U, SDL_KMOD_SHIFT },
/* 86 */ { SDL_SCANCODE_V, SDL_KMOD_SHIFT },
/* 87 */ { SDL_SCANCODE_W, SDL_KMOD_SHIFT },
/* 88 */ { SDL_SCANCODE_X, SDL_KMOD_SHIFT },
/* 89 */ { SDL_SCANCODE_Y, SDL_KMOD_SHIFT },
/* 90 */ { SDL_SCANCODE_Z, SDL_KMOD_SHIFT },
/* 91 */ { SDL_SCANCODE_LEFTBRACKET, 0 },
/* 92 */ { SDL_SCANCODE_BACKSLASH, 0 },
/* 93 */ { SDL_SCANCODE_RIGHTBRACKET, 0 },
/* 94 */ { SDL_SCANCODE_6, KMOD_SHIFT }, /* plus shift modifier '^' */
/* 95 */ { SDL_SCANCODE_MINUS, KMOD_SHIFT }, /* plus shift modifier '_' */
/* 96 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* '`' */
/* 94 */ { SDL_SCANCODE_6, SDL_KMOD_SHIFT }, /* plus shift modifier '^' */
/* 95 */ { SDL_SCANCODE_MINUS, SDL_KMOD_SHIFT }, /* plus shift modifier '_' */
/* 96 */ { SDL_SCANCODE_GRAVE, SDL_KMOD_SHIFT }, /* '`' */
/* 97 */ { SDL_SCANCODE_A, 0 },
/* 98 */ { SDL_SCANCODE_B, 0 },
/* 99 */ { SDL_SCANCODE_C, 0 },
@ -157,11 +157,11 @@ static ASCIIKeyInfo SDL_ASCIIKeyInfoTable[] = {
/* 120 */ { SDL_SCANCODE_X, 0 },
/* 121 */ { SDL_SCANCODE_Y, 0 },
/* 122 */ { SDL_SCANCODE_Z, 0 },
/* 123 */ { SDL_SCANCODE_LEFTBRACKET, KMOD_SHIFT }, /* plus shift modifier '{' */
/* 124 */ { SDL_SCANCODE_BACKSLASH, KMOD_SHIFT }, /* plus shift modifier '|' */
/* 125 */ { SDL_SCANCODE_RIGHTBRACKET, KMOD_SHIFT }, /* plus shift modifier '}' */
/* 126 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* plus shift modifier '~' */
/* 127 */ { SDL_SCANCODE_BACKSPACE, KMOD_SHIFT }
/* 123 */ { SDL_SCANCODE_LEFTBRACKET, SDL_KMOD_SHIFT }, /* plus shift modifier '{' */
/* 124 */ { SDL_SCANCODE_BACKSLASH, SDL_KMOD_SHIFT }, /* plus shift modifier '|' */
/* 125 */ { SDL_SCANCODE_RIGHTBRACKET, SDL_KMOD_SHIFT }, /* plus shift modifier '}' */
/* 126 */ { SDL_SCANCODE_GRAVE, SDL_KMOD_SHIFT }, /* plus shift modifier '~' */
/* 127 */ { SDL_SCANCODE_BACKSPACE, SDL_KMOD_SHIFT }
};
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1797,9 +1797,9 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
break;
case SDL_KEYDOWN:
{
SDL_bool withControl = !!(event->key.keysym.mod & KMOD_CTRL);
SDL_bool withShift = !!(event->key.keysym.mod & KMOD_SHIFT);
SDL_bool withAlt = !!(event->key.keysym.mod & KMOD_ALT);
SDL_bool withControl = !!(event->key.keysym.mod & SDL_KMOD_CTRL);
SDL_bool withShift = !!(event->key.keysym.mod & SDL_KMOD_SHIFT);
SDL_bool withAlt = !!(event->key.keysym.mod & SDL_KMOD_ALT);
switch (event->key.keysym.sym) {
/* Add hotkeys here */

View File

@ -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)

View File

@ -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);

View File

@ -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, &regs, &regs);
driverdata->last_mouse_buttons = regs.r[2];

View File

@ -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. */

View File

@ -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 {

View File

@ -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)

View File

@ -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);

View File

@ -67,40 +67,40 @@ print_modifiers(char **text, size_t *maxlen)
print_string(text, maxlen, " (none)");
return;
}
if (mod & KMOD_LSHIFT) {
if (mod & SDL_KMOD_LSHIFT) {
print_string(text, maxlen, " LSHIFT");
}
if (mod & KMOD_RSHIFT) {
if (mod & SDL_KMOD_RSHIFT) {
print_string(text, maxlen, " RSHIFT");
}
if (mod & KMOD_LCTRL) {
if (mod & SDL_KMOD_LCTRL) {
print_string(text, maxlen, " LCTRL");
}
if (mod & KMOD_RCTRL) {
if (mod & SDL_KMOD_RCTRL) {
print_string(text, maxlen, " RCTRL");
}
if (mod & KMOD_LALT) {
if (mod & SDL_KMOD_LALT) {
print_string(text, maxlen, " LALT");
}
if (mod & KMOD_RALT) {
if (mod & SDL_KMOD_RALT) {
print_string(text, maxlen, " RALT");
}
if (mod & KMOD_LGUI) {
if (mod & SDL_KMOD_LGUI) {
print_string(text, maxlen, " LGUI");
}
if (mod & KMOD_RGUI) {
if (mod & SDL_KMOD_RGUI) {
print_string(text, maxlen, " RGUI");
}
if (mod & KMOD_NUM) {
if (mod & SDL_KMOD_NUM) {
print_string(text, maxlen, " NUM");
}
if (mod & KMOD_CAPS) {
if (mod & SDL_KMOD_CAPS) {
print_string(text, maxlen, " CAPS");
}
if (mod & KMOD_MODE) {
if (mod & SDL_KMOD_MODE) {
print_string(text, maxlen, " MODE");
}
if (mod & KMOD_SCROLL) {
if (mod & SDL_KMOD_SCROLL) {
print_string(text, maxlen, " SCROLL");
}
}

View File

@ -64,40 +64,40 @@ print_modifiers(char **text, size_t *maxlen)
print_string(text, maxlen, " (none)");
return;
}
if (mod & KMOD_LSHIFT) {
if (mod & SDL_KMOD_LSHIFT) {
print_string(text, maxlen, " LSHIFT");
}
if (mod & KMOD_RSHIFT) {
if (mod & SDL_KMOD_RSHIFT) {
print_string(text, maxlen, " RSHIFT");
}
if (mod & KMOD_LCTRL) {
if (mod & SDL_KMOD_LCTRL) {
print_string(text, maxlen, " LCTRL");
}
if (mod & KMOD_RCTRL) {
if (mod & SDL_KMOD_RCTRL) {
print_string(text, maxlen, " RCTRL");
}
if (mod & KMOD_LALT) {
if (mod & SDL_KMOD_LALT) {
print_string(text, maxlen, " LALT");
}
if (mod & KMOD_RALT) {
if (mod & SDL_KMOD_RALT) {
print_string(text, maxlen, " RALT");
}
if (mod & KMOD_LGUI) {
if (mod & SDL_KMOD_LGUI) {
print_string(text, maxlen, " LGUI");
}
if (mod & KMOD_RGUI) {
if (mod & SDL_KMOD_RGUI) {
print_string(text, maxlen, " RGUI");
}
if (mod & KMOD_NUM) {
if (mod & SDL_KMOD_NUM) {
print_string(text, maxlen, " NUM");
}
if (mod & KMOD_CAPS) {
if (mod & SDL_KMOD_CAPS) {
print_string(text, maxlen, " CAPS");
}
if (mod & KMOD_MODE) {
if (mod & SDL_KMOD_MODE) {
print_string(text, maxlen, " MODE");
}
if (mod & KMOD_SCROLL) {
if (mod & SDL_KMOD_SCROLL) {
print_string(text, maxlen, " SCROLL");
}
}

View File

@ -280,19 +280,19 @@ int keyboard_getSetModState(void *arg)
SDL_Keymod currentState;
SDL_Keymod newState;
SDL_Keymod allStates =
KMOD_NONE |
KMOD_LSHIFT |
KMOD_RSHIFT |
KMOD_LCTRL |
KMOD_RCTRL |
KMOD_LALT |
KMOD_RALT |
KMOD_LGUI |
KMOD_RGUI |
KMOD_NUM |
KMOD_CAPS |
KMOD_MODE |
KMOD_SCROLL;
SDL_KMOD_NONE |
SDL_KMOD_LSHIFT |
SDL_KMOD_RSHIFT |
SDL_KMOD_LCTRL |
SDL_KMOD_RCTRL |
SDL_KMOD_LALT |
SDL_KMOD_RALT |
SDL_KMOD_LGUI |
SDL_KMOD_RGUI |
SDL_KMOD_NUM |
SDL_KMOD_CAPS |
SDL_KMOD_MODE |
SDL_KMOD_SCROLL;
/* Get state, cache for later reset */
result = SDL_GetModState();

View File

@ -356,7 +356,7 @@ static SDL_bool ShowingFront()
}
}
}
if ((SDL_GetModState() & KMOD_SHIFT) != 0) {
if ((SDL_GetModState() & SDL_KMOD_SHIFT) != 0) {
showing_front = SDL_FALSE;
}
return showing_front;

View File

@ -232,7 +232,7 @@ void loop()
case SDL_KEYDOWN:
switch (event.key.keysym.sym) {
case 'l':
if (event.key.keysym.mod & KMOD_SHIFT) {
if (event.key.keysym.mod & SDL_KMOD_SHIFT) {
num_lines = 0;
} else {
add_line(rand() % 640, rand() % 480, rand() % 640,
@ -240,7 +240,7 @@ void loop()
}
break;
case 'r':
if (event.key.keysym.mod & KMOD_SHIFT) {
if (event.key.keysym.mod & SDL_KMOD_SHIFT) {
num_rects = 0;
} else {
add_rect(rand() % 640, rand() % 480, rand() % 640,