mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-10-26 12:27:44 +00:00 
			
		
		
		
	Fix key code names for ISO keyboard layouts
This commit is contained in:
		 Cyril Dubet
					Cyril Dubet
				
			
				
					committed by
					
						 Sam Lantinga
						Sam Lantinga
					
				
			
			
				
	
			
			
			 Sam Lantinga
						Sam Lantinga
					
				
			
						parent
						
							73b2faea4e
						
					
				
				
					commit
					60dcaff7eb
				
			| @@ -279,6 +279,17 @@ static void UpdateKeymap(SDL_CocoaVideoData *data, SDL_bool send_event) | |||||||
|                 continue; |                 continue; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  |             /*  | ||||||
|  |              * Swap the scancode for these two wrongly translated keys | ||||||
|  |              * UCKeyTranslate() function does not do its job properly for ISO layout keyboards, where the key '@', | ||||||
|  |              * which is located in the top left corner of the keyboard right under the Escape key, and the additional | ||||||
|  |              * key '<', which is on the right of the Shift key, are inverted | ||||||
|  |             */ | ||||||
|  |             if ((scancode == SDL_SCANCODE_NONUSBACKSLASH || scancode == SDL_SCANCODE_GRAVE) && KBGetLayoutType(LMGetKbdType()) == kKeyboardISO) { | ||||||
|  |                 /* see comments in scancodes_darwin.h */ | ||||||
|  |                 scancode = (SDL_Scancode)((SDL_SCANCODE_NONUSBACKSLASH + SDL_SCANCODE_GRAVE) - scancode); | ||||||
|  |             } | ||||||
|  |  | ||||||
|             dead_key_state = 0; |             dead_key_state = 0; | ||||||
|             err = UCKeyTranslate((UCKeyboardLayout *)chr_data, |             err = UCKeyTranslate((UCKeyboardLayout *)chr_data, | ||||||
|                                  i, kUCKeyActionDown, |                                  i, kUCKeyActionDown, | ||||||
| @@ -385,7 +396,7 @@ void Cocoa_HandleKeyEvent(_THIS, NSEvent *event) | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
|     if ((scancode == 10 || scancode == 50) && KBGetLayoutType(LMGetKbdType()) == kKeyboardISO) { |     if ((scancode == 10 || scancode == 50) && KBGetLayoutType(LMGetKbdType()) == kKeyboardISO) { | ||||||
|         /* see comments in SDL_cocoakeys.h */ |         /* see comments in scancodes_darwin.h */ | ||||||
|         scancode = 60 - scancode; |         scancode = 60 - scancode; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user