From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=UOOR+Jbx; spf=pass (domain: outlook.com, ip: 40.92.65.44, mailfrom: marvin.haeuser@outlook.com) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (EUR01-HE1-obe.outbound.protection.outlook.com [40.92.65.44]) by groups.io with SMTP; Tue, 24 Sep 2019 05:46:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F5DEBxkl2RyUPNeg2Enx2fbWif/XZF3TTfxirI98wQz/WAb5ogSFMCfjKS9xghXke4N4lBGAzkYWni4iixQan32NXrFToNqfOA2J77vJ7t4AE0Dm//t+syEtV8/gn+hLcGe4n9qC0Rdh1Ix0xCg8LrQm0YXL5Zmm7zTTBmuMIlG6wRHBlcpIzhevttU27R3QMVA+h49boRccx74JqSm5VXa9onxv5iABHMH33irWfvKeGOiNsoAbWUjqmfPpsc75gEeXol+pFp4jbunjc7k6bH2tgX7IzVsmS5D4GXwyLwqYnWMRWi3PllQ44JoFwxMqkBPRVPIupdlSFpDGZhpZ0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xMRH1pOftwSFtTFxpoMBtnKEu0StIgP1KAW1IglYokA=; b=l83lYnfoophLWf5VcAhnlsCSEl7FPbykP76nIB9pFgNaFFDFeukcJNUySgrf5xZSnaO/8vku16YvpxNsJrSIfT/+ZA8zKcKxA/zaRr9IL4F/s7z7lujDmuk9zwGQzKRmrsAatJb5/i4Ne1ovCXknwx5y2ocsM4+KcO14ztTMH6Hlw/YYATGstqh7ukSpybGpJz+tV0Fq9xOQWPUxlr39zhsBJxxlTcmdUaidrznTWx+QzvIhmY8ltCiWWIiVJiVaUIv5X9tYxOhdovGiHpD8fhQAQ7VV67adT5uWXxVF82hJpenJ3yyYV7deHjO+QGOgF0014LhC4jYBoZ25p+tpAQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none 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=xMRH1pOftwSFtTFxpoMBtnKEu0StIgP1KAW1IglYokA=; b=UOOR+Jbx9okYaV5+Nd3Vkb+SskKjz/4InFXrAua8A0vWsfn6z3JaFg0I9sCXS3rig9AEfHeC9xG+LzDcX/c8WgjJHy42feARcV559vBQXN0KUzPrzd8ca9b0UQTEILFOdwyHHIWw/vCGT0okTLPmlZRdlORvxfhGCuUhHR++e6sim32qpXcZHUWNlZm9dwaxzEmxYrspNFVzAqazN5h2+q3VWTCIr3YUUwHsG7NIuSw0pecugQQgeUrnp47v4m2bTZkA6OuTJbZRxvN5KSIJYEHkdY9XnRpdZX6H8RTn5yQTEc1ctRQeT8NGm+c7j5tvvHb2hZDkS5vR4SzgOQTGdg== Received: from DB5EUR01FT038.eop-EUR01.prod.protection.outlook.com (10.152.4.58) by DB5EUR01HT086.eop-EUR01.prod.protection.outlook.com (10.152.5.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20; Tue, 24 Sep 2019 12:46:15 +0000 Received: from AM0PR07MB4386.eurprd07.prod.outlook.com (10.152.4.60) by DB5EUR01FT038.mail.protection.outlook.com (10.152.4.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20 via Frontend Transport; Tue, 24 Sep 2019 12:46:15 +0000 Received: from AM0PR07MB4386.eurprd07.prod.outlook.com ([fe80::6056:53c8:6f16:3d8]) by AM0PR07MB4386.eurprd07.prod.outlook.com ([fe80::6056:53c8:6f16:3d8%3]) with mapi id 15.20.2305.013; Tue, 24 Sep 2019 12:46:15 +0000 From: =?iso-8859-1?Q?Marvin_H=E4user?= To: "devel@edk2.groups.io" CC: Jordan Justen , Andrew Fish , Ray Ni Subject: [PATCH] WinHost: Add SimplePointer support Thread-Topic: [PATCH] WinHost: Add SimplePointer support Thread-Index: AQHVctYNzIw1Y7l3LUmZIP4c1t7x5Q== Date: Tue, 24 Sep 2019 12:46:14 +0000 Message-ID: References: In-Reply-To: Accept-Language: de-DE, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PR1PR01CA0027.eurprd01.prod.exchangelabs.com (2603:10a6:102::40) To AM0PR07MB4386.eurprd07.prod.outlook.com (2603:10a6:208:b3::11) x-incomingtopheadermarker: OriginalChecksum:EF6CF4DFF1E4B6420729A2EF128CF0C1F65DE3656111B1366EBF9A99891206C0;UpperCasedChecksum:EC0BB55861DB80C6A8649A45ADE82419CCCAE67B8E8DD723E5C6E3B694A28722;SizeAsReceived:7673;Count:51 x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.23.0.windows.1 x-tmn: [Qb9MGIUDAookI8URABkDbDkj0KBeqfvd] x-microsoft-original-message-id: <83e892c5513d3ad10d2cfc3ae5064cf17fd000d6.1569329060.git.mhaeuser@outlook.de> x-ms-publictraffictype: Email x-incomingheadercount: 51 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(5050001)(7020095)(20181119205)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031322404)(2017031323274)(2017031324274)(2017031321001)(1601125500)(1603101475)(1701031045);SRVR:DB5EUR01HT086; x-ms-traffictypediagnostic: DB5EUR01HT086: x-microsoft-antispam-message-info: FoOkObwx/MmJK5I6Lvo1jXV8hn1gNAQ61JQ6KLAUXFZJHVLqhX+XqStH/owZdM960lvJK+h1UXyCgzhADJdhgXqpoDfWQPF/jnEOOw+gw2G1rcUI69xLpBIcqXMUbVtLT+UdFrKQ9GgXxTOLbLIjH8Yvf1D3bq6s0zJ5+Q/W5H73yPGBy0AcVoTMhFroiANr x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 90e6935e-1a2c-4fa3-993b-08d740ed2f7a X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2019 12:46:14.7833 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5EUR01HT086 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable From: Marvin Haeuser Catch WM mouse events and expose them via the SimplePointer protocol. 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(-) diff --git a/EmulatorPkg/Win/Host/WinGopInput.c b/EmulatorPkg/Win/Host/WinG= opInput.c index 0e8d11fc57ac..312a549847c5 100644 --- a/EmulatorPkg/Win/Host/WinGopInput.c +++ b/EmulatorPkg/Win/Host/WinGopInput.c @@ -409,9 +409,12 @@ WinNtWndCheckPointer ( =0D Private =3D GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);=0D =0D - return EFI_NOT_READY;=0D -}=0D + if (!Private->PointerStateChanged) {=0D + return EFI_NOT_READY;=0D + }=0D =0D + return EFI_SUCCESS;=0D +}=0D =0D EFI_STATUS=0D EFIAPI=0D @@ -424,5 +427,21 @@ WinNtWndGetPointerState ( =0D Private =3D GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);=0D =0D - return EFI_NOT_READY;=0D + if (!Private->PointerStateChanged) {=0D + return EFI_NOT_READY;=0D + }=0D +=0D + State->RelativeMovementX =3D Private->PointerState.RelativeMovementX;=0D + State->RelativeMovementY =3D Private->PointerState.RelativeMovementY;=0D + State->RelativeMovementZ =3D Private->PointerState.RelativeMovementZ;=0D + State->LeftButton =3D Private->PointerState.LeftButton;=0D + State->RightButton =3D Private->PointerState.RightButton;=0D +=0D + Private->PointerState.RelativeMovementX =3D 0;=0D + Private->PointerState.RelativeMovementY =3D 0;=0D + Private->PointerState.RelativeMovementZ =3D 0;=0D +=0D + Private->PointerStateChanged =3D FALSE;=0D +=0D + return EFI_SUCCESS;=0D }=0D diff --git a/EmulatorPkg/Win/Host/WinGopScreen.c b/EmulatorPkg/Win/Host/Win= GopScreen.c index 8f42606823f1..fa34596497f8 100644 --- a/EmulatorPkg/Win/Host/WinGopScreen.c +++ b/EmulatorPkg/Win/Host/WinGopScreen.c @@ -399,6 +399,8 @@ WinNtGopThreadWindowProc ( LPARAM Index;=0D EFI_INPUT_KEY Key;=0D BOOLEAN AltIsPress;=0D + INT32 PosX;=0D + INT32 PosY;=0D =0D //=0D // Use mTlsIndex global to get a Thread Local Storage version of Private= .=0D @@ -527,6 +529,45 @@ WinNtGopThreadWindowProc ( WinNtGopConvertParamToEfiKeyShiftState (Private, &wParam, &lParam, FAL= SE);=0D return 0;=0D =0D + case WM_MOUSEMOVE:=0D + PosX =3D GET_X_LPARAM (lParam);=0D + PosY =3D GET_Y_LPARAM (lParam);=0D +=0D + if (Private->PointerPreviousX !=3D PosX) {=0D + Private->PointerState.RelativeMovementX +=3D (PosX - Private->Pointe= rPreviousX);=0D + Private->PointerPreviousX =3D PosX;=0D + Private->PointerStateChanged =3D TRUE;=0D + }=0D +=0D + if (Private->PointerPreviousY !=3D PosY) {=0D + Private->PointerState.RelativeMovementY +=3D (PosY - Private->Pointe= rPreviousY);=0D + Private->PointerPreviousY =3D PosY;=0D + Private->PointerStateChanged =3D TRUE;=0D + }=0D +=0D + Private->PointerState.RelativeMovementZ =3D 0;=0D + return 0;=0D +=0D + case WM_LBUTTONDOWN:=0D + Private->PointerState.LeftButton =3D TRUE;=0D + Private->PointerStateChanged =3D TRUE;=0D + return 0;=0D +=0D + case WM_LBUTTONUP:=0D + Private->PointerState.LeftButton =3D FALSE;=0D + Private->PointerStateChanged =3D TRUE;=0D + return 0;=0D +=0D + case WM_RBUTTONDOWN:=0D + Private->PointerState.RightButton =3D TRUE;=0D + Private->PointerStateChanged =3D TRUE;=0D + return 0;=0D +=0D + case WM_RBUTTONUP:=0D + Private->PointerState.RightButton =3D FALSE;=0D + Private->PointerStateChanged =3D TRUE;=0D + return 0;=0D +=0D case WM_CLOSE:=0D //=0D // This close message is issued by user, core is not aware of this,=0D 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: =0D #include =0D #include =0D +#include =0D #include =0D #include =0D #include =0D @@ -109,6 +110,10 @@ typedef struct { BOOLEAN ScrollLock;=0D BOOLEAN CapsLock;=0D BOOLEAN IsPartialKeySupport;=0D + INT32 PointerPreviousX;=0D + INT32 PointerPreviousY;=0D + BOOLEAN PointerStateChanged;=0D + EFI_SIMPLE_POINTER_STATE PointerState;=0D } GRAPHICS_PRIVATE_DATA;=0D #define GRAPHICS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('g', 'f', 'x', 'd')= =0D #define GRAPHICS_PRIVATE_DATA_FROM_THIS(a) \=0D diff --git a/EmulatorPkg/Win/Host/WinInclude.h b/EmulatorPkg/Win/Host/WinIn= clude.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=0D =0D #include "windows.h"=0D +#include "windowsx.h"=0D =0D #undef GUID=0D #undef _LIST_ENTRY=0D --=20 2.23.0.windows.1