Fix a bug with closing tabs by pressing the tertiary mouse button. fMouseDown
would be true, but the fLastMouseEventTab would have been reset when removing the tab. Rather than fixing this problem, behave the same as Firefox and close the tab on mouse up (when the mouse is still over the tab, which allows the user a way back out). Avoids the above problem as a side effect. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@469 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
parent
99006ca0ae
commit
464aca712f
@ -440,7 +440,7 @@ TabContainerView::_MouseMoved(BPoint where, uint32 _transit,
|
||||
return;
|
||||
}
|
||||
|
||||
if (fLastMouseEventTab && fLastMouseEventTab == tab)
|
||||
if (fLastMouseEventTab != NULL && fLastMouseEventTab == tab)
|
||||
fLastMouseEventTab->MouseMoved(where, B_INSIDE_VIEW, dragMessage);
|
||||
else {
|
||||
if (fLastMouseEventTab)
|
||||
|
@ -366,6 +366,7 @@ private:
|
||||
TabManagerController* fController;
|
||||
bool fOverCloseRect;
|
||||
bool fClicked;
|
||||
bool fCloseOnMouseUp;
|
||||
};
|
||||
|
||||
|
||||
@ -375,7 +376,8 @@ WebTabView::WebTabView(TabManagerController* controller)
|
||||
fIcon(NULL),
|
||||
fController(controller),
|
||||
fOverCloseRect(false),
|
||||
fClicked(false)
|
||||
fClicked(false),
|
||||
fCloseOnMouseUp(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -449,7 +451,7 @@ void
|
||||
WebTabView::MouseDown(BPoint where, uint32 buttons)
|
||||
{
|
||||
if (buttons & B_TERTIARY_MOUSE_BUTTON) {
|
||||
fController->CloseTab(ContainerView()->IndexOf(this));
|
||||
fCloseOnMouseUp = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -467,12 +469,20 @@ WebTabView::MouseDown(BPoint where, uint32 buttons)
|
||||
void
|
||||
WebTabView::MouseUp(BPoint where)
|
||||
{
|
||||
if (!fClicked) {
|
||||
if (!fClicked && !fCloseOnMouseUp) {
|
||||
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