+ KeyData.Key.ScanCode = 0;
+ KeyData.Key.UnicodeChar = 0;
+ KeyData.KeyState.KeyShiftState = 0;
+
+ //
+ // KeyRelease is not supported (on Mac) so we can not easily implement Ex functions.
+ // If a modifier key is hit by its self we get a keysym. If a modfifier and key is hit
+ // we get the state bit set and keysym is the modified key.
+ //
+ // We use lack of state bits being set to clear ToggleState and KeyShiftState. We can
+ // also use the stat bits to set ToggleState and KeyShiftState.
+ // Skipping EFI_SCROLL_LOCK_ACTIVE & EFI_NUM_LOCK_ACTIVE since they are not on Macs
+ //
+ if ((ev->xkey.state & LockMask) == 0) {
+ drv->KeyState.KeyToggleState &= ~EFI_CAPS_LOCK_ACTIVE;
+ } else {
+ drv->KeyState.KeyToggleState |= EFI_CAPS_LOCK_ACTIVE;
+ }
+
+ if ((ev->xkey.state & ControlMask) == 0) {
+ drv->KeyState.KeyShiftState &= ~(EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED);
+ } else if ((drv->KeyState.KeyShiftState & EFI_RIGHT_CONTROL_PRESSED) == 0) {
+ drv->KeyState.KeyShiftState |= EFI_LEFT_CONTROL_PRESSED;
+ }
+
+ if ((ev->xkey.state & ShiftMask) == 0) {
+ drv->KeyState.KeyShiftState &= ~(EFI_RIGHT_SHIFT_PRESSED | EFI_LEFT_SHIFT_PRESSED);
+ } else if ((drv->KeyState.KeyShiftState & EFI_RIGHT_SHIFT_PRESSED) == 0) {
+ drv->KeyState.KeyShiftState |= EFI_LEFT_SHIFT_PRESSED;
+ }
+
+ if ((ev->xkey.state & Mod2Mask) == 0) {
+ drv->KeyState.KeyShiftState &= ~(EFI_RIGHT_LOGO_PRESSED | EFI_LEFT_LOGO_PRESSED);
+ } else if ((drv->KeyState.KeyShiftState & EFI_RIGHT_LOGO_PRESSED) == 0) {
+ drv->KeyState.KeyShiftState |= EFI_LEFT_LOGO_PRESSED;
+ }
+
+ if ((ev->xkey.state & 0x2000) == 0) {
+ drv->KeyState.KeyShiftState &= ~(EFI_LEFT_ALT_PRESSED);
+ } else {
+ drv->KeyState.KeyShiftState |= EFI_LEFT_ALT_PRESSED;
+ }
+
+