mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 05:31:01 +00:00 
			
		
		
		
	Linux/BSD: Modify only keypad keys
The `keycode` field of `InputEventKey` is supposed to be "unshifted"; That is, what the key would output if no modifier keys were pressed. This should match what's written on the key label, but `Key` enumerates also all keypad keys, which require a modifier. We thus require some extra checks for them. Note that this can still allow "stuck keys", but that's an even deeper problem.
This commit is contained in:
		
							parent
							
								
									a013481b09
								
							
						
					
					
						commit
						140a63be25
					
				
					 6 changed files with 96 additions and 11 deletions
				
			
		|  | @ -1129,6 +1129,30 @@ void KeyMappingX11::initialize() { | |||
| 	location_map[0x86] = KeyLocation::RIGHT; | ||||
| } | ||||
| 
 | ||||
| bool KeyMappingX11::is_sym_numpad(KeySym p_keysym) { | ||||
| 	switch (p_keysym) { | ||||
| 		case XK_KP_Multiply: | ||||
| 		case XK_KP_Divide: | ||||
| 		case XK_KP_Subtract: | ||||
| 		case XK_KP_Separator: | ||||
| 		case XK_KP_Add: | ||||
| 		case XK_KP_0: | ||||
| 		case XK_KP_1: | ||||
| 		case XK_KP_2: | ||||
| 		case XK_KP_3: | ||||
| 		case XK_KP_4: | ||||
| 		case XK_KP_5: | ||||
| 		case XK_KP_6: | ||||
| 		case XK_KP_7: | ||||
| 		case XK_KP_8: | ||||
| 		case XK_KP_9: { | ||||
| 			return true; | ||||
| 		} break; | ||||
| 	} | ||||
| 
 | ||||
| 	return false; | ||||
| } | ||||
| 
 | ||||
| Key KeyMappingX11::get_keycode(KeySym p_keysym) { | ||||
| 	if (p_keysym >= 0x20 && p_keysym < 0x7E) { // ASCII, maps 1-1
 | ||||
| 		if (p_keysym > 0x60 && p_keysym < 0x7B) { // Lowercase ASCII.
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Riteo
						Riteo