public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] WinHost: Add SimplePointer support
       [not found] <d65f328a1d27ba0b84917426d86c14718187ed42.1569329065.git.mhaeuser@outlook.de>
@ 2019-09-24 12:46 ` Marvin Häuser
  2019-09-25 22:32   ` Ni, Ray
  0 siblings, 1 reply; 6+ messages in thread
From: Marvin Häuser @ 2019-09-24 12:46 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Jordan Justen, Andrew Fish, Ray Ni

From: Marvin Haeuser <mhaeuser@outlook.de>

Catch WM mouse events and expose them via the SimplePointer protocol.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
---
 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/WinGopInput.c
index 0e8d11fc57ac..312a549847c5 100644
--- a/EmulatorPkg/Win/Host/WinGopInput.c
+++ b/EmulatorPkg/Win/Host/WinGopInput.c
@@ -409,9 +409,12 @@ WinNtWndCheckPointer (
 
   Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
 
-  return EFI_NOT_READY;
-}
+  if (!Private->PointerStateChanged) {
+    return EFI_NOT_READY;
+  }
 
+  return EFI_SUCCESS;
+}
 
 EFI_STATUS
 EFIAPI
@@ -424,5 +427,21 @@ WinNtWndGetPointerState (
 
   Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
 
-  return EFI_NOT_READY;
+  if (!Private->PointerStateChanged) {
+    return EFI_NOT_READY;
+  }
+
+  State->RelativeMovementX = Private->PointerState.RelativeMovementX;
+  State->RelativeMovementY = Private->PointerState.RelativeMovementY;
+  State->RelativeMovementZ = Private->PointerState.RelativeMovementZ;
+  State->LeftButton        = Private->PointerState.LeftButton;
+  State->RightButton       = Private->PointerState.RightButton;
+
+  Private->PointerState.RelativeMovementX = 0;
+  Private->PointerState.RelativeMovementY = 0;
+  Private->PointerState.RelativeMovementZ = 0;
+
+  Private->PointerStateChanged = FALSE;
+
+  return EFI_SUCCESS;
 }
diff --git a/EmulatorPkg/Win/Host/WinGopScreen.c b/EmulatorPkg/Win/Host/WinGopScreen.c
index 8f42606823f1..fa34596497f8 100644
--- a/EmulatorPkg/Win/Host/WinGopScreen.c
+++ b/EmulatorPkg/Win/Host/WinGopScreen.c
@@ -399,6 +399,8 @@ WinNtGopThreadWindowProc (
   LPARAM                Index;
   EFI_INPUT_KEY         Key;
   BOOLEAN               AltIsPress;
+  INT32                 PosX;
+  INT32                 PosY;
 
   //
   // Use mTlsIndex global to get a Thread Local Storage version of Private.
@@ -527,6 +529,45 @@ WinNtGopThreadWindowProc (
     WinNtGopConvertParamToEfiKeyShiftState (Private, &wParam, &lParam, FALSE);
     return 0;
 
+  case WM_MOUSEMOVE:
+    PosX = GET_X_LPARAM (lParam);
+    PosY = GET_Y_LPARAM (lParam);
+
+    if (Private->PointerPreviousX != PosX) {
+      Private->PointerState.RelativeMovementX += (PosX - Private->PointerPreviousX);
+      Private->PointerPreviousX                = PosX;
+      Private->PointerStateChanged             = TRUE;
+    }
+
+    if (Private->PointerPreviousY != PosY) {
+      Private->PointerState.RelativeMovementY += (PosY - Private->PointerPreviousY);
+      Private->PointerPreviousY                = PosY;
+      Private->PointerStateChanged             = TRUE;
+    }
+
+    Private->PointerState.RelativeMovementZ  = 0;
+    return 0;
+
+  case WM_LBUTTONDOWN:
+    Private->PointerState.LeftButton = TRUE;
+    Private->PointerStateChanged     = TRUE;
+    return 0;
+
+  case WM_LBUTTONUP:
+    Private->PointerState.LeftButton = FALSE;
+    Private->PointerStateChanged     = TRUE;
+    return 0;
+
+  case WM_RBUTTONDOWN:
+    Private->PointerState.RightButton = TRUE;
+    Private->PointerStateChanged      = TRUE;
+    return 0;
+
+  case WM_RBUTTONUP:
+    Private->PointerState.RightButton = FALSE;
+    Private->PointerStateChanged      = TRUE;
+    return 0;
+
   case WM_CLOSE:
     //
     // This close message is issued by user, core is not aware of this,
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:
 
 #include <Protocol/EmuIoThunk.h>
 #include <Protocol/EmuGraphicsWindow.h>
+#include <Protocol/SimplePointer.h>
 #include <Protocol/SimpleTextIn.h>
 #include <Protocol/SimpleTextInEx.h>
 #include <Protocol/GraphicsOutput.h>
@@ -109,6 +110,10 @@ typedef struct {
   BOOLEAN                           ScrollLock;
   BOOLEAN                           CapsLock;
   BOOLEAN                           IsPartialKeySupport;
+  INT32                             PointerPreviousX;
+  INT32                             PointerPreviousY;
+  BOOLEAN                           PointerStateChanged;
+  EFI_SIMPLE_POINTER_STATE          PointerState;
 } GRAPHICS_PRIVATE_DATA;
 #define GRAPHICS_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('g', 'f', 'x', 'd')
 #define GRAPHICS_PRIVATE_DATA_FROM_THIS(a)  \
diff --git a/EmulatorPkg/Win/Host/WinInclude.h b/EmulatorPkg/Win/Host/WinInclude.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
 
 #include "windows.h"
+#include "windowsx.h"
 
 #undef GUID
 #undef _LIST_ENTRY
-- 
2.23.0.windows.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] WinHost: Add SimplePointer support
  2019-09-24 12:46 ` [PATCH] WinHost: Add SimplePointer support Marvin Häuser
@ 2019-09-25 22:32   ` Ni, Ray
  2019-09-26 16:37     ` Marvin Häuser
  0 siblings, 1 reply; 6+ messages in thread
From: Ni, Ray @ 2019-09-25 22:32 UTC (permalink / raw)
  To: Marvin Häuser, devel@edk2.groups.io; +Cc: Justen, Jordan L, Andrew Fish

Marvin,
Can you kindly share what unit test you've done?

> -----Original Message-----
> From: Marvin Häuser <Marvin.Haeuser@outlook.com>
> Sent: Tuesday, September 24, 2019 5:46 AM
> To: devel@edk2.groups.io
> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Andrew Fish <afish@apple.com>; Ni, Ray <ray.ni@intel.com>
> Subject: [PATCH] WinHost: Add SimplePointer support
> 
> From: Marvin Haeuser <mhaeuser@outlook.de>
> 
> Catch WM mouse events and expose them via the SimplePointer protocol.
> 
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
> ---
>  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/WinGopInput.c
> index 0e8d11fc57ac..312a549847c5 100644
> --- a/EmulatorPkg/Win/Host/WinGopInput.c
> +++ b/EmulatorPkg/Win/Host/WinGopInput.c
> @@ -409,9 +409,12 @@ WinNtWndCheckPointer (
> 
> 
>    Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
> 
> 
> 
> -  return EFI_NOT_READY;
> 
> -}
> 
> +  if (!Private->PointerStateChanged) {
> 
> +    return EFI_NOT_READY;
> 
> +  }
> 
> 
> 
> +  return EFI_SUCCESS;
> 
> +}
> 
> 
> 
>  EFI_STATUS
> 
>  EFIAPI
> 
> @@ -424,5 +427,21 @@ WinNtWndGetPointerState (
> 
> 
>    Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
> 
> 
> 
> -  return EFI_NOT_READY;
> 
> +  if (!Private->PointerStateChanged) {
> 
> +    return EFI_NOT_READY;
> 
> +  }
> 
> +
> 
> +  State->RelativeMovementX = Private->PointerState.RelativeMovementX;
> 
> +  State->RelativeMovementY = Private->PointerState.RelativeMovementY;
> 
> +  State->RelativeMovementZ = Private->PointerState.RelativeMovementZ;
> 
> +  State->LeftButton        = Private->PointerState.LeftButton;
> 
> +  State->RightButton       = Private->PointerState.RightButton;
> 
> +
> 
> +  Private->PointerState.RelativeMovementX = 0;
> 
> +  Private->PointerState.RelativeMovementY = 0;
> 
> +  Private->PointerState.RelativeMovementZ = 0;
> 
> +
> 
> +  Private->PointerStateChanged = FALSE;
> 
> +
> 
> +  return EFI_SUCCESS;
> 
>  }
> 
> diff --git a/EmulatorPkg/Win/Host/WinGopScreen.c b/EmulatorPkg/Win/Host/WinGopScreen.c
> index 8f42606823f1..fa34596497f8 100644
> --- a/EmulatorPkg/Win/Host/WinGopScreen.c
> +++ b/EmulatorPkg/Win/Host/WinGopScreen.c
> @@ -399,6 +399,8 @@ WinNtGopThreadWindowProc (
>    LPARAM                Index;
> 
>    EFI_INPUT_KEY         Key;
> 
>    BOOLEAN               AltIsPress;
> 
> +  INT32                 PosX;
> 
> +  INT32                 PosY;
> 
> 
> 
>    //
> 
>    // Use mTlsIndex global to get a Thread Local Storage version of Private.
> 
> @@ -527,6 +529,45 @@ WinNtGopThreadWindowProc (
>      WinNtGopConvertParamToEfiKeyShiftState (Private, &wParam, &lParam, FALSE);
> 
>      return 0;
> 
> 
> 
> +  case WM_MOUSEMOVE:
> 
> +    PosX = GET_X_LPARAM (lParam);
> 
> +    PosY = GET_Y_LPARAM (lParam);
> 
> +
> 
> +    if (Private->PointerPreviousX != PosX) {
> 
> +      Private->PointerState.RelativeMovementX += (PosX - Private->PointerPreviousX);
> 
> +      Private->PointerPreviousX                = PosX;
> 
> +      Private->PointerStateChanged             = TRUE;
> 
> +    }
> 
> +
> 
> +    if (Private->PointerPreviousY != PosY) {
> 
> +      Private->PointerState.RelativeMovementY += (PosY - Private->PointerPreviousY);
> 
> +      Private->PointerPreviousY                = PosY;
> 
> +      Private->PointerStateChanged             = TRUE;
> 
> +    }
> 
> +
> 
> +    Private->PointerState.RelativeMovementZ  = 0;
> 
> +    return 0;
> 
> +
> 
> +  case WM_LBUTTONDOWN:
> 
> +    Private->PointerState.LeftButton = TRUE;
> 
> +    Private->PointerStateChanged     = TRUE;
> 
> +    return 0;
> 
> +
> 
> +  case WM_LBUTTONUP:
> 
> +    Private->PointerState.LeftButton = FALSE;
> 
> +    Private->PointerStateChanged     = TRUE;
> 
> +    return 0;
> 
> +
> 
> +  case WM_RBUTTONDOWN:
> 
> +    Private->PointerState.RightButton = TRUE;
> 
> +    Private->PointerStateChanged      = TRUE;
> 
> +    return 0;
> 
> +
> 
> +  case WM_RBUTTONUP:
> 
> +    Private->PointerState.RightButton = FALSE;
> 
> +    Private->PointerStateChanged      = TRUE;
> 
> +    return 0;
> 
> +
> 
>    case WM_CLOSE:
> 
>      //
> 
>      // This close message is issued by user, core is not aware of this,
> 
> 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:
> 
> 
>  #include <Protocol/EmuIoThunk.h>
> 
>  #include <Protocol/EmuGraphicsWindow.h>
> 
> +#include <Protocol/SimplePointer.h>
> 
>  #include <Protocol/SimpleTextIn.h>
> 
>  #include <Protocol/SimpleTextInEx.h>
> 
>  #include <Protocol/GraphicsOutput.h>
> 
> @@ -109,6 +110,10 @@ typedef struct {
>    BOOLEAN                           ScrollLock;
> 
>    BOOLEAN                           CapsLock;
> 
>    BOOLEAN                           IsPartialKeySupport;
> 
> +  INT32                             PointerPreviousX;
> 
> +  INT32                             PointerPreviousY;
> 
> +  BOOLEAN                           PointerStateChanged;
> 
> +  EFI_SIMPLE_POINTER_STATE          PointerState;
> 
>  } GRAPHICS_PRIVATE_DATA;
> 
>  #define GRAPHICS_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('g', 'f', 'x', 'd')
> 
>  #define GRAPHICS_PRIVATE_DATA_FROM_THIS(a)  \
> 
> diff --git a/EmulatorPkg/Win/Host/WinInclude.h b/EmulatorPkg/Win/Host/WinInclude.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
> 
> 
> 
>  #include "windows.h"
> 
> +#include "windowsx.h"
> 
> 
> 
>  #undef GUID
> 
>  #undef _LIST_ENTRY
> 
> --
> 2.23.0.windows.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] WinHost: Add SimplePointer support
  2019-09-25 22:32   ` Ni, Ray
@ 2019-09-26 16:37     ` Marvin Häuser
  2019-09-26 18:44       ` Ni, Ray
  0 siblings, 1 reply; 6+ messages in thread
From: Marvin Häuser @ 2019-09-26 16:37 UTC (permalink / raw)
  To: Ni, Ray, Marvin Häuser, devel@edk2.groups.io
  Cc: Justen, Jordan L, Andrew Fish

Good day,

I have tested cursor movement (including initial window entry) 
extensively and left mouse button functionality. As the right mouse 
button works analoguously, I expect it to work. This was all from the 
GetState() function of the SP protocol.

Thanks,
Marvin

Am 26.09.2019 um 00:32 schrieb Ni, Ray:
> Marvin,
> Can you kindly share what unit test you've done?
> 
>> -----Original Message-----
>> From: Marvin Häuser <Marvin.Haeuser@outlook.com>
>> Sent: Tuesday, September 24, 2019 5:46 AM
>> To: devel@edk2.groups.io
>> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Andrew Fish <afish@apple.com>; Ni, Ray <ray.ni@intel.com>
>> Subject: [PATCH] WinHost: Add SimplePointer support
>>
>> From: Marvin Haeuser <mhaeuser@outlook.de>
>>
>> Catch WM mouse events and expose them via the SimplePointer protocol.
>>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Andrew Fish <afish@apple.com>
>> Cc: Ray Ni <ray.ni@intel.com>
>> Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
>> ---
>>   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/WinGopInput.c
>> index 0e8d11fc57ac..312a549847c5 100644
>> --- a/EmulatorPkg/Win/Host/WinGopInput.c
>> +++ b/EmulatorPkg/Win/Host/WinGopInput.c
>> @@ -409,9 +409,12 @@ WinNtWndCheckPointer (
>>
>>
>>     Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
>>
>>
>>
>> -  return EFI_NOT_READY;
>>
>> -}
>>
>> +  if (!Private->PointerStateChanged) {
>>
>> +    return EFI_NOT_READY;
>>
>> +  }
>>
>>
>>
>> +  return EFI_SUCCESS;
>>
>> +}
>>
>>
>>
>>   EFI_STATUS
>>
>>   EFIAPI
>>
>> @@ -424,5 +427,21 @@ WinNtWndGetPointerState (
>>
>>
>>     Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
>>
>>
>>
>> -  return EFI_NOT_READY;
>>
>> +  if (!Private->PointerStateChanged) {
>>
>> +    return EFI_NOT_READY;
>>
>> +  }
>>
>> +
>>
>> +  State->RelativeMovementX = Private->PointerState.RelativeMovementX;
>>
>> +  State->RelativeMovementY = Private->PointerState.RelativeMovementY;
>>
>> +  State->RelativeMovementZ = Private->PointerState.RelativeMovementZ;
>>
>> +  State->LeftButton        = Private->PointerState.LeftButton;
>>
>> +  State->RightButton       = Private->PointerState.RightButton;
>>
>> +
>>
>> +  Private->PointerState.RelativeMovementX = 0;
>>
>> +  Private->PointerState.RelativeMovementY = 0;
>>
>> +  Private->PointerState.RelativeMovementZ = 0;
>>
>> +
>>
>> +  Private->PointerStateChanged = FALSE;
>>
>> +
>>
>> +  return EFI_SUCCESS;
>>
>>   }
>>
>> diff --git a/EmulatorPkg/Win/Host/WinGopScreen.c b/EmulatorPkg/Win/Host/WinGopScreen.c
>> index 8f42606823f1..fa34596497f8 100644
>> --- a/EmulatorPkg/Win/Host/WinGopScreen.c
>> +++ b/EmulatorPkg/Win/Host/WinGopScreen.c
>> @@ -399,6 +399,8 @@ WinNtGopThreadWindowProc (
>>     LPARAM                Index;
>>
>>     EFI_INPUT_KEY         Key;
>>
>>     BOOLEAN               AltIsPress;
>>
>> +  INT32                 PosX;
>>
>> +  INT32                 PosY;
>>
>>
>>
>>     //
>>
>>     // Use mTlsIndex global to get a Thread Local Storage version of Private.
>>
>> @@ -527,6 +529,45 @@ WinNtGopThreadWindowProc (
>>       WinNtGopConvertParamToEfiKeyShiftState (Private, &wParam, &lParam, FALSE);
>>
>>       return 0;
>>
>>
>>
>> +  case WM_MOUSEMOVE:
>>
>> +    PosX = GET_X_LPARAM (lParam);
>>
>> +    PosY = GET_Y_LPARAM (lParam);
>>
>> +
>>
>> +    if (Private->PointerPreviousX != PosX) {
>>
>> +      Private->PointerState.RelativeMovementX += (PosX - Private->PointerPreviousX);
>>
>> +      Private->PointerPreviousX                = PosX;
>>
>> +      Private->PointerStateChanged             = TRUE;
>>
>> +    }
>>
>> +
>>
>> +    if (Private->PointerPreviousY != PosY) {
>>
>> +      Private->PointerState.RelativeMovementY += (PosY - Private->PointerPreviousY);
>>
>> +      Private->PointerPreviousY                = PosY;
>>
>> +      Private->PointerStateChanged             = TRUE;
>>
>> +    }
>>
>> +
>>
>> +    Private->PointerState.RelativeMovementZ  = 0;
>>
>> +    return 0;
>>
>> +
>>
>> +  case WM_LBUTTONDOWN:
>>
>> +    Private->PointerState.LeftButton = TRUE;
>>
>> +    Private->PointerStateChanged     = TRUE;
>>
>> +    return 0;
>>
>> +
>>
>> +  case WM_LBUTTONUP:
>>
>> +    Private->PointerState.LeftButton = FALSE;
>>
>> +    Private->PointerStateChanged     = TRUE;
>>
>> +    return 0;
>>
>> +
>>
>> +  case WM_RBUTTONDOWN:
>>
>> +    Private->PointerState.RightButton = TRUE;
>>
>> +    Private->PointerStateChanged      = TRUE;
>>
>> +    return 0;
>>
>> +
>>
>> +  case WM_RBUTTONUP:
>>
>> +    Private->PointerState.RightButton = FALSE;
>>
>> +    Private->PointerStateChanged      = TRUE;
>>
>> +    return 0;
>>
>> +
>>
>>     case WM_CLOSE:
>>
>>       //
>>
>>       // This close message is issued by user, core is not aware of this,
>>
>> 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:
>>
>>
>>   #include <Protocol/EmuIoThunk.h>
>>
>>   #include <Protocol/EmuGraphicsWindow.h>
>>
>> +#include <Protocol/SimplePointer.h>
>>
>>   #include <Protocol/SimpleTextIn.h>
>>
>>   #include <Protocol/SimpleTextInEx.h>
>>
>>   #include <Protocol/GraphicsOutput.h>
>>
>> @@ -109,6 +110,10 @@ typedef struct {
>>     BOOLEAN                           ScrollLock;
>>
>>     BOOLEAN                           CapsLock;
>>
>>     BOOLEAN                           IsPartialKeySupport;
>>
>> +  INT32                             PointerPreviousX;
>>
>> +  INT32                             PointerPreviousY;
>>
>> +  BOOLEAN                           PointerStateChanged;
>>
>> +  EFI_SIMPLE_POINTER_STATE          PointerState;
>>
>>   } GRAPHICS_PRIVATE_DATA;
>>
>>   #define GRAPHICS_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('g', 'f', 'x', 'd')
>>
>>   #define GRAPHICS_PRIVATE_DATA_FROM_THIS(a)  \
>>
>> diff --git a/EmulatorPkg/Win/Host/WinInclude.h b/EmulatorPkg/Win/Host/WinInclude.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
>>
>>
>>
>>   #include "windows.h"
>>
>> +#include "windowsx.h"
>>
>>
>>
>>   #undef GUID
>>
>>   #undef _LIST_ENTRY
>>
>> --
>> 2.23.0.windows.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] WinHost: Add SimplePointer support
  2019-09-26 16:37     ` Marvin Häuser
@ 2019-09-26 18:44       ` Ni, Ray
  2019-10-20  9:30         ` Marvin Häuser
  0 siblings, 1 reply; 6+ messages in thread
From: Ni, Ray @ 2019-09-26 18:44 UTC (permalink / raw)
  To: Marvin Häuser, Marvin Häuser, devel@edk2.groups.io
  Cc: Justen, Jordan L, Andrew Fish

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Marvin Häuser <mhaeuser@outlook.de>
> Sent: Thursday, September 26, 2019 9:38 AM
> To: Ni, Ray <ray.ni@intel.com>; Marvin Häuser <Marvin.Haeuser@outlook.com>; devel@edk2.groups.io
> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Andrew Fish <afish@apple.com>
> Subject: Re: [PATCH] WinHost: Add SimplePointer support
> 
> Good day,
> 
> I have tested cursor movement (including initial window entry)
> extensively and left mouse button functionality. As the right mouse
> button works analoguously, I expect it to work. This was all from the
> GetState() function of the SP protocol.
> 
> Thanks,
> Marvin
> 
> Am 26.09.2019 um 00:32 schrieb Ni, Ray:
> > Marvin,
> > Can you kindly share what unit test you've done?
> >
> >> -----Original Message-----
> >> From: Marvin Häuser <Marvin.Haeuser@outlook.com>
> >> Sent: Tuesday, September 24, 2019 5:46 AM
> >> To: devel@edk2.groups.io
> >> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Andrew Fish <afish@apple.com>; Ni, Ray <ray.ni@intel.com>
> >> Subject: [PATCH] WinHost: Add SimplePointer support
> >>
> >> From: Marvin Haeuser <mhaeuser@outlook.de>
> >>
> >> Catch WM mouse events and expose them via the SimplePointer protocol.
> >>
> >> Cc: Jordan Justen <jordan.l.justen@intel.com>
> >> Cc: Andrew Fish <afish@apple.com>
> >> Cc: Ray Ni <ray.ni@intel.com>
> >> Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
> >> ---
> >>   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/WinGopInput.c
> >> index 0e8d11fc57ac..312a549847c5 100644
> >> --- a/EmulatorPkg/Win/Host/WinGopInput.c
> >> +++ b/EmulatorPkg/Win/Host/WinGopInput.c
> >> @@ -409,9 +409,12 @@ WinNtWndCheckPointer (
> >>
> >>
> >>     Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
> >>
> >>
> >>
> >> -  return EFI_NOT_READY;
> >>
> >> -}
> >>
> >> +  if (!Private->PointerStateChanged) {
> >>
> >> +    return EFI_NOT_READY;
> >>
> >> +  }
> >>
> >>
> >>
> >> +  return EFI_SUCCESS;
> >>
> >> +}
> >>
> >>
> >>
> >>   EFI_STATUS
> >>
> >>   EFIAPI
> >>
> >> @@ -424,5 +427,21 @@ WinNtWndGetPointerState (
> >>
> >>
> >>     Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
> >>
> >>
> >>
> >> -  return EFI_NOT_READY;
> >>
> >> +  if (!Private->PointerStateChanged) {
> >>
> >> +    return EFI_NOT_READY;
> >>
> >> +  }
> >>
> >> +
> >>
> >> +  State->RelativeMovementX = Private->PointerState.RelativeMovementX;
> >>
> >> +  State->RelativeMovementY = Private->PointerState.RelativeMovementY;
> >>
> >> +  State->RelativeMovementZ = Private->PointerState.RelativeMovementZ;
> >>
> >> +  State->LeftButton        = Private->PointerState.LeftButton;
> >>
> >> +  State->RightButton       = Private->PointerState.RightButton;
> >>
> >> +
> >>
> >> +  Private->PointerState.RelativeMovementX = 0;
> >>
> >> +  Private->PointerState.RelativeMovementY = 0;
> >>
> >> +  Private->PointerState.RelativeMovementZ = 0;
> >>
> >> +
> >>
> >> +  Private->PointerStateChanged = FALSE;
> >>
> >> +
> >>
> >> +  return EFI_SUCCESS;
> >>
> >>   }
> >>
> >> diff --git a/EmulatorPkg/Win/Host/WinGopScreen.c b/EmulatorPkg/Win/Host/WinGopScreen.c
> >> index 8f42606823f1..fa34596497f8 100644
> >> --- a/EmulatorPkg/Win/Host/WinGopScreen.c
> >> +++ b/EmulatorPkg/Win/Host/WinGopScreen.c
> >> @@ -399,6 +399,8 @@ WinNtGopThreadWindowProc (
> >>     LPARAM                Index;
> >>
> >>     EFI_INPUT_KEY         Key;
> >>
> >>     BOOLEAN               AltIsPress;
> >>
> >> +  INT32                 PosX;
> >>
> >> +  INT32                 PosY;
> >>
> >>
> >>
> >>     //
> >>
> >>     // Use mTlsIndex global to get a Thread Local Storage version of Private.
> >>
> >> @@ -527,6 +529,45 @@ WinNtGopThreadWindowProc (
> >>       WinNtGopConvertParamToEfiKeyShiftState (Private, &wParam, &lParam, FALSE);
> >>
> >>       return 0;
> >>
> >>
> >>
> >> +  case WM_MOUSEMOVE:
> >>
> >> +    PosX = GET_X_LPARAM (lParam);
> >>
> >> +    PosY = GET_Y_LPARAM (lParam);
> >>
> >> +
> >>
> >> +    if (Private->PointerPreviousX != PosX) {
> >>
> >> +      Private->PointerState.RelativeMovementX += (PosX - Private->PointerPreviousX);
> >>
> >> +      Private->PointerPreviousX                = PosX;
> >>
> >> +      Private->PointerStateChanged             = TRUE;
> >>
> >> +    }
> >>
> >> +
> >>
> >> +    if (Private->PointerPreviousY != PosY) {
> >>
> >> +      Private->PointerState.RelativeMovementY += (PosY - Private->PointerPreviousY);
> >>
> >> +      Private->PointerPreviousY                = PosY;
> >>
> >> +      Private->PointerStateChanged             = TRUE;
> >>
> >> +    }
> >>
> >> +
> >>
> >> +    Private->PointerState.RelativeMovementZ  = 0;
> >>
> >> +    return 0;
> >>
> >> +
> >>
> >> +  case WM_LBUTTONDOWN:
> >>
> >> +    Private->PointerState.LeftButton = TRUE;
> >>
> >> +    Private->PointerStateChanged     = TRUE;
> >>
> >> +    return 0;
> >>
> >> +
> >>
> >> +  case WM_LBUTTONUP:
> >>
> >> +    Private->PointerState.LeftButton = FALSE;
> >>
> >> +    Private->PointerStateChanged     = TRUE;
> >>
> >> +    return 0;
> >>
> >> +
> >>
> >> +  case WM_RBUTTONDOWN:
> >>
> >> +    Private->PointerState.RightButton = TRUE;
> >>
> >> +    Private->PointerStateChanged      = TRUE;
> >>
> >> +    return 0;
> >>
> >> +
> >>
> >> +  case WM_RBUTTONUP:
> >>
> >> +    Private->PointerState.RightButton = FALSE;
> >>
> >> +    Private->PointerStateChanged      = TRUE;
> >>
> >> +    return 0;
> >>
> >> +
> >>
> >>     case WM_CLOSE:
> >>
> >>       //
> >>
> >>       // This close message is issued by user, core is not aware of this,
> >>
> >> 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:
> >>
> >>
> >>   #include <Protocol/EmuIoThunk.h>
> >>
> >>   #include <Protocol/EmuGraphicsWindow.h>
> >>
> >> +#include <Protocol/SimplePointer.h>
> >>
> >>   #include <Protocol/SimpleTextIn.h>
> >>
> >>   #include <Protocol/SimpleTextInEx.h>
> >>
> >>   #include <Protocol/GraphicsOutput.h>
> >>
> >> @@ -109,6 +110,10 @@ typedef struct {
> >>     BOOLEAN                           ScrollLock;
> >>
> >>     BOOLEAN                           CapsLock;
> >>
> >>     BOOLEAN                           IsPartialKeySupport;
> >>
> >> +  INT32                             PointerPreviousX;
> >>
> >> +  INT32                             PointerPreviousY;
> >>
> >> +  BOOLEAN                           PointerStateChanged;
> >>
> >> +  EFI_SIMPLE_POINTER_STATE          PointerState;
> >>
> >>   } GRAPHICS_PRIVATE_DATA;
> >>
> >>   #define GRAPHICS_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('g', 'f', 'x', 'd')
> >>
> >>   #define GRAPHICS_PRIVATE_DATA_FROM_THIS(a)  \
> >>
> >> diff --git a/EmulatorPkg/Win/Host/WinInclude.h b/EmulatorPkg/Win/Host/WinInclude.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
> >>
> >>
> >>
> >>   #include "windows.h"
> >>
> >> +#include "windowsx.h"
> >>
> >>
> >>
> >>   #undef GUID
> >>
> >>   #undef _LIST_ENTRY
> >>
> >> --
> >> 2.23.0.windows.1
> >

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] WinHost: Add SimplePointer support
  2019-09-26 18:44       ` Ni, Ray
@ 2019-10-20  9:30         ` Marvin Häuser
  2019-10-21  2:17           ` [edk2-devel] " Ni, Ray
  0 siblings, 1 reply; 6+ messages in thread
From: Marvin Häuser @ 2019-10-20  9:30 UTC (permalink / raw)
  To: Ni, Ray, devel@edk2.groups.io; +Cc: Justen, Jordan L, Andrew Fish

Good day,

Thank you for your review. I have not seen this patch pushed yet, could 
you please update me with the status?

Thanks,
Marvin
> Reviewed-by: Ray Ni <ray.ni@intel.com>
>
>> -----Original Message-----
>> From: Marvin Häuser <mhaeuser@outlook.de>
>> Sent: Thursday, September 26, 2019 9:38 AM
>> To: Ni, Ray <ray.ni@intel.com>; Marvin Häuser <Marvin.Haeuser@outlook.com>; devel@edk2.groups.io
>> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Andrew Fish <afish@apple.com>
>> Subject: Re: [PATCH] WinHost: Add SimplePointer support
>>
>> Good day,
>>
>> I have tested cursor movement (including initial window entry)
>> extensively and left mouse button functionality. As the right mouse
>> button works analoguously, I expect it to work. This was all from the
>> GetState() function of the SP protocol.
>>
>> Thanks,
>> Marvin
>>
>> Am 26.09.2019 um 00:32 schrieb Ni, Ray:
>>> Marvin,
>>> Can you kindly share what unit test you've done?
>>>
>>>> -----Original Message-----
>>>> From: Marvin Häuser <Marvin.Haeuser@outlook.com>
>>>> Sent: Tuesday, September 24, 2019 5:46 AM
>>>> To: devel@edk2.groups.io
>>>> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Andrew Fish <afish@apple.com>; Ni, Ray <ray.ni@intel.com>
>>>> Subject: [PATCH] WinHost: Add SimplePointer support
>>>>
>>>> From: Marvin Haeuser <mhaeuser@outlook.de>
>>>>
>>>> Catch WM mouse events and expose them via the SimplePointer protocol.
>>>>
>>>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>>>> Cc: Andrew Fish <afish@apple.com>
>>>> Cc: Ray Ni <ray.ni@intel.com>
>>>> Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
>>>> ---
>>>>    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/WinGopInput.c
>>>> index 0e8d11fc57ac..312a549847c5 100644
>>>> --- a/EmulatorPkg/Win/Host/WinGopInput.c
>>>> +++ b/EmulatorPkg/Win/Host/WinGopInput.c
>>>> @@ -409,9 +409,12 @@ WinNtWndCheckPointer (
>>>>
>>>>
>>>>      Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
>>>>
>>>>
>>>>
>>>> -  return EFI_NOT_READY;
>>>>
>>>> -}
>>>>
>>>> +  if (!Private->PointerStateChanged) {
>>>>
>>>> +    return EFI_NOT_READY;
>>>>
>>>> +  }
>>>>
>>>>
>>>>
>>>> +  return EFI_SUCCESS;
>>>>
>>>> +}
>>>>
>>>>
>>>>
>>>>    EFI_STATUS
>>>>
>>>>    EFIAPI
>>>>
>>>> @@ -424,5 +427,21 @@ WinNtWndGetPointerState (
>>>>
>>>>
>>>>      Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
>>>>
>>>>
>>>>
>>>> -  return EFI_NOT_READY;
>>>>
>>>> +  if (!Private->PointerStateChanged) {
>>>>
>>>> +    return EFI_NOT_READY;
>>>>
>>>> +  }
>>>>
>>>> +
>>>>
>>>> +  State->RelativeMovementX = Private->PointerState.RelativeMovementX;
>>>>
>>>> +  State->RelativeMovementY = Private->PointerState.RelativeMovementY;
>>>>
>>>> +  State->RelativeMovementZ = Private->PointerState.RelativeMovementZ;
>>>>
>>>> +  State->LeftButton        = Private->PointerState.LeftButton;
>>>>
>>>> +  State->RightButton       = Private->PointerState.RightButton;
>>>>
>>>> +
>>>>
>>>> +  Private->PointerState.RelativeMovementX = 0;
>>>>
>>>> +  Private->PointerState.RelativeMovementY = 0;
>>>>
>>>> +  Private->PointerState.RelativeMovementZ = 0;
>>>>
>>>> +
>>>>
>>>> +  Private->PointerStateChanged = FALSE;
>>>>
>>>> +
>>>>
>>>> +  return EFI_SUCCESS;
>>>>
>>>>    }
>>>>
>>>> diff --git a/EmulatorPkg/Win/Host/WinGopScreen.c b/EmulatorPkg/Win/Host/WinGopScreen.c
>>>> index 8f42606823f1..fa34596497f8 100644
>>>> --- a/EmulatorPkg/Win/Host/WinGopScreen.c
>>>> +++ b/EmulatorPkg/Win/Host/WinGopScreen.c
>>>> @@ -399,6 +399,8 @@ WinNtGopThreadWindowProc (
>>>>      LPARAM                Index;
>>>>
>>>>      EFI_INPUT_KEY         Key;
>>>>
>>>>      BOOLEAN               AltIsPress;
>>>>
>>>> +  INT32                 PosX;
>>>>
>>>> +  INT32                 PosY;
>>>>
>>>>
>>>>
>>>>      //
>>>>
>>>>      // Use mTlsIndex global to get a Thread Local Storage version of Private.
>>>>
>>>> @@ -527,6 +529,45 @@ WinNtGopThreadWindowProc (
>>>>        WinNtGopConvertParamToEfiKeyShiftState (Private, &wParam, &lParam, FALSE);
>>>>
>>>>        return 0;
>>>>
>>>>
>>>>
>>>> +  case WM_MOUSEMOVE:
>>>>
>>>> +    PosX = GET_X_LPARAM (lParam);
>>>>
>>>> +    PosY = GET_Y_LPARAM (lParam);
>>>>
>>>> +
>>>>
>>>> +    if (Private->PointerPreviousX != PosX) {
>>>>
>>>> +      Private->PointerState.RelativeMovementX += (PosX - Private->PointerPreviousX);
>>>>
>>>> +      Private->PointerPreviousX                = PosX;
>>>>
>>>> +      Private->PointerStateChanged             = TRUE;
>>>>
>>>> +    }
>>>>
>>>> +
>>>>
>>>> +    if (Private->PointerPreviousY != PosY) {
>>>>
>>>> +      Private->PointerState.RelativeMovementY += (PosY - Private->PointerPreviousY);
>>>>
>>>> +      Private->PointerPreviousY                = PosY;
>>>>
>>>> +      Private->PointerStateChanged             = TRUE;
>>>>
>>>> +    }
>>>>
>>>> +
>>>>
>>>> +    Private->PointerState.RelativeMovementZ  = 0;
>>>>
>>>> +    return 0;
>>>>
>>>> +
>>>>
>>>> +  case WM_LBUTTONDOWN:
>>>>
>>>> +    Private->PointerState.LeftButton = TRUE;
>>>>
>>>> +    Private->PointerStateChanged     = TRUE;
>>>>
>>>> +    return 0;
>>>>
>>>> +
>>>>
>>>> +  case WM_LBUTTONUP:
>>>>
>>>> +    Private->PointerState.LeftButton = FALSE;
>>>>
>>>> +    Private->PointerStateChanged     = TRUE;
>>>>
>>>> +    return 0;
>>>>
>>>> +
>>>>
>>>> +  case WM_RBUTTONDOWN:
>>>>
>>>> +    Private->PointerState.RightButton = TRUE;
>>>>
>>>> +    Private->PointerStateChanged      = TRUE;
>>>>
>>>> +    return 0;
>>>>
>>>> +
>>>>
>>>> +  case WM_RBUTTONUP:
>>>>
>>>> +    Private->PointerState.RightButton = FALSE;
>>>>
>>>> +    Private->PointerStateChanged      = TRUE;
>>>>
>>>> +    return 0;
>>>>
>>>> +
>>>>
>>>>      case WM_CLOSE:
>>>>
>>>>        //
>>>>
>>>>        // This close message is issued by user, core is not aware of this,
>>>>
>>>> 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:
>>>>
>>>>
>>>>    #include <Protocol/EmuIoThunk.h>
>>>>
>>>>    #include <Protocol/EmuGraphicsWindow.h>
>>>>
>>>> +#include <Protocol/SimplePointer.h>
>>>>
>>>>    #include <Protocol/SimpleTextIn.h>
>>>>
>>>>    #include <Protocol/SimpleTextInEx.h>
>>>>
>>>>    #include <Protocol/GraphicsOutput.h>
>>>>
>>>> @@ -109,6 +110,10 @@ typedef struct {
>>>>      BOOLEAN                           ScrollLock;
>>>>
>>>>      BOOLEAN                           CapsLock;
>>>>
>>>>      BOOLEAN                           IsPartialKeySupport;
>>>>
>>>> +  INT32                             PointerPreviousX;
>>>>
>>>> +  INT32                             PointerPreviousY;
>>>>
>>>> +  BOOLEAN                           PointerStateChanged;
>>>>
>>>> +  EFI_SIMPLE_POINTER_STATE          PointerState;
>>>>
>>>>    } GRAPHICS_PRIVATE_DATA;
>>>>
>>>>    #define GRAPHICS_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('g', 'f', 'x', 'd')
>>>>
>>>>    #define GRAPHICS_PRIVATE_DATA_FROM_THIS(a)  \
>>>>
>>>> diff --git a/EmulatorPkg/Win/Host/WinInclude.h b/EmulatorPkg/Win/Host/WinInclude.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
>>>>
>>>>
>>>>
>>>>    #include "windows.h"
>>>>
>>>> +#include "windowsx.h"
>>>>
>>>>
>>>>
>>>>    #undef GUID
>>>>
>>>>    #undef _LIST_ENTRY
>>>>
>>>> --
>>>> 2.23.0.windows.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH] WinHost: Add SimplePointer support
  2019-10-20  9:30         ` Marvin Häuser
@ 2019-10-21  2:17           ` Ni, Ray
  0 siblings, 0 replies; 6+ messages in thread
From: Ni, Ray @ 2019-10-21  2:17 UTC (permalink / raw)
  To: devel@edk2.groups.io, mhaeuser@outlook.de; +Cc: Justen, Jordan L, Andrew Fish

It was just pushed.

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Marvin
> H?user
> Sent: Sunday, October 20, 2019 5:31 PM
> To: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io
> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Andrew Fish
> <afish@apple.com>
> Subject: Re: [edk2-devel] [PATCH] WinHost: Add SimplePointer support
> 
> Good day,
> 
> Thank you for your review. I have not seen this patch pushed yet, could you
> please update me with the status?
> 
> Thanks,
> Marvin
> > Reviewed-by: Ray Ni <ray.ni@intel.com>
> >
> >> -----Original Message-----
> >> From: Marvin Häuser <mhaeuser@outlook.de>
> >> Sent: Thursday, September 26, 2019 9:38 AM
> >> To: Ni, Ray <ray.ni@intel.com>; Marvin Häuser
> >> <Marvin.Haeuser@outlook.com>; devel@edk2.groups.io
> >> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Andrew Fish
> >> <afish@apple.com>
> >> Subject: Re: [PATCH] WinHost: Add SimplePointer support
> >>
> >> Good day,
> >>
> >> I have tested cursor movement (including initial window entry)
> >> extensively and left mouse button functionality. As the right mouse
> >> button works analoguously, I expect it to work. This was all from the
> >> GetState() function of the SP protocol.
> >>
> >> Thanks,
> >> Marvin
> >>
> >> Am 26.09.2019 um 00:32 schrieb Ni, Ray:
> >>> Marvin,
> >>> Can you kindly share what unit test you've done?
> >>>
> >>>> -----Original Message-----
> >>>> From: Marvin Häuser <Marvin.Haeuser@outlook.com>
> >>>> Sent: Tuesday, September 24, 2019 5:46 AM
> >>>> To: devel@edk2.groups.io
> >>>> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Andrew Fish
> >>>> <afish@apple.com>; Ni, Ray <ray.ni@intel.com>
> >>>> Subject: [PATCH] WinHost: Add SimplePointer support
> >>>>
> >>>> From: Marvin Haeuser <mhaeuser@outlook.de>
> >>>>
> >>>> Catch WM mouse events and expose them via the SimplePointer
> protocol.
> >>>>
> >>>> Cc: Jordan Justen <jordan.l.justen@intel.com>
> >>>> Cc: Andrew Fish <afish@apple.com>
> >>>> Cc: Ray Ni <ray.ni@intel.com>
> >>>> Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
> >>>> ---
> >>>>    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/WinGopInput.c
> >>>> index 0e8d11fc57ac..312a549847c5 100644
> >>>> --- a/EmulatorPkg/Win/Host/WinGopInput.c
> >>>> +++ b/EmulatorPkg/Win/Host/WinGopInput.c
> >>>> @@ -409,9 +409,12 @@ WinNtWndCheckPointer (
> >>>>
> >>>>
> >>>>      Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
> >>>>
> >>>>
> >>>>
> >>>> -  return EFI_NOT_READY;
> >>>>
> >>>> -}
> >>>>
> >>>> +  if (!Private->PointerStateChanged) {
> >>>>
> >>>> +    return EFI_NOT_READY;
> >>>>
> >>>> +  }
> >>>>
> >>>>
> >>>>
> >>>> +  return EFI_SUCCESS;
> >>>>
> >>>> +}
> >>>>
> >>>>
> >>>>
> >>>>    EFI_STATUS
> >>>>
> >>>>    EFIAPI
> >>>>
> >>>> @@ -424,5 +427,21 @@ WinNtWndGetPointerState (
> >>>>
> >>>>
> >>>>      Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
> >>>>
> >>>>
> >>>>
> >>>> -  return EFI_NOT_READY;
> >>>>
> >>>> +  if (!Private->PointerStateChanged) {
> >>>>
> >>>> +    return EFI_NOT_READY;
> >>>>
> >>>> +  }
> >>>>
> >>>> +
> >>>>
> >>>> +  State->RelativeMovementX =
> >>>> + Private->PointerState.RelativeMovementX;
> >>>>
> >>>> +  State->RelativeMovementY =
> >>>> + Private->PointerState.RelativeMovementY;
> >>>>
> >>>> +  State->RelativeMovementZ =
> >>>> + Private->PointerState.RelativeMovementZ;
> >>>>
> >>>> +  State->LeftButton        = Private->PointerState.LeftButton;
> >>>>
> >>>> +  State->RightButton       = Private->PointerState.RightButton;
> >>>>
> >>>> +
> >>>>
> >>>> +  Private->PointerState.RelativeMovementX = 0;
> >>>>
> >>>> +  Private->PointerState.RelativeMovementY = 0;
> >>>>
> >>>> +  Private->PointerState.RelativeMovementZ = 0;
> >>>>
> >>>> +
> >>>>
> >>>> +  Private->PointerStateChanged = FALSE;
> >>>>
> >>>> +
> >>>>
> >>>> +  return EFI_SUCCESS;
> >>>>
> >>>>    }
> >>>>
> >>>> diff --git a/EmulatorPkg/Win/Host/WinGopScreen.c
> >>>> b/EmulatorPkg/Win/Host/WinGopScreen.c
> >>>> index 8f42606823f1..fa34596497f8 100644
> >>>> --- a/EmulatorPkg/Win/Host/WinGopScreen.c
> >>>> +++ b/EmulatorPkg/Win/Host/WinGopScreen.c
> >>>> @@ -399,6 +399,8 @@ WinNtGopThreadWindowProc (
> >>>>      LPARAM                Index;
> >>>>
> >>>>      EFI_INPUT_KEY         Key;
> >>>>
> >>>>      BOOLEAN               AltIsPress;
> >>>>
> >>>> +  INT32                 PosX;
> >>>>
> >>>> +  INT32                 PosY;
> >>>>
> >>>>
> >>>>
> >>>>      //
> >>>>
> >>>>      // Use mTlsIndex global to get a Thread Local Storage version of
> Private.
> >>>>
> >>>> @@ -527,6 +529,45 @@ WinNtGopThreadWindowProc (
> >>>>        WinNtGopConvertParamToEfiKeyShiftState (Private, &wParam,
> >>>> &lParam, FALSE);
> >>>>
> >>>>        return 0;
> >>>>
> >>>>
> >>>>
> >>>> +  case WM_MOUSEMOVE:
> >>>>
> >>>> +    PosX = GET_X_LPARAM (lParam);
> >>>>
> >>>> +    PosY = GET_Y_LPARAM (lParam);
> >>>>
> >>>> +
> >>>>
> >>>> +    if (Private->PointerPreviousX != PosX) {
> >>>>
> >>>> +      Private->PointerState.RelativeMovementX += (PosX -
> >>>> + Private->PointerPreviousX);
> >>>>
> >>>> +      Private->PointerPreviousX                = PosX;
> >>>>
> >>>> +      Private->PointerStateChanged             = TRUE;
> >>>>
> >>>> +    }
> >>>>
> >>>> +
> >>>>
> >>>> +    if (Private->PointerPreviousY != PosY) {
> >>>>
> >>>> +      Private->PointerState.RelativeMovementY += (PosY -
> >>>> + Private->PointerPreviousY);
> >>>>
> >>>> +      Private->PointerPreviousY                = PosY;
> >>>>
> >>>> +      Private->PointerStateChanged             = TRUE;
> >>>>
> >>>> +    }
> >>>>
> >>>> +
> >>>>
> >>>> +    Private->PointerState.RelativeMovementZ  = 0;
> >>>>
> >>>> +    return 0;
> >>>>
> >>>> +
> >>>>
> >>>> +  case WM_LBUTTONDOWN:
> >>>>
> >>>> +    Private->PointerState.LeftButton = TRUE;
> >>>>
> >>>> +    Private->PointerStateChanged     = TRUE;
> >>>>
> >>>> +    return 0;
> >>>>
> >>>> +
> >>>>
> >>>> +  case WM_LBUTTONUP:
> >>>>
> >>>> +    Private->PointerState.LeftButton = FALSE;
> >>>>
> >>>> +    Private->PointerStateChanged     = TRUE;
> >>>>
> >>>> +    return 0;
> >>>>
> >>>> +
> >>>>
> >>>> +  case WM_RBUTTONDOWN:
> >>>>
> >>>> +    Private->PointerState.RightButton = TRUE;
> >>>>
> >>>> +    Private->PointerStateChanged      = TRUE;
> >>>>
> >>>> +    return 0;
> >>>>
> >>>> +
> >>>>
> >>>> +  case WM_RBUTTONUP:
> >>>>
> >>>> +    Private->PointerState.RightButton = FALSE;
> >>>>
> >>>> +    Private->PointerStateChanged      = TRUE;
> >>>>
> >>>> +    return 0;
> >>>>
> >>>> +
> >>>>
> >>>>      case WM_CLOSE:
> >>>>
> >>>>        //
> >>>>
> >>>>        // This close message is issued by user, core is not aware
> >>>> of this,
> >>>>
> >>>> 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:
> >>>>
> >>>>
> >>>>    #include <Protocol/EmuIoThunk.h>
> >>>>
> >>>>    #include <Protocol/EmuGraphicsWindow.h>
> >>>>
> >>>> +#include <Protocol/SimplePointer.h>
> >>>>
> >>>>    #include <Protocol/SimpleTextIn.h>
> >>>>
> >>>>    #include <Protocol/SimpleTextInEx.h>
> >>>>
> >>>>    #include <Protocol/GraphicsOutput.h>
> >>>>
> >>>> @@ -109,6 +110,10 @@ typedef struct {
> >>>>      BOOLEAN                           ScrollLock;
> >>>>
> >>>>      BOOLEAN                           CapsLock;
> >>>>
> >>>>      BOOLEAN                           IsPartialKeySupport;
> >>>>
> >>>> +  INT32                             PointerPreviousX;
> >>>>
> >>>> +  INT32                             PointerPreviousY;
> >>>>
> >>>> +  BOOLEAN                           PointerStateChanged;
> >>>>
> >>>> +  EFI_SIMPLE_POINTER_STATE          PointerState;
> >>>>
> >>>>    } GRAPHICS_PRIVATE_DATA;
> >>>>
> >>>>    #define GRAPHICS_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('g',
> 'f',
> >>>> 'x', 'd')
> >>>>
> >>>>    #define GRAPHICS_PRIVATE_DATA_FROM_THIS(a)  \
> >>>>
> >>>> diff --git a/EmulatorPkg/Win/Host/WinInclude.h
> >>>> b/EmulatorPkg/Win/Host/WinInclude.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
> >>>>
> >>>>
> >>>>
> >>>>    #include "windows.h"
> >>>>
> >>>> +#include "windowsx.h"
> >>>>
> >>>>
> >>>>
> >>>>    #undef GUID
> >>>>
> >>>>    #undef _LIST_ENTRY
> >>>>
> >>>> --
> >>>> 2.23.0.windows.1
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-10-21  2:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <d65f328a1d27ba0b84917426d86c14718187ed42.1569329065.git.mhaeuser@outlook.de>
2019-09-24 12:46 ` [PATCH] WinHost: Add SimplePointer support Marvin Häuser
2019-09-25 22:32   ` Ni, Ray
2019-09-26 16:37     ` Marvin Häuser
2019-09-26 18:44       ` Ni, Ray
2019-10-20  9:30         ` Marvin Häuser
2019-10-21  2:17           ` [edk2-devel] " Ni, Ray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox