From 4492fe62bb73cdffbc5b6cb604a8192d27bc24a3 Mon Sep 17 00:00:00 2001 From: Fredrik Orderud Date: Thu, 15 Feb 2024 11:50:48 +0100 Subject: [PATCH] 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. --- input/moufiltr/moufiltr.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/input/moufiltr/moufiltr.c b/input/moufiltr/moufiltr.c index 84716db2b..73d4293f5 100644 --- a/input/moufiltr/moufiltr.c +++ b/input/moufiltr/moufiltr.c @@ -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);