From c0b6b0dff601a1a113ac8948aa0b1377f5cd6a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 24 Feb 2009 20:13:49 +0000 Subject: [PATCH] * Refactored _SanitizeEvents() a bit to remove small bits of duplicate code. * Round the mouse coordinate to be compatible with BeOS behavior. I know that in WonderBrush, I had to extract the fractional coords using the be:tablet_x and y fields. This may actually be a better fix for #1527, now that we know what caused it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29317 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/input/InputServer.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/servers/input/InputServer.cpp b/src/servers/input/InputServer.cpp index 8389efc823..348a503775 100644 --- a/src/servers/input/InputServer.cpp +++ b/src/servers/input/InputServer.cpp @@ -1570,11 +1570,9 @@ InputServer::_SanitizeEvents(EventList& events) && event->FindInt32("y", &y) == B_OK) { where.x = fMousePos.x + x; where.y = fMousePos.y - y; - where.ConstrainTo(fFrame); event->RemoveName("x"); event->RemoveName("y"); - event->AddPoint("where", where); event->AddInt32("be:delta_x", x); event->AddInt32("be:delta_y", y); @@ -1588,19 +1586,22 @@ InputServer::_SanitizeEvents(EventList& events) // absolute coordinates as "be:tablet_x/y"). where.x = absX * fFrame.Width(); where.y = absY * fFrame.Height(); - where.ConstrainTo(fFrame); event->RemoveName("x"); event->RemoveName("y"); - event->AddPoint("where", where); PRINT(("new position : %f, %f\n", where.x, where.y)); } else if (event->FindPoint("where", &where) == B_OK) { - where.ConstrainTo(fFrame); - - event->ReplacePoint("where", where); PRINT(("new position : %f, %f\n", where.x, where.y)); } + // Constrain and filter the mouse coords and add the final + // point to the message. + where.x = roundf(where.x); + where.y = roundf(where.y); + where.ConstrainTo(fFrame); + if (event->ReplacePoint("where", where) != B_OK) + event->AddPoint("where", where); + if (!event->HasInt64("when")) event->AddInt64("when", system_time());