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
76a24d27
Commit
76a24d27
authored
Feb 07, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sheena pointed out that "scancode" and "keysym" are single words and shouldn't be camel-cased.
parent
f0fa63a5
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
76 additions
and
74 deletions
+76
-74
SDL_compat.h
include/SDL_compat.h
+4
-2
SDL_events.h
include/SDL_events.h
+1
-1
SDL_keyboard.h
include/SDL_keyboard.h
+9
-9
SDL_scancode.h
include/SDL_scancode.h
+2
-2
SDL_keyboard.c
src/events/SDL_keyboard.c
+8
-8
SDL_keyboard_c.h
src/events/SDL_keyboard_c.h
+2
-2
scancodes_darwin.h
src/events/scancodes_darwin.h
+1
-1
scancodes_linux.h
src/events/scancodes_linux.h
+1
-1
scancodes_windows.h
src/events/scancodes_windows.h
+1
-1
scancodes_xfree86.h
src/events/scancodes_xfree86.h
+2
-2
SDL_androidkeyboard.c
src/video/android/SDL_androidkeyboard.c
+3
-3
SDL_BWin.h
src/video/bwindow/SDL_BWin.h
+2
-2
SDL_cocoakeyboard.m
src/video/cocoa/SDL_cocoakeyboard.m
+10
-10
SDL_DirectFB_events.c
src/video/directfb/SDL_DirectFB_events.c
+13
-13
SDL_DirectFB_video.h
src/video/directfb/SDL_DirectFB_video.h
+1
-1
SDL_uikitview.m
src/video/uikit/SDL_uikitview.m
+2
-2
keyinfotable.h
src/video/uikit/keyinfotable.h
+2
-2
SDL_windowskeyboard.c
src/video/windows/SDL_windowskeyboard.c
+1
-1
SDL_windowsvideo.h
src/video/windows/SDL_windowsvideo.h
+1
-1
SDL_x11events.c
src/video/x11/SDL_x11events.c
+1
-1
SDL_x11keyboard.c
src/video/x11/SDL_x11keyboard.c
+5
-5
SDL_x11video.h
src/video/x11/SDL_x11video.h
+1
-1
checkkeys.c
test/checkkeys.c
+1
-1
testkeys.c
test/testkeys.c
+1
-1
testwm.c
test/testwm.c
+1
-1
No files found.
include/SDL_compat.h
View file @
76a24d27
...
@@ -215,8 +215,10 @@ struct SDL_SysWMinfo;
...
@@ -215,8 +215,10 @@ struct SDL_SysWMinfo;
*/
*/
/*@{*/
/*@{*/
#define SDL_keysym SDL_KeySym
#define SDL_keysym SDL_Keysym
#define SDL_scancode SDL_ScanCode
#define SDL_KeySym SDL_Keysym
#define SDL_scancode SDL_Scancode
#define SDL_ScanCode SDL_Scancode
/**
/**
* \name Renamed keys
* \name Renamed keys
...
...
include/SDL_events.h
View file @
76a24d27
...
@@ -151,7 +151,7 @@ typedef struct SDL_KeyboardEvent
...
@@ -151,7 +151,7 @@ typedef struct SDL_KeyboardEvent
Uint8
repeat
;
/**< Non-zero if this is a key repeat */
Uint8
repeat
;
/**< Non-zero if this is a key repeat */
Uint8
padding2
;
Uint8
padding2
;
Uint8
padding3
;
Uint8
padding3
;
SDL_Key
S
ym
keysym
;
/**< The key that was pressed or released */
SDL_Key
s
ym
keysym
;
/**< The key that was pressed or released */
}
SDL_KeyboardEvent
;
}
SDL_KeyboardEvent
;
#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
...
...
include/SDL_keyboard.h
View file @
76a24d27
...
@@ -45,13 +45,13 @@ extern "C" {
...
@@ -45,13 +45,13 @@ extern "C" {
/**
/**
* \brief The SDL keysym structure, used in key events.
* \brief The SDL keysym structure, used in key events.
*/
*/
typedef
struct
SDL_Key
S
ym
typedef
struct
SDL_Key
s
ym
{
{
SDL_Scan
Code
scancode
;
/**< SDL physical key code - see ::SDL_ScanC
ode for details */
SDL_Scan
code
scancode
;
/**< SDL physical key code - see ::SDL_Scanc
ode for details */
SDLKey
sym
;
/**< SDL virtual key code - see ::SDLKey for details */
SDLKey
sym
;
/**< SDL virtual key code - see ::SDLKey for details */
Uint16
mod
;
/**< current key modifiers */
Uint16
mod
;
/**< current key modifiers */
Uint32
unicode
;
/**< \deprecated use SDL_TextInputEvent instead */
Uint32
unicode
;
/**< \deprecated use SDL_TextInputEvent instead */
}
SDL_Key
S
ym
;
}
SDL_Key
s
ym
;
/* Function prototypes */
/* Function prototypes */
...
@@ -65,7 +65,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
...
@@ -65,7 +65,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
*
*
* \param numkeys if non-NULL, receives the length of the returned array.
* \param numkeys if non-NULL, receives the length of the returned array.
*
*
* \return An array of key states. Indexes into this array are obtained by using ::SDL_Scan
C
ode values.
* \return An array of key states. Indexes into this array are obtained by using ::SDL_Scan
c
ode values.
*
*
* \b Example:
* \b Example:
* \code
* \code
...
@@ -97,17 +97,17 @@ extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
...
@@ -97,17 +97,17 @@ extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
*
*
* \sa SDL_GetKeyName()
* \sa SDL_GetKeyName()
*/
*/
extern
DECLSPEC
SDLKey
SDLCALL
SDL_GetKeyFromScancode
(
SDL_Scan
C
ode
scancode
);
extern
DECLSPEC
SDLKey
SDLCALL
SDL_GetKeyFromScancode
(
SDL_Scan
c
ode
scancode
);
/**
/**
* \brief Get the scancode corresponding to the given key code according to the
* \brief Get the scancode corresponding to the given key code according to the
* current keyboard layout.
* current keyboard layout.
*
*
* See ::SDL_Scan
C
ode for details.
* See ::SDL_Scan
c
ode for details.
*
*
* \sa SDL_GetScancodeName()
* \sa SDL_GetScancodeName()
*/
*/
extern
DECLSPEC
SDL_Scan
C
ode
SDLCALL
SDL_GetScancodeFromKey
(
SDLKey
key
);
extern
DECLSPEC
SDL_Scan
c
ode
SDLCALL
SDL_GetScancodeFromKey
(
SDLKey
key
);
/**
/**
* \brief Get a human-readable name for a scancode.
* \brief Get a human-readable name for a scancode.
...
@@ -117,9 +117,9 @@ extern DECLSPEC SDL_ScanCode SDLCALL SDL_GetScancodeFromKey(SDLKey key);
...
@@ -117,9 +117,9 @@ extern DECLSPEC SDL_ScanCode SDLCALL SDL_GetScancodeFromKey(SDLKey key);
* copy it. If the scancode doesn't have a name, this function returns
* copy it. If the scancode doesn't have a name, this function returns
* an empty string ("").
* an empty string ("").
*
*
* \sa SDL_Scan
C
ode
* \sa SDL_Scan
c
ode
*/
*/
extern
DECLSPEC
const
char
*
SDLCALL
SDL_GetScancodeName
(
SDL_Scan
C
ode
extern
DECLSPEC
const
char
*
SDLCALL
SDL_GetScancodeName
(
SDL_Scan
c
ode
scancode
);
scancode
);
/**
/**
...
...
include/SDL_scancode.h
View file @
76a24d27
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
* \brief The SDL keyboard scancode representation.
* \brief The SDL keyboard scancode representation.
*
*
* Values of this type are used to represent keyboard keys, among other places
* Values of this type are used to represent keyboard keys, among other places
* in the \link SDL_Key
S
ym::scancode key.keysym.scancode \endlink field of the
* in the \link SDL_Key
s
ym::scancode key.keysym.scancode \endlink field of the
* SDL_Event structure.
* SDL_Event structure.
*
*
* The values in this enumeration are based on the USB usage page standard:
* The values in this enumeration are based on the USB usage page standard:
...
@@ -392,7 +392,7 @@ typedef enum
...
@@ -392,7 +392,7 @@ typedef enum
SDL_NUM_SCANCODES
=
512
/**< not a key, just marks the number of scancodes
SDL_NUM_SCANCODES
=
512
/**< not a key, just marks the number of scancodes
for array bounds */
for array bounds */
}
SDL_Scan
C
ode
;
}
SDL_Scan
c
ode
;
#endif
/* _SDL_scancode_h */
#endif
/* _SDL_scancode_h */
...
...
src/events/SDL_keyboard.c
View file @
76a24d27
...
@@ -562,7 +562,7 @@ void
...
@@ -562,7 +562,7 @@ void
SDL_ResetKeyboard
(
void
)
SDL_ResetKeyboard
(
void
)
{
{
SDL_Keyboard
*
keyboard
=
&
SDL_keyboard
;
SDL_Keyboard
*
keyboard
=
&
SDL_keyboard
;
SDL_Scan
C
ode
scancode
;
SDL_Scan
c
ode
scancode
;
for
(
scancode
=
0
;
scancode
<
SDL_NUM_SCANCODES
;
++
scancode
)
{
for
(
scancode
=
0
;
scancode
<
SDL_NUM_SCANCODES
;
++
scancode
)
{
if
(
keyboard
->
keystate
[
scancode
]
==
SDL_PRESSED
)
{
if
(
keyboard
->
keystate
[
scancode
]
==
SDL_PRESSED
)
{
...
@@ -590,7 +590,7 @@ SDL_SetKeymap(int start, SDLKey * keys, int length)
...
@@ -590,7 +590,7 @@ SDL_SetKeymap(int start, SDLKey * keys, int length)
}
}
void
void
SDL_SetScancodeName
(
SDL_Scan
C
ode
scancode
,
const
char
*
name
)
SDL_SetScancodeName
(
SDL_Scan
c
ode
scancode
,
const
char
*
name
)
{
{
SDL_scancode_names
[
scancode
]
=
name
;
SDL_scancode_names
[
scancode
]
=
name
;
}
}
...
@@ -638,7 +638,7 @@ SDL_SetKeyboardFocus(SDL_Window * window)
...
@@ -638,7 +638,7 @@ SDL_SetKeyboardFocus(SDL_Window * window)
}
}
int
int
SDL_SendKeyboardKey
(
Uint8
state
,
SDL_Scan
C
ode
scancode
)
SDL_SendKeyboardKey
(
Uint8
state
,
SDL_Scan
c
ode
scancode
)
{
{
SDL_Keyboard
*
keyboard
=
&
SDL_keyboard
;
SDL_Keyboard
*
keyboard
=
&
SDL_keyboard
;
int
posted
;
int
posted
;
...
@@ -849,18 +849,18 @@ SDL_SetModState(SDLMod modstate)
...
@@ -849,18 +849,18 @@ SDL_SetModState(SDLMod modstate)
}
}
SDLKey
SDLKey
SDL_GetKeyFromScancode
(
SDL_Scan
C
ode
scancode
)
SDL_GetKeyFromScancode
(
SDL_Scan
c
ode
scancode
)
{
{
SDL_Keyboard
*
keyboard
=
&
SDL_keyboard
;
SDL_Keyboard
*
keyboard
=
&
SDL_keyboard
;
return
keyboard
->
keymap
[
scancode
];
return
keyboard
->
keymap
[
scancode
];
}
}
SDL_Scan
C
ode
SDL_Scan
c
ode
SDL_GetScancodeFromKey
(
SDLKey
key
)
SDL_GetScancodeFromKey
(
SDLKey
key
)
{
{
SDL_Keyboard
*
keyboard
=
&
SDL_keyboard
;
SDL_Keyboard
*
keyboard
=
&
SDL_keyboard
;
SDL_Scan
C
ode
scancode
;
SDL_Scan
c
ode
scancode
;
for
(
scancode
=
SDL_SCANCODE_UNKNOWN
;
scancode
<
SDL_NUM_SCANCODES
;
for
(
scancode
=
SDL_SCANCODE_UNKNOWN
;
scancode
<
SDL_NUM_SCANCODES
;
++
scancode
)
{
++
scancode
)
{
...
@@ -872,7 +872,7 @@ SDL_GetScancodeFromKey(SDLKey key)
...
@@ -872,7 +872,7 @@ SDL_GetScancodeFromKey(SDLKey key)
}
}
const
char
*
const
char
*
SDL_GetScancodeName
(
SDL_Scan
C
ode
scancode
)
SDL_GetScancodeName
(
SDL_Scan
c
ode
scancode
)
{
{
const
char
*
name
=
SDL_scancode_names
[
scancode
];
const
char
*
name
=
SDL_scancode_names
[
scancode
];
...
@@ -890,7 +890,7 @@ SDL_GetKeyName(SDLKey key)
...
@@ -890,7 +890,7 @@ SDL_GetKeyName(SDLKey key)
if
(
key
&
SDLK_SCANCODE_MASK
)
{
if
(
key
&
SDLK_SCANCODE_MASK
)
{
return
return
SDL_GetScancodeName
((
SDL_Scan
C
ode
)
(
key
&
~
SDLK_SCANCODE_MASK
));
SDL_GetScancodeName
((
SDL_Scan
c
ode
)
(
key
&
~
SDLK_SCANCODE_MASK
));
}
}
switch
(
key
)
{
switch
(
key
)
{
...
...
src/events/SDL_keyboard_c.h
View file @
76a24d27
...
@@ -43,13 +43,13 @@ extern void SDL_SetKeymap(int start, SDLKey * keys, int length);
...
@@ -43,13 +43,13 @@ extern void SDL_SetKeymap(int start, SDLKey * keys, int length);
name. Encoded as UTF-8. The string is not copied, thus the pointer given to
name. Encoded as UTF-8. The string is not copied, thus the pointer given to
this function must stay valid forever (or at least until the call to
this function must stay valid forever (or at least until the call to
VideoQuit()). */
VideoQuit()). */
extern
void
SDL_SetScancodeName
(
SDL_Scan
C
ode
scancode
,
const
char
*
name
);
extern
void
SDL_SetScancodeName
(
SDL_Scan
c
ode
scancode
,
const
char
*
name
);
/* Set the keyboard focus window */
/* Set the keyboard focus window */
extern
void
SDL_SetKeyboardFocus
(
SDL_Window
*
window
);
extern
void
SDL_SetKeyboardFocus
(
SDL_Window
*
window
);
/* Send a keyboard key event */
/* Send a keyboard key event */
extern
int
SDL_SendKeyboardKey
(
Uint8
state
,
SDL_Scan
C
ode
scancode
);
extern
int
SDL_SendKeyboardKey
(
Uint8
state
,
SDL_Scan
c
ode
scancode
);
/* Send keyboard text input */
/* Send keyboard text input */
extern
int
SDL_SendKeyboardText
(
const
char
*
text
);
extern
int
SDL_SendKeyboardText
(
const
char
*
text
);
...
...
src/events/scancodes_darwin.h
View file @
76a24d27
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
- experimentation on various ADB and USB ISO keyboards and one ADB ANSI keyboard
- experimentation on various ADB and USB ISO keyboards and one ADB ANSI keyboard
*/
*/
/* *INDENT-OFF* */
/* *INDENT-OFF* */
static
const
SDL_Scan
C
ode
darwin_scancode_table
[]
=
{
static
const
SDL_Scan
c
ode
darwin_scancode_table
[]
=
{
/* 0 */
SDL_SCANCODE_A
,
/* 0 */
SDL_SCANCODE_A
,
/* 1 */
SDL_SCANCODE_S
,
/* 1 */
SDL_SCANCODE_S
,
/* 2 */
SDL_SCANCODE_D
,
/* 2 */
SDL_SCANCODE_D
,
...
...
src/events/scancodes_linux.h
View file @
76a24d27
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
- Linux kernel source input.h
- Linux kernel source input.h
*/
*/
/* *INDENT-OFF* */
/* *INDENT-OFF* */
static
SDL_Scan
C
ode
const
linux_scancode_table
[]
=
{
static
SDL_Scan
c
ode
const
linux_scancode_table
[]
=
{
/* 0 */
SDL_SCANCODE_UNKNOWN
,
/* 0 */
SDL_SCANCODE_UNKNOWN
,
/* 1 */
SDL_SCANCODE_ESCAPE
,
/* 1 */
SDL_SCANCODE_ESCAPE
,
/* 2 */
SDL_SCANCODE_1
,
/* 2 */
SDL_SCANCODE_1
,
...
...
src/events/scancodes_windows.h
View file @
76a24d27
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
- msdn.microsoft.com
- msdn.microsoft.com
*/
*/
/* *INDENT-OFF* */
/* *INDENT-OFF* */
static
const
SDL_Scan
C
ode
windows_scancode_table
[]
=
{
static
const
SDL_Scan
c
ode
windows_scancode_table
[]
=
{
/* 0, 0x00 */
SDL_SCANCODE_UNKNOWN
,
/* 0, 0x00 */
SDL_SCANCODE_UNKNOWN
,
/* 1, 0x01 */
SDL_SCANCODE_UNKNOWN
,
/* 1, 0x01 */
SDL_SCANCODE_UNKNOWN
,
/* 2, 0x02 */
SDL_SCANCODE_UNKNOWN
,
/* 2, 0x02 */
SDL_SCANCODE_UNKNOWN
,
...
...
src/events/scancodes_xfree86.h
View file @
76a24d27
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
- atKeyNames.h from XFree86 source code
- atKeyNames.h from XFree86 source code
*/
*/
/* *INDENT-OFF* */
/* *INDENT-OFF* */
static
const
SDL_Scan
C
ode
xfree86_scancode_table
[]
=
{
static
const
SDL_Scan
c
ode
xfree86_scancode_table
[]
=
{
/* 0 */
SDL_SCANCODE_UNKNOWN
,
/* 0 */
SDL_SCANCODE_UNKNOWN
,
/* 1 */
SDL_SCANCODE_ESCAPE
,
/* 1 */
SDL_SCANCODE_ESCAPE
,
/* 2 */
SDL_SCANCODE_1
,
/* 2 */
SDL_SCANCODE_1
,
...
@@ -177,7 +177,7 @@ static const SDL_ScanCode xfree86_scancode_table[] = {
...
@@ -177,7 +177,7 @@ static const SDL_ScanCode xfree86_scancode_table[] = {
};
};
/* for wireless usb keyboard (manufacturer TRUST) without numpad. */
/* for wireless usb keyboard (manufacturer TRUST) without numpad. */
static
const
SDL_Scan
C
ode
xfree86_scancode_table2
[]
=
{
static
const
SDL_Scan
c
ode
xfree86_scancode_table2
[]
=
{
/* 0 */
SDL_SCANCODE_UNKNOWN
,
/* 0 */
SDL_SCANCODE_UNKNOWN
,
/* 1 */
SDL_SCANCODE_ESCAPE
,
/* 1 */
SDL_SCANCODE_ESCAPE
,
/* 2 */
SDL_SCANCODE_1
,
/* 2 */
SDL_SCANCODE_1
,
...
...
src/video/android/SDL_androidkeyboard.c
View file @
76a24d27
...
@@ -37,7 +37,7 @@ void Android_InitKeyboard()
...
@@ -37,7 +37,7 @@ void Android_InitKeyboard()
SDL_SetKeymap
(
0
,
keymap
,
SDL_NUM_SCANCODES
);
SDL_SetKeymap
(
0
,
keymap
,
SDL_NUM_SCANCODES
);
}
}
static
SDL_Scan
C
ode
Android_Keycodes
[]
=
{
static
SDL_Scan
c
ode
Android_Keycodes
[]
=
{
SDL_SCANCODE_UNKNOWN
,
/* AKEYCODE_UNKNOWN */
SDL_SCANCODE_UNKNOWN
,
/* AKEYCODE_UNKNOWN */
SDL_SCANCODE_UNKNOWN
,
/* AKEYCODE_SOFT_LEFT */
SDL_SCANCODE_UNKNOWN
,
/* AKEYCODE_SOFT_LEFT */
SDL_SCANCODE_UNKNOWN
,
/* AKEYCODE_SOFT_RIGHT */
SDL_SCANCODE_UNKNOWN
,
/* AKEYCODE_SOFT_RIGHT */
...
@@ -151,10 +151,10 @@ static SDL_ScanCode Android_Keycodes[] = {
...
@@ -151,10 +151,10 @@ static SDL_ScanCode Android_Keycodes[] = {
SDL_SCANCODE_UNKNOWN
,
/* AKEYCODE_BUTTON_MODE */
SDL_SCANCODE_UNKNOWN
,
/* AKEYCODE_BUTTON_MODE */
};
};
static
SDL_Scan
C
ode
static
SDL_Scan
c
ode
TranslateKeycode
(
int
keycode
)
TranslateKeycode
(
int
keycode
)
{
{
SDL_Scan
C
ode
scancode
=
SDL_SCANCODE_UNKNOWN
;
SDL_Scan
c
ode
scancode
=
SDL_SCANCODE_UNKNOWN
;
if
(
keycode
<
SDL_arraysize
(
Android_Keycodes
))
{
if
(
keycode
<
SDL_arraysize
(
Android_Keycodes
))
{
scancode
=
Android_Keycodes
[
keycode
];
scancode
=
Android_Keycodes
[
keycode
];
...
...
src/video/bwindow/SDL_BWin.h
View file @
76a24d27
...
@@ -509,7 +509,7 @@ class SDL_BWin:public BDirectWindow
...
@@ -509,7 +509,7 @@ class SDL_BWin:public BDirectWindow
if
(
msg
->
FindInt32
(
"key"
,
&
key
)
==
B_OK
if
(
msg
->
FindInt32
(
"key"
,
&
key
)
==
B_OK
&&
msg
->
FindInt32
(
"modifiers"
,
&
modifiers
)
==
B_OK
)
{
&&
msg
->
FindInt32
(
"modifiers"
,
&
modifiers
)
==
B_OK
)
{
SDL_Key
S
ym
keysym
;
SDL_Key
s
ym
keysym
;
keysym
.
scancode
=
key
;
keysym
.
scancode
=
key
;
if
((
key
>
0
)
&&
(
key
<
128
))
{
if
((
key
>
0
)
&&
(
key
<
128
))
{
keysym
.
sym
=
keymap
[
key
];
keysym
.
sym
=
keymap
[
key
];
...
@@ -543,7 +543,7 @@ class SDL_BWin:public BDirectWindow
...
@@ -543,7 +543,7 @@ class SDL_BWin:public BDirectWindow
int32
modifiers
;
int32
modifiers
;
if
(
msg
->
FindInt32
(
"key"
,
&
key
)
==
B_OK
if
(
msg
->
FindInt32
(
"key"
,
&
key
)
==
B_OK
&&
msg
->
FindInt32
(
"modifiers"
,
&
modifiers
)
==
B_OK
)
{
&&
msg
->
FindInt32
(
"modifiers"
,
&
modifiers
)
==
B_OK
)
{
SDL_Key
S
ym
keysym
;
SDL_Key
s
ym
keysym
;
keysym
.
scancode
=
key
;
keysym
.
scancode
=
key
;
if
((
key
>
0
)
&&
(
key
<
128
))
{
if
((
key
>
0
)
&&
(
key
<
128
))
{
keysym
.
sym
=
keymap
[
key
];
keysym
.
sym
=
keymap
[
key
];
...
...
src/video/cocoa/SDL_cocoakeyboard.m
View file @
76a24d27
...
@@ -246,7 +246,7 @@ static void
...
@@ -246,7 +246,7 @@ static void
HandleNonDeviceModifier
(
unsigned
int
device_independent_mask
,
HandleNonDeviceModifier
(
unsigned
int
device_independent_mask
,
unsigned
int
oldMods
,
unsigned
int
oldMods
,
unsigned
int
newMods
,
unsigned
int
newMods
,
SDL_Scan
C
ode
scancode
)
SDL_Scan
c
ode
scancode
)
{
{
unsigned
int
oldMask
,
newMask
;
unsigned
int
oldMask
,
newMask
;
...
@@ -268,7 +268,7 @@ HandleNonDeviceModifier(unsigned int device_independent_mask,
...
@@ -268,7 +268,7 @@ HandleNonDeviceModifier(unsigned int device_independent_mask,
*/
*/
static
void
static
void
HandleModifierOneSide
(
unsigned
int
oldMods
,
unsigned
int
newMods
,
HandleModifierOneSide
(
unsigned
int
oldMods
,
unsigned
int
newMods
,
SDL_Scan
C
ode
scancode
,
SDL_Scan
c
ode
scancode
,
unsigned
int
sided_device_dependent_mask
)
unsigned
int
sided_device_dependent_mask
)
{
{
unsigned
int
old_dep_mask
,
new_dep_mask
;
unsigned
int
old_dep_mask
,
new_dep_mask
;
...
@@ -297,8 +297,8 @@ HandleModifierOneSide(unsigned int oldMods, unsigned int newMods,
...
@@ -297,8 +297,8 @@ HandleModifierOneSide(unsigned int oldMods, unsigned int newMods,
static
void
static
void
HandleModifierSide
(
int
device_independent_mask
,
HandleModifierSide
(
int
device_independent_mask
,
unsigned
int
oldMods
,
unsigned
int
newMods
,
unsigned
int
oldMods
,
unsigned
int
newMods
,
SDL_Scan
C
ode
left_scancode
,
SDL_Scan
c
ode
left_scancode
,
SDL_Scan
C
ode
right_scancode
,
SDL_Scan
c
ode
right_scancode
,
unsigned
int
left_device_dependent_mask
,
unsigned
int
left_device_dependent_mask
,
unsigned
int
right_device_dependent_mask
)
unsigned
int
right_device_dependent_mask
)
{
{
...
@@ -341,8 +341,8 @@ HandleModifierSide(int device_independent_mask,
...
@@ -341,8 +341,8 @@ HandleModifierSide(int device_independent_mask,
static
void
static
void
ReleaseModifierSide
(
unsigned
int
device_independent_mask
,
ReleaseModifierSide
(
unsigned
int
device_independent_mask
,
unsigned
int
oldMods
,
unsigned
int
newMods
,
unsigned
int
oldMods
,
unsigned
int
newMods
,
SDL_Scan
C
ode
left_scancode
,
SDL_Scan
c
ode
left_scancode
,
SDL_Scan
C
ode
right_scancode
,
SDL_Scan
c
ode
right_scancode
,
unsigned
int
left_device_dependent_mask
,
unsigned
int
left_device_dependent_mask
,
unsigned
int
right_device_dependent_mask
)
unsigned
int
right_device_dependent_mask
)
{
{
...
@@ -409,13 +409,13 @@ DoSidedModifiers(unsigned short scancode,
...
@@ -409,13 +409,13 @@ DoSidedModifiers(unsigned short scancode,
unsigned
int
oldMods
,
unsigned
int
newMods
)
unsigned
int
oldMods
,
unsigned
int
newMods
)
{
{
/* Set up arrays for the key syms for the left and right side. */
/* Set up arrays for the key syms for the left and right side. */
const
SDL_Scan
C
ode
left_mapping
[]
=
{
const
SDL_Scan
c
ode
left_mapping
[]
=
{
SDL_SCANCODE_LSHIFT
,
SDL_SCANCODE_LSHIFT
,
SDL_SCANCODE_LCTRL
,
SDL_SCANCODE_LCTRL
,
SDL_SCANCODE_LALT
,
SDL_SCANCODE_LALT
,
SDL_SCANCODE_LGUI
SDL_SCANCODE_LGUI
};
};
const
SDL_Scan
C
ode
right_mapping
[]
=
{
const
SDL_Scan
c
ode
right_mapping
[]
=
{
SDL_SCANCODE_RSHIFT
,
SDL_SCANCODE_RSHIFT
,
SDL_SCANCODE_RCTRL
,
SDL_SCANCODE_RCTRL
,
SDL_SCANCODE_RALT
,
SDL_SCANCODE_RALT
,
...
@@ -489,7 +489,7 @@ UpdateKeymap(SDL_VideoData *data)
...
@@ -489,7 +489,7 @@ UpdateKeymap(SDL_VideoData *data)
#endif
#endif
const
void
*
chr_data
;
const
void
*
chr_data
;
int
i
;
int
i
;
SDL_Scan
C
ode
scancode
;
SDL_Scan
c
ode
scancode
;
SDLKey
keymap
[
SDL_NUM_SCANCODES
];
SDLKey
keymap
[
SDL_NUM_SCANCODES
];
/* See if the keymap needs to be updated */
/* See if the keymap needs to be updated */
...
@@ -675,7 +675,7 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event)
...
@@ -675,7 +675,7 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event)
{
{
SDL_VideoData
*
data
=
(
SDL_VideoData
*
)
_this
->
driverdata
;
SDL_VideoData
*
data
=
(
SDL_VideoData
*
)
_this
->
driverdata
;
unsigned
short
scancode
=
[
event
keyCode
];
unsigned
short
scancode
=
[
event
keyCode
];
SDL_Scan
C
ode
code
;
SDL_Scan
c
ode
code
;
#if 0
#if 0
const char *text;
const char *text;
#endif
#endif
...
...
src/video/directfb/SDL_DirectFB_events.c
View file @
76a24d27
...
@@ -61,15 +61,15 @@ struct _cb_data
...
@@ -61,15 +61,15 @@ struct _cb_data
};
};
/* The translation tables from a DirectFB keycode to a SDL keysym */
/* The translation tables from a DirectFB keycode to a SDL keysym */
static
SDL_Scan
C
ode
oskeymap
[
256
];
static
SDL_Scan
c
ode
oskeymap
[
256
];
static
SDL_Key
S
ym
*
DirectFB_TranslateKey
(
_THIS
,
DFBWindowEvent
*
evt
,
static
SDL_Key
s
ym
*
DirectFB_TranslateKey
(
_THIS
,
DFBWindowEvent
*
evt
,
SDL_Key
S
ym
*
keysym
);
SDL_Key
s
ym
*
keysym
);
static
SDL_Key
S
ym
*
DirectFB_TranslateKeyInputEvent
(
_THIS
,
DFBInputEvent
*
evt
,
static
SDL_Key
s
ym
*
DirectFB_TranslateKeyInputEvent
(
_THIS
,
DFBInputEvent
*
evt
,
SDL_Key
S
ym
*
keysym
);
SDL_Key
s
ym
*
keysym
);
static
void
DirectFB_InitOSKeymap
(
_THIS
,
SDL_Scan
C
ode
*
keypmap
,
int
numkeys
);
static
void
DirectFB_InitOSKeymap
(
_THIS
,
SDL_Scan
c
ode
*
keypmap
,
int
numkeys
);
static
int
DirectFB_TranslateButton
(
DFBInputDeviceButtonIdentifier
button
);
static
int
DirectFB_TranslateButton
(
DFBInputDeviceButtonIdentifier
button
);
static
void
UnicodeToUtf8
(
Uint16
w
,
char
*
utf8buf
)
static
void
UnicodeToUtf8
(
Uint16
w
,
char
*
utf8buf
)
...
@@ -176,7 +176,7 @@ ProcessWindowEvent(_THIS, SDL_Window *sdlwin, DFBWindowEvent * evt)
...
@@ -176,7 +176,7 @@ ProcessWindowEvent(_THIS, SDL_Window *sdlwin, DFBWindowEvent * evt)
{
{
SDL_DFB_DEVICEDATA
(
_this
);
SDL_DFB_DEVICEDATA
(
_this
);
SDL_DFB_WINDOWDATA
(
sdlwin
);
SDL_DFB_WINDOWDATA
(
sdlwin
);
SDL_Key
S
ym
keysym
;
SDL_Key
s
ym
keysym
;
char
text
[
SDL_TEXTINPUTEVENT_TEXT_SIZE
];
char
text
[
SDL_TEXTINPUTEVENT_TEXT_SIZE
];
if
(
evt
->
clazz
==
DFEC_WINDOW
)
{
if
(
evt
->
clazz
==
DFEC_WINDOW
)
{
...
@@ -308,7 +308,7 @@ static void
...
@@ -308,7 +308,7 @@ static void
ProcessInputEvent
(
_THIS
,
DFBInputEvent
*
ievt
)
ProcessInputEvent
(
_THIS
,
DFBInputEvent
*
ievt
)
{
{
SDL_DFB_DEVICEDATA
(
_this
);
SDL_DFB_DEVICEDATA
(
_this
);
SDL_Key
S
ym
keysym
;
SDL_Key
s
ym
keysym
;
int
kbd_idx
;
int
kbd_idx
;
char
text
[
SDL_TEXTINPUTEVENT_TEXT_SIZE
];
char
text
[
SDL_TEXTINPUTEVENT_TEXT_SIZE
];
...
@@ -448,7 +448,7 @@ DirectFB_PumpEventsWindow(_THIS)
...
@@ -448,7 +448,7 @@ DirectFB_PumpEventsWindow(_THIS)
}
}
void
void
DirectFB_InitOSKeymap
(
_THIS
,
SDL_Scan
C
ode
*
keymap
,
int
numkeys
)
DirectFB_InitOSKeymap
(
_THIS
,
SDL_Scan
c
ode
*
keymap
,
int
numkeys
)
{
{
int
i
;
int
i
;
...
@@ -575,8 +575,8 @@ DirectFB_InitOSKeymap(_THIS, SDL_ScanCode * keymap, int numkeys)
...
@@ -575,8 +575,8 @@ DirectFB_InitOSKeymap(_THIS, SDL_ScanCode * keymap, int numkeys)
}
}
static
SDL_Key
S
ym
*
static
SDL_Key
s
ym
*
DirectFB_TranslateKey
(
_THIS
,
DFBWindowEvent
*
evt
,
SDL_Key
S
ym
*
keysym
)
DirectFB_TranslateKey
(
_THIS
,
DFBWindowEvent
*
evt
,
SDL_Key
s
ym
*
keysym
)
{
{
SDL_DFB_DEVICEDATA
(
_this
);
SDL_DFB_DEVICEDATA
(
_this
);
int
kbd_idx
=
0
;
/* Window events lag the device source KbdIndex(_this, evt->device_id); */
int
kbd_idx
=
0
;
/* Window events lag the device source KbdIndex(_this, evt->device_id); */
...
@@ -605,9 +605,9 @@ DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt, SDL_KeySym * keysym)
...
@@ -605,9 +605,9 @@ DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt, SDL_KeySym * keysym)
return
keysym
;
return
keysym
;
}
}
static
SDL_Key
S
ym
*
static
SDL_Key
s
ym
*
DirectFB_TranslateKeyInputEvent
(
_THIS
,
DFBInputEvent
*
evt
,
DirectFB_TranslateKeyInputEvent
(
_THIS
,
DFBInputEvent
*
evt
,
SDL_Key
S
ym
*
keysym
)
SDL_Key
s
ym
*
keysym
)
{
{
SDL_DFB_DEVICEDATA
(
_this
);
SDL_DFB_DEVICEDATA
(
_this
);
int
kbd_idx
=
KbdIndex
(
_this
,
evt
->
device_id
);
int
kbd_idx
=
KbdIndex
(
_this
,
evt
->
device_id
);
...
...
src/video/directfb/SDL_DirectFB_video.h
View file @
76a24d27
...
@@ -142,7 +142,7 @@ static inline DFBResult sdl_dfb_check(DFBResult ret, const char *src_file, int s
...
@@ -142,7 +142,7 @@ static inline DFBResult sdl_dfb_check(DFBResult ret, const char *src_file, int s
typedef
struct
_DFB_KeyboardData
DFB_KeyboardData
;
typedef
struct
_DFB_KeyboardData
DFB_KeyboardData
;
struct
_DFB_KeyboardData
struct
_DFB_KeyboardData
{
{
const
SDL_Scan
C
ode
*
map
;
/* keyboard scancode map */
const
SDL_Scan
c
ode
*
map
;
/* keyboard scancode map */
int
map_size
;
/* size of map */
int
map_size
;
/* size of map */
int
map_adjust
;
/* index adjust */
int
map_adjust
;
/* index adjust */
int
is_generic
;
/* generic keyboard */
int
is_generic
;
/* generic keyboard */
...
...
src/video/uikit/SDL_uikitview.m
View file @
76a24d27
...
@@ -267,10 +267,10 @@
...
@@ -267,10 +267,10 @@
unichar
c
=
[
string
characterAtIndex
:
i
];
unichar
c
=
[
string
characterAtIndex
:
i
];
Uint16
mod
=
0
;
Uint16
mod
=
0
;
SDL_Scan
C
ode
code
;
SDL_Scan
c
ode
code
;
if
(
c
<
127
)
{
if
(
c
<
127
)
{
/* figure out the SDL_Scan
C
ode and SDL_keymod for this unichar */
/* figure out the SDL_Scan
c
ode and SDL_keymod for this unichar */
code
=
unicharToUIKeyInfoTable
[
c
].
code
;
code
=
unicharToUIKeyInfoTable
[
c
].
code
;
mod
=
unicharToUIKeyInfoTable
[
c
].
mod
;
mod
=
unicharToUIKeyInfoTable
[
c
].
mod
;
}
}
...
...
src/video/uikit/keyinfotable.h
View file @
76a24d27
...
@@ -27,14 +27,14 @@
...
@@ -27,14 +27,14 @@
/*
/*
This file is used by the keyboard code in SDL_uikitview.m to convert between characters
This file is used by the keyboard code in SDL_uikitview.m to convert between characters
passed in from the iPhone's virtual keyboard, and tuples of SDL_Scan
Codes
and SDL_keymods.
passed in from the iPhone's virtual keyboard, and tuples of SDL_Scan
code
and SDL_keymods.
For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower
For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower
case a.
case a.
*/
*/
typedef
struct
typedef
struct
{
{
SDL_Scan
C
ode
code
;
SDL_Scan
c
ode
code
;
Uint16
mod
;
Uint16
mod
;
}
UIKitKeyInfo
;
}
UIKitKeyInfo
;
...
...
src/video/windows/SDL_windowskeyboard.c
View file @
76a24d27
...
@@ -150,7 +150,7 @@ void
...
@@ -150,7 +150,7 @@ void
WIN_UpdateKeymap
()
WIN_UpdateKeymap
()
{
{
int
i
;
int
i
;
SDL_Scan
C
ode
scancode
;
SDL_Scan
c
ode
scancode
;
SDLKey
keymap
[
SDL_NUM_SCANCODES
];
SDLKey
keymap
[
SDL_NUM_SCANCODES
];
SDL_GetDefaultKeymap
(
keymap
);
SDL_GetDefaultKeymap
(
keymap
);
...
...
src/video/windows/SDL_windowsvideo.h
View file @
76a24d27
...
@@ -123,7 +123,7 @@ typedef struct SDL_VideoData
...
@@ -123,7 +123,7 @@ typedef struct SDL_VideoData
PFCoordTransform
CoordTransform
;
PFCoordTransform
CoordTransform
;
#endif
#endif
const
SDL_Scan
C
ode
*
key_layout
;
const
SDL_Scan
c
ode
*
key_layout
;
DWORD
clipboard_count
;
DWORD
clipboard_count
;
/* Touch input functions */
/* Touch input functions */
...
...
src/video/x11/SDL_x11events.c
View file @
76a24d27
...
@@ -202,7 +202,7 @@ X11_DispatchEvent(_THIS)
...
@@ -202,7 +202,7 @@ X11_DispatchEvent(_THIS)
case
KeyPress
:{
case
KeyPress
:{
KeyCode
keycode
=
xevent
.
xkey
.
keycode
;
KeyCode
keycode
=
xevent
.
xkey
.
keycode
;
KeySym
keysym
=
NoSymbol
;
KeySym
keysym
=
NoSymbol
;
SDL_Scan
C
ode
scancode
;
SDL_Scan
c
ode
scancode
;
char
text
[
SDL_TEXTINPUTEVENT_TEXT_SIZE
];
char
text
[
SDL_TEXTINPUTEVENT_TEXT_SIZE
];
Status
status
=
0
;
Status
status
=
0
;
...
...
src/video/x11/SDL_x11keyboard.c
View file @
76a24d27
...
@@ -134,7 +134,7 @@ static const struct {
...
@@ -134,7 +134,7 @@ static const struct {
static
const
struct
static
const
struct
{
{
const
SDL_Scan
C
ode
const
*
table
;
const
SDL_Scan
c
ode
const
*
table
;
int
table_size
;
int
table_size
;
}
scancode_set
[]
=
{
}
scancode_set
[]
=
{
{
darwin_scancode_table
,
SDL_arraysize
(
darwin_scancode_table
)
},
{
darwin_scancode_table
,
SDL_arraysize
(
darwin_scancode_table
)
},
...
@@ -175,7 +175,7 @@ X11_InitKeyboard(_THIS)
...
@@ -175,7 +175,7 @@ X11_InitKeyboard(_THIS)
int
i
,
j
;
int
i
,
j
;
int
min_keycode
,
max_keycode
;
int
min_keycode
,
max_keycode
;
struct
{
struct
{
SDL_Scan
C
ode
scancode
;
SDL_Scan
c
ode
scancode
;
KeySym
keysym
;
KeySym
keysym
;
int
value
;
int
value
;
}
fingerprint
[]
=
{
}
fingerprint
[]
=
{
...
@@ -215,7 +215,7 @@ X11_InitKeyboard(_THIS)
...
@@ -215,7 +215,7 @@ X11_InitKeyboard(_THIS)
printf
(
"Using scancode set %d, min_keycode = %d, max_keycode = %d, table_size = %d
\n
"
,
i
,
min_keycode
,
max_keycode
,
scancode_set
[
i
].
table_size
);
printf
(
"Using scancode set %d, min_keycode = %d, max_keycode = %d, table_size = %d
\n
"
,
i
,
min_keycode
,
max_keycode
,
scancode_set
[
i
].
table_size
);
#endif
#endif
SDL_memcpy
(
&
data
->
key_layout
[
min_keycode
],
scancode_set
[
i
].
table
,
SDL_memcpy
(
&
data
->
key_layout
[
min_keycode
],
scancode_set
[
i
].
table
,
sizeof
(
SDL_Scan
C
ode
)
*
scancode_set
[
i
].
table_size
);
sizeof
(
SDL_Scan
c
ode
)
*
scancode_set
[
i
].
table_size
);
fingerprint_detected
=
SDL_TRUE
;
fingerprint_detected
=
SDL_TRUE
;
break
;
break
;
}
}
...
@@ -239,7 +239,7 @@ X11_InitKeyboard(_THIS)
...
@@ -239,7 +239,7 @@ X11_InitKeyboard(_THIS)
key
=
X11_KeyCodeToSDLKey
(
data
->
display
,
i
);
key
=
X11_KeyCodeToSDLKey
(
data
->
display
,
i
);
for
(
j
=
0
;
j
<
SDL_arraysize
(
keymap
);
++
j
)
{
for
(
j
=
0
;
j
<
SDL_arraysize
(
keymap
);
++
j
)
{
if
(
keymap
[
j
]
==
key
)
{
if
(
keymap
[
j
]
==
key
)
{
data
->
key_layout
[
i
]
=
(
SDL_Scan
C
ode
)
j
;
data
->
key_layout
[
i
]
=
(
SDL_Scan
c
ode
)
j
;
break
;
break
;
}
}
}
}
...
@@ -264,7 +264,7 @@ X11_UpdateKeymap(_THIS)
...
@@ -264,7 +264,7 @@ X11_UpdateKeymap(_THIS)
{
{
SDL_VideoData
*
data
=
(
SDL_VideoData
*
)
_this
->
driverdata
;
SDL_VideoData
*
data
=
(
SDL_VideoData
*
)
_this
->
driverdata
;
int
i
;
int
i
;
SDL_Scan
C
ode
scancode
;
SDL_Scan
c
ode
scancode
;
SDLKey
keymap
[
SDL_NUM_SCANCODES
];
SDLKey
keymap
[
SDL_NUM_SCANCODES
];
SDL_zero
(
keymap
);
SDL_zero
(
keymap
);
...
...
src/video/x11/SDL_x11video.h
View file @
76a24d27
...
@@ -89,7 +89,7 @@ typedef struct SDL_VideoData
...
@@ -89,7 +89,7 @@ typedef struct SDL_VideoData
Atom
_NET_WM_ICON
;
Atom
_NET_WM_ICON
;
Atom
UTF8_STRING
;
Atom
UTF8_STRING
;
SDL_Scan
C
ode
key_layout
[
256
];
SDL_Scan
c
ode
key_layout
[
256
];
SDL_bool
selection_waiting
;
SDL_bool
selection_waiting
;
}
SDL_VideoData
;
}
SDL_VideoData
;
...
...
test/checkkeys.c
View file @
76a24d27
...
@@ -53,7 +53,7 @@ print_modifiers(void)
...
@@ -53,7 +53,7 @@ print_modifiers(void)
}
}
static
void
static
void
PrintKey
(
SDL_Key
S
ym
*
sym
,
SDL_bool
pressed
,
SDL_bool
repeat
)
PrintKey
(
SDL_Key
s
ym
*
sym
,
SDL_bool
pressed
,
SDL_bool
repeat
)
{
{
/* Print the keycode, name and state */
/* Print the keycode, name and state */
if
(
sym
->
sym
)
{
if
(
sym
->
sym
)
{
...
...
test/testkeys.c
View file @
76a24d27
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
int
int
main
(
int
argc
,
char
*
argv
[])
main
(
int
argc
,
char
*
argv
[])
{
{
SDL_Scan
C
ode
scancode
;
SDL_Scan
c
ode
scancode
;
if
(
SDL_Init
(
SDL_INIT_VIDEO
)
<
0
)
{
if
(
SDL_Init
(
SDL_INIT_VIDEO
)
<
0
)
{
fprintf
(
stderr
,
"Couldn't initialize SDL: %s
\n
"
,
SDL_GetError
());
fprintf
(
stderr
,
"Couldn't initialize SDL: %s
\n
"
,
SDL_GetError
());
...
...
test/testwm.c
View file @
76a24d27
...
@@ -210,7 +210,7 @@ print_modifiers(void)
...
@@ -210,7 +210,7 @@ print_modifiers(void)
printf
(
" MODE"
);
printf
(
" MODE"
);
}
}
static
void
PrintKey
(
const
SDL_Key
S
ym
*
sym
,
int
pressed
)
static
void
PrintKey
(
const
SDL_Key
s
ym
*
sym
,
int
pressed
)
{
{
/* Print the keycode, name and state */
/* Print the keycode, name and state */
if
(
sym
->
sym
)
{
if
(
sym
->
sym
)
{
...
...
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