Add new flag SHIFT

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-08-19 02:21:36 +02:00
parent b6f7b4ba03
commit 2111447675
3 changed files with 19 additions and 9 deletions

View file

@ -20,6 +20,8 @@
#define GRUB_TERM_HEADER 1 #define GRUB_TERM_HEADER 1
/* Internal codes used by GRUB to represent terminal input. */ /* Internal codes used by GRUB to represent terminal input. */
/* Only for keys otherwise not having shifted modification. */
#define GRUB_TERM_SHIFT 0x01000000
#define GRUB_TERM_CTRL 0x02000000 #define GRUB_TERM_CTRL 0x02000000
#define GRUB_TERM_ALT 0x04000000 #define GRUB_TERM_ALT 0x04000000
/* Used by keylayouts code. Never returned in grub_getkey. */ /* Used by keylayouts code. Never returned in grub_getkey. */
@ -27,8 +29,8 @@
#define GRUB_TERM_CAPS 0x10000000 #define GRUB_TERM_CAPS 0x10000000
/* Keys without associated character. */ /* Keys without associated character. */
#define GRUB_TERM_EXTENDED 0x1000000 #define GRUB_TERM_EXTENDED 0x00800000
#define GRUB_TERM_KEY_MASK 0x1ffffff #define GRUB_TERM_KEY_MASK 0x00ffffff
#define GRUB_TERM_KEY_LEFT (GRUB_TERM_EXTENDED | 1) #define GRUB_TERM_KEY_LEFT (GRUB_TERM_EXTENDED | 1)
#define GRUB_TERM_KEY_RIGHT (GRUB_TERM_EXTENDED | 2) #define GRUB_TERM_KEY_RIGHT (GRUB_TERM_EXTENDED | 2)
#define GRUB_TERM_KEY_UP (GRUB_TERM_EXTENDED | 3) #define GRUB_TERM_KEY_UP (GRUB_TERM_EXTENDED | 3)

View file

@ -187,10 +187,14 @@ grub_at_keyboard_getkey_noblock (void)
key = -1; key = -1;
break; break;
default: default:
if ((at_keyboard_status & (KEYBOARD_STATUS_SHIFT_L if (at_keyboard_status & (KEYBOARD_STATUS_SHIFT_L
| KEYBOARD_STATUS_SHIFT_R)) | KEYBOARD_STATUS_SHIFT_R))
&& keyboard_map_shift[code]) {
key = keyboard_map_shift[code]; if (keyboard_map_shift[code])
key = keyboard_map_shift[code];
else
key = keyboard_map[code] | GRUB_TERM_SHIFT;
}
else else
key = keyboard_map[code]; key = keyboard_map[code];

View file

@ -162,10 +162,14 @@ grub_usb_keyboard_checkkey (struct grub_term_input *term __attribute__ ((unused)
#define GRUB_USB_KEYBOARD_RIGHT_ALT 0x40 #define GRUB_USB_KEYBOARD_RIGHT_ALT 0x40
/* Check if the Shift key was pressed. */ /* Check if the Shift key was pressed. */
if ((data[0] & GRUB_USB_KEYBOARD_LEFT_SHIFT if (data[0] & GRUB_USB_KEYBOARD_LEFT_SHIFT
|| data[0] & GRUB_USB_KEYBOARD_RIGHT_SHIFT) || data[0] & GRUB_USB_KEYBOARD_RIGHT_SHIFT)
&& keyboard_map_shift[data[2]]) {
key = keyboard_map_shift[data[2]]; if (keyboard_map_shift[data[2]])
key = keyboard_map_shift[data[2]];
else
key = keyboard_map[data[2]] | GRUB_TERM_SHIFT;
}
else else
key = keyboard_map[data[2]]; key = keyboard_map[data[2]];