From 7d5d344bf1c545c8cca88b75e40c571f99b5c9d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 28 Sep 2004 11:20:45 +0000 Subject: [PATCH] Some mice have two wheels git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9088 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/input/kb_mouse_driver.h | 3 ++- src/add-ons/input_server/devices/mouse/Jamfile | 5 +++++ .../input_server/devices/mouse/MouseInputDevice.cpp | 7 ++++--- src/add-ons/kernel/drivers/input/hid/hid.c | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/headers/private/input/kb_mouse_driver.h b/headers/private/input/kb_mouse_driver.h index 5365cf9ded..b47b4456eb 100644 --- a/headers/private/input/kb_mouse_driver.h +++ b/headers/private/input/kb_mouse_driver.h @@ -111,7 +111,8 @@ typedef struct { int32 clicks; int32 modifiers; bigtime_t timestamp; - int32 wheel_delta; + int32 wheel_ydelta; + int32 wheel_xdelta; } mouse_movement; diff --git a/src/add-ons/input_server/devices/mouse/Jamfile b/src/add-ons/input_server/devices/mouse/Jamfile index c07432662d..20c7ca40fb 100644 --- a/src/add-ons/input_server/devices/mouse/Jamfile +++ b/src/add-ons/input_server/devices/mouse/Jamfile @@ -7,3 +7,8 @@ Addon mouse : input_server/devices : : false : be input_server ; +if $(COMPILE_FOR_R5) { +} else { + LinkSharedOSLibs mouse : libopenbeos.so ; +} + diff --git a/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp b/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp index 83f316234f..1a5ac8d904 100644 --- a/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp +++ b/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp @@ -371,6 +371,7 @@ MouseInputDevice::DeviceWatcher(void *arg) BMessage *message; char log[128]; while (dev->active) { + memset(&movements, 0, sizeof(movements)); if (ioctl(dev->driver_fd, kGetMouseMovements, &movements) < B_OK) continue; @@ -418,12 +419,12 @@ MouseInputDevice::DeviceWatcher(void *arg) } } - if (movements.wheel_delta != 0) { + if ((movements.wheel_ydelta != 0) || (movements.wheel_xdelta != 0)) { message = new BMessage(B_MOUSE_WHEEL_CHANGED); if (message) { message->AddInt64("when", movements.timestamp); - message->AddFloat("be:wheel_delta_x", 0.0); - message->AddFloat("be:wheel_delta_y", movements.wheel_delta); + message->AddFloat("be:wheel_delta_x", movements.wheel_xdelta); + message->AddFloat("be:wheel_delta_y", movements.wheel_ydelta); sSingletonMouseDevice->EnqueueMessage(message); } diff --git a/src/add-ons/kernel/drivers/input/hid/hid.c b/src/add-ons/kernel/drivers/input/hid/hid.c index 3ac06e6dcc..d0ab5f337e 100644 --- a/src/add-ons/kernel/drivers/input/hid/hid.c +++ b/src/add-ons/kernel/drivers/input/hid/hid.c @@ -512,7 +512,7 @@ interpret_ms_buffer(my_device_info *my_dev) info.ydelta = -value; break; case USAGE_ID_WHEEL: - info.wheel_delta = -value; + info.wheel_ydelta = -value; break; } }