Liming,


  Ok, because the origin code in Unix Host numeric pad has no function in shell 
environment .

I have tested the X11 ABI on my hand (Ubuntu 18.04), no matter “numlock” is 
activated or not ,we can’t get “XK_KP_0 ~ XK_KP_9” from  XGetKeyboardMapping  
We just can get “numLock” key status.









发送自 Windows 10 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>应用



________________________________
发件人: Gao, Liming <liming....@intel.com>
发送时间: Monday, November 19, 2018 8:52:10 AM
收件人: Liu Yu; "af...@apple.com; jordan.l.jus...@intel.com ; ruiyu.ni"@intel.com
抄送: edk2-devel@lists.01.org
主题: RE: [edk2] EmulatorPkg/Unix/Host fixed numeric pad function

Yu:
  Could you add the reason why make this change?

  Besides, please add Contributed-under: TianoCore Contribution Agreement 1.1 
before Signed-off-by. And, add Cc: to the package maintainers. Then, use git 
send-email to send this patch.

Thanks
Liming
>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Liu
>Yu
>Sent: Sunday, November 18, 2018 10:54 PM
>To: "af...@apple.com; jordan.l.jus...@intel.com ; ruiyu.ni"@intel.com
>Cc: edk2-devel@lists.01.org
>Subject: [edk2] EmulatorPkg/Unix/Host fixed numeric pad function
>
>add numeric pad key map
>
>Signed-off-by: Pedroa Liu <pedroa....@outlook.com>
>---
>  EmulatorPkg/Unix/Host/X11GraphicsWindow.c | 54 ++++++++++++++++++-
>----
>  1 file changed, 43 insertions(+), 11 deletions(-)
>
>diff --git a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
>b/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
>index a3cc28c223..573f0f1bfd 100644
>--- a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
>+++ b/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
>@@ -271,7 +271,14 @@ handleKeyEvent (
>      }
>    }
>
>-  // Skipping EFI_MENU_KEY_PRESSED and EFI_SYS_REQ_PRESSED
>+  if ((ev->xkey.state & Mod2Mask) == 0) {
>+    Drv->KeyState.KeyToggleState &= ~EFI_NUM_LOCK_ACTIVE;
>+  } else {
>+    if (Make) {
>+      Drv->KeyState.KeyToggleState |= EFI_NUM_LOCK_ACTIVE;
>+    }
>+  }
>+ // Skipping EFI_MENU_KEY_PRESSED and EFI_SYS_REQ_PRESSED
>
>    switch (*KeySym) {
>    case XK_Control_R:
>@@ -328,35 +335,70 @@ handleKeyEvent (
>      break;
>
>    case XK_KP_Home:
>+    if ((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE))) {
>+      KeyData.Key.UnicodeChar = L'7'; break;
>+    }
>    case XK_Home:       KeyData.Key.ScanCode = SCAN_HOME; break;
>
>    case XK_KP_End:
>+    if ((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE))) {
>+      KeyData.Key.UnicodeChar = L'1'; break;
>+    }
>    case XK_End:        KeyData.Key.ScanCode = SCAN_END; break;
>
>    case XK_KP_Left:
>+    if ((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE))) {
>+      KeyData.Key.UnicodeChar = L'4'; break;
>+    }
>    case XK_Left:       KeyData.Key.ScanCode = SCAN_LEFT; break;
>
>    case XK_KP_Right:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+      KeyData.Key.UnicodeChar = L'6'; break;
>+    }
>    case XK_Right:      KeyData.Key.ScanCode = SCAN_RIGHT; break;
>
>    case XK_KP_Up:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+      KeyData.Key.UnicodeChar = L'8'; break;
>+    }
>    case XK_Up:         KeyData.Key.ScanCode = SCAN_UP; break;
>
>    case XK_KP_Down:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+      KeyData.Key.UnicodeChar = L'2'; break;
>+    }
>    case XK_Down:       KeyData.Key.ScanCode = SCAN_DOWN; break;
>
>    case XK_KP_Delete:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+      KeyData.Key.UnicodeChar = L'.'; break;
>+    }
>    case XK_Delete:       KeyData.Key.ScanCode = SCAN_DELETE; break;
>
>    case XK_KP_Insert:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+      KeyData.Key.UnicodeChar = L'0';break;
>+    }
>    case XK_Insert:     KeyData.Key.ScanCode = SCAN_INSERT; break;
>
>    case XK_KP_Page_Up:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+      KeyData.Key.UnicodeChar = L'9'; break;
>+    }
>    case XK_Page_Up:    KeyData.Key.ScanCode = SCAN_PAGE_UP; break;
>
>    case XK_KP_Page_Down:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+      KeyData.Key.UnicodeChar = L'3'; break;
>+    }
>    case XK_Page_Down:  KeyData.Key.ScanCode = SCAN_PAGE_DOWN; break;
>
>+  case XK_KP_Begin:
>+    if((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED |
>EFI_RIGHT_SHIFT_PRESSED)) ^ (Drv->KeyState.KeyToggleState &
>(EFI_NUM_LOCK_ACTIVE)) ){
>+      KeyData.Key.UnicodeChar = L'5'; break;
>+    }
>+    /* no map efi scan code */ break;
>    case XK_Escape:     KeyData.Key.ScanCode = SCAN_ESC; break;
>
>    case XK_Pause:      KeyData.Key.ScanCode = SCAN_PAUSE; break;
>@@ -431,16 +473,6 @@ handleKeyEvent (
>    case XK_KP_Decimal    : KeyData.Key.UnicodeChar = L'.'; break;
>    case XK_KP_Divide     : KeyData.Key.UnicodeChar = L'/'; break;
>
>-  case XK_KP_0    : KeyData.Key.UnicodeChar = L'0'; break;
>-  case XK_KP_1    : KeyData.Key.UnicodeChar = L'1'; break;
>-  case XK_KP_2    : KeyData.Key.UnicodeChar = L'2'; break;
>-  case XK_KP_3    : KeyData.Key.UnicodeChar = L'3'; break;
>-  case XK_KP_4    : KeyData.Key.UnicodeChar = L'4'; break;
>-  case XK_KP_5    : KeyData.Key.UnicodeChar = L'5'; break;
>-  case XK_KP_6    : KeyData.Key.UnicodeChar = L'6'; break;
>-  case XK_KP_7    : KeyData.Key.UnicodeChar = L'7'; break;
>-  case XK_KP_8    : KeyData.Key.UnicodeChar = L'8'; break;
>-  case XK_KP_9    : KeyData.Key.UnicodeChar = L'9'; break;
>
>    default:
>      ;
>--
>2.17.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to