* 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
This commit is contained in:
parent
ea83c971c6
commit
c0b6b0dff6
@ -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());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user