annotate src/events/SDL_keyboard_c.h @ 1735:8dd28c4ef746 SDL-1.3

SDL_Rect now uses int for position and size. Added a few more rectangle functions. Added a dirty rectangle list implementation.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 10 Jul 2006 07:34:50 +0000
parents 6c63fc2bd986
children
rev   line source
1673
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 #include "SDL_config.h"
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #ifndef _SDL_keyboard_c_h
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 #define _SDL_keyboard_c_h
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26
1720
a1ebb17f9c52 Cleaned up a bunch of warnings, started adding Win32 event support
Sam Lantinga <slouken@libsdl.org>
parents: 1674
diff changeset
27 #include "SDL_keysym.h"
a1ebb17f9c52 Cleaned up a bunch of warnings, started adding Win32 event support
Sam Lantinga <slouken@libsdl.org>
parents: 1674
diff changeset
28 #include "SDL_events.h"
a1ebb17f9c52 Cleaned up a bunch of warnings, started adding Win32 event support
Sam Lantinga <slouken@libsdl.org>
parents: 1674
diff changeset
29
1673
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 typedef struct SDL_Keyboard SDL_Keyboard;
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 struct SDL_Keyboard
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 {
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 /* Free the keyboard when it's time */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 void (*FreeKeyboard) (SDL_Keyboard * keyboard);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36
1674
7688a73b25b1 Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents: 1673
diff changeset
37 /* Data common to all keyboards */
7688a73b25b1 Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents: 1673
diff changeset
38 SDL_WindowID focus;
7688a73b25b1 Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents: 1673
diff changeset
39 Uint16 modstate;
1673
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 Uint8 keystate[SDLK_LAST];
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 struct
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 {
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 int firsttime; /* if we check against the delay or repeat value */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 int delay; /* the delay before we start repeating */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 int interval; /* the delay between key repeat events */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 Uint32 timestamp; /* the time the first keydown event occurred */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 SDL_Event evt; /* the event we are supposed to repeat */
1674
7688a73b25b1 Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents: 1673
diff changeset
50 } repeat;
1673
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 void *driverdata;
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 };
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54
1674
7688a73b25b1 Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents: 1673
diff changeset
55 /* Used by the OS keyboard code to detect whether or not to do UNICODE */
7688a73b25b1 Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents: 1673
diff changeset
56 #ifndef DEFAULT_UNICODE_TRANSLATION
7688a73b25b1 Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents: 1673
diff changeset
57 #define DEFAULT_UNICODE_TRANSLATION 0 /* Default off because of overhead */
7688a73b25b1 Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents: 1673
diff changeset
58 #endif
7688a73b25b1 Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents: 1673
diff changeset
59 extern int SDL_TranslateUNICODE;
1673
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 /* Initialize the keyboard subsystem */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 extern int SDL_KeyboardInit(void);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 /* Get the keyboard at an index */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 extern SDL_Keyboard *SDL_GetKeyboard(int index);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 /* Add a keyboard, possibly reattaching at a particular index (or -1),
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 returning the index of the keyboard, or -1 if there was an error.
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 extern int SDL_AddKeyboard(const SDL_Keyboard * keyboard, int index);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 /* Remove a keyboard at an index, clearing the slot for later */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 extern void SDL_DelKeyboard(int index);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 /* Clear the state of a keyboard at an index */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 extern void SDL_ResetKeyboard(int index);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1720
diff changeset
78 /* Set the keyboard focus window */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1720
diff changeset
79 extern void SDL_SetKeyboardFocus(int index, SDL_WindowID windowID);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1720
diff changeset
80
1673
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 /* Send a keyboard event for a keyboard at an index */
1724
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1720
diff changeset
82 extern int SDL_SendKeyboardKey(int index, Uint8 state, Uint8 scancode,
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1720
diff changeset
83 SDLKey key);
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1720
diff changeset
84
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1720
diff changeset
85 /* Send keyboard text input for a keyboard at an index */
6c63fc2bd986 Proof of concept done - Win32 GDI implementation mostly complete.
Sam Lantinga <slouken@libsdl.org>
parents: 1720
diff changeset
86 extern int SDL_SendKeyboardText(int index, const char *text);
1674
7688a73b25b1 Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents: 1673
diff changeset
87
7688a73b25b1 Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents: 1673
diff changeset
88 /* Used by the event loop to queue pending keyboard repeat events */
7688a73b25b1 Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents: 1673
diff changeset
89 extern void SDL_CheckKeyRepeat(void);
1673
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 /* Shutdown the keyboard subsystem */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 extern void SDL_KeyboardQuit(void);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 #endif /* _SDL_keyboard_c_h */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 /* vi: set ts=4 sw=4 expandtab: */