Skip to content

Commit 362755d

Browse files
committed
Merge pull request #3427
1ad2636 qt: Prevent non-functional GUI from popping up during Init (Wladimir J. van der Laan)
2 parents f46babc + 1ad2636 commit 362755d

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,13 @@ void HandleSIGHUP(int)
164164

165165
bool static InitError(const std::string &str)
166166
{
167-
uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_ERROR);
167+
uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_ERROR | CClientUIInterface::NOSHOWGUI);
168168
return false;
169169
}
170170

171171
bool static InitWarning(const std::string &str)
172172
{
173-
uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_WARNING);
173+
uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_WARNING | CClientUIInterface::NOSHOWGUI);
174174
return true;
175175
}
176176

src/qt/bitcoingui.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,11 @@ void BitcoinGUI::message(const QString &title, const QString &message, unsigned
684684
if (!(buttons = (QMessageBox::StandardButton)(style & CClientUIInterface::BTN_MASK)))
685685
buttons = QMessageBox::Ok;
686686

687-
// Ensure we get users attention
688-
showNormalIfMinimized();
687+
// Ensure we get users attention, but only if main window is visible
688+
// as we don't want to pop up the main window for messages that happen before
689+
// initialization is finished.
690+
if(!(style & CClientUIInterface::NOSHOWGUI))
691+
showNormalIfMinimized();
689692
QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message, buttons, this);
690693
int r = mBox.exec();
691694
if (ret != NULL)

src/ui_interface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ class CClientUIInterface
6262

6363
/** Force blocking, modal message box dialog (not just OS notification) */
6464
MODAL = 0x10000000U,
65+
/** Don't bring GUI to foreground. Use for messages during initialization */
66+
NOSHOWGUI = 0x20000000U,
6567

6668
/** Predefined combinations for certain default usage cases */
6769
MSG_INFORMATION = ICON_INFORMATION,

0 commit comments

Comments
 (0)