From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.92.255.82; helo=apc01-hk2-obe.outbound.protection.outlook.com; envelope-from=pedroa.liu@outlook.com; receiver=edk2-devel@lists.01.org Received: from APC01-HK2-obe.outbound.protection.outlook.com (mail-oln040092255082.outbound.protection.outlook.com [40.92.255.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 057782118F770 for ; Mon, 19 Nov 2018 05:03:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WBDBMP/Z8v/ZYOwceBBvRjdCAjGnKwvthp4Xsl+UaFE=; b=f0oNpNh7rPJunDCbosXbPvLvZI3Km4+F6jCuzIEjSPjyO6376Oc5LrfnzQTMjkPHTE+feDZU33q+OU/+WkWzedsVDw5Y3vAh+Jg11aairnCE/D++KJEqTNBiB5eaPemHTFxD4+MGaZAbWs7+VQ84eFQ9Ejt4uwBLktmxkG1vFfLIPttKGTxfpfMnDO+7FgD3dSAGaXcbCoEVsJh3VlSAJ9S0tPS2dJI/yPopOjWr3KxwEcQOyoXgp8w+k5kbQKLP7m3fdZpusuz4KLEKz/nnByd7Jbn8sLfjN+0Yl7M7bBFZYnKxE7p5+bJQHwLkm4df9spAFW5Ad0lg2pU6EcG5wA== Received: from HK2APC01FT003.eop-APC01.prod.protection.outlook.com (10.152.248.51) by HK2APC01HT230.eop-APC01.prod.protection.outlook.com (10.152.249.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1339.10; Mon, 19 Nov 2018 13:03:31 +0000 Received: from TY2PR02MB2831.apcprd02.prod.outlook.com (10.152.248.55) by HK2APC01FT003.mail.protection.outlook.com (10.152.248.173) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1339.10 via Frontend Transport; Mon, 19 Nov 2018 13:03:31 +0000 Received: from TY2PR02MB2831.apcprd02.prod.outlook.com ([fe80::14e4:c263:fc12:13e0]) by TY2PR02MB2831.apcprd02.prod.outlook.com ([fe80::14e4:c263:fc12:13e0%5]) with mapi id 15.20.1294.048; Mon, 19 Nov 2018 13:03:31 +0000 From: Liu Yu To: "jordan.l.justen@intel.com" , "afish@apple.com" , "ruiyu.ni@intel.com" CC: "edk2-devel@lists.01.org" , Liu Yu Thread-Topic: [PATCH v2] [edk2] EmulatorPkg/Unix/Host fixed numeric pad function Thread-Index: AQHUgAhFXc2R/KwJRE6BX8W/Im+axQ== Date: Mon, 19 Nov 2018 13:03:31 +0000 Message-ID: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK0PR03CA0039.apcprd03.prod.outlook.com (2603:1096:203:2f::27) To TY2PR02MB2831.apcprd02.prod.outlook.com (2603:1096:404:47::11) x-incomingtopheadermarker: OriginalChecksum:BE32D839AD08F5E2EDBC9315E6A57B278A84002B8CAAD1977B2FC4362DEB83CD; UpperCasedChecksum:49D00B72FACBE962EFC4E1D949708348059B659D592B5EB75824CE37B7CC8A51; SizeAsReceived:7486; Count:48 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [kQWSNkJ6Gp3BJVyj4h4ZBGcplgJprXQQ] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HK2APC01HT230; 6:uIdbe8BjGLzYczJWct8L4G+miDYUaWapkb5DIWtcwTVk+e5ZGFRwmQbrzZvP163EqhLADt7v5QQl3H7s2NmeMpREAKDEeVnfJgr9SReUEhlRlhrIBM1qo8Ia8Ve2OuoNnaCReb9Gzzu86HT+ediBvfez2CARaFdCLIlL9nhrKd8uqECCCuwLrLAseMf4Tl2I1qr1VkVbXc/Y59dBUp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0Ky4MCoqtkmGsKGjRuEiZ7vLNW5u/dWN8q7hJcltw8dEAV69BAFqmAw6MOyHzyM57qeQSxqiSG/vVSQnAoY726ZV6FjvkwqiaVoJ1EscBw7tv76AQa5NKkzMVXFiHkHyFB3J1/u+JRnj4/sX0tkYodLaHmtVXljmSB4DBDSNCTeZ8ENaGN3OwGwpyqLFi+T3HyI7mWb3Jo4gShJ3Rtz3KbZwvgEjIRiQNbW0UelH0xrawfhvNr478F6rnInQlTXxlgqzNvY+S4C9leSdDHyOEHCfHGMPZelP2xc3uXtGUXPPwlq4jpMCk4GuHSDCaPhr1BpsQN2Esj3MY139GWdU= x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(201702181274)(2017031322404)(1603101475)(1601125500)(1701031045); SRVR:HK2APC01HT230; x-ms-traffictypediagnostic: HK2APC01HT230: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(4566010)(82015058); SRVR:HK2APC01HT230; BCL:0; PCL:0; RULEID:; SRVR:HK2APC01HT230; x-microsoft-antispam-message-info: 0OE+3/6h2fv9JnhrkSGXoHKFNxlTaKKAPhEM/Iy+3uuVjEr/Q+1p6SK6KGBBPx1O MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 5dab7a8a-ebdc-4bd9-9cfd-67cde50b170b X-MS-Exchange-CrossTenant-Network-Message-Id: 28b609ca-35e9-4bd7-ac38-08d64e1f676b X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 5dab7a8a-ebdc-4bd9-9cfd-67cde50b170b X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Nov 2018 13:03:31.6073 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2APC01HT230 Subject: [PATCH v2] EmulatorPkg/Unix/Host fixed numeric pad function X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Nov 2018 13:03:35 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable From: Pedroa Liu origin code in Unix Host numeric pad has no function in shell environment since we can't get "XK_KP_0 ~ XK_KP_9" from XGetKeyboardMapping just can get "numlock" key status. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Pedroa Liu --- EmulatorPkg/Unix/Host/X11GraphicsWindow.c | 54 ++++++++++++++++++----- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c b/EmulatorPkg/Unix/H= ost/X11GraphicsWindow.c index a3cc28c223..573f0f1bfd 100644 --- a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c +++ b/EmulatorPkg/Unix/Host/X11GraphicsWindow.c @@ -271,7 +271,14 @@ handleKeyEvent ( } } =20 - // Skipping EFI_MENU_KEY_PRESSED and EFI_SYS_REQ_PRESSED + if ((ev->xkey.state & Mod2Mask) =3D=3D 0) { + Drv->KeyState.KeyToggleState &=3D ~EFI_NUM_LOCK_ACTIVE; + } else { + if (Make) { + Drv->KeyState.KeyToggleState |=3D EFI_NUM_LOCK_ACTIVE; + } + } + // Skipping EFI_MENU_KEY_PRESSED and EFI_SYS_REQ_PRESSED =20 switch (*KeySym) { case XK_Control_R: @@ -328,35 +335,70 @@ handleKeyEvent ( break; =20 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 =3D L'7'; break; + } case XK_Home: KeyData.Key.ScanCode =3D SCAN_HOME; break; =20 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 =3D L'1'; break; + } case XK_End: KeyData.Key.ScanCode =3D SCAN_END; break; =20 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 =3D L'4'; break; + } case XK_Left: KeyData.Key.ScanCode =3D SCAN_LEFT; break; =20 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 =3D L'6'; break; + } case XK_Right: KeyData.Key.ScanCode =3D SCAN_RIGHT; break; =20 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 =3D L'8'; break; + } case XK_Up: KeyData.Key.ScanCode =3D SCAN_UP; break; =20 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 =3D L'2'; break; + } case XK_Down: KeyData.Key.ScanCode =3D SCAN_DOWN; break; =20 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 =3D L'.'; break; + } case XK_Delete: KeyData.Key.ScanCode =3D SCAN_DELETE; break; =20 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 =3D L'0';break; + } case XK_Insert: KeyData.Key.ScanCode =3D SCAN_INSERT; break; =20 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 =3D L'9'; break; + } case XK_Page_Up: KeyData.Key.ScanCode =3D SCAN_PAGE_UP; break; =20 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 =3D L'3'; break; + } case XK_Page_Down: KeyData.Key.ScanCode =3D SCAN_PAGE_DOWN; break; =20 + 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 =3D L'5'; break; + } + /* no map efi scan code */ break; case XK_Escape: KeyData.Key.ScanCode =3D SCAN_ESC; break; =20 case XK_Pause: KeyData.Key.ScanCode =3D SCAN_PAUSE; break; @@ -431,16 +473,6 @@ handleKeyEvent ( case XK_KP_Decimal : KeyData.Key.UnicodeChar =3D L'.'; break; case XK_KP_Divide : KeyData.Key.UnicodeChar =3D L'/'; break; =20 - case XK_KP_0 : KeyData.Key.UnicodeChar =3D L'0'; break; - case XK_KP_1 : KeyData.Key.UnicodeChar =3D L'1'; break; - case XK_KP_2 : KeyData.Key.UnicodeChar =3D L'2'; break; - case XK_KP_3 : KeyData.Key.UnicodeChar =3D L'3'; break; - case XK_KP_4 : KeyData.Key.UnicodeChar =3D L'4'; break; - case XK_KP_5 : KeyData.Key.UnicodeChar =3D L'5'; break; - case XK_KP_6 : KeyData.Key.UnicodeChar =3D L'6'; break; - case XK_KP_7 : KeyData.Key.UnicodeChar =3D L'7'; break; - case XK_KP_8 : KeyData.Key.UnicodeChar =3D L'8'; break; - case XK_KP_9 : KeyData.Key.UnicodeChar =3D L'9'; break; =20 default: ; --=20 2.17.1