Change arithmetics order to allow mouse movement in cases with high mouse resolution

This commit is contained in:
asava 2020-03-29 21:02:54 +03:00
parent 941244d894
commit 7e747613a9

View File

@ -169,7 +169,7 @@ VOID XPointer::UpdatePointer()
CopyMem(&State, &tmpState, sizeof(State)); CopyMem(&State, &tmpState, sizeof(State));
CurrentMode = SimplePointerProtocol->Mode; CurrentMode = SimplePointerProtocol->Mode;
ScreenRelX = ((UGAWidth * State.RelativeMovementX / (INTN)CurrentMode->ResolutionX) * gSettings.PointerSpeed) >> 10; ScreenRelX = (UGAWidth * State.RelativeMovementX * gSettings.PointerSpeed / (INTN)CurrentMode->ResolutionX) >> 10;
if (gSettings.PointerMirror) { if (gSettings.PointerMirror) {
newPlace.XPos -= ScreenRelX; newPlace.XPos -= ScreenRelX;
} }
@ -180,7 +180,7 @@ VOID XPointer::UpdatePointer()
if (newPlace.XPos > UGAWidth - 1) newPlace.XPos = UGAWidth - 1; if (newPlace.XPos > UGAWidth - 1) newPlace.XPos = UGAWidth - 1;
// YPosPrev = newPlace.YPos; // YPosPrev = newPlace.YPos;
ScreenRelY = ((UGAHeight * State.RelativeMovementY / (INTN)CurrentMode->ResolutionY) * gSettings.PointerSpeed) >> 10; ScreenRelY = (UGAHeight * State.RelativeMovementY * gSettings.PointerSpeed / (INTN)CurrentMode->ResolutionY) >> 10;
newPlace.YPos += ScreenRelY; newPlace.YPos += ScreenRelY;
if (newPlace.YPos < 0) newPlace.YPos = 0; if (newPlace.YPos < 0) newPlace.YPos = 0;
if (newPlace.YPos > UGAHeight - 1) newPlace.YPos = UGAHeight - 1; if (newPlace.YPos > UGAHeight - 1) newPlace.YPos = UGAHeight - 1;