Skip to content

Commit

Permalink
moufiltr: Mirror mouse movement
Browse files Browse the repository at this point in the history
Make the driver more interesting by mirroring mouse events, so that left movement becomes right, up movement becomes down, and so on.

Using MOUSE_MOVE_ABSOLUTE(1) instead of MOUSE_MOVE_RELATIVE(0) to allow bitmask operations.
  • Loading branch information
Fredrik Orderud committed Feb 15, 2024
1 parent c73af47 commit 4492fe6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions input/moufiltr/moufiltr.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,15 @@ Return Value:
PDEVICE_EXTENSION devExt;
WDFDEVICE hDevice;

// mirror mouse events in queue
for (MOUSE_INPUT_DATA* id = InputDataStart; id != InputDataEnd; ++id) {
if (!(id->Flags & MOUSE_MOVE_ABSOLUTE)) {
// invert relative mouse movement
id->LastX = -id->LastX;
id->LastY = -id->LastY;
}
}

hDevice = WdfWdmDeviceGetWdfDeviceHandle(DeviceObject);

devExt = FilterGetData(hDevice);
Expand Down

0 comments on commit 4492fe6

Please sign in to comment.