fix buttons handling
seems doubleclick not handled yet crash when debug is active (before this change) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8797 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6179417d78
commit
e361bf6901
@ -75,7 +75,7 @@ MouseInputDevice::MouseInputDevice()
|
|||||||
fFd = open("dev/input/mouse/ps2/0", O_RDWR);
|
fFd = open("dev/input/mouse/ps2/0", O_RDWR);
|
||||||
if (fFd >= 0)
|
if (fFd >= 0)
|
||||||
fThread = spawn_thread(DeviceWatcher, "mouse watcher thread",
|
fThread = spawn_thread(DeviceWatcher, "mouse watcher thread",
|
||||||
B_NORMAL_PRIORITY, this);
|
B_FIRST_REAL_TIME_PRIORITY+4, this);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
sLogFile = fopen("/var/log/mouse_device_log.log", "w");
|
sLogFile = fopen("/var/log/mouse_device_log.log", "w");
|
||||||
@ -218,7 +218,7 @@ MouseInputDevice::DeviceWatcher(void *arg)
|
|||||||
ioctl(dev->fFd, kGetMouseMovements, &movements);
|
ioctl(dev->fFd, kGetMouseMovements, &movements);
|
||||||
|
|
||||||
// TODO: send B_MOUSE_UP/B_MOUSE_DOWN messages
|
// TODO: send B_MOUSE_UP/B_MOUSE_DOWN messages
|
||||||
int32 buttons = dev->fButtons - movements.buttons;
|
uint32 buttons = dev->fButtons ^ movements.buttons;
|
||||||
|
|
||||||
snprintf(log, 128, "buttons: %ld, x: %ld, y: %ld\n",
|
snprintf(log, 128, "buttons: %ld, x: %ld, y: %ld\n",
|
||||||
movements.buttons, movements.xdelta, movements.ydelta);
|
movements.buttons, movements.xdelta, movements.ydelta);
|
||||||
@ -230,22 +230,20 @@ MouseInputDevice::DeviceWatcher(void *arg)
|
|||||||
// for some reason. Check if they reach the input server.
|
// for some reason. Check if they reach the input server.
|
||||||
if (buttons != 0) {
|
if (buttons != 0) {
|
||||||
message = new BMessage;
|
message = new BMessage;
|
||||||
if (buttons < 0) {
|
if (buttons & movements.buttons > 0) {
|
||||||
buttons = -buttons;
|
|
||||||
message->what = B_MOUSE_DOWN;
|
message->what = B_MOUSE_DOWN;
|
||||||
LOG("B_MOUSE_DOWN\n");
|
LOG("B_MOUSE_DOWN\n");
|
||||||
|
|
||||||
} else if (buttons > 0) {
|
} else {
|
||||||
message->what = B_MOUSE_UP;
|
message->what = B_MOUSE_UP;
|
||||||
LOG("B_MOUSE_UP\n");
|
LOG("B_MOUSE_UP\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
message->AddInt64("when", movements.mouse_time);
|
message->AddInt64("when", movements.mouse_time);
|
||||||
message->AddInt32("buttons", buttons);
|
message->AddInt32("buttons", movements.buttons);
|
||||||
message->AddInt32("clicks", movements.click_count);
|
message->AddInt32("clicks", movements.click_count);
|
||||||
// TODO: do we need to add the "where" field ?
|
message->AddInt32("x", movements.xdelta);
|
||||||
// I guess not, as the input server will probably know the
|
message->AddInt32("y", movements.ydelta);
|
||||||
// cursor position
|
|
||||||
|
|
||||||
dev->EnqueueMessage(message);
|
dev->EnqueueMessage(message);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user