sync to rev 1.62 from OT rep: use the event time instead of the current system time for appending or starting a new match when typing ahead to select a pose

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17930 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2006-06-27 09:16:31 +00:00
parent fe7f3a2f1d
commit f8262c2b19

View File

@ -5928,16 +5928,23 @@ BPoseView::KeyDown(const char *bytes, int32 count)
return;
}
// figure out the time at which the keypress happened
bigtime_t eventTime;
BMessage* message = Window()->CurrentMessage();
if (!message || message->FindInt64("when", &eventTime) < B_OK) {
eventTime = system_time();
}
// add char to existing matchString or start new match string
// make sure we don't overfill matchstring
if (system_time() - fLastKeyTime < (doubleClickSpeed * 2)) {
if (eventTime - fLastKeyTime < (doubleClickSpeed * 2)) {
uint32 nchars = B_FILE_NAME_LENGTH - strlen(fMatchString);
strncat(fMatchString, searchChar, nchars);
} else {
strncpy(fMatchString, searchChar, B_FILE_NAME_LENGTH - 1);
}
fMatchString[B_FILE_NAME_LENGTH - 1] = '\0';
fLastKeyTime = system_time();
fLastKeyTime = eventTime;
fCountView->SetTypeAhead(fMatchString);