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 authored and forderud committed Jun 18, 2024
1 parent dbfbead commit a1f98d9
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 a1f98d9

Please sign in to comment.