* s/fLastKeyTime is no longer a static member - this fixes that the type-ahead

buffer will be taken over to another window (if you type fast enough).
* Also the type-ahead runner no longer clobbers the static type-ahead buffer,
  so it won't delete something you typed in another window anymore (again, if
  you type fast enough :-)).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28745 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-11-28 20:35:28 +00:00
parent b9224a2568
commit d35d0f74a6
2 changed files with 7 additions and 8 deletions
+6 -7
View File
@@ -217,6 +217,7 @@ BPoseView::BPoseView(Model *model, BRect bounds, uint32 viewMode, uint32 resizeM
fIsDesktopWindow(false),
fIsWatchingDateFormatChange(false),
fHasPosesInClipboard(false),
fLastKeyTime(0),
fLastDeskbarFrameCheckTime(LONGLONG_MIN),
fDeskbarFrame(0, 0, -1, -1)
{
@@ -2279,8 +2280,7 @@ BPoseView::MessageReceived(BMessage *message)
{
bigtime_t doubleClickSpeed;
get_click_speed(&doubleClickSpeed);
if (system_time() - sLastKeyTime > (doubleClickSpeed * 2)) {
strcpy(sMatchString, "");
if (system_time() - fLastKeyTime > (doubleClickSpeed * 2)) {
fCountView->SetTypeAhead(sMatchString);
delete fKeyRunner;
fKeyRunner = NULL;
@@ -5910,7 +5910,7 @@ BPoseView::KeyDown(const char *bytes, int32 count)
// remove last char from the typeahead buffer
sMatchString[strlen(sMatchString) - 1] = '\0';
sLastKeyTime = system_time();
fLastKeyTime = system_time();
fCountView->SetTypeAhead(sMatchString);
@@ -5950,14 +5950,14 @@ BPoseView::KeyDown(const char *bytes, int32 count)
// add char to existing matchString or start new match string
// make sure we don't overfill matchstring
if (eventTime - sLastKeyTime < (doubleClickSpeed * 2)) {
if (eventTime - fLastKeyTime < (doubleClickSpeed * 2)) {
uint32 nchars = B_FILE_NAME_LENGTH - strlen(sMatchString);
strncat(sMatchString, searchChar, nchars);
} else {
strncpy(sMatchString, searchChar, B_FILE_NAME_LENGTH - 1);
}
sMatchString[B_FILE_NAME_LENGTH - 1] = '\0';
sLastKeyTime = eventTime;
fLastKeyTime = eventTime;
fCountView->SetTypeAhead(sMatchString);
@@ -7559,7 +7559,7 @@ BPoseView::SwitchDir(const entry_ref *newDirRef, AttributeStreamNode *node)
Invalidate();
sLastKeyTime = 0;
fLastKeyTime = 0;
}
@@ -9321,7 +9321,6 @@ TPoseViewFilter::Filter(BMessage *message, BHandler **)
float BPoseView::sFontHeight = -1;
font_height BPoseView::sFontInfo = { 0, 0, 0 };
bigtime_t BPoseView::sLastKeyTime = 0;
BFont BPoseView::sCurrentFont;
OffscreenBitmap *BPoseView::sOffscreen = new OffscreenBitmap;
char BPoseView::sMatchString[] = "";
+1 -1
View File
@@ -654,10 +654,10 @@ class BPoseView : public BView {
static float sFontHeight;
static font_height sFontInfo;
static BFont sCurrentFont;
static bigtime_t sLastKeyTime;
static char sMatchString[B_FILE_NAME_LENGTH];
// used for typeahead - should be replaced by a typeahead state
bigtime_t fLastKeyTime;
bigtime_t fLastDeskbarFrameCheckTime;
BRect fDeskbarFrame;