Fix #6978: Add and close tabs on middle mouse down, not up.
This reduces perceived latency. One day when I add a tab close undo stack, this will be even better. But generally using the middle mouse button is not accidental.
This commit is contained in:
parent
cc467a28d9
commit
45ecce1d57
@ -138,7 +138,7 @@ TabContainerView::MouseDown(BPoint where)
|
||||
else {
|
||||
if ((buttons & B_TERTIARY_MOUSE_BUTTON) != 0) {
|
||||
// Middle click outside tabs should always open a new tab.
|
||||
fClickCount = 2;
|
||||
fController->DoubleClickOutsideTabs();
|
||||
} else if (clicks > 1)
|
||||
fClickCount++;
|
||||
else
|
||||
|
@ -454,7 +454,6 @@ private:
|
||||
TabManagerController* fController;
|
||||
bool fOverCloseRect;
|
||||
bool fClicked;
|
||||
bool fCloseOnMouseUp;
|
||||
};
|
||||
|
||||
|
||||
@ -464,8 +463,7 @@ WebTabView::WebTabView(TabManagerController* controller)
|
||||
fIcon(NULL),
|
||||
fController(controller),
|
||||
fOverCloseRect(false),
|
||||
fClicked(false),
|
||||
fCloseOnMouseUp(false)
|
||||
fClicked(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -539,7 +537,8 @@ void
|
||||
WebTabView::MouseDown(BPoint where, uint32 buttons)
|
||||
{
|
||||
if (buttons & B_TERTIARY_MOUSE_BUTTON) {
|
||||
fCloseOnMouseUp = true;
|
||||
// Immediately close tab
|
||||
fController->CloseTab(ContainerView()->IndexOf(this));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -557,20 +556,12 @@ WebTabView::MouseDown(BPoint where, uint32 buttons)
|
||||
void
|
||||
WebTabView::MouseUp(BPoint where)
|
||||
{
|
||||
if (!fClicked && !fCloseOnMouseUp) {
|
||||
if (!fClicked) {
|
||||
TabView::MouseUp(where);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fCloseOnMouseUp && Frame().Contains(where)) {
|
||||
fCloseOnMouseUp = false;
|
||||
fController->CloseTab(ContainerView()->IndexOf(this));
|
||||
// Probably this object is toast now, better return here.
|
||||
return;
|
||||
}
|
||||
|
||||
fClicked = false;
|
||||
fCloseOnMouseUp = false;
|
||||
|
||||
if (_CloseRectFrame(Frame()).Contains(where))
|
||||
fController->CloseTab(ContainerView()->IndexOf(this));
|
||||
|
Loading…
Reference in New Issue
Block a user