Mercurial > sdl-ios-xcode
annotate src/video/maccommon/SDL_macevents.c @ 563:04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Enclosed is a patch that addresses the following:
--Various minor cleanups.
Removed dead/obsolete code, made some style cleanups
--Mouse Events
Now keep track of what button(s) were pressed so we know when to send
the mouse up event. This fixes the case where the mouse is dragged
outside of the game window and released (in which case we want to send
the mouse up event even though the mouse is outside the game window).
--Input Grabbing
Here is my take on the grabbing situation, which is the basis for the
new implementation.
There are 3 grab states, ungrabbed (UG), visible (VG), and invisible
(IG). Both VG and IG keep the mouse constrained to the window and
produce relative motion events. In VG the cursor is visible (duh), in
IG it is not. In VG, absolute motion events also work.
There are 6 actions that can affect grabbing:
1. Set Fullscreen/Window (F/W). In fullscreen, a visible grab should do
nothing. However, a fullscreen visible grab can be treated just like a
windowed visible grab, which is what I have done to help simplify
things.
2. Cursor hide/show (H/S). If the cursor is hidden when grabbing, the
grab is an invisible grab. If the cursor is visible, the grab should
just constrain the mouse to the window.
3. Input grab/ungrab(G/U). If grabbed, the cursor should be confined to
the window as should the keyboard input. On Mac OS X, the keyboard
input is implicitly grabbed by confining the cursor, except for
command-tab which can switch away from the application. Should the
window come to the foreground if the application is deactivated and
grab input is called? This isn't necessary in this implementation
because the grab state will be asserted upon activation.
Using my notation, these are all the cases that need to be handled
(state + action = new state).
UG+U = UG
UG+G = VG or IG, if cursor is visible or not
UG+H = UG
UG+S = UG
VG+U = UG
VG+G = VG
VG+H = IG
VG+S = VG
IG+U = UG
IG+G = IG
IG+H = IG
IG+S = VG
The cases that result in the same state can be ignored in the code,
which cuts it down to just 5 cases.
Another issue is what happens when the app loses/gains input focus from
deactivate/activate or iconify/deiconify. I think that if input focus
is ever lost (outside of SDL's control), the grab state should be
suspended and the cursor should become visible and active again. When
regained, the cursor should reappear in its original location and/or
grab state. This way, when reactivating the cursor is still in the same
position as before so apps shouldn't get confused when the next motion
event comes in. This is what I've done in this patch.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Fri, 27 Dec 2002 20:52:41 +0000 |
parents | f6ffac90895c |
children | b8d311d90021 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
297
f6ffac90895c
Updated copyright information for 2002
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
198
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
28 #include <stdio.h> | |
29 | |
30 #if TARGET_API_MAC_CARBON | |
31 #include <Carbon.h> | |
32 #else | |
33 #include <Script.h> | |
34 #include <LowMem.h> | |
35 #include <Devices.h> | |
36 #include <DiskInit.h> | |
37 #include <ToolUtils.h> | |
38 #endif | |
39 | |
40 #include "SDL_events.h" | |
41 #include "SDL_video.h" | |
42 #include "SDL_error.h" | |
43 #include "SDL_syswm.h" | |
44 #include "SDL_events_c.h" | |
45 #include "SDL_cursor_c.h" | |
46 #include "SDL_sysevents.h" | |
47 #include "SDL_macevents_c.h" | |
48 #include "SDL_mackeys.h" | |
49 #include "SDL_macmouse_c.h" | |
50 | |
51 /* Define this to be able to collapse SDL windows. | |
52 #define USE_APPEARANCE_MANAGER | |
53 */ | |
54 | |
55 /* Macintosh resource constants */ | |
56 #define mApple 128 /* Apple menu resource */ | |
57 #define iAbout 1 /* About menu item */ | |
58 | |
59 /* Functions to handle the About menu */ | |
60 static void Mac_DoAppleMenu(_THIS, long item); | |
61 | |
62 /* The translation table from a macintosh key scancode to a SDL keysym */ | |
63 static SDLKey MAC_keymap[256]; | |
64 static SDL_keysym *TranslateKey(int scancode, int modifiers, | |
65 SDL_keysym *keysym, int pressed); | |
66 | |
67 /* Handle activation and deactivation -- returns whether an event was posted */ | |
68 static int Mac_HandleActivate(int activate) | |
69 { | |
70 if ( activate ) { | |
71 /* Show the current SDL application cursor */ | |
72 SDL_SetCursor(NULL); | |
73 | |
74 /* put our mask back case it changed during context switch */ | |
168
e92aa316c517
Added Max's patches for building MacOS X apps on command line
Sam Lantinga <slouken@libsdl.org>
parents:
155
diff
changeset
|
75 SetEventMask(everyEvent & ~autoKeyMask); |
0 | 76 } else { |
77 #if TARGET_API_MAC_CARBON | |
78 { Cursor cursor; | |
79 SetCursor(GetQDGlobalsArrow(&cursor)); | |
80 } | |
81 #else | |
82 SetCursor(&theQD->arrow); | |
83 #endif | |
84 if ( ! Mac_cursor_showing ) { | |
85 ShowCursor(); | |
86 Mac_cursor_showing = 1; | |
87 } | |
88 } | |
89 return(SDL_PrivateAppActive(activate, SDL_APPINPUTFOCUS)); | |
90 } | |
91 | |
92 static void myGlobalToLocal(_THIS, Point *pt) | |
93 { | |
94 if ( SDL_VideoSurface && !(SDL_VideoSurface->flags&SDL_FULLSCREEN) ) { | |
95 GrafPtr saveport; | |
96 GetPort(&saveport); | |
97 #if TARGET_API_MAC_CARBON | |
98 SetPort(GetWindowPort(SDL_Window)); | |
99 #else | |
100 SetPort(SDL_Window); | |
101 #endif | |
102 GlobalToLocal(pt); | |
103 SetPort(saveport); | |
104 } | |
105 } | |
106 | |
107 /* The main MacOS event handler */ | |
108 static int Mac_HandleEvents(_THIS, int wait4it) | |
109 { | |
155
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
110 static int mouse_button = 1; |
0 | 111 int i; |
112 EventRecord event; | |
113 | |
114 #if TARGET_API_MAC_CARBON | |
115 /* There's no GetOSEvent() in the Carbon API. *sigh* */ | |
116 #define cooperative_multitasking 1 | |
117 #else | |
118 int cooperative_multitasking; | |
119 /* If we're running fullscreen, we can hog the MacOS events, | |
120 otherwise we had better play nicely with the other apps. | |
121 */ | |
122 if ( this->screen && (this->screen->flags & SDL_FULLSCREEN) ) { | |
123 cooperative_multitasking = 0; | |
124 } else { | |
125 cooperative_multitasking = 1; | |
126 } | |
127 #endif | |
128 | |
129 /* If we call WaitNextEvent(), MacOS will check other processes | |
130 * and allow them to run, and perform other high-level processing. | |
131 */ | |
132 if ( cooperative_multitasking || wait4it ) { | |
133 UInt32 wait_time; | |
134 | |
135 /* Are we polling or not? */ | |
136 if ( wait4it ) { | |
137 wait_time = 2147483647; | |
138 } else { | |
139 wait_time = 0; | |
140 } | |
141 WaitNextEvent(everyEvent, &event, wait_time, nil); | |
142 } else { | |
143 #if ! TARGET_API_MAC_CARBON | |
144 GetOSEvent(everyEvent, &event); | |
145 #endif | |
146 } | |
147 | |
148 #if TARGET_API_MAC_CARBON | |
149 /* for some reason, event.where isn't set ? */ | |
150 GetGlobalMouse ( &event.where ); | |
151 #endif | |
155
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
152 |
0 | 153 /* Check for mouse motion */ |
154 if ( (event.where.h != last_where.h) || | |
155 (event.where.v != last_where.v) ) { | |
156 Point pt; | |
157 pt = last_where = event.where; | |
158 myGlobalToLocal(this, &pt); | |
159 SDL_PrivateMouseMotion(0, 0, pt.h, pt.v); | |
160 } | |
161 | |
162 /* Check the current state of the keyboard */ | |
163 if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) { | |
164 KeyMap keys; | |
165 | |
166 /* Check for special non-event keys */ | |
167 if ( event.modifiers != last_mods ) { | |
168 static struct { | |
169 EventModifiers mask; | |
170 SDLKey key; | |
171 } mods[] = { | |
172 { alphaLock, SDLK_CAPSLOCK }, | |
173 #if 0 /* These are handled below in the GetKeys() code */ | |
174 { cmdKey, SDLK_LMETA }, | |
175 { shiftKey, SDLK_LSHIFT }, | |
176 { rightShiftKey, SDLK_RSHIFT }, | |
177 { optionKey, SDLK_LALT }, | |
178 { rightOptionKey, SDLK_RALT }, | |
179 { controlKey, SDLK_LCTRL }, | |
180 { rightControlKey, SDLK_RCTRL }, | |
181 #endif /* 0 */ | |
182 { 0, 0 } | |
183 }; | |
184 SDL_keysym keysym; | |
185 Uint8 mode; | |
186 EventModifiers mod, mask; | |
187 | |
188 | |
189 /* Set up the keyboard event */ | |
190 keysym.scancode = 0; | |
191 keysym.sym = SDLK_UNKNOWN; | |
192 keysym.mod = KMOD_NONE; | |
193 keysym.unicode = 0; | |
194 | |
195 /* See what has changed, and generate events */ | |
196 mod = event.modifiers; | |
197 for ( i=0; mods[i].mask; ++i ) { | |
198 mask = mods[i].mask; | |
199 if ( (mod&mask) != (last_mods&mask) ) { | |
200 keysym.sym = mods[i].key; | |
201 if ( (mod&mask) || | |
202 (mods[i].key == SDLK_CAPSLOCK) ) { | |
203 mode = SDL_PRESSED; | |
204 } else { | |
205 mode = SDL_RELEASED; | |
206 } | |
207 SDL_PrivateKeyboard(mode, &keysym); | |
208 } | |
209 } | |
210 | |
211 /* Save state for next time */ | |
212 last_mods = mod; | |
213 } | |
214 | |
215 /* Check for normal event keys, but we have to scan the | |
216 actual keyboard state because on MacOS X a keydown event | |
217 is immediately followed by a keyup event. | |
218 */ | |
219 GetKeys(keys); | |
220 if ( (keys[0] != last_keys[0]) || (keys[1] != last_keys[1]) || | |
221 (keys[2] != last_keys[2]) || (keys[3] != last_keys[3]) ) { | |
222 SDL_keysym keysym; | |
223 int old_bit, new_bit; | |
224 | |
225 #ifdef DEBUG_KEYBOARD | |
226 fprintf(sterr, "New keys: 0x%x 0x%x 0x%x 0x%x\n", | |
227 new_keys[0], new_keys[1], | |
228 new_keys[2], new_keys[3]); | |
229 #endif | |
230 for ( i=0; i<128; ++i ) { | |
231 old_bit = (((Uint8 *)last_keys)[i/8]>>(i%8)) & 0x01; | |
232 new_bit = (((Uint8 *)keys)[i/8]>>(i%8)) & 0x01; | |
233 if ( old_bit != new_bit ) { | |
234 /* Post the keyboard event */ | |
235 #ifdef DEBUG_KEYBOARD | |
236 fprintf(stderr,"Scancode: 0x%2.2X\n",i); | |
237 #endif | |
238 SDL_PrivateKeyboard(new_bit, | |
239 TranslateKey(i, event.modifiers, | |
240 &keysym, new_bit)); | |
241 } | |
242 } | |
243 | |
244 /* Save state for next time */ | |
245 last_keys[0] = keys[0]; | |
246 last_keys[1] = keys[1]; | |
247 last_keys[2] = keys[2]; | |
248 last_keys[3] = keys[3]; | |
249 } | |
250 } | |
251 | |
252 /* Handle normal events */ | |
253 switch (event.what) { | |
254 case mouseDown: { | |
255 WindowRef win; | |
256 short area; | |
257 | |
258 area = FindWindow(event.where, &win); | |
259 /* Support switching between the SIOUX console | |
260 and SDL_Window by clicking in the window. | |
261 */ | |
262 if ( win && (win != FrontWindow()) ) { | |
263 SelectWindow(win); | |
264 } | |
265 switch (area) { | |
266 case inMenuBar: /* Only the apple menu exists */ | |
267 Mac_DoAppleMenu(this, MenuSelect(event.where)); | |
268 HiliteMenu(0); | |
269 break; | |
270 case inDrag: | |
271 #if TARGET_API_MAC_CARBON | |
272 DragWindow(win, event.where, NULL); | |
273 #else | |
274 DragWindow(win, event.where, &theQD->screenBits.bounds); | |
275 #endif | |
276 break; | |
277 case inGoAway: | |
278 if ( TrackGoAway(win, event.where) ) { | |
279 SDL_PrivateQuit(); | |
280 } | |
281 break; | |
282 case inContent: | |
283 myGlobalToLocal(this, &event.where); | |
284 /* Treat command-click as right mouse button */ | |
285 if ( event.modifiers & optionKey ) { | |
155
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
286 mouse_button = 2; |
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
287 } else if ( event.modifiers & cmdKey ) { |
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
288 mouse_button = 3; |
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
289 } else { |
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
290 mouse_button = 1; |
0 | 291 } |
155
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
292 SDL_PrivateMouseButton(SDL_PRESSED, |
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
293 mouse_button, event.where.h, event.where.v); |
0 | 294 break; |
295 case inGrow: { | |
296 int newSize; | |
297 | |
298 /* Don't allow resize if video mode isn't resizable */ | |
299 if ( ! SDL_PublicSurface || | |
300 ! (SDL_PublicSurface->flags & SDL_RESIZABLE) ) { | |
301 break; | |
302 } | |
303 #if TARGET_API_MAC_CARBON | |
304 newSize = GrowWindow(win, event.where, NULL); | |
305 #else | |
306 newSize = GrowWindow(win, event.where, &theQD->screenBits.bounds); | |
307 #endif | |
308 if ( newSize ) { | |
309 #if !TARGET_API_MAC_CARBON | |
310 EraseRect ( &theQD->screenBits.bounds ); | |
311 #endif | |
312 SizeWindow ( win, LoWord (newSize), HiWord (newSize), 1 ); | |
313 SDL_PrivateResize ( LoWord (newSize), HiWord (newSize) ); | |
314 } | |
315 } break; | |
316 case inZoomIn: | |
317 case inZoomOut: | |
318 if ( TrackBox (win, event.where, area )) { | |
319 Rect rect; | |
320 #if !TARGET_API_MAC_CARBON | |
321 EraseRect ( &theQD->screenBits.bounds ); | |
322 #endif | |
323 ZoomWindow ( win, area, 0); | |
324 if ( area == inZoomIn ) { | |
325 GetWindowUserState(SDL_Window, &rect); | |
326 } else { | |
327 GetWindowStandardState(SDL_Window, &rect); | |
328 } | |
329 SDL_PrivateResize (rect.right-rect.left, | |
330 rect.bottom-rect.top); | |
331 } | |
332 break; | |
333 #if TARGET_API_MAC_CARBON | |
334 case inCollapseBox: | |
335 if ( TrackBox (win, event.where, area )) { | |
336 if ( IsWindowCollapsable(win) ) { | |
337 CollapseWindow (win, !IsWindowCollapsed(win)); | |
155
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
338 /* There should be something done like in inGrow case, but... */ |
0 | 339 } |
340 } | |
341 break; | |
342 #endif /* TARGET_API_MAC_CARBON */ | |
343 case inSysWindow: | |
344 #if TARGET_API_MAC_CARBON | |
345 /* Never happens in Carbon? */ | |
346 #else | |
347 SystemClick(&event, win); | |
348 #endif | |
349 break; | |
350 default: | |
351 break; | |
352 } | |
353 } | |
354 break; | |
355 case mouseUp: { | |
356 myGlobalToLocal(this, &event.where); | |
155
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
357 /* Release the mouse button we simulated in the last press. |
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
358 The drawback of this methos is we cannot press more than |
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
359 one button. However, this doesn't matter, since there is |
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
360 only a single logical mouse button, even if you have a |
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
361 multi-button mouse, this doesn't matter at all. |
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
362 */ |
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
363 SDL_PrivateMouseButton(SDL_RELEASED, |
2d162219f433
Date: Thu, 16 Aug 2001 21:50:51 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
10
diff
changeset
|
364 mouse_button, event.where.h, event.where.v); |
0 | 365 } |
366 break; | |
367 #if 0 /* Handled above the switch statement */ | |
368 case keyDown: { | |
369 SDL_keysym keysym; | |
370 | |
371 SDL_PrivateKeyboard(SDL_PRESSED, | |
372 TranslateKey((event.message&keyCodeMask)>>8 | |
373 event.modifiers, &keysym, 1)); | |
374 } | |
375 break; | |
376 case keyUp: { | |
377 SDL_keysym keysym; | |
378 | |
379 SDL_PrivateKeyboard(SDL_RELEASED, | |
380 TranslateKey((event.message&keyCodeMask)>>8 | |
381 event.modifiers, &keysym, 0)); | |
382 } | |
383 break; | |
384 #endif | |
385 case updateEvt: { | |
386 BeginUpdate(SDL_Window); | |
387 if ( (SDL_VideoSurface->flags & SDL_HWSURFACE) == | |
388 SDL_SWSURFACE ) { | |
389 SDL_UpdateRect(SDL_VideoSurface, 0, 0, 0, 0); | |
390 } | |
391 EndUpdate(SDL_Window); | |
392 } | |
393 /* If this was an update event for the SIOUX console, we return 0 | |
394 in order to stop an endless series of updates being triggered. | |
395 */ | |
396 if ( (WindowRef) event.message != SDL_Window ) { | |
397 return 0; | |
398 } | |
399 break; | |
400 case activateEvt: { | |
401 Mac_HandleActivate(!!(event.modifiers & activeFlag)); | |
402 } | |
403 break; | |
404 case diskEvt: { | |
405 #if TARGET_API_MAC_CARBON | |
406 /* What are we supposed to do? */; | |
407 #else | |
408 if ( ((event.message>>16)&0xFFFF) != noErr ) { | |
409 Point spot; | |
410 SetPt(&spot, 0x0070, 0x0050); | |
411 DIBadMount(spot, event.message); | |
412 } | |
413 #endif | |
414 } | |
415 break; | |
416 case osEvt: { | |
417 switch ((event.message>>24) & 0xFF) { | |
418 #if 0 /* Handled above the switch statement */ | |
419 case mouseMovedMessage: { | |
420 myGlobalToLocal(this, &event.where); | |
421 SDL_PrivateMouseMotion(0, 0, | |
422 event.where.h, event.where.v); | |
423 } | |
424 break; | |
425 #endif /* 0 */ | |
426 case suspendResumeMessage: { | |
427 Mac_HandleActivate(!!(event.message & resumeFlag)); | |
428 } | |
429 break; | |
430 } | |
431 } | |
432 break; | |
433 default: { | |
434 ; | |
435 } | |
436 break; | |
437 } | |
438 return (event.what != nullEvent); | |
439 } | |
440 | |
441 | |
442 void Mac_PumpEvents(_THIS) | |
443 { | |
444 /* Process pending MacOS events */ | |
445 while ( Mac_HandleEvents(this, 0) ) { | |
446 /* Loop and check again */; | |
447 } | |
448 } | |
449 | |
450 void Mac_InitOSKeymap(_THIS) | |
451 { | |
198
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
452 const void *KCHRPtr; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
453 UInt32 state; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
454 UInt32 value; |
0 | 455 int i; |
198
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
456 int world = SDLK_WORLD_0; |
0 | 457 |
458 /* Map the MAC keysyms */ | |
459 for ( i=0; i<SDL_TABLESIZE(MAC_keymap); ++i ) | |
460 MAC_keymap[i] = SDLK_UNKNOWN; | |
461 | |
462 /* Defined MAC_* constants */ | |
463 MAC_keymap[MK_ESCAPE] = SDLK_ESCAPE; | |
464 MAC_keymap[MK_F1] = SDLK_F1; | |
465 MAC_keymap[MK_F2] = SDLK_F2; | |
466 MAC_keymap[MK_F3] = SDLK_F3; | |
467 MAC_keymap[MK_F4] = SDLK_F4; | |
468 MAC_keymap[MK_F5] = SDLK_F5; | |
469 MAC_keymap[MK_F6] = SDLK_F6; | |
470 MAC_keymap[MK_F7] = SDLK_F7; | |
471 MAC_keymap[MK_F8] = SDLK_F8; | |
472 MAC_keymap[MK_F9] = SDLK_F9; | |
473 MAC_keymap[MK_F10] = SDLK_F10; | |
474 MAC_keymap[MK_F11] = SDLK_F11; | |
475 MAC_keymap[MK_F12] = SDLK_F12; | |
476 MAC_keymap[MK_PRINT] = SDLK_PRINT; | |
477 MAC_keymap[MK_SCROLLOCK] = SDLK_SCROLLOCK; | |
478 MAC_keymap[MK_PAUSE] = SDLK_PAUSE; | |
479 MAC_keymap[MK_POWER] = SDLK_POWER; | |
480 MAC_keymap[MK_BACKQUOTE] = SDLK_BACKQUOTE; | |
481 MAC_keymap[MK_1] = SDLK_1; | |
482 MAC_keymap[MK_2] = SDLK_2; | |
483 MAC_keymap[MK_3] = SDLK_3; | |
484 MAC_keymap[MK_4] = SDLK_4; | |
485 MAC_keymap[MK_5] = SDLK_5; | |
486 MAC_keymap[MK_6] = SDLK_6; | |
487 MAC_keymap[MK_7] = SDLK_7; | |
488 MAC_keymap[MK_8] = SDLK_8; | |
489 MAC_keymap[MK_9] = SDLK_9; | |
490 MAC_keymap[MK_0] = SDLK_0; | |
491 MAC_keymap[MK_MINUS] = SDLK_MINUS; | |
492 MAC_keymap[MK_EQUALS] = SDLK_EQUALS; | |
493 MAC_keymap[MK_BACKSPACE] = SDLK_BACKSPACE; | |
494 MAC_keymap[MK_INSERT] = SDLK_INSERT; | |
495 MAC_keymap[MK_HOME] = SDLK_HOME; | |
496 MAC_keymap[MK_PAGEUP] = SDLK_PAGEUP; | |
497 MAC_keymap[MK_NUMLOCK] = SDLK_NUMLOCK; | |
498 MAC_keymap[MK_KP_EQUALS] = SDLK_KP_EQUALS; | |
499 MAC_keymap[MK_KP_DIVIDE] = SDLK_KP_DIVIDE; | |
500 MAC_keymap[MK_KP_MULTIPLY] = SDLK_KP_MULTIPLY; | |
501 MAC_keymap[MK_TAB] = SDLK_TAB; | |
502 MAC_keymap[MK_q] = SDLK_q; | |
503 MAC_keymap[MK_w] = SDLK_w; | |
504 MAC_keymap[MK_e] = SDLK_e; | |
505 MAC_keymap[MK_r] = SDLK_r; | |
506 MAC_keymap[MK_t] = SDLK_t; | |
507 MAC_keymap[MK_y] = SDLK_y; | |
508 MAC_keymap[MK_u] = SDLK_u; | |
509 MAC_keymap[MK_i] = SDLK_i; | |
510 MAC_keymap[MK_o] = SDLK_o; | |
511 MAC_keymap[MK_p] = SDLK_p; | |
512 MAC_keymap[MK_LEFTBRACKET] = SDLK_LEFTBRACKET; | |
513 MAC_keymap[MK_RIGHTBRACKET] = SDLK_RIGHTBRACKET; | |
514 MAC_keymap[MK_BACKSLASH] = SDLK_BACKSLASH; | |
515 MAC_keymap[MK_DELETE] = SDLK_DELETE; | |
516 MAC_keymap[MK_END] = SDLK_END; | |
517 MAC_keymap[MK_PAGEDOWN] = SDLK_PAGEDOWN; | |
518 MAC_keymap[MK_KP7] = SDLK_KP7; | |
519 MAC_keymap[MK_KP8] = SDLK_KP8; | |
520 MAC_keymap[MK_KP9] = SDLK_KP9; | |
521 MAC_keymap[MK_KP_MINUS] = SDLK_KP_MINUS; | |
522 MAC_keymap[MK_CAPSLOCK] = SDLK_CAPSLOCK; | |
523 MAC_keymap[MK_a] = SDLK_a; | |
524 MAC_keymap[MK_s] = SDLK_s; | |
525 MAC_keymap[MK_d] = SDLK_d; | |
526 MAC_keymap[MK_f] = SDLK_f; | |
527 MAC_keymap[MK_g] = SDLK_g; | |
528 MAC_keymap[MK_h] = SDLK_h; | |
529 MAC_keymap[MK_j] = SDLK_j; | |
530 MAC_keymap[MK_k] = SDLK_k; | |
531 MAC_keymap[MK_l] = SDLK_l; | |
532 MAC_keymap[MK_SEMICOLON] = SDLK_SEMICOLON; | |
533 MAC_keymap[MK_QUOTE] = SDLK_QUOTE; | |
534 MAC_keymap[MK_RETURN] = SDLK_RETURN; | |
535 MAC_keymap[MK_KP4] = SDLK_KP4; | |
536 MAC_keymap[MK_KP5] = SDLK_KP5; | |
537 MAC_keymap[MK_KP6] = SDLK_KP6; | |
538 MAC_keymap[MK_KP_PLUS] = SDLK_KP_PLUS; | |
539 MAC_keymap[MK_LSHIFT] = SDLK_LSHIFT; | |
540 MAC_keymap[MK_z] = SDLK_z; | |
541 MAC_keymap[MK_x] = SDLK_x; | |
542 MAC_keymap[MK_c] = SDLK_c; | |
543 MAC_keymap[MK_v] = SDLK_v; | |
544 MAC_keymap[MK_b] = SDLK_b; | |
545 MAC_keymap[MK_n] = SDLK_n; | |
546 MAC_keymap[MK_m] = SDLK_m; | |
547 MAC_keymap[MK_COMMA] = SDLK_COMMA; | |
548 MAC_keymap[MK_PERIOD] = SDLK_PERIOD; | |
549 MAC_keymap[MK_SLASH] = SDLK_SLASH; | |
550 #if 0 /* These are the same as the left versions - use left by default */ | |
551 MAC_keymap[MK_RSHIFT] = SDLK_RSHIFT; | |
552 #endif | |
553 MAC_keymap[MK_UP] = SDLK_UP; | |
554 MAC_keymap[MK_KP1] = SDLK_KP1; | |
555 MAC_keymap[MK_KP2] = SDLK_KP2; | |
556 MAC_keymap[MK_KP3] = SDLK_KP3; | |
557 MAC_keymap[MK_KP_ENTER] = SDLK_KP_ENTER; | |
558 MAC_keymap[MK_LCTRL] = SDLK_LCTRL; | |
559 MAC_keymap[MK_LALT] = SDLK_LALT; | |
560 MAC_keymap[MK_LMETA] = SDLK_LMETA; | |
561 MAC_keymap[MK_SPACE] = SDLK_SPACE; | |
562 #if 0 /* These are the same as the left versions - use left by default */ | |
563 MAC_keymap[MK_RMETA] = SDLK_RMETA; | |
564 MAC_keymap[MK_RALT] = SDLK_RALT; | |
565 MAC_keymap[MK_RCTRL] = SDLK_RCTRL; | |
566 #endif | |
567 MAC_keymap[MK_LEFT] = SDLK_LEFT; | |
568 MAC_keymap[MK_DOWN] = SDLK_DOWN; | |
569 MAC_keymap[MK_RIGHT] = SDLK_RIGHT; | |
570 MAC_keymap[MK_KP0] = SDLK_KP0; | |
571 MAC_keymap[MK_KP_PERIOD] = SDLK_KP_PERIOD; | |
10
ee3bb7cd06b5
Fixed left arrow on iBook keyboard under MacOS X
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
572 |
ee3bb7cd06b5
Fixed left arrow on iBook keyboard under MacOS X
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
573 #if defined(__APPLE__) && defined(__MACH__) |
ee3bb7cd06b5
Fixed left arrow on iBook keyboard under MacOS X
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
574 /* Wierd, these keys are on my iBook under MacOS X |
ee3bb7cd06b5
Fixed left arrow on iBook keyboard under MacOS X
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
575 Note that the left arrow keysym is the same as left ctrl!? |
ee3bb7cd06b5
Fixed left arrow on iBook keyboard under MacOS X
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
576 */ |
ee3bb7cd06b5
Fixed left arrow on iBook keyboard under MacOS X
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
577 MAC_keymap[MK_IBOOK_ENTER] = SDLK_KP_ENTER; |
ee3bb7cd06b5
Fixed left arrow on iBook keyboard under MacOS X
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
578 MAC_keymap[MK_IBOOK_RIGHT] = SDLK_RIGHT; |
ee3bb7cd06b5
Fixed left arrow on iBook keyboard under MacOS X
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
579 MAC_keymap[MK_IBOOK_DOWN] = SDLK_DOWN; |
ee3bb7cd06b5
Fixed left arrow on iBook keyboard under MacOS X
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
580 MAC_keymap[MK_IBOOK_UP] = SDLK_UP; |
ee3bb7cd06b5
Fixed left arrow on iBook keyboard under MacOS X
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
581 MAC_keymap[MK_IBOOK_LEFT] = SDLK_LEFT; |
ee3bb7cd06b5
Fixed left arrow on iBook keyboard under MacOS X
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
582 #endif /* MacOS X */ |
198
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
583 |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
584 /* Up there we setup a static scancode->keysym map. However, it will not |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
585 * work very well on international keyboard. Hence we now query MacOS |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
586 * for its own keymap to adjust our own mapping table. However, this is |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
587 * bascially only useful for ascii char keys. This is also the reason |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
588 * why we keep the static table, too. |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
589 */ |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
590 |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
591 /* Get a pointer to the systems cached KCHR */ |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
592 KCHRPtr = (void *)GetScriptManagerVariable(smKCHRCache); |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
593 if (KCHRPtr) |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
594 { |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
595 /* Loop over all 127 possible scan codes */ |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
596 for (i = 0; i < 0x7F; i++) |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
597 { |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
598 /* We pretend a clean start to begin with (i.e. no dead keys active */ |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
599 state = 0; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
600 |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
601 /* Now translate the key code to a key value */ |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
602 value = KeyTranslate(KCHRPtr, i, &state) & 0xff; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
603 |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
604 /* If the state become 0, it was a dead key. We need to translate again, |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
605 passing in the new state, to get the actual key value */ |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
606 if (state != 0) |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
607 value = KeyTranslate(KCHRPtr, i, &state) & 0xff; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
608 |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
609 /* Now we should have an ascii value, or 0. Try to figure out to which SDL symbol it maps */ |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
610 if (value >= 128) /* Some non-ASCII char, map it to SDLK_WORLD_* */ |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
611 MAC_keymap[i] = world++; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
612 else if (value >= 32) /* non-control ASCII char */ |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
613 MAC_keymap[i] = value; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
614 } |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
615 } |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
616 |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
617 /* The keypad codes are re-setup here, because the loop above cannot |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
618 * distinguish between a key on the keypad and a regular key. We maybe |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
619 * could get around this problem in another fashion: NSEvent's flags |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
620 * include a "NSNumericPadKeyMask" bit; we could check that and modify |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
621 * the symbol we return on the fly. However, this flag seems to exhibit |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
622 * some weird behaviour related to the num lock key |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
623 */ |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
624 MAC_keymap[MK_KP0] = SDLK_KP0; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
625 MAC_keymap[MK_KP1] = SDLK_KP1; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
626 MAC_keymap[MK_KP2] = SDLK_KP2; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
627 MAC_keymap[MK_KP3] = SDLK_KP3; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
628 MAC_keymap[MK_KP4] = SDLK_KP4; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
629 MAC_keymap[MK_KP5] = SDLK_KP5; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
630 MAC_keymap[MK_KP6] = SDLK_KP6; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
631 MAC_keymap[MK_KP7] = SDLK_KP7; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
632 MAC_keymap[MK_KP8] = SDLK_KP8; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
633 MAC_keymap[MK_KP9] = SDLK_KP9; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
634 MAC_keymap[MK_KP_MINUS] = SDLK_KP_MINUS; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
635 MAC_keymap[MK_KP_PLUS] = SDLK_KP_PLUS; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
636 MAC_keymap[MK_KP_PERIOD] = SDLK_KP_PERIOD; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
637 MAC_keymap[MK_KP_EQUALS] = SDLK_KP_EQUALS; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
638 MAC_keymap[MK_KP_DIVIDE] = SDLK_KP_DIVIDE; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
639 MAC_keymap[MK_KP_MULTIPLY] = SDLK_KP_MULTIPLY; |
49bf25403f5e
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
640 MAC_keymap[MK_KP_ENTER] = SDLK_KP_ENTER; |
0 | 641 } |
642 | |
643 static SDL_keysym *TranslateKey(int scancode, int modifiers, | |
644 SDL_keysym *keysym, int pressed) | |
645 { | |
646 /* Set the keysym information */ | |
647 keysym->scancode = scancode; | |
648 keysym->sym = MAC_keymap[keysym->scancode]; | |
649 keysym->mod = KMOD_NONE; | |
650 keysym->unicode = 0; | |
651 if ( pressed && SDL_TranslateUNICODE ) { | |
652 static unsigned long state = 0; | |
653 static Ptr keymap = nil; | |
654 Ptr new_keymap; | |
655 | |
656 /* Get the current keyboard map resource */ | |
657 new_keymap = (Ptr)GetScriptManagerVariable(smKCHRCache); | |
658 if ( new_keymap != keymap ) { | |
659 keymap = new_keymap; | |
660 state = 0; | |
661 } | |
662 keysym->unicode = KeyTranslate(keymap, | |
663 keysym->scancode|modifiers, &state) & 0xFFFF; | |
664 } | |
665 return(keysym); | |
666 } | |
667 | |
668 void Mac_InitEvents(_THIS) | |
669 { | |
670 /* Create apple menu bar */ | |
671 apple_menu = GetMenu(mApple); | |
672 if ( apple_menu != nil ) { | |
673 AppendResMenu(apple_menu, 'DRVR'); | |
674 InsertMenu(apple_menu, 0); | |
675 } | |
676 DrawMenuBar(); | |
677 | |
678 /* Get rid of spurious events at startup */ | |
679 FlushEvents(everyEvent, 0); | |
680 | |
681 /* Allow every event but keyrepeat */ | |
168
e92aa316c517
Added Max's patches for building MacOS X apps on command line
Sam Lantinga <slouken@libsdl.org>
parents:
155
diff
changeset
|
682 SetEventMask(everyEvent & ~autoKeyMask); |
0 | 683 } |
684 | |
685 void Mac_QuitEvents(_THIS) | |
686 { | |
687 ClearMenuBar(); | |
688 if ( apple_menu != nil ) { | |
689 ReleaseResource((char **)apple_menu); | |
690 } | |
691 | |
692 /* Clean up pending events */ | |
693 FlushEvents(everyEvent, 0); | |
694 } | |
695 | |
696 static void Mac_DoAppleMenu(_THIS, long choice) | |
697 { | |
698 #if !TARGET_API_MAC_CARBON /* No Apple menu in OS X */ | |
699 short menu, item; | |
700 | |
701 item = (choice&0xFFFF); | |
702 choice >>= 16; | |
703 menu = (choice&0xFFFF); | |
704 | |
705 switch (menu) { | |
706 case mApple: { | |
707 switch (item) { | |
708 case iAbout: { | |
709 /* Run the about box */; | |
710 } | |
711 break; | |
712 default: { | |
713 Str255 name; | |
714 | |
715 GetMenuItemText(apple_menu, item, name); | |
716 OpenDeskAcc(name); | |
717 } | |
718 break; | |
719 } | |
720 } | |
721 break; | |
722 default: { | |
723 /* Ignore other menus */; | |
724 } | |
725 } | |
726 #endif /* !TARGET_API_MAC_CARBON */ | |
727 } | |
728 | |
729 #if !TARGET_API_MAC_CARBON | |
730 /* Since we don't initialize QuickDraw, we need to get a pointer to qd */ | |
731 QDGlobals *theQD = NULL; | |
732 | |
733 /* Exported to the macmain code */ | |
734 void SDL_InitQuickDraw(struct QDGlobals *the_qd) | |
735 { | |
736 theQD = the_qd; | |
737 } | |
738 #endif |