Mercurial > sdl-ios-xcode
comparison src/video/gem/SDL_gemevents.c @ 2189:f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Fri, 13 Jul 2007 22:55:15 +0000 |
parents | 6fe43f7efd94 |
children | 7e1caa8452f3 |
comparison
equal
deleted
inserted
replaced
2188:0e751c1f83f5 | 2189:f54670a477bb |
---|---|
30 * Olivier Landemarre, Johan Klockars, Xavier Joubert, Claude Attard | 30 * Olivier Landemarre, Johan Klockars, Xavier Joubert, Claude Attard |
31 */ | 31 */ |
32 | 32 |
33 #include <gem.h> | 33 #include <gem.h> |
34 | 34 |
35 #include "../../events/SDL_sysevents.h" | 35 #include "SDL_gemvideo.h" |
36 #include "SDL_gemevents.h" | |
36 #include "../../events/SDL_events_c.h" | 37 #include "../../events/SDL_events_c.h" |
37 #include "SDL_gemvideo.h" | |
38 #include "SDL_gemevents_c.h" | |
39 #include "../ataricommon/SDL_atarikeys.h" /* for keyboard scancodes */ | 38 #include "../ataricommon/SDL_atarikeys.h" /* for keyboard scancodes */ |
40 #include "../ataricommon/SDL_atarievents_c.h" | 39 #include "../ataricommon/SDL_atarievents_c.h" |
41 #include "../ataricommon/SDL_xbiosevents_c.h" | 40 #include "../ataricommon/SDL_xbiosevents_c.h" |
42 #include "../ataricommon/SDL_ataridevmouse_c.h" | 41 #include "../ataricommon/SDL_ataridevmouse_c.h" |
43 | 42 |
53 static void do_mouse(_THIS, short mx, short my, short mb, short ks); | 52 static void do_mouse(_THIS, short mx, short my, short mb, short ks); |
54 | 53 |
55 /* Functions */ | 54 /* Functions */ |
56 | 55 |
57 void | 56 void |
58 GEM_InitOSKeymap(_THIS) | |
59 { | |
60 SDL_memset(gem_currentkeyboard, 0, sizeof(gem_currentkeyboard)); | |
61 SDL_memset(gem_previouskeyboard, 0, sizeof(gem_previouskeyboard)); | |
62 | |
63 /* Mouse init */ | |
64 GEM_mouse_relative = SDL_FALSE; | |
65 | |
66 SDL_Atari_InitInternalKeymap(this); | |
67 } | |
68 | |
69 void | |
70 GEM_PumpEvents(_THIS) | 57 GEM_PumpEvents(_THIS) |
71 { | 58 { |
59 #if 0 | |
72 short mousex, mousey, mouseb, dummy; | 60 short mousex, mousey, mouseb, dummy; |
73 short kstate, prevkc, prevks; | 61 short kstate, prevkc, prevks; |
74 int i; | 62 int i; |
75 SDL_keysym keysym; | 63 SDL_keysym keysym; |
76 | 64 |
86 | 74 |
87 event_mask = MU_MESAG | MU_TIMER | MU_KEYBD; | 75 event_mask = MU_MESAG | MU_TIMER | MU_KEYBD; |
88 if (!GEM_fullscreen && (GEM_handle >= 0)) { | 76 if (!GEM_fullscreen && (GEM_handle >= 0)) { |
89 wind_get(GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2); | 77 wind_get(GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2); |
90 event_mask |= MU_M1; | 78 event_mask |= MU_M1; |
91 if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS)) { | 79 mouse_event = ((SDL_GetAppState() & SDL_APPMOUSEFOCUS) == |
92 mouse_event = MO_LEAVE; | 80 SDL_APPMOUSEFOCUS) ? MO_LEAVE : MO_ENTER; |
93 } else { | |
94 mouse_event = MO_ENTER; | |
95 } | |
96 } | 81 } |
97 | 82 |
98 resultat = evnt_multi(event_mask, | 83 resultat = evnt_multi(event_mask, |
99 0, 0, 0, | 84 0, 0, 0, |
100 mouse_event, x2, y2, w2, h2, | 85 mouse_event, x2, y2, w2, h2, |
118 } | 103 } |
119 | 104 |
120 /* Mouse entering/leaving window */ | 105 /* Mouse entering/leaving window */ |
121 if (resultat & MU_M1) { | 106 if (resultat & MU_M1) { |
122 if (this->input_grab == SDL_GRAB_OFF) { | 107 if (this->input_grab == SDL_GRAB_OFF) { |
123 if (SDL_GetAppState() & SDL_APPMOUSEFOCUS) { | 108 /* Switch mouse focus state */ |
124 SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS); | 109 SDL_PrivateAppActive((mouse_event == MO_ENTER), |
125 } else { | 110 SDL_APPMOUSEFOCUS); |
126 SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS); | 111 } |
127 } | 112 GEM_CheckMouseMode(this); |
128 } | |
129 } | 113 } |
130 | 114 |
131 /* Timer event ? */ | 115 /* Timer event ? */ |
132 if ((resultat & MU_TIMER) || quit) | 116 if ((resultat & MU_TIMER) || quit) |
133 break; | 117 break; |
163 (short) (((unsigned long) window_name) >> 16), | 147 (short) (((unsigned long) window_name) >> 16), |
164 (short) (((unsigned long) window_name) & 0xffff), 0, 0); | 148 (short) (((unsigned long) window_name) & 0xffff), 0, 0); |
165 } | 149 } |
166 GEM_refresh_name = SDL_FALSE; | 150 GEM_refresh_name = SDL_FALSE; |
167 } | 151 } |
152 #endif | |
168 } | 153 } |
169 | 154 |
170 static int | 155 static int |
171 do_messages(_THIS, short *message) | 156 do_messages(_THIS, short *message) |
172 { | 157 { |
173 int quit, posted; | 158 #if 0 |
159 int quit, posted, check_mouse_mode; | |
174 short x2, y2, w2, h2; | 160 short x2, y2, w2, h2; |
175 | 161 |
176 quit = 0; | 162 quit = check_mouse_mode = 0; |
177 switch (message[0]) { | 163 switch (message[0]) { |
178 case WM_CLOSED: | 164 case WM_CLOSED: |
179 case AP_TERM: | 165 case AP_TERM: |
180 posted = SDL_PrivateQuit(); | 166 posted = SDL_PrivateQuit(); |
181 quit = 1; | 167 quit = 1; |
190 case WM_ONTOP: | 176 case WM_ONTOP: |
191 SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS); | 177 SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS); |
192 if (VDI_setpalette) { | 178 if (VDI_setpalette) { |
193 VDI_setpalette(this, VDI_curpalette); | 179 VDI_setpalette(this, VDI_curpalette); |
194 } | 180 } |
181 check_mouse_mode = 1; | |
195 break; | 182 break; |
196 case WM_REDRAW: | 183 case WM_REDRAW: |
197 if (!GEM_lock_redraw) { | 184 if (!GEM_lock_redraw) { |
198 GEM_wind_redraw(this, message[3], &message[4]); | 185 GEM_wind_redraw(this, message[3], &message[4]); |
199 } | 186 } |
213 (short) (((unsigned long) GEM_icon_name) >> 16), | 200 (short) (((unsigned long) GEM_icon_name) >> 16), |
214 (short) (((unsigned long) GEM_icon_name) & 0xffff), | 201 (short) (((unsigned long) GEM_icon_name) & 0xffff), |
215 0, 0); | 202 0, 0); |
216 GEM_refresh_name = SDL_FALSE; | 203 GEM_refresh_name = SDL_FALSE; |
217 } | 204 } |
205 check_mouse_mode = 1; | |
218 break; | 206 break; |
219 case WM_UNICONIFY: | 207 case WM_UNICONIFY: |
220 wind_set(message[3], WF_UNICONIFY, message[4], message[5], | 208 wind_set(message[3], WF_UNICONIFY, message[4], message[5], |
221 message[6], message[7]); | 209 message[6], message[7]); |
222 /* If we're not active, make ourselves active */ | 210 /* If we're not active, make ourselves active */ |
229 (short) (((unsigned long) GEM_title_name) >> 16), | 217 (short) (((unsigned long) GEM_title_name) >> 16), |
230 (short) (((unsigned long) GEM_title_name) & 0xffff), | 218 (short) (((unsigned long) GEM_title_name) & 0xffff), |
231 0, 0); | 219 0, 0); |
232 GEM_refresh_name = SDL_FALSE; | 220 GEM_refresh_name = SDL_FALSE; |
233 } | 221 } |
222 check_mouse_mode = 1; | |
234 break; | 223 break; |
235 case WM_SIZED: | 224 case WM_SIZED: |
236 wind_set(message[3], WF_CURRXYWH, message[4], message[5], | 225 wind_set(message[3], WF_CURRXYWH, message[4], message[5], |
237 message[6], message[7]); | 226 message[6], message[7]); |
238 wind_get(message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2); | 227 wind_get(message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2); |
266 case WM_UNTOPPED: | 255 case WM_UNTOPPED: |
267 SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS); | 256 SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS); |
268 if (VDI_setpalette) { | 257 if (VDI_setpalette) { |
269 VDI_setpalette(this, VDI_oldpalette); | 258 VDI_setpalette(this, VDI_oldpalette); |
270 } | 259 } |
271 break; | 260 check_mouse_mode = 1; |
261 break; | |
262 } | |
263 | |
264 if (check_mouse_mode) { | |
265 GEM_CheckMouseMode(this); | |
272 } | 266 } |
273 | 267 |
274 return quit; | 268 return quit; |
269 #else | |
270 return 0; | |
271 #endif | |
275 } | 272 } |
276 | 273 |
277 static void | 274 static void |
278 do_keyboard(short kc, short ks) | 275 do_keyboard(short kc, short ks) |
279 { | 276 { |
277 #if 0 | |
280 int scancode, asciicode; | 278 int scancode, asciicode; |
281 | 279 |
282 if (kc) { | 280 if (kc) { |
283 scancode = (kc >> 8) & (ATARIBIOS_MAXKEYS - 1); | 281 scancode = (kc >> 8) & (ATARIBIOS_MAXKEYS - 1); |
284 gem_currentkeyboard[scancode] = 0xFF; | 282 gem_currentkeyboard[scancode] = 0xFF; |
291 gem_currentkeyboard[SCANCODE_LEFTSHIFT] = 0xFF; | 289 gem_currentkeyboard[SCANCODE_LEFTSHIFT] = 0xFF; |
292 if (ks & K_CTRL) | 290 if (ks & K_CTRL) |
293 gem_currentkeyboard[SCANCODE_LEFTCONTROL] = 0xFF; | 291 gem_currentkeyboard[SCANCODE_LEFTCONTROL] = 0xFF; |
294 if (ks & K_ALT) | 292 if (ks & K_ALT) |
295 gem_currentkeyboard[SCANCODE_LEFTALT] = 0xFF; | 293 gem_currentkeyboard[SCANCODE_LEFTALT] = 0xFF; |
294 #endif | |
296 } | 295 } |
297 | 296 |
298 static void | 297 static void |
299 do_mouse(_THIS, short mx, short my, short mb, short ks) | 298 do_mouse(_THIS, short mx, short my, short mb, short ks) |
300 { | 299 { |
300 #if 0 | |
301 static short prevmousex = 0, prevmousey = 0, prevmouseb = 0; | 301 static short prevmousex = 0, prevmousey = 0, prevmouseb = 0; |
302 short x2, y2, w2, h2; | 302 short x2, y2, w2, h2; |
303 | 303 |
304 /* Don't return mouse events if out of window */ | 304 /* Don't return mouse events if out of window */ |
305 if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS) == 0) { | 305 if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS) == 0) { |
375 gem_currentkeyboard[SCANCODE_LEFTSHIFT] = 0xFF; | 375 gem_currentkeyboard[SCANCODE_LEFTSHIFT] = 0xFF; |
376 if (ks & K_CTRL) | 376 if (ks & K_CTRL) |
377 gem_currentkeyboard[SCANCODE_LEFTCONTROL] = 0xFF; | 377 gem_currentkeyboard[SCANCODE_LEFTCONTROL] = 0xFF; |
378 if (ks & K_ALT) | 378 if (ks & K_ALT) |
379 gem_currentkeyboard[SCANCODE_LEFTALT] = 0xFF; | 379 gem_currentkeyboard[SCANCODE_LEFTALT] = 0xFF; |
380 #endif | |
380 } | 381 } |
381 | 382 |
382 /* vi: set ts=4 sw=4 expandtab: */ | 383 /* vi: set ts=4 sw=4 expandtab: */ |