From 7076ff2f6b8748958fbcea1c28edebb9dbb06f13 Mon Sep 17 00:00:00 2001 From: apio Date: Thu, 3 Aug 2023 12:18:30 +0200 Subject: [PATCH] kernel: Fix negative movement in the PS/2 mouse driver --- kernel/src/arch/x86_64/PS2Mouse.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/src/arch/x86_64/PS2Mouse.cpp b/kernel/src/arch/x86_64/PS2Mouse.cpp index 3d9aa167..417d017b 100644 --- a/kernel/src/arch/x86_64/PS2Mouse.cpp +++ b/kernel/src/arch/x86_64/PS2Mouse.cpp @@ -43,8 +43,8 @@ static void process_mouse_event(u8 data) packet.buttons = 0; u8 flags = g_mouse_packet[0]; - if (flags & PS2_MOUSE_X_SIGN) packet.xdelta = -packet.xdelta; - if (flags & PS2_MOUSE_Y_SIGN) packet.ydelta = -packet.ydelta; + if (flags & PS2_MOUSE_X_SIGN) packet.xdelta = -(256 - packet.xdelta); + if (flags & PS2_MOUSE_Y_SIGN) packet.ydelta = -(256 - packet.ydelta); if (flags & PS2_MOUSE_MIDDLE_BTN) packet.buttons |= moon::MouseButton::Middle; if (flags & PS2_MOUSE_RIGHT_BTN) packet.buttons |= moon::MouseButton::Right;