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 Aug 21, 2024
1 parent c4a093e commit ff66e0f
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 ff66e0f

Please sign in to comment.