* Lock the popup menu window when archiving, fixes #1775

* Made the drag detection less sensitive as most simple clicks would initiate an unwanted drag.
* Don't show the dragger's popup from its original parent window (not a shelf) for all buttons, as in R5.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29727 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexandre Deckner 2009-03-26 11:07:45 +00:00
parent 1d5db3c036
commit 82e6d2ffcd

View File

@ -118,9 +118,12 @@ BDragger::Archive(BMessage *data, bool deep) const
BMessage popupMsg;
if (fPopUp) {
ret = fPopUp->Archive(&popupMsg, deep);
if (ret == B_OK)
ret = data->AddMessage("_popup", &popupMsg);
if (fPopUp->Window()->Lock()) {
ret = fPopUp->Archive(&popupMsg, deep);
if (ret == B_OK)
ret = data->AddMessage("_popup", &popupMsg);
fPopUp->Window()->Unlock();
}
}
if (ret == B_OK)
@ -194,10 +197,8 @@ BDragger::MouseDown(BPoint where)
Window()->CurrentMessage()->FindInt32("buttons", (int32 *)&buttons);
if (buttons & B_SECONDARY_MOUSE_BUTTON) {
if (!fShelf || !fTarget) {
beep();
if (!fShelf)
return;
}
_ShowPopUp(fTarget, where);
} else {
@ -215,7 +216,11 @@ BDragger::MouseDown(BPoint where)
if (!buttons || system_time() > time + clickSpeed)
break;
if (mousePoint != where) {
float squaredDistance =
(mousePoint.x - where.x) * (mousePoint.x - where.x)
+ (mousePoint.y - where.y) * (mousePoint.y - where.y);
if (squaredDistance >= 16) {
drag = true;
break;
}
@ -242,7 +247,7 @@ BDragger::MouseDown(BPoint where)
archive.AddInt32("be:actions", B_TRASH_TARGET);
BPoint offset;
drawing_mode mode;
drawing_mode mode;
BBitmap *bitmap = DragBitmap(&offset, &mode);
if (bitmap != NULL)
DragMessage(&archive, bitmap, mode, offset, this);
@ -251,8 +256,12 @@ BDragger::MouseDown(BPoint where)
ConvertFromScreen(fTarget->ConvertToScreen(fTarget->Bounds())),
this);
}
} else
} else {
if (!fShelf)
return;
_ShowPopUp(fTarget, where);
}
}
}