From d548fb2b3e493004761739c3e3fcc008ec497860 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 28 Jul 2020 21:53:19 -0400 Subject: [PATCH] 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. --- src/kits/tracker/FilePanel.cpp | 10 ++++++++++ src/kits/tracker/FilePanelPriv.cpp | 18 ------------------ 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/kits/tracker/FilePanel.cpp b/src/kits/tracker/FilePanel.cpp index 539b7eaf5c..99a01b5826 100644 --- a/src/kits/tracker/FilePanel.cpp +++ b/src/kits/tracker/FilePanel.cpp @@ -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 } diff --git a/src/kits/tracker/FilePanelPriv.cpp b/src/kits/tracker/FilePanelPriv.cpp index e905781e6e..aa7d5d5d24 100644 --- a/src/kits/tracker/FilePanelPriv.cpp +++ b/src/kits/tracker/FilePanelPriv.cpp @@ -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 }