mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 20:45:14 +00:00
Respect the overflow bit in PS/2 mouse data.
This commit is contained in:
parent
dc20f00872
commit
d793323254
Notes:
sideshowbarker
2024-07-19 16:01:03 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d7933232547
1 changed files with 3 additions and 3 deletions
|
@ -119,13 +119,13 @@ void WSEventLoop::drain_mouse()
|
|||
int dx = 0;
|
||||
int dy = 0;
|
||||
while (mouse.can_read(*m_server_process)) {
|
||||
signed_byte data[3];
|
||||
byte data[3];
|
||||
ssize_t nread = mouse.read(*m_server_process, (byte*)data, sizeof(data));
|
||||
ASSERT(nread == sizeof(data));
|
||||
bool left_button = data[0] & 1;
|
||||
bool right_button = data[0] & 2;
|
||||
dx += data[1];
|
||||
dy += -data[2];
|
||||
dx += data[1] ? (int)data[1] - (int)((data[0] << 4) & 0x100) : 0;
|
||||
dy += data[2] ? (int)((data[0] << 3) & 0x100) - (int)data[2] : 0;
|
||||
if (left_button != prev_left_button || right_button != prev_right_button || !mouse.can_read(*m_server_process)) {
|
||||
prev_left_button = left_button;
|
||||
prev_right_button = right_button;
|
||||
|
|
Loading…
Add table
Reference in a new issue