From d35d0f74a62f9a3121d3e77eacb9c3276f02076d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 28 Nov 2008 20:35:28 +0000 Subject: [PATCH] * 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 --- src/kits/tracker/PoseView.cpp | 13 ++++++------- src/kits/tracker/PoseView.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 2da2744b86..c5206ffefc 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -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[] = ""; diff --git a/src/kits/tracker/PoseView.h b/src/kits/tracker/PoseView.h index c5e0a53beb..59df2ff4f6 100644 --- a/src/kits/tracker/PoseView.h +++ b/src/kits/tracker/PoseView.h @@ -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;