Tracker: fix window focus behaviour

* Also fix LongAndDragTrackingFilter
Fixes #15605

Change-Id: I98c5f3ca435e54c98515ebe2fccbbfd5d08c1a25
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2081
Reviewed-by: Sergei Reznikov <diver@gelios.net>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
X512 2020-01-07 16:39:47 +09:00 committed by waddlesplash
parent 073e295aa6
commit 6bff918400
3 changed files with 18 additions and 2 deletions

View File

@ -74,11 +74,13 @@ LongAndDragTrackingFilter::Filter(BMessage* message, BHandler** target)
return B_DISPATCH_MESSAGE;
switch (message->what) {
case B_MOUSE_DOWN:
case B_MOUSE_DOWN: {
int32 clicks = 0;
message->FindInt32("buttons", (int32*)&fClickButtons);
message->FindInt32("clicks", (int32*)&clicks);
if (fClickButtons != 0) {
if (fClickButtons != 0 && clicks == 1) {
BView* targetView = dynamic_cast<BView*>(*target);
if (targetView != NULL)
@ -94,10 +96,12 @@ LongAndDragTrackingFilter::Filter(BMessage* message, BHandler** target)
BMessenger(*target), &message, fDurationThreshold, 1);
}
return B_DISPATCH_MESSAGE;
}
case B_MOUSE_UP:
_StopTracking();
message->AddInt32("last_buttons", (int32)fClickButtons);
message->FindInt32("buttons", (int32*)&fClickButtons);
return B_DISPATCH_MESSAGE;
case B_MOUSE_MOVED:

View File

@ -251,6 +251,7 @@ BPoseView::BPoseView(Model* model, uint32 viewMode)
fRealPivotPose(NULL),
fKeyRunner(NULL),
fTrackRightMouseUp(false),
fTrackMouseUp(false),
fSelectionVisible(true),
fMultipleSelection(true),
fDragEnabled(true),
@ -7305,6 +7306,7 @@ BPoseView::MouseDragged(const BMessage* message)
fTextWidgetToCheck->CancelWait();
fTrackRightMouseUp = false;
fTrackMouseUp = false;
BPoint where;
uint32 buttons = 0;
@ -7329,6 +7331,7 @@ void
BPoseView::MouseLongDown(const BMessage* message)
{
fTrackRightMouseUp = false;
fTrackMouseUp = false;
BPoint where;
if (message->FindPoint("where", &where) != B_OK)
@ -7383,6 +7386,7 @@ BPoseView::MouseDown(BPoint where)
bool secondaryMouseButtonDown
= SecondaryMouseButtonDown(modifierKeys, buttons);
fTrackRightMouseUp = secondaryMouseButtonDown;
fTrackMouseUp = !secondaryMouseButtonDown;
bool extendSelection = (modifierKeys & B_COMMAND_KEY) != 0
&& fMultipleSelection;
@ -7403,6 +7407,8 @@ BPoseView::MouseDown(BPoint where)
&& buttons == B_PRIMARY_MOUSE_BUTTON
&& fLastClickButtons == B_PRIMARY_MOUSE_BUTTON
&& (modifierKeys & B_CONTROL_KEY) == 0) {
fTrackRightMouseUp = false;
fTrackMouseUp = false;
// special handling for path field double-clicks
if (!WasClickInPath(pose, index, where))
OpenSelection(pose, &index);
@ -7468,7 +7474,12 @@ BPoseView::MouseUp(BPoint where)
}
ShowContextMenu(where);
}
if (fTrackMouseUp)
Window()->Activate();
fTrackRightMouseUp = false;
fTrackMouseUp = false;
}

View File

@ -745,6 +745,7 @@ protected:
const BPose* fRealPivotPose;
BMessageRunner* fKeyRunner;
bool fTrackRightMouseUp;
bool fTrackMouseUp;
struct SelectionRectInfo {
SelectionRectInfo()