From 647c273bc7f97218914b1b57f9f7a10ad3beb715 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 23 Feb 2003 02:05:55 +0000 Subject: Patch from Jakub Vrana to avoid mouse debouncing on Windows where assigning a key to double click can result in two mouse clicks arriving with the same time. --- gtk/PlatGTK.cxx | 4 ++++ include/Platform.h | 1 + src/Editor.cxx | 2 +- win32/PlatWin.cxx | 4 ++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 8afe2bcba..0a84f46a1 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -1686,6 +1686,10 @@ unsigned int Platform::DoubleClickTime() { return 500; // Half a second } +bool Platform::MouseButtonBounce() { + return true; +} + void Platform::DebugDisplay(const char *s) { printf("%s", s); } diff --git a/include/Platform.h b/include/Platform.h index eacf2302d..ee6e07c34 100644 --- a/include/Platform.h +++ b/include/Platform.h @@ -440,6 +440,7 @@ public: static const char *DefaultFont(); static int DefaultFontSize(); static unsigned int DoubleClickTime(); + static bool MouseButtonBounce(); static void DebugDisplay(const char *s); static bool IsKeyDown(int key); static long SendScintilla( diff --git a/src/Editor.cxx b/src/Editor.cxx index b156dd3ec..5f3020fc0 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -4338,7 +4338,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b SetEmptySelection(newPos); bool doubleClick = false; // Stop mouse button bounce changing selection type - if (curTime != lastClickTime) { + if (!Platform::MouseButtonBounce() || curTime != lastClickTime) { if (selectionType == selChar) { selectionType = selWord; doubleClick = true; diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index dbcc3c940..80a2e8557 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1281,6 +1281,10 @@ unsigned int Platform::DoubleClickTime() { return ::GetDoubleClickTime(); } +bool Platform::MouseButtonBounce() { + return false; +} + void Platform::DebugDisplay(const char *s) { ::OutputDebugString(s); } -- cgit v1.2.3