mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	Add key map for ctrl modifier as well.
This commit is contained in:
		
							parent
							
								
									b29415ee6d
								
							
						
					
					
						commit
						0d77fd484c
					
				
					 1 changed files with 19 additions and 17 deletions
				
			
		
							
								
								
									
										36
									
								
								terminal.c
									
										
									
									
									
								
							
							
						
						
									
										36
									
								
								terminal.c
									
										
									
									
									
								
							| 
						 | 
					@ -196,7 +196,7 @@ acknowledge_handler(struct window *window, uint32_t key, void *data)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct key {
 | 
					struct key {
 | 
				
			||||||
	int code[2];
 | 
						int code[4];
 | 
				
			||||||
} evdev_keymap[] = {
 | 
					} evdev_keymap[] = {
 | 
				
			||||||
	{ { 0, 0 } },		/* 0 */
 | 
						{ { 0, 0 } },		/* 0 */
 | 
				
			||||||
	{ { 0x1b, 0x1b } },
 | 
						{ { 0x1b, 0x1b } },
 | 
				
			||||||
| 
						 | 
					@ -216,29 +216,29 @@ struct key {
 | 
				
			||||||
	{ { '\t', '\t' } },
 | 
						{ { '\t', '\t' } },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{ { 'q', 'Q' } },		/* 16 */
 | 
						{ { 'q', 'Q' } },		/* 16 */
 | 
				
			||||||
	{ { 'w', 'W' } },
 | 
						{ { 'w', 'W', 0x17 } },
 | 
				
			||||||
	{ { 'e', 'E' } },
 | 
						{ { 'e', 'E', 0x05 } },
 | 
				
			||||||
	{ { 'r', 'R' } },
 | 
						{ { 'r', 'R', 0x12 } },
 | 
				
			||||||
	{ { 't', 'T' } },
 | 
						{ { 't', 'T' } },
 | 
				
			||||||
	{ { 'y', 'Y' } },
 | 
						{ { 'y', 'Y' } },
 | 
				
			||||||
	{ { 'u', 'U' } },
 | 
						{ { 'u', 'U', 0x15 } },
 | 
				
			||||||
	{ { 'i', 'I' } },
 | 
						{ { 'i', 'I' } },
 | 
				
			||||||
	{ { 'o', 'O' } },
 | 
						{ { 'o', 'O' } },
 | 
				
			||||||
	{ { 'p', 'P' } },
 | 
						{ { 'p', 'P', 0x10 } },
 | 
				
			||||||
	{ { '[', '{' } },
 | 
						{ { '[', '{' } },
 | 
				
			||||||
	{ { ']', '}' } },
 | 
						{ { ']', '}' } },
 | 
				
			||||||
	{ { '\n', '\n' } },
 | 
						{ { '\n', '\n' } },
 | 
				
			||||||
	{ { 0, 0 } },
 | 
						{ { 0, 0 } },
 | 
				
			||||||
	{ { 'a', 'A' } },
 | 
						{ { 'a', 'A', 0x01} },
 | 
				
			||||||
	{ { 's', 'S' } },
 | 
						{ { 's', 'S', 0x13 } },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{ { 'd', 'D' } },		/* 32 */
 | 
						{ { 'd', 'D', 0x04 } },		/* 32 */
 | 
				
			||||||
	{ { 'f', 'F' } },
 | 
						{ { 'f', 'F', 0x06 } },
 | 
				
			||||||
	{ { 'g', 'G' } },
 | 
						{ { 'g', 'G' } },
 | 
				
			||||||
	{ { 'h', 'H' } },
 | 
						{ { 'h', 'H' } },
 | 
				
			||||||
	{ { 'j', 'J' } },
 | 
						{ { 'j', 'J', 0x0a } },
 | 
				
			||||||
	{ { 'k', 'K' } },
 | 
						{ { 'k', 'K', 0x0b } },
 | 
				
			||||||
	{ { 'l', 'L' } },
 | 
						{ { 'l', 'L', 0x0c } },
 | 
				
			||||||
	{ { ';', ':' } },
 | 
						{ { ';', ':' } },
 | 
				
			||||||
	{ { '\'', '"' } },
 | 
						{ { '\'', '"' } },
 | 
				
			||||||
	{ { '`', '~' } },
 | 
						{ { '`', '~' } },
 | 
				
			||||||
| 
						 | 
					@ -249,9 +249,9 @@ struct key {
 | 
				
			||||||
	{ { 'c', 'C' } },
 | 
						{ { 'c', 'C' } },
 | 
				
			||||||
	{ { 'v', 'V' } },
 | 
						{ { 'v', 'V' } },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{ { 'b', 'B' } },		/* 48 */
 | 
						{ { 'b', 'B', 0x02 } },		/* 48 */
 | 
				
			||||||
	{ { 'n', 'N' } },
 | 
						{ { 'n', 'N', 0x0e } },
 | 
				
			||||||
	{ { 'm', 'M' } },
 | 
						{ { 'm', 'M', 0x0d } },
 | 
				
			||||||
	{ { ',', '<' } },
 | 
						{ { ',', '<' } },
 | 
				
			||||||
	{ { '.', '>' } },
 | 
						{ { '.', '>' } },
 | 
				
			||||||
	{ { '/', '?' } },
 | 
						{ { '/', '?' } },
 | 
				
			||||||
| 
						 | 
					@ -288,7 +288,9 @@ key_handler(struct window *window, uint32_t key, uint32_t state, void *data)
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		if (key < ARRAY_LENGTH(evdev_keymap)) {
 | 
							if (key < ARRAY_LENGTH(evdev_keymap)) {
 | 
				
			||||||
			if (terminal->modifiers & MOD_SHIFT)
 | 
								if (terminal->modifiers & MOD_CTRL)
 | 
				
			||||||
 | 
									c = evdev_keymap[key].code[2];
 | 
				
			||||||
 | 
								else if (terminal->modifiers & MOD_SHIFT)
 | 
				
			||||||
				c = evdev_keymap[key].code[1];
 | 
									c = evdev_keymap[key].code[1];
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
				c = evdev_keymap[key].code[0];
 | 
									c = evdev_keymap[key].code[0];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue