mirror of https://github.com/acidanthera/audk.git
WinHost: Add SimplePointer support
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> Reviewed-by: Ray Ni <ray.ni@intel.com> Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
This commit is contained in:
parent
2bbbdeeea2
commit
109197ee11
|
@ -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) \
|
||||
|
|
|
@ -409,9 +409,12 @@ WinNtWndCheckPointer (
|
|||
|
||||
Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -40,6 +40,7 @@ typedef UINT32 size_t ;
|
|||
#endif
|
||||
|
||||
#include "windows.h"
|
||||
#include "windowsx.h"
|
||||
|
||||
#undef GUID
|
||||
#undef _LIST_ENTRY
|
||||
|
|
Loading…
Reference in New Issue