From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: ray.ni@intel.com) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by groups.io with SMTP; Wed, 25 Sep 2019 15:32:58 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2019 15:32:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,549,1559545200"; d="scan'208";a="219146136" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga002.fm.intel.com with ESMTP; 25 Sep 2019 15:32:57 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 25 Sep 2019 15:32:57 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 25 Sep 2019 15:32:57 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.32]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.195]) with mapi id 14.03.0439.000; Thu, 26 Sep 2019 06:32:55 +0800 From: "Ni, Ray" To: =?iso-8859-1?Q?Marvin_H=E4user?= , "devel@edk2.groups.io" CC: "Justen, Jordan L" , Andrew Fish Subject: Re: [PATCH] WinHost: Add SimplePointer support Thread-Topic: [PATCH] WinHost: Add SimplePointer support Thread-Index: AQHVctYNzIw1Y7l3LUmZIP4c1t7x5ac8/H7g Date: Wed, 25 Sep 2019 22:32:54 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C2F2205@SHSMSX104.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiM2MyOGYyOWUtMzk0ZS00NDUwLWE3M2ItMzQ2ZmZlZjMzOWUxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiYmE1cEFHTzF5U3VDQzZqUll4eVhHRjNYQzVHcndsVTBhM3NXK3dDQ0NkSHUxR3d2RUdacGdaRXdRWlIwc0RHaCJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Marvin, Can you kindly share what unit test you've done? > -----Original Message----- > From: Marvin H=E4user > Sent: Tuesday, September 24, 2019 5:46 AM > To: devel@edk2.groups.io > Cc: Justen, Jordan L ; Andrew Fish ; Ni, Ray > Subject: [PATCH] WinHost: Add SimplePointer support >=20 > From: Marvin Haeuser >=20 > Catch WM mouse events and expose them via the SimplePointer protocol. >=20 > Cc: Jordan Justen > Cc: Andrew Fish > Cc: Ray Ni > Signed-off-by: Marvin Haeuser > --- > EmulatorPkg/Win/Host/WinGopInput.c | 25 ++++++++++-- > EmulatorPkg/Win/Host/WinGopScreen.c | 41 ++++++++++++++++++++ > EmulatorPkg/Win/Host/WinGop.h | 5 +++ > EmulatorPkg/Win/Host/WinInclude.h | 1 + > 4 files changed, 69 insertions(+), 3 deletions(-) >=20 > diff --git a/EmulatorPkg/Win/Host/WinGopInput.c b/EmulatorPkg/Win/Host/Wi= nGopInput.c > index 0e8d11fc57ac..312a549847c5 100644 > --- a/EmulatorPkg/Win/Host/WinGopInput.c > +++ b/EmulatorPkg/Win/Host/WinGopInput.c > @@ -409,9 +409,12 @@ WinNtWndCheckPointer ( >=20 >=20 > Private =3D GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo); >=20 >=20 >=20 > - return EFI_NOT_READY; >=20 > -} >=20 > + if (!Private->PointerStateChanged) { >=20 > + return EFI_NOT_READY; >=20 > + } >=20 >=20 >=20 > + return EFI_SUCCESS; >=20 > +} >=20 >=20 >=20 > EFI_STATUS >=20 > EFIAPI >=20 > @@ -424,5 +427,21 @@ WinNtWndGetPointerState ( >=20 >=20 > Private =3D GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo); >=20 >=20 >=20 > - return EFI_NOT_READY; >=20 > + if (!Private->PointerStateChanged) { >=20 > + return EFI_NOT_READY; >=20 > + } >=20 > + >=20 > + State->RelativeMovementX =3D Private->PointerState.RelativeMovementX; >=20 > + State->RelativeMovementY =3D Private->PointerState.RelativeMovementY; >=20 > + State->RelativeMovementZ =3D Private->PointerState.RelativeMovementZ; >=20 > + State->LeftButton =3D Private->PointerState.LeftButton; >=20 > + State->RightButton =3D Private->PointerState.RightButton; >=20 > + >=20 > + Private->PointerState.RelativeMovementX =3D 0; >=20 > + Private->PointerState.RelativeMovementY =3D 0; >=20 > + Private->PointerState.RelativeMovementZ =3D 0; >=20 > + >=20 > + Private->PointerStateChanged =3D FALSE; >=20 > + >=20 > + return EFI_SUCCESS; >=20 > } >=20 > diff --git a/EmulatorPkg/Win/Host/WinGopScreen.c b/EmulatorPkg/Win/Host/W= inGopScreen.c > index 8f42606823f1..fa34596497f8 100644 > --- a/EmulatorPkg/Win/Host/WinGopScreen.c > +++ b/EmulatorPkg/Win/Host/WinGopScreen.c > @@ -399,6 +399,8 @@ WinNtGopThreadWindowProc ( > LPARAM Index; >=20 > EFI_INPUT_KEY Key; >=20 > BOOLEAN AltIsPress; >=20 > + INT32 PosX; >=20 > + INT32 PosY; >=20 >=20 >=20 > // >=20 > // Use mTlsIndex global to get a Thread Local Storage version of Priva= te. >=20 > @@ -527,6 +529,45 @@ WinNtGopThreadWindowProc ( > WinNtGopConvertParamToEfiKeyShiftState (Private, &wParam, &lParam, F= ALSE); >=20 > return 0; >=20 >=20 >=20 > + case WM_MOUSEMOVE: >=20 > + PosX =3D GET_X_LPARAM (lParam); >=20 > + PosY =3D GET_Y_LPARAM (lParam); >=20 > + >=20 > + if (Private->PointerPreviousX !=3D PosX) { >=20 > + Private->PointerState.RelativeMovementX +=3D (PosX - Private->Poin= terPreviousX); >=20 > + Private->PointerPreviousX =3D PosX; >=20 > + Private->PointerStateChanged =3D TRUE; >=20 > + } >=20 > + >=20 > + if (Private->PointerPreviousY !=3D PosY) { >=20 > + Private->PointerState.RelativeMovementY +=3D (PosY - Private->Poin= terPreviousY); >=20 > + Private->PointerPreviousY =3D PosY; >=20 > + Private->PointerStateChanged =3D TRUE; >=20 > + } >=20 > + >=20 > + Private->PointerState.RelativeMovementZ =3D 0; >=20 > + return 0; >=20 > + >=20 > + case WM_LBUTTONDOWN: >=20 > + Private->PointerState.LeftButton =3D TRUE; >=20 > + Private->PointerStateChanged =3D TRUE; >=20 > + return 0; >=20 > + >=20 > + case WM_LBUTTONUP: >=20 > + Private->PointerState.LeftButton =3D FALSE; >=20 > + Private->PointerStateChanged =3D TRUE; >=20 > + return 0; >=20 > + >=20 > + case WM_RBUTTONDOWN: >=20 > + Private->PointerState.RightButton =3D TRUE; >=20 > + Private->PointerStateChanged =3D TRUE; >=20 > + return 0; >=20 > + >=20 > + case WM_RBUTTONUP: >=20 > + Private->PointerState.RightButton =3D FALSE; >=20 > + Private->PointerStateChanged =3D TRUE; >=20 > + return 0; >=20 > + >=20 > case WM_CLOSE: >=20 > // >=20 > // This close message is issued by user, core is not aware of this, >=20 > diff --git a/EmulatorPkg/Win/Host/WinGop.h b/EmulatorPkg/Win/Host/WinGop.= h > index aa41db6dbc8c..5943ca93b22f 100644 > --- a/EmulatorPkg/Win/Host/WinGop.h > +++ b/EmulatorPkg/Win/Host/WinGop.h > @@ -22,6 +22,7 @@ Abstract: >=20 >=20 > #include >=20 > #include >=20 > +#include >=20 > #include >=20 > #include >=20 > #include >=20 > @@ -109,6 +110,10 @@ typedef struct { > BOOLEAN ScrollLock; >=20 > BOOLEAN CapsLock; >=20 > BOOLEAN IsPartialKeySupport; >=20 > + INT32 PointerPreviousX; >=20 > + INT32 PointerPreviousY; >=20 > + BOOLEAN PointerStateChanged; >=20 > + EFI_SIMPLE_POINTER_STATE PointerState; >=20 > } GRAPHICS_PRIVATE_DATA; >=20 > #define GRAPHICS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('g', 'f', 'x', 'd= ') >=20 > #define GRAPHICS_PRIVATE_DATA_FROM_THIS(a) \ >=20 > diff --git a/EmulatorPkg/Win/Host/WinInclude.h b/EmulatorPkg/Win/Host/Win= Include.h > index ae02770d9fb0..8a9ae7d7465b 100644 > --- a/EmulatorPkg/Win/Host/WinInclude.h > +++ b/EmulatorPkg/Win/Host/WinInclude.h > @@ -40,6 +40,7 @@ typedef UINT32 size_t ; > #endif >=20 >=20 >=20 > #include "windows.h" >=20 > +#include "windowsx.h" >=20 >=20 >=20 > #undef GUID >=20 > #undef _LIST_ENTRY >=20 > -- > 2.23.0.windows.1