Bugfixes for tab view click events:
* When adding/removing tabs, process a fake mouse moved event to synchronize with the new tab layout. * Count the mouse clicks for the "double click into empty area opens new tab" feature in such a way that clicks into tabs never count (closing a tab was the first click before, the second would immediately open a new tab and similar issues). git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@309 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
committed by
Alexandre Deckner
parent
7239ea752d
commit
dcad381777
@@ -145,6 +145,8 @@ public:
|
|||||||
virtual void MouseMoved(BPoint where, uint32 transit,
|
virtual void MouseMoved(BPoint where, uint32 transit,
|
||||||
const BMessage* dragMessage);
|
const BMessage* dragMessage);
|
||||||
|
|
||||||
|
virtual void DoLayout();
|
||||||
|
|
||||||
void AddTab(const char* label, int32 index = -1);
|
void AddTab(const char* label, int32 index = -1);
|
||||||
void AddTab(TabView* tab, int32 index = -1);
|
void AddTab(TabView* tab, int32 index = -1);
|
||||||
TabView* RemoveTab(int32 index);
|
TabView* RemoveTab(int32 index);
|
||||||
@@ -159,10 +161,13 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
TabView* _TabAt(const BPoint& where) const;
|
TabView* _TabAt(const BPoint& where) const;
|
||||||
|
void _MouseMoved(BPoint where, uint32 transit,
|
||||||
|
const BMessage* dragMessage);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TabView* fLastMouseEventTab;
|
TabView* fLastMouseEventTab;
|
||||||
bool fMouseDown;
|
bool fMouseDown;
|
||||||
|
uint32 fClickCount;
|
||||||
TabView* fSelectedTab;
|
TabView* fSelectedTab;
|
||||||
Controller* fController;
|
Controller* fController;
|
||||||
};
|
};
|
||||||
@@ -179,6 +184,7 @@ TabContainerView::TabContainerView(Controller* controller)
|
|||||||
BGroupView(B_HORIZONTAL),
|
BGroupView(B_HORIZONTAL),
|
||||||
fLastMouseEventTab(NULL),
|
fLastMouseEventTab(NULL),
|
||||||
fMouseDown(false),
|
fMouseDown(false),
|
||||||
|
fClickCount(0),
|
||||||
fSelectedTab(NULL),
|
fSelectedTab(NULL),
|
||||||
fController(controller)
|
fController(controller)
|
||||||
{
|
{
|
||||||
@@ -260,8 +266,12 @@ TabContainerView::MouseDown(BPoint where)
|
|||||||
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
|
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
|
||||||
if (fLastMouseEventTab)
|
if (fLastMouseEventTab)
|
||||||
fLastMouseEventTab->MouseDown(where, buttons);
|
fLastMouseEventTab->MouseDown(where, buttons);
|
||||||
else if (clicks > 1)
|
else {
|
||||||
fController->DoubleClickOutsideTabs();
|
if (clicks > 1)
|
||||||
|
fClickCount++;
|
||||||
|
else
|
||||||
|
fClickCount = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -271,6 +281,10 @@ TabContainerView::MouseUp(BPoint where)
|
|||||||
fMouseDown = false;
|
fMouseDown = false;
|
||||||
if (fLastMouseEventTab)
|
if (fLastMouseEventTab)
|
||||||
fLastMouseEventTab->MouseUp(where);
|
fLastMouseEventTab->MouseUp(where);
|
||||||
|
else if (fClickCount > 1) {
|
||||||
|
fClickCount = 0;
|
||||||
|
fController->DoubleClickOutsideTabs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -278,27 +292,22 @@ void
|
|||||||
TabContainerView::MouseMoved(BPoint where, uint32 transit,
|
TabContainerView::MouseMoved(BPoint where, uint32 transit,
|
||||||
const BMessage* dragMessage)
|
const BMessage* dragMessage)
|
||||||
{
|
{
|
||||||
TabView* tab = _TabAt(where);
|
_MouseMoved(where, transit, dragMessage);
|
||||||
if (fMouseDown) {
|
|
||||||
uint32 transit = tab == fLastMouseEventTab
|
|
||||||
? B_INSIDE_VIEW : B_OUTSIDE_VIEW;
|
|
||||||
if (fLastMouseEventTab)
|
|
||||||
fLastMouseEventTab->MouseMoved(where, transit, dragMessage);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fLastMouseEventTab && fLastMouseEventTab == tab)
|
|
||||||
fLastMouseEventTab->MouseMoved(where, B_INSIDE_VIEW, dragMessage);
|
|
||||||
else {
|
|
||||||
if (fLastMouseEventTab)
|
|
||||||
fLastMouseEventTab->MouseMoved(where, B_EXITED_VIEW, dragMessage);
|
|
||||||
fLastMouseEventTab = tab;
|
|
||||||
if (fLastMouseEventTab)
|
|
||||||
fLastMouseEventTab->MouseMoved(where, B_ENTERED_VIEW, dragMessage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TabContainerView::DoLayout()
|
||||||
|
{
|
||||||
|
BGroupView::DoLayout();
|
||||||
|
|
||||||
|
BPoint where;
|
||||||
|
uint32 buttons;
|
||||||
|
GetMouse(&where, &buttons, false);
|
||||||
|
if (Bounds().Contains(where))
|
||||||
|
_MouseMoved(where, B_INSIDE_VIEW, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TabContainerView::AddTab(const char* label, int32 index)
|
TabContainerView::AddTab(const char* label, int32 index)
|
||||||
{
|
{
|
||||||
@@ -472,6 +481,31 @@ TabContainerView::_TabAt(const BPoint& where) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TabContainerView::_MouseMoved(BPoint where, uint32 _transit,
|
||||||
|
const BMessage* dragMessage)
|
||||||
|
{
|
||||||
|
TabView* tab = _TabAt(where);
|
||||||
|
if (fMouseDown) {
|
||||||
|
uint32 transit = tab == fLastMouseEventTab
|
||||||
|
? B_INSIDE_VIEW : B_OUTSIDE_VIEW;
|
||||||
|
if (fLastMouseEventTab)
|
||||||
|
fLastMouseEventTab->MouseMoved(where, transit, dragMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fLastMouseEventTab && fLastMouseEventTab == tab)
|
||||||
|
fLastMouseEventTab->MouseMoved(where, B_INSIDE_VIEW, dragMessage);
|
||||||
|
else {
|
||||||
|
if (fLastMouseEventTab)
|
||||||
|
fLastMouseEventTab->MouseMoved(where, B_EXITED_VIEW, dragMessage);
|
||||||
|
fLastMouseEventTab = tab;
|
||||||
|
if (fLastMouseEventTab)
|
||||||
|
fLastMouseEventTab->MouseMoved(where, B_ENTERED_VIEW, dragMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - TabView
|
// #pragma mark - TabView
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user