From e40ed644c893cc73373d83d4139f25182b7cc036 Mon Sep 17 00:00:00 2001
From: YuSanka <yusanka@gmail.com>
Date: Fri, 4 Dec 2020 13:34:44 +0100
Subject: [PATCH] Show the PrintHostDialog on the same display as an
 application window. Probably, fix for #5044

---
 src/slic3r/GUI/PrintHostDialogs.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/slic3r/GUI/PrintHostDialogs.cpp b/src/slic3r/GUI/PrintHostDialogs.cpp
index dcf7115ca..ec9e36c45 100644
--- a/src/slic3r/GUI/PrintHostDialogs.cpp
+++ b/src/slic3r/GUI/PrintHostDialogs.cpp
@@ -19,6 +19,7 @@
 #include "I18N.hpp"
 #include "../Utils/PrintHost.hpp"
 #include "wxExtensions.hpp"
+#include "MainFrame.hpp"
 #include "libslic3r/AppConfig.hpp"
 
 namespace fs = boost::filesystem;
@@ -31,7 +32,7 @@ static const char *CONFIG_KEY_PRINT = "printhost_print";
 static const char *CONFIG_KEY_GROUP = "printhost_group";
 
 PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, bool can_start_print, const wxArrayString &groups)
-    : MsgDialog(nullptr, _L("Send G-Code to printer host"), _L("Upload to Printer Host with the following filename:"), wxID_NONE)
+    : MsgDialog(static_cast<wxWindow*>(wxGetApp().mainframe), _L("Send G-Code to printer host"), _L("Upload to Printer Host with the following filename:"), wxID_NONE)
     , txt_filename(new wxTextCtrl(this, wxID_ANY))
     , box_print(can_start_print ? new wxCheckBox(this, wxID_ANY, _L("Start printing after upload")) : nullptr)
     , combo_groups(!groups.IsEmpty() ? new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, groups, wxCB_READONLY) : nullptr)
@@ -77,6 +78,7 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, bool can_start_pr
     txt_filename->SetFocus();
     
     Fit();
+    CenterOnParent();
 
     Bind(wxEVT_SHOW, [=](const wxShowEvent &) {
         // Another similar case where the function only works with EVT_SHOW + CallAfter,