MouseDown(): Also check whether the buttons pressed have changed since the

last click and reset the click count, if so. Fixes a regression introduced in
r39602 (left-click after right-click was recognized as double-click).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39609 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-11-24 16:25:12 +00:00
parent 52cac2e7a4
commit 5116393fb9
2 changed files with 12 additions and 6 deletions
+11 -6
View File
@@ -491,6 +491,7 @@ DefaultWindowBehaviour::DefaultWindowBehaviour(Window* window)
fDesktop(window->Desktop()),
fState(NULL),
fLastModifiers(0),
fLastMouseButtons(0),
fResetClickCount(0)
{
}
@@ -506,21 +507,26 @@ bool
DefaultWindowBehaviour::MouseDown(BMessage* message, BPoint where)
{
// Get the click count and reset it, if the modifiers changed in the
// meantime.
// TODO: This should be done in a better place (e.g. the input server). It
// should also reset clicks after mouse movement (which we don't do here
// either -- though that's probably acceptable).
// meantime. Do the same when this is not the button we've seen before.
// TODO: At least the modifier check should be done in a better place
// (e.g. the input server). It should also reset clicks after mouse
// movement (which we don't do here either -- though that's probably
// acceptable).
int32 clickCount = message->FindInt32("clicks");
int32 modifiers = message->FindInt32("modifiers");
int32 buttons = message->FindInt32("buttons");
if (clickCount <= 1) {
fResetClickCount = 0;
} else if (modifiers != fLastModifiers
} else if (modifiers != fLastModifiers || buttons != fLastMouseButtons
|| clickCount - fResetClickCount < 1) {
fResetClickCount = clickCount - 1;
clickCount = 1;
} else
clickCount -= fResetClickCount;
fLastModifiers = modifiers;
fLastMouseButtons = buttons;
// if a state is active, let it do the job
if (fState != NULL)
@@ -554,7 +560,6 @@ DefaultWindowBehaviour::MouseDown(BMessage* message, BPoint where)
}
// translate the region into an action
int32 buttons = message->FindInt32("buttons");
bool leftButton = (buttons & B_PRIMARY_MOUSE_BUTTON) != 0;
bool rightButton = (buttons & B_SECONDARY_MOUSE_BUTTON) != 0;
uint32 flags = fWindow->Flags();
+1
View File
@@ -74,6 +74,7 @@ protected:
Desktop* fDesktop;
State* fState;
int32 fLastModifiers;
int32 fLastMouseButtons;
int32 fResetClickCount;
};