Tracker: Rework BFilePanel compatibility code.

Instead of adding "dummy views", leave the original views intact
and just add a resizing hack to take care of any movements that
apps have inflicted.

Fixes #16411, a crash in WonderBrush, and compatibility issues
in some other applications.
This commit is contained in:
Augustin Cavalier 2020-07-28 21:53:19 -04:00
parent 494bd14713
commit d548fb2b3e
2 changed files with 10 additions and 18 deletions

View File

@ -116,6 +116,16 @@ BFilePanel::Show()
fWindow->Show();
fWindow->Activate();
#if 1
// The Be Book gives the names for some of the child views so that apps
// could move them around if they needed to, but we have most in layouts,
// so once the window has been opened, we have to forcibly resize "PoseView"
// (fBackView) to fully invalidate its layout in case any of the controls
// in it have been moved.
fWindow->FindView("PoseView")->ResizeBy(1, 1);
fWindow->FindView("PoseView")->ResizeBy(-1, -1);
#endif
}

View File

@ -909,24 +909,6 @@ TFilePanel::RestoreState()
// Finish UI creation now that the PoseView is initialized
InitLayout();
#if 1
// The Be Book gives the names for some of these views so that apps could
// move them around if they needed to, but we have them here in layouts,
// so we need to change their names and add dummy views for compatibility.
// (The same is done for the PoseView above.)
fPoseView->TitleView()->SetName("ActualTitleView");
fPoseView->CountView()->SetName("ActualCountView");
fPoseView->HScrollBar()->SetName("ActualHScrollBar");
fPoseView->VScrollBar()->SetName("ActualVScrollBar");
const char* views[] = {"TitleView", "HScrollBar", "VScrollBar", "CountVw", NULL};
for (int i = 0; views[i] != NULL; i++) {
BView* dummy = new BView(BRect(), views[i], B_FOLLOW_NONE, 0);
fBackView->AddChild(dummy);
dummy->Hide();
}
#endif
}