Skip to content

Commit

Permalink
BTab: fix behavior with custom BTabView
Browse files Browse the repository at this point in the history
* BTab should not assume too much about BTabView, because some apps (eg.
Terminal) completely override the structure of it.
* Use the given owner view in Select/Deselect, rather than trying to
guess from the fTabView.

Fixes tabs not showing in Terminal, mouse not working in Terminal, and
probably some other problems there as the view tree was not correct
anymore.
  • Loading branch information
pulkomandy committed Jul 14, 2015
1 parent d585e4c commit ce7470f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/kits/interface/TabView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,28 +149,28 @@ BTab::IsSelected() const


void
BTab::Select(BView*)
BTab::Select(BView* owner)
{
fSelected = true;

if (!fTabView || !View())
if (!owner || !View() || !owner->Window())
return;

// NOTE: Views are not added/removed, if there is layout,
// they are made visible/invisible in that case.
if (!fTabView->ContainerView()->GetLayout() && View()->Parent() == NULL)
fTabView->AddChild(fView);
if (!owner->GetLayout() && View()->Parent() == NULL)
owner->AddChild(fView);
}


void
BTab::Deselect()
{
if (View() && fTabView) {
if (View()) {
// NOTE: Views are not added/removed, if there is layout,
// they are made visible/invisible in that case.
bool removeView = false;
BView* container = fTabView->ContainerView();
BView* container = View()->Parent();
if (container)
removeView =
dynamic_cast<BCardLayout*>(container->GetLayout()) == NULL;
Expand Down Expand Up @@ -691,10 +691,10 @@ BTabView::Select(int32 index)
tab->Deselect();

tab = TabAt(index);
tab->Select(NULL);
if (tab && ContainerView()) {
if (index == 0)
fTabOffset = 0.0f;
tab->Select(ContainerView());
fSelection = index;

// make the view visible through the layout if there is one
Expand Down

0 comments on commit ce7470f

Please sign in to comment.