Skip to content

Commit 9e43349

Browse files
Fredrik Orderudforderud
authored andcommitted
moufiltr: Mirror mouse movement
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.
1 parent ed3dbe5 commit 9e43349

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

input/moufiltr/moufiltr.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,15 @@ Return Value:
487487
PDEVICE_EXTENSION devExt;
488488
WDFDEVICE hDevice;
489489

490+
// mirror mouse events in queue
491+
for (MOUSE_INPUT_DATA* id = InputDataStart; id != InputDataEnd; ++id) {
492+
if (!(id->Flags & MOUSE_MOVE_ABSOLUTE)) {
493+
// invert relative mouse movement
494+
id->LastX = -id->LastX;
495+
id->LastY = -id->LastY;
496+
}
497+
}
498+
490499
hDevice = WdfWdmDeviceGetWdfDeviceHandle(DeviceObject);
491500

492501
devExt = FilterGetData(hDevice);

0 commit comments

Comments
 (0)