src/video/maccommon/SDL_macevents.c
branchSDL-1.2
changeset 3947 0f8a812e2855
parent 1621 f12379c41042
child 4068 86746036a6d6
equal deleted inserted replaced
3946:259aaca0fb0c 3947:0f8a812e2855
   157 	}
   157 	}
   158 
   158 
   159 	/* Check the current state of the keyboard */
   159 	/* Check the current state of the keyboard */
   160 	if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) {
   160 	if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) {
   161 		KeyMap keys;
   161 		KeyMap keys;
       
   162 		const Uint8 *keysptr = (Uint8 *) &keys;
       
   163 		const Uint8 *last_keysptr = (Uint8 *) &last_keys;
   162 
   164 
   163 		/* Check for special non-event keys */
   165 		/* Check for special non-event keys */
   164 		if ( event.modifiers != last_mods ) {
   166 		if ( event.modifiers != last_mods ) {
   165 			static struct {
   167 			static struct {
   166 				EventModifiers mask;
   168 				EventModifiers mask;
   212 		/* Check for normal event keys, but we have to scan the
   214 		/* Check for normal event keys, but we have to scan the
   213 		   actual keyboard state because on Mac OS X a keydown event
   215 		   actual keyboard state because on Mac OS X a keydown event
   214 		   is immediately followed by a keyup event.
   216 		   is immediately followed by a keyup event.
   215 		*/
   217 		*/
   216 		GetKeys(keys);
   218 		GetKeys(keys);
   217 		if ( (keys[0] != last_keys[0]) || (keys[1] != last_keys[1]) ||
   219 		if ( (keysptr[0] != last_keysptr[0]) ||
   218 		     (keys[2] != last_keys[2]) || (keys[3] != last_keys[3]) ) {
   220 		     (keysptr[1] != last_keysptr[1]) ||
       
   221 		     (keysptr[2] != last_keysptr[2]) ||
       
   222 		     (keysptr[3] != last_keysptr[3]) ) {
   219 			SDL_keysym keysym;
   223 			SDL_keysym keysym;
   220 			int old_bit, new_bit;
   224 			int old_bit, new_bit;
   221 
   225 
   222 #ifdef DEBUG_KEYBOARD
   226 #ifdef DEBUG_KEYBOARD
   223 			fprintf(sterr, "New keys: 0x%x 0x%x 0x%x 0x%x\n",
   227 			fprintf(sterr, "New keys: 0x%x 0x%x 0x%x 0x%x\n",
   728 #endif /* !TARGET_API_MAC_CARBON */
   732 #endif /* !TARGET_API_MAC_CARBON */
   729 }
   733 }
   730 
   734 
   731 #if !TARGET_API_MAC_CARBON
   735 #if !TARGET_API_MAC_CARBON
   732 /* Since we don't initialize QuickDraw, we need to get a pointer to qd */
   736 /* Since we don't initialize QuickDraw, we need to get a pointer to qd */
   733 QDGlobals *theQD = NULL;
   737 struct QDGlobals *theQD = NULL;
   734 #endif
   738 #endif
   735 
   739 
   736 /* Exported to the macmain code */
   740 /* Exported to the macmain code */
   737 void SDL_InitQuickDraw(struct QDGlobals *the_qd)
   741 void SDL_InitQuickDraw(struct QDGlobals *the_qd)
   738 {
   742 {