annotate src/video/qtopia/SDL_sysevents.cc @ 769:b8d311d90021

Updated copyright information for 2004 (Happy New Year!)
author Sam Lantinga <slouken@libsdl.org>
date Sun, 04 Jan 2004 16:49:27 +0000
parents db0cc6034336
children c9b51268668f
rev   line source
371
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
769
b8d311d90021 Updated copyright information for 2004 (Happy New Year!)
Sam Lantinga <slouken@libsdl.org>
parents: 371
diff changeset
3 Copyright (C) 1997-2004 Sam Lantinga
371
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Library General Public License for more details.
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 #ifdef SAVE_RCSID
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 static char rcsid =
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 "@(#) $Id$";
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #endif
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 #include <qpe/qpeapplication.h>
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #include <stdio.h>
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #include <string.h>
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 #include "SDL_error.h"
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 #include "SDL_events.h"
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 #include "SDL_QWin.h"
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #include "SDL_lowvideo.h"
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 #include "SDL_timer.h"
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 extern "C" {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 #include "SDL_events_c.h"
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 #include "SDL_sysevents.h"
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 #include "SDL_sysevents_c.h"
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 // static SDLKey keymap[128];
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 /* This is special because we know it will be run in a loop in a separate
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 thread. Normally this function should loop as long as there are input
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 states changing, i.e. new events arriving.
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 */
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 void QT_PumpEvents(_THIS)
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 if(!qApp) {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 return;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 // printf("processing events: %p\n", qApp);
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 //qApp->processOneEvent(); // wait for a event
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 qApp->processEvents(); // and process all outstanding ones
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 #if 0
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 BView *view;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 BRect bounds;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 BPoint point;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 uint32 buttons;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 const uint32 button_masks[3] = {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 B_PRIMARY_MOUSE_BUTTON,
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 B_TERTIARY_MOUSE_BUTTON,
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 B_SECONDARY_MOUSE_BUTTON,
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 };
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 unsigned int i, j;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 /* Check out the mouse buttons and position (slight race condition) */
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 if ( SDL_Win->Lock() ) {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 /* Don't do anything if we have no view */
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 view = SDL_Win->View();
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 if ( ! view ) {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 SDL_Win->Unlock();
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 return;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 bounds = view->Bounds();
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 /* Get new input state, if still active */
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 if ( SDL_Win->IsActive() ) {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 key_flip = !key_flip;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 get_key_info(&keyinfo[key_flip]);
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 view->GetMouse(&point, &buttons, true);
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 } else {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 key_flip = key_flip;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 point = last_point;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 buttons = last_buttons;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 SDL_Win->Unlock();
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 } else {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 return;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 /* If our view is active, we'll find key changes here */
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 if ( memcmp(keyinfo[0].key_states, keyinfo[1].key_states, 16) != 0 ) {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 for ( i=0; i<16; ++i ) {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 Uint8 new_state, transition;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 new_state = keyinfo[key_flip].key_states[i];
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 transition = keyinfo[!key_flip].key_states[i] ^
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 keyinfo[ key_flip].key_states[i];
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 for ( j=0; j<8; ++j ) {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 if ( transition&0x80 )
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 QueueKey(i*8+j, new_state&0x80);
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 transition <<= 1;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 new_state <<= 1;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 /* We check keyboard, but not mouse if mouse isn't in window */
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 if ( ! bounds.Contains(point) ) {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 /* Mouse moved outside our view? */
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 if ( SDL_GetAppState() & SDL_APPMOUSEFOCUS ) {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 be_app->SetCursor(B_HAND_CURSOR);
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 return;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 /* Has the mouse moved back into our view? */
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 if ( ! (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 /* Reset the B_HAND_CURSOR to our own */
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 SDL_SetCursor(NULL);
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 /* Check for mouse motion */
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 if ( point != last_point ) {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 int x, y;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 SDL_Win->GetXYOffset(x, y);
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 x = (int)point.x - x;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131 y = (int)point.y - y;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 SDL_PrivateMouseMotion(0, 0, x, y);
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 last_point = point;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 /* Add any mouse button events */
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 for ( i=0; i<SDL_TABLESIZE(button_masks); ++i ) {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 if ( (buttons ^ last_buttons) & button_masks[i] ) {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 if ( buttons & button_masks[i] ) {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 SDL_PrivateMouseButton(SDL_PRESSED, 1+i, 0, 0);
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 } else {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 SDL_PrivateMouseButton(SDL_RELEASED, 1+i, 0, 0);
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 last_buttons = buttons;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 #endif
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 void QT_InitOSKeymap(_THIS)
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 {
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 #if 0
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 unsigned int i;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 /* Initialize all the key states as "up" */
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 key_flip = 0;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157 memset(keyinfo[key_flip].key_states, 0, 16);
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 /* Initialize the key translation table */
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 for ( i=0; i<SDL_TABLESIZE(keymap); ++i )
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 keymap[i] = SDLK_UNKNOWN;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 // keymap[0x01] = SDLK_ESCAPE;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 // keymap[B_F1_KEY] = SDLK_F1;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 // keymap[B_F2_KEY] = SDLK_F2;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 // keymap[B_F3_KEY] = SDLK_F3;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 // keymap[B_F4_KEY] = SDLK_F4;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 // keymap[B_F5_KEY] = SDLK_F5;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 // keymap[B_F6_KEY] = SDLK_F6;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 // keymap[B_F7_KEY] = SDLK_F7;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 // keymap[B_F8_KEY] = SDLK_F8;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 // keymap[B_F9_KEY] = SDLK_F9;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 // keymap[B_F10_KEY] = SDLK_F10;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 // keymap[B_F11_KEY] = SDLK_F11;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 // keymap[B_F12_KEY] = SDLK_F12;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176 // keymap[B_PRINT_KEY] = SDLK_PRINT;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177 //keymap[B_SCROLL_KEY] = SDLK_SCROLLOCK;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 // keymap[B_PAUSE_KEY] = SDLK_PAUSE;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 keymap[0x11] = SDLK_BACKQUOTE;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180 keymap[0x12] = SDLK_1;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181 keymap[0x13] = SDLK_2;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182 keymap[0x14] = SDLK_3;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 keymap[0x15] = SDLK_4;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184 keymap[0x16] = SDLK_5;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
185 keymap[0x17] = SDLK_6;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
186 keymap[0x18] = SDLK_7;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 keymap[0x19] = SDLK_8;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188 keymap[0x1a] = SDLK_9;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 keymap[0x1b] = SDLK_0;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
190 keymap[0x1c] = SDLK_MINUS;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191 keymap[0x1d] = SDLK_EQUALS;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 keymap[0x1e] = SDLK_BACKSPACE;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 keymap[0x1f] = SDLK_INSERT;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194 keymap[0x20] = SDLK_HOME;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 keymap[0x21] = SDLK_PAGEUP;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
196 //keymap[0x22] = SDLK_NUMLOCK;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
197 keymap[0x23] = SDLK_KP_DIVIDE;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198 keymap[0x24] = SDLK_KP_MULTIPLY;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 keymap[0x25] = SDLK_KP_MINUS;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200 keymap[0x26] = SDLK_TAB;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201 keymap[0x27] = SDLK_q;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 keymap[0x28] = SDLK_w;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203 keymap[0x29] = SDLK_e;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 keymap[0x2a] = SDLK_r;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
205 keymap[0x2b] = SDLK_t;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 keymap[0x2c] = SDLK_y;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 keymap[0x2d] = SDLK_u;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208 keymap[0x2e] = SDLK_i;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 keymap[0x2f] = SDLK_o;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210 keymap[0x30] = SDLK_p;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 keymap[0x31] = SDLK_LEFTBRACKET;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 keymap[0x32] = SDLK_RIGHTBRACKET;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213 keymap[0x33] = SDLK_BACKSLASH;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 keymap[0x34] = SDLK_DELETE;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215 keymap[0x35] = SDLK_END;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216 keymap[0x36] = SDLK_PAGEDOWN;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217 keymap[0x37] = SDLK_KP7;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 keymap[0x38] = SDLK_KP8;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219 keymap[0x39] = SDLK_KP9;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
220 keymap[0x3a] = SDLK_KP_PLUS;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221 //keymap[0x3b] = SDLK_CAPSLOCK;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 keymap[0x3c] = SDLK_a;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
223 keymap[0x3d] = SDLK_s;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
224 keymap[0x3e] = SDLK_d;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 keymap[0x3f] = SDLK_f;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
226 keymap[0x40] = SDLK_g;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
227 keymap[0x41] = SDLK_h;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
228 keymap[0x42] = SDLK_j;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229 keymap[0x43] = SDLK_k;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 keymap[0x44] = SDLK_l;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231 keymap[0x45] = SDLK_SEMICOLON;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 keymap[0x46] = SDLK_QUOTE;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233 keymap[0x47] = SDLK_RETURN;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 keymap[0x48] = SDLK_KP4;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235 keymap[0x49] = SDLK_KP5;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 keymap[0x4a] = SDLK_KP6;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237 keymap[0x4b] = SDLK_LSHIFT;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238 keymap[0x4c] = SDLK_z;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
239 keymap[0x4d] = SDLK_x;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240 keymap[0x4e] = SDLK_c;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241 keymap[0x4f] = SDLK_v;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
242 keymap[0x50] = SDLK_b;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243 keymap[0x51] = SDLK_n;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244 keymap[0x52] = SDLK_m;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
245 keymap[0x53] = SDLK_COMMA;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246 keymap[0x54] = SDLK_PERIOD;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247 keymap[0x55] = SDLK_SLASH;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248 keymap[0x56] = SDLK_RSHIFT;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249 keymap[0x57] = SDLK_UP;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
250 keymap[0x58] = SDLK_KP1;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251 keymap[0x59] = SDLK_KP2;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
252 keymap[0x5a] = SDLK_KP3;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253 keymap[0x5b] = SDLK_KP_ENTER;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
254 //keymap[0x5c] = SDLK_LCTRL;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255 //keymap[0x5d] = SDLK_LALT;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
256 keymap[0x5e] = SDLK_SPACE;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
257 //keymap[0x5f] = SDLK_RALT;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
258 //keymap[0x60] = SDLK_RCTRL;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
259 keymap[0x61] = SDLK_LEFT;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
260 keymap[0x62] = SDLK_DOWN;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
261 keymap[0x63] = SDLK_RIGHT;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
262 keymap[0x64] = SDLK_KP0;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
263 keymap[0x65] = SDLK_KP_PERIOD;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
264 //keymap[0x66] = SDLK_LMETA;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265 //keymap[0x67] = SDLK_RMETA;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266 //keymap[0x68] = SDLK_MENU;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
267 keymap[0x69] = SDLK_EURO;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
268 keymap[0x6a] = SDLK_KP_EQUALS;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
269 keymap[0x6b] = SDLK_POWER;
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
270 #endif
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
271 }
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
272
db0cc6034336 Added David Hedbor's Qtopia patches
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
273 }; /* Extern C */