diff options
author | Derek Lin <derek.lin2@hpe.com> | 2016-03-09 16:34:31 +0800 |
---|---|---|
committer | Star Zeng <star.zeng@intel.com> | 2016-03-16 16:17:03 +0800 |
commit | 30ed3422ab2de03abf7c1433ebb482f6e5e16f45 (patch) | |
tree | b38fa7544e612ee824d9f6be457e1b45fd815146 | |
parent | dcbdb8bfb026588cb888949c2c0adb43687935f3 (diff) | |
download | edk2-platforms-30ed3422ab2de03abf7c1433ebb482f6e5e16f45.tar.xz |
MdeModulePkg: Rescale ConSplitter Absolute Pointer.
ConSplitter's Absolute Pointer should scale virtual device's resolution like what Simple Pointer do.
Before this change, caller will get Virtual device's resolution but physical device's current point.
This change let caller get Virtual device's resolution with virtual device's current point.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Derek Lin <derek.lin2@hpe.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
-rw-r--r-- | MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c index dae97b09a2..af90d5e5e4 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c @@ -17,6 +17,7 @@ device situation.
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -4096,7 +4097,18 @@ ConSplitterAbsolutePointerGetState ( EFI_STATUS ReturnStatus;
UINTN Index;
EFI_ABSOLUTE_POINTER_STATE CurrentState;
-
+ UINT64 MinX;
+ UINT64 MinY;
+ UINT64 MinZ;
+ UINT64 MaxX;
+ UINT64 MaxY;
+ UINT64 MaxZ;
+ UINT64 VirtualMinX;
+ UINT64 VirtualMinY;
+ UINT64 VirtualMinZ;
+ UINT64 VirtualMaxX;
+ UINT64 VirtualMaxY;
+ UINT64 VirtualMaxZ;
Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS (This);
@@ -4107,6 +4119,13 @@ ConSplitterAbsolutePointerGetState ( State->CurrentZ = 0;
State->ActiveButtons = 0;
+ VirtualMinX = Private->AbsolutePointerMode.AbsoluteMinX;
+ VirtualMinY = Private->AbsolutePointerMode.AbsoluteMinY;
+ VirtualMinZ = Private->AbsolutePointerMode.AbsoluteMinZ;
+ VirtualMaxX = Private->AbsolutePointerMode.AbsoluteMaxX;
+ VirtualMaxY = Private->AbsolutePointerMode.AbsoluteMaxY;
+ VirtualMaxZ = Private->AbsolutePointerMode.AbsoluteMaxZ;
+
//
// if no physical pointer device exists, return EFI_NOT_READY;
// if any physical pointer device has changed state,
@@ -4124,16 +4143,26 @@ ConSplitterAbsolutePointerGetState ( ReturnStatus = EFI_SUCCESS;
}
+ MinX = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinX;
+ MinY = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinY;
+ MinZ = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinZ;
+ MaxX = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxX;
+ MaxY = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxY;
+ MaxZ = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxZ;
+
State->ActiveButtons = CurrentState.ActiveButtons;
- if (!(Private->AbsolutePointerMode.AbsoluteMinX == 0 && Private->AbsolutePointerMode.AbsoluteMaxX == 0)) {
- State->CurrentX = CurrentState.CurrentX;
+ //
+ // Rescale to Con Splitter virtual Absolute Pointer's resolution.
+ //
+ if (!(MinX == 0 && MaxX == 0)) {
+ State->CurrentX = VirtualMinX + (CurrentState.CurrentX * (VirtualMaxX - VirtualMinX)) / (MaxX - MinX);
}
- if (!(Private->AbsolutePointerMode.AbsoluteMinY == 0 && Private->AbsolutePointerMode.AbsoluteMaxY == 0)) {
- State->CurrentY = CurrentState.CurrentY;
+ if (!(MinY == 0 && MaxY == 0)) {
+ State->CurrentY = VirtualMinY + (CurrentState.CurrentY * (VirtualMaxY - VirtualMinY)) / (MaxY - MinY);
}
- if (!(Private->AbsolutePointerMode.AbsoluteMinZ == 0 && Private->AbsolutePointerMode.AbsoluteMaxZ == 0)) {
- State->CurrentZ = CurrentState.CurrentZ;
+ if (!(MinZ == 0 && MaxZ == 0)) {
+ State->CurrentZ = VirtualMinZ + (CurrentState.CurrentZ * (VirtualMaxZ - VirtualMinZ)) / (MaxZ - MinZ);
}
} else if (Status == EFI_DEVICE_ERROR) {
|