zenilib: zenilib/jni/external/sdl/src/events/SDL_keyboard.c File Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Typedefs | Functions | Variables
SDL_keyboard.c File Reference
`#include "SDL_config.h"`
`#include "SDL_timer.h"`
`#include "SDL_events.h"`
`#include "SDL_events_c.h"`
`#include "../video/SDL_sysvideo.h"`

Go to the source code of this file.

## Typedefs

typedef struct SDL_Keyboard | SDL_Keyboard

## Functions

void | SDL_GetDefaultKeymap (SDL_Keycode *keymap)
SDL_Window * | SDL_GetKeyboardFocus (void)
| Get the window which currently has keyboard focus. More...
const Uint8 * | SDL_GetKeyboardState (int *numkeys)
| Get a snapshot of the current state of the keyboard. More...
SDL_Keycode | SDL_GetKeyFromName (const char *name)
| Get a key code from a human-readable name. More...
SDL_Keycode | SDL_GetKeyFromScancode (SDL_Scancode scancode)
| Get the key code corresponding to the given scancode according to the current keyboard layout. More...
const char * | SDL_GetKeyName (SDL_Keycode key)
| Get a human-readable name for a key. More...
SDL_Keymod | SDL_GetModState (void)
| Get the current key modifier state for the keyboard. More...
SDL_Scancode | SDL_GetScancodeFromKey (SDL_Keycode key)
| Get the scancode corresponding to the given key code according to the current keyboard layout. More...
SDL_Scancode | SDL_GetScancodeFromName (const char *name)
| Get a scancode from a human-readable name. More...
const char * | SDL_GetScancodeName (SDL_Scancode scancode)
| Get a human-readable name for a scancode. More...
int | SDL_KeyboardInit (void)
void | SDL_KeyboardQuit (void)
void | SDL_ResetKeyboard (void)
int | SDL_SendEditingText (const char *text, int start, int length)
int | SDL_SendKeyboardKey (Uint8 state, SDL_Scancode scancode)
int | SDL_SendKeyboardText (const char *text)
void | SDL_SetKeyboardFocus (SDL_Window *window)
void | SDL_SetKeymap (int start, SDL_Keycode *keys, int length)
void | SDL_SetModState (SDL_Keymod modstate)
| Set the current key modifier state for the keyboard. More...
void | SDL_SetScancodeName (SDL_Scancode scancode, const char *name)
static char * | SDL_UCS4ToUTF8 (Uint32 ch, char *dst)

## Variables

static const SDL_Keycode | SDL_default_keymap [SDL_NUM_SCANCODES]
static SDL_Keyboard | SDL_keyboard
static const char * | SDL_scancode_names [SDL_NUM_SCANCODES]

## Typedef Documentation

typedef struct SDL_Keyboard SDL_Keyboard

Definition at line 35 of file SDL_keyboard.c.

## Function Documentation

void SDL_GetDefaultKeymap | ( | SDL_Keycode * | keymap | ) |

Definition at line 579 of file SDL_keyboard.c.

References SDL_default_keymap, and SDL_memcpy().

SDL_Window* SDL_GetKeyboardFocus | ( | void |  | ) |

Get the window which currently has keyboard focus.

Definition at line 603 of file SDL_keyboard.c.

References SDL_keyboard.

Referenced by SDL_DestroyWindow(), SDL_PrivateJoystickShouldIgnoreEvent(), and SDL_SetRelativeMouseMode().

const Uint8* SDL_GetKeyboardState | ( | int * | numkeys | ) |

Get a snapshot of the current state of the keyboard.

Parameters

  numkeys | if non-NULL, receives the length of the returned array.

Returns
  An array of key states. Indexes into this array are obtained by using SDL_Scancode values.

Example:

* const Uint8 *state = SDL_GetKeyboardState(NULL);
* if ( state[SDL_SCANCODE_RETURN] ) {
* printf("<RETURN> is pressed.\n");
* }
*

Definition at line 832 of file SDL_keyboard.c.

References SDL_keyboard, and SDL_NUM_SCANCODES.

SDL_Keycode SDL_GetKeyFromName | ( | const char * | name | ) |

Get a key code from a human-readable name.

Returns
  key code, or SDLK_UNKNOWN if the name wasn't recognized

See Also
  SDL_Keycode

Definition at line 964 of file SDL_keyboard.c.

References i, NULL, SDL_default_keymap, SDL_GetScancodeFromName(), SDL_strlen(), and SDLK_UNKNOWN.

SDL_Keycode SDL_GetKeyFromScancode | ( | SDL_Scancode | scancode | ) |

Get the key code corresponding to the given scancode according to the current keyboard layout.

See SDL_Keycode for details.

See Also
  SDL_GetKeyName()

Definition at line 859 of file SDL_keyboard.c.

References SDL_InvalidParamError, SDL_keyboard, and SDL_NUM_SCANCODES.

const char* SDL_GetKeyName | ( | SDL_Keycode | key | ) |

Get a human-readable name for a key.

Returns
  A pointer to a UTF-8 string that stays valid at least until the next call to this function. If you need it around any longer, you must copy it. If the key doesn't have a name, this function returns an empty string ("").

See Also
  SDL_Key

Definition at line 925 of file SDL_keyboard.c.

References SDL_GetScancodeName(), SDL_SCANCODE_BACKSPACE, SDL_SCANCODE_DELETE, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_RETURN, SDL_SCANCODE_SPACE, SDL_SCANCODE_TAB, SDL_UCS4ToUTF8(), SDLK_BACKSPACE, SDLK_DELETE, SDLK_ESCAPE, SDLK_RETURN, SDLK_SCANCODE_MASK, SDLK_SPACE, and SDLK_TAB.

Referenced by SDLTest_PrintEvent().

SDL_Keymod SDL_GetModState | ( | void |  | ) |

Get the current key modifier state for the keyboard.

Definition at line 843 of file SDL_keyboard.c.

References SDL_keyboard.

Referenced by Zeni::Game::run().

SDL_Scancode SDL_GetScancodeFromKey | ( | SDL_Keycode | key | ) |

Get the scancode corresponding to the given key code according to the current keyboard layout.

See SDL_Scancode for details.

See Also
  SDL_GetScancodeName()

Definition at line 872 of file SDL_keyboard.c.

References SDL_keyboard, SDL_NUM_SCANCODES, and SDL_SCANCODE_UNKNOWN.

Referenced by PSP_PumpEvents().

SDL_Scancode SDL_GetScancodeFromName | ( | const char * | name | ) |

Get a scancode from a human-readable name.

Returns
  scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized

See Also
  SDL_Scancode

Definition at line 902 of file SDL_keyboard.c.

References i, SDL_arraysize, SDL_InvalidParamError, SDL_scancode_names, SDL_SCANCODE_UNKNOWN, and SDL_strcasecmp().

Referenced by SDL_GetKeyFromName().

const char* SDL_GetScancodeName | ( | SDL_Scancode | scancode | ) |

Get a human-readable name for a scancode.

Returns
  A pointer to the name for the scancode. If the scancode doesn't have a name, this function returns an empty string ("").

See Also
  SDL_Scancode

Definition at line 887 of file SDL_keyboard.c.

References SDL_InvalidParamError, SDL_NUM_SCANCODES, and SDL_scancode_names.

Referenced by SDL_GetKeyName(), SDL_SendKeyboardKey(), and SDLTest_PrintEvent().

int SDL_KeyboardInit | ( | void |  | ) |

Definition at line 553 of file SDL_keyboard.c.

References SDL_default_keymap, SDL_keyboard, and SDL_memcpy().

Referenced by SDL_VideoInit().

void SDL_KeyboardQuit | ( | void |  | ) |

Definition at line 827 of file SDL_keyboard.c.

Referenced by SDL_VideoQuit().

void SDL_ResetKeyboard | ( | void |  | ) |

Definition at line 563 of file SDL_keyboard.c.

References SDL_keyboard, SDL_NUM_SCANCODES, SDL_PRESSED, SDL_RELEASED, and SDL_SendKeyboardKey().

Referenced by SDL_SetKeyboardFocus().

int SDL_SendEditingText | ( | const char * | text,
|  | int | start,
|  | int | length
| ) |  |

Definition at line 807 of file SDL_keyboard.c.

References SDL_Event::edit, SDL_arraysize, SDL_ENABLE, SDL_GetEventState, SDL_keyboard, SDL_PushEvent(), SDL_TEXTEDITING, SDL_utf8strlcpy(), and SDL_TextEditingEvent::text.

int SDL_SendKeyboardKey | ( | Uint8 | state,
|  | SDL_Scancode | scancode
| ) |  |

Definition at line 650 of file SDL_keyboard.c.

References KMOD_CAPS, KMOD_LALT, KMOD_LCTRL, KMOD_LGUI, KMOD_LSHIFT, KMOD_MODE, KMOD_NUM, KMOD_RALT, KMOD_RCTRL, KMOD_RGUI, KMOD_RSHIFT, SDL_ENABLE, SDL_GetEventState, SDL_GetScancodeName(), SDL_keyboard, SDL_KEYDOWN, SDL_KEYUP, SDL_PRESSED, SDL_PushEvent(), SDL_RELEASED, SDL_SCANCODE_CAPSLOCK, SDL_SCANCODE_LALT, SDL_SCANCODE_LCTRL, SDL_SCANCODE_LGUI, SDL_SCANCODE_LSHIFT, SDL_SCANCODE_MODE, SDL_SCANCODE_NUMLOCKCLEAR, SDL_SCANCODE_RALT, SDL_SCANCODE_RCTRL, SDL_SCANCODE_RGUI, and SDL_SCANCODE_RSHIFT.

Referenced by PSP_PumpEvents(), and SDL_ResetKeyboard().

int SDL_SendKeyboardText | ( | const char * | text | ) |

Definition at line 784 of file SDL_keyboard.c.

References SDL_arraysize, SDL_ENABLE, SDL_GetEventState, SDL_keyboard, SDL_PushEvent(), SDL_TEXTINPUT, SDL_utf8strlcpy(), SDL_TextInputEvent::text, and SDL_Event::text.

void SDL_SetKeyboardFocus | ( | SDL_Window * | window | ) |

Definition at line 611 of file SDL_keyboard.c.

References SDL_EventState(), SDL_GetVideoDevice(), SDL_keyboard, SDL_QUERY, SDL_ResetKeyboard(), SDL_SendWindowEvent(), SDL_TEXTINPUT, SDL_WINDOWEVENT_FOCUS_GAINED, SDL_WINDOWEVENT_FOCUS_LOST, SDL_VideoDevice::StartTextInput, and SDL_VideoDevice::StopTextInput.

Referenced by SDL_DestroyWindow().

void SDL_SetKeymap | ( | int | start,
|  | SDL_Keycode * | keys,
|  | int | length
| ) |  |

Definition at line 585 of file SDL_keyboard.c.

References SDL_keyboard, SDL_memcpy(), and SDL_NUM_SCANCODES.

void SDL_SetModState | ( | SDL_Keymod | modstate | ) |

Set the current key modifier state for the keyboard.

Note
  This does not change the keyboard state, only the key modifier flags.

Definition at line 851 of file SDL_keyboard.c.

References SDL_keyboard.

void SDL_SetScancodeName | ( | SDL_Scancode | scancode,
|  | const char * | name
| ) |  |

Definition at line 597 of file SDL_keyboard.c.

References SDL_scancode_names.

static char* SDL_UCS4ToUTF8 | ( | Uint32 | ch,
|  | char * | dst
| ) |  |

static

Definition at line 511 of file SDL_keyboard.c.

Referenced by SDL_GetKeyName().

## Variable Documentation

const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES]

static

Definition at line 48 of file SDL_keyboard.c.

Referenced by SDL_GetDefaultKeymap(), SDL_GetKeyFromName(), and SDL_KeyboardInit().

SDL_Keyboard SDL_keyboard

static

Definition at line 46 of file SDL_keyboard.c.

Referenced by SDL_GetKeyboardFocus(), SDL_GetKeyboardState(), SDL_GetKeyFromScancode(), SDL_GetModState(), SDL_GetScancodeFromKey(), SDL_KeyboardInit(), SDL_ResetKeyboard(), SDL_SendEditingText(), SDL_SendKeyboardKey(), SDL_SendKeyboardText(), SDL_SetKeyboardFocus(), SDL_SetKeymap(), and SDL_SetModState().

const char* SDL_scancode_names[SDL_NUM_SCANCODES]

static

Definition at line 277 of file SDL_keyboard.c.

Referenced by SDL_GetScancodeFromName(), SDL_GetScancodeName(), and SDL_SetScancodeName().