Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
acee78a1
Commit
acee78a1
authored
Feb 07, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed SDL_Key to SDL_Keycode to clarify terminology.
parent
cc52151b
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
34 additions
and
34 deletions
+34
-34
SDL_compat.h
include/SDL_compat.h
+2
-2
SDL_keyboard.h
include/SDL_keyboard.h
+7
-7
SDL_keysym.h
include/SDL_keysym.h
+2
-2
SDL_keyboard.c
src/events/SDL_keyboard.c
+9
-9
SDL_keyboard_c.h
src/events/SDL_keyboard_c.h
+2
-2
scancodes_linux.h
src/events/scancodes_linux.h
+1
-1
SDL_androidkeyboard.c
src/video/android/SDL_androidkeyboard.c
+1
-1
SDL_BWin.h
src/video/bwindow/SDL_BWin.h
+1
-1
SDL_cocoakeyboard.m
src/video/cocoa/SDL_cocoakeyboard.m
+1
-1
SDL_DirectFB_events.c
src/video/directfb/SDL_DirectFB_events.c
+1
-1
SDL_windowskeyboard.c
src/video/windows/SDL_windowskeyboard.c
+1
-1
SDL_x11keyboard.c
src/video/x11/SDL_x11keyboard.c
+6
-6
No files found.
include/SDL_compat.h
View file @
acee78a1
...
...
@@ -219,8 +219,8 @@ struct SDL_SysWMinfo;
#define SDL_KeySym SDL_Keysym
#define SDL_scancode SDL_Scancode
#define SDL_ScanCode SDL_Scancode
#define SDLKey SDL_Key
#define SDLMod SDL_
M
od
#define SDLKey SDL_Key
code
#define SDLMod SDL_
Keym
od
/**
* \name Renamed keys
...
...
include/SDL_keyboard.h
View file @
acee78a1
...
...
@@ -48,7 +48,7 @@ extern "C" {
typedef
struct
SDL_Keysym
{
SDL_Scancode
scancode
;
/**< SDL physical key code - see ::SDL_Scancode for details */
SDL_Key
sym
;
/**< SDL virtual key code - see ::SDL_Key
for details */
SDL_Key
code
sym
;
/**< SDL virtual key code - see ::SDL_Keycode
for details */
Uint16
mod
;
/**< current key modifiers */
Uint32
unicode
;
/**< \deprecated use SDL_TextInputEvent instead */
}
SDL_Keysym
;
...
...
@@ -80,24 +80,24 @@ extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
/**
* \brief Get the current key modifier state for the keyboard.
*/
extern
DECLSPEC
SDL_
M
od
SDLCALL
SDL_GetModState
(
void
);
extern
DECLSPEC
SDL_
Keym
od
SDLCALL
SDL_GetModState
(
void
);
/**
* \brief Set the current key modifier state for the keyboard.
*
* \note This does not change the keyboard state, only the key modifier flags.
*/
extern
DECLSPEC
void
SDLCALL
SDL_SetModState
(
SDL_
M
od
modstate
);
extern
DECLSPEC
void
SDLCALL
SDL_SetModState
(
SDL_
Keym
od
modstate
);
/**
* \brief Get the key code corresponding to the given scancode according
* to the current keyboard layout.
*
* See ::SDL_Key for details.
* See ::SDL_Key
code
for details.
*
* \sa SDL_GetKeyName()
*/
extern
DECLSPEC
SDL_Key
SDLCALL
SDL_GetKeyFromScancode
(
SDL_Scancode
scancode
);
extern
DECLSPEC
SDL_Key
code
SDLCALL
SDL_GetKeyFromScancode
(
SDL_Scancode
scancode
);
/**
* \brief Get the scancode corresponding to the given key code according to the
...
...
@@ -107,7 +107,7 @@ extern DECLSPEC SDL_Key SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
*
* \sa SDL_GetScancodeName()
*/
extern
DECLSPEC
SDL_Scancode
SDLCALL
SDL_GetScancodeFromKey
(
SDL_Key
key
);
extern
DECLSPEC
SDL_Scancode
SDLCALL
SDL_GetScancodeFromKey
(
SDL_Key
code
key
);
/**
* \brief Get a human-readable name for a scancode.
...
...
@@ -132,7 +132,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode
*
* \sa SDL_Key
*/
extern
DECLSPEC
const
char
*
SDLCALL
SDL_GetKeyName
(
SDL_Key
key
);
extern
DECLSPEC
const
char
*
SDLCALL
SDL_GetKeyName
(
SDL_Key
code
key
);
/**
* \brief Start accepting Unicode text input events.
...
...
include/SDL_keysym.h
View file @
acee78a1
...
...
@@ -40,7 +40,7 @@
* the unmodified character that would be generated by pressing the key, or
* an SDLK_* constant for those keys that do not generate characters.
*/
typedef
Sint32
SDL_Key
;
typedef
Sint32
SDL_Key
code
;
#define SDLK_SCANCODE_MASK (1<<30)
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
...
...
@@ -330,7 +330,7 @@ typedef enum
KMOD_CAPS
=
0x2000
,
KMOD_MODE
=
0x4000
,
KMOD_RESERVED
=
0x8000
}
SDL_
M
od
;
}
SDL_
Keym
od
;
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
...
...
src/events/SDL_keyboard.c
View file @
acee78a1
...
...
@@ -39,12 +39,12 @@ struct SDL_Keyboard
SDL_Window
*
focus
;
Uint16
modstate
;
Uint8
keystate
[
SDL_NUM_SCANCODES
];
SDL_Key
keymap
[
SDL_NUM_SCANCODES
];
SDL_Key
code
keymap
[
SDL_NUM_SCANCODES
];
};
static
SDL_Keyboard
SDL_keyboard
;
static
const
SDL_Key
SDL_default_keymap
[
SDL_NUM_SCANCODES
]
=
{
static
const
SDL_Key
code
SDL_default_keymap
[
SDL_NUM_SCANCODES
]
=
{
0
,
0
,
0
,
0
,
'a'
,
'b'
,
...
...
@@ -572,13 +572,13 @@ SDL_ResetKeyboard(void)
}
void
SDL_GetDefaultKeymap
(
SDL_Key
*
keymap
)
SDL_GetDefaultKeymap
(
SDL_Key
code
*
keymap
)
{
SDL_memcpy
(
keymap
,
SDL_default_keymap
,
sizeof
(
SDL_default_keymap
));
}
void
SDL_SetKeymap
(
int
start
,
SDL_Key
*
keys
,
int
length
)
SDL_SetKeymap
(
int
start
,
SDL_Key
code
*
keys
,
int
length
)
{
SDL_Keyboard
*
keyboard
=
&
SDL_keyboard
;
...
...
@@ -832,7 +832,7 @@ SDL_GetKeyboardState(int *numkeys)
return
keyboard
->
keystate
;
}
SDL_
M
od
SDL_
Keym
od
SDL_GetModState
(
void
)
{
SDL_Keyboard
*
keyboard
=
&
SDL_keyboard
;
...
...
@@ -841,14 +841,14 @@ SDL_GetModState(void)
}
void
SDL_SetModState
(
SDL_
M
od
modstate
)
SDL_SetModState
(
SDL_
Keym
od
modstate
)
{
SDL_Keyboard
*
keyboard
=
&
SDL_keyboard
;
keyboard
->
modstate
=
modstate
;
}
SDL_Key
SDL_Key
code
SDL_GetKeyFromScancode
(
SDL_Scancode
scancode
)
{
SDL_Keyboard
*
keyboard
=
&
SDL_keyboard
;
...
...
@@ -857,7 +857,7 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode)
}
SDL_Scancode
SDL_GetScancodeFromKey
(
SDL_Key
key
)
SDL_GetScancodeFromKey
(
SDL_Key
code
key
)
{
SDL_Keyboard
*
keyboard
=
&
SDL_keyboard
;
SDL_Scancode
scancode
;
...
...
@@ -883,7 +883,7 @@ SDL_GetScancodeName(SDL_Scancode scancode)
}
const
char
*
SDL_GetKeyName
(
SDL_Key
key
)
SDL_GetKeyName
(
SDL_Key
code
key
)
{
static
char
name
[
8
];
char
*
end
;
...
...
src/events/SDL_keyboard_c.h
View file @
acee78a1
...
...
@@ -34,10 +34,10 @@ extern int SDL_KeyboardInit(void);
extern
void
SDL_ResetKeyboard
(
void
);
/* Get the default keymap */
extern
void
SDL_GetDefaultKeymap
(
SDL_Key
*
keymap
);
extern
void
SDL_GetDefaultKeymap
(
SDL_Key
code
*
keymap
);
/* Set the mapping of scancode to key codes */
extern
void
SDL_SetKeymap
(
int
start
,
SDL_Key
*
keys
,
int
length
);
extern
void
SDL_SetKeymap
(
int
start
,
SDL_Key
code
*
keys
,
int
length
);
/* Set a platform-dependent key name, overriding the default platform-agnostic
name. Encoded as UTF-8. The string is not copied, thus the pointer given to
...
...
src/events/scancodes_linux.h
View file @
acee78a1
...
...
@@ -21,7 +21,7 @@
*/
#include "../../include/SDL_scancode.h"
/* Linux virtual key code to SDL_Key mapping table
/* Linux virtual key code to SDL_Key
code
mapping table
Sources:
- Linux kernel source input.h
*/
...
...
src/video/android/SDL_androidkeyboard.c
View file @
acee78a1
...
...
@@ -30,7 +30,7 @@
void
Android_InitKeyboard
()
{
SDL_Key
keymap
[
SDL_NUM_SCANCODES
];
SDL_Key
code
keymap
[
SDL_NUM_SCANCODES
];
/* Add default scancode to key mapping */
SDL_GetDefaultKeymap
(
keymap
);
...
...
src/video/bwindow/SDL_BWin.h
View file @
acee78a1
...
...
@@ -586,7 +586,7 @@ class SDL_BWin:public BDirectWindow
bool
inhibit_resize
;
int32
last_buttons
;
SDL_Key
keymap
[
128
];
SDL_Key
code
keymap
[
128
];
};
#endif
/* _SDL_BWin_h */
...
...
src/video/cocoa/SDL_cocoakeyboard.m
View file @
acee78a1
...
...
@@ -490,7 +490,7 @@ UpdateKeymap(SDL_VideoData *data)
const
void
*
chr_data
;
int
i
;
SDL_Scancode
scancode
;
SDL_Key
keymap
[
SDL_NUM_SCANCODES
];
SDL_Key
code
keymap
[
SDL_NUM_SCANCODES
];
/* See if the keymap needs to be updated */
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
...
...
src/video/directfb/SDL_DirectFB_events.c
View file @
acee78a1
...
...
@@ -659,7 +659,7 @@ EnumKeyboards(DFBInputDeviceID device_id,
#if USE_MULTI_API
SDL_Keyboard
keyboard
;
#endif
SDL_Key
keymap
[
SDL_NUM_SCANCODES
];
SDL_Key
code
keymap
[
SDL_NUM_SCANCODES
];
if
(
!
cb
->
sys_kbd
)
{
if
(
cb
->
sys_ids
)
{
...
...
src/video/windows/SDL_windowskeyboard.c
View file @
acee78a1
...
...
@@ -151,7 +151,7 @@ WIN_UpdateKeymap()
{
int
i
;
SDL_Scancode
scancode
;
SDL_Key
keymap
[
SDL_NUM_SCANCODES
];
SDL_Key
code
keymap
[
SDL_NUM_SCANCODES
];
SDL_GetDefaultKeymap
(
keymap
);
...
...
src/video/x11/SDL_x11keyboard.c
View file @
acee78a1
...
...
@@ -34,7 +34,7 @@
/* *INDENT-OFF* */
static
const
struct
{
KeySym
keysym
;
SDL_Key
sdlkey
;
SDL_Key
code
sdlkey
;
}
KeySymToSDLKey
[]
=
{
{
XK_Return
,
SDLK_RETURN
},
{
XK_Escape
,
SDLK_ESCAPE
},
...
...
@@ -143,7 +143,7 @@ static const struct
};
/* *INDENT-OFF* */
static
SDL_Key
static
SDL_Key
code
X11_KeyCodeToSDLKey
(
Display
*
display
,
KeyCode
keycode
)
{
KeySym
keysym
;
...
...
@@ -157,7 +157,7 @@ X11_KeyCodeToSDLKey(Display *display, KeyCode keycode)
ucs4
=
X11_KeySymToUcs4
(
keysym
);
if
(
ucs4
)
{
return
(
SDL_Key
)
ucs4
;
return
(
SDL_Key
code
)
ucs4
;
}
for
(
i
=
0
;
i
<
SDL_arraysize
(
KeySymToSDLKey
);
++
i
)
{
...
...
@@ -222,7 +222,7 @@ X11_InitKeyboard(_THIS)
}
if
(
!
fingerprint_detected
)
{
SDL_Key
keymap
[
SDL_NUM_SCANCODES
];
SDL_Key
code
keymap
[
SDL_NUM_SCANCODES
];
printf
(
"Keyboard layout unknown, please send the following to the SDL mailing list (sdl@libsdl.org):
\n
"
);
...
...
@@ -233,7 +233,7 @@ X11_InitKeyboard(_THIS)
KeySym
sym
;
sym
=
XKeycodeToKeysym
(
data
->
display
,
i
,
0
);
if
(
sym
!=
NoSymbol
)
{
SDL_Key
key
;
SDL_Key
code
key
;
printf
(
"code = %d, sym = 0x%X (%s) "
,
i
-
min_keycode
,
(
unsigned
int
)
sym
,
XKeysymToString
(
sym
));
key
=
X11_KeyCodeToSDLKey
(
data
->
display
,
i
);
...
...
@@ -265,7 +265,7 @@ X11_UpdateKeymap(_THIS)
SDL_VideoData
*
data
=
(
SDL_VideoData
*
)
_this
->
driverdata
;
int
i
;
SDL_Scancode
scancode
;
SDL_Key
keymap
[
SDL_NUM_SCANCODES
];
SDL_Key
code
keymap
[
SDL_NUM_SCANCODES
];
SDL_zero
(
keymap
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment