Middle click anywhere into a tab closes that page.

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@230 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
stippi
2010-02-27 00:05:33 +00:00
parent 84c9928e40
commit f44756cf46
+14 -6
View File
@@ -84,7 +84,7 @@ public:
virtual void DrawContents(BView* owner, BRect frame, virtual void DrawContents(BView* owner, BRect frame,
const BRect& updateRect, bool isFirst, bool isLast, bool isFront); const BRect& updateRect, bool isFirst, bool isLast, bool isFront);
virtual void MouseDown(BPoint where); virtual void MouseDown(BPoint where, uint32 buttons);
virtual void MouseUp(BPoint where); virtual void MouseUp(BPoint where);
virtual void MouseMoved(BPoint where, uint32 transit, virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage); const BMessage* dragMessage);
@@ -248,10 +248,13 @@ TabContainerView::Draw(BRect updateRect)
void void
TabContainerView::MouseDown(BPoint where) TabContainerView::MouseDown(BPoint where)
{ {
uint32 buttons;
if (Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons) != B_OK)
buttons = B_PRIMARY_MOUSE_BUTTON;
fMouseDown = true; fMouseDown = true;
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
if (fLastMouseEventTab) if (fLastMouseEventTab)
fLastMouseEventTab->MouseDown(where); fLastMouseEventTab->MouseDown(where, buttons);
} }
@@ -544,7 +547,7 @@ void TabView::DrawContents(BView* owner, BRect frame, const BRect& updateRect,
base, 0, BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); base, 0, BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
} }
void TabView::MouseDown(BPoint where) void TabView::MouseDown(BPoint where, uint32 buttons)
{ {
fContainerView->SelectTab(this); fContainerView->SelectTab(this);
} }
@@ -731,7 +734,7 @@ public:
virtual void DrawContents(BView* owner, BRect frame, const BRect& updateRect, virtual void DrawContents(BView* owner, BRect frame, const BRect& updateRect,
bool isFirst, bool isLast, bool isFront); bool isFirst, bool isLast, bool isFront);
virtual void MouseDown(BPoint where); virtual void MouseDown(BPoint where, uint32 buttons);
virtual void MouseUp(BPoint where); virtual void MouseUp(BPoint where);
virtual void MouseMoved(BPoint where, uint32 transit, virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage); const BMessage* dragMessage);
@@ -811,11 +814,16 @@ WebTabView::DrawContents(BView* owner, BRect frame, const BRect& updateRect,
void void
WebTabView::MouseDown(BPoint where) WebTabView::MouseDown(BPoint where, uint32 buttons)
{ {
if (buttons & B_TERTIARY_MOUSE_BUTTON) {
fController->CloseTab(ContainerView()->IndexOf(this));
return;
}
BRect closeRect = _CloseRectFrame(Frame()); BRect closeRect = _CloseRectFrame(Frame());
if (!closeRect.Contains(where)) { if (!closeRect.Contains(where)) {
TabView::MouseDown(where); TabView::MouseDown(where, buttons);
return; return;
} }