From 93e536ab5d2a81951820943172a197b132f980a2 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Mon, 24 Oct 2022 22:43:27 -0400 Subject: [PATCH] registrar: Properly clear out icons and resize when text changes. May help with #18006. --- src/servers/registrar/ShutdownProcess.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/servers/registrar/ShutdownProcess.cpp b/src/servers/registrar/ShutdownProcess.cpp index 104f04e4c5..f4fee2b5bd 100644 --- a/src/servers/registrar/ShutdownProcess.cpp +++ b/src/servers/registrar/ShutdownProcess.cpp @@ -31,6 +31,7 @@ #include // for B_REQUEST_QUIT #include #include +#include #include #include @@ -362,6 +363,18 @@ public: fKillAppMessage->ReplaceInt32("team", team); } + void SetText(const char* text) + { + const int32 initialLength = TextView()->TextLength(), + initialLines = TextView()->CountLines(); + + BAlert::SetText(text); + + if (TextView()->CountLines() > initialLines + || TextView()->CountLines() > (initialLength * 2)) + ResizeToPreferred(); + } + void SetCancelShutdownButtonEnabled(bool enable) { fCancelShutdownButton->SetEnabled(enable); @@ -393,9 +406,7 @@ public: fRebootSystemButton->Show(); SetTitle(B_TRANSLATE("System is shut down")); - SetText( - B_TRANSLATE("It's now safe to turn off the computer.")); - ResizeToPreferred(); + SetText(B_TRANSLATE("It's now safe to turn off the computer.")); } void SetWaitForAbortedOK() @@ -467,7 +478,8 @@ private: fCurrentIconBitmap = NULL; } else SetIcon(fCurrentIconBitmap); - } + } else + SetIcon(NULL); } void IconWaitAnimationEnabled(bool enable)