diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d773208ac0..dc4b66ad93 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -415,9 +415,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : _previousScriptLocation = _settings->value("LastScriptLocation", QVariant("")).toString(); } - connect(_window, &MainWindow::windowGeometryChanged, - _runningScriptsWidget, &RunningScriptsWidget::setBoundary); - _trayIcon->show(); // set the local loopback interface for local sounds from audio scripts diff --git a/interface/src/ui/HMDToolsDialog.cpp b/interface/src/ui/HMDToolsDialog.cpp index 88924f68d1..580490f83b 100644 --- a/interface/src/ui/HMDToolsDialog.cpp +++ b/interface/src/ui/HMDToolsDialog.cpp @@ -79,7 +79,6 @@ HMDToolsDialog::HMDToolsDialog(QWidget* parent) : // keep track of changes to the number of screens connect(QApplication::desktop(), &QDesktopWidget::screenCountChanged, this, &HMDToolsDialog::screenCountChanged); - } HMDToolsDialog::~HMDToolsDialog() { diff --git a/interface/src/ui/HMDToolsDialog.h b/interface/src/ui/HMDToolsDialog.h index e3e5573533..d539b58d04 100644 --- a/interface/src/ui/HMDToolsDialog.h +++ b/interface/src/ui/HMDToolsDialog.h @@ -22,6 +22,8 @@ public: ~HMDToolsDialog(); QString getDebugDetails() const; + QScreen* getHMDScreen() const { return _hmdScreen; } + bool hasHMDScreen() const { return _hmdScreenNumber >= -1; } signals: void closed(); diff --git a/interface/src/ui/RunningScriptsWidget.cpp b/interface/src/ui/RunningScriptsWidget.cpp index 29c004bdb7..4fd19d4588 100644 --- a/interface/src/ui/RunningScriptsWidget.cpp +++ b/interface/src/ui/RunningScriptsWidget.cpp @@ -17,7 +17,9 @@ #include #include #include +#include #include +#include #include "Application.h" #include "Menu.h" @@ -82,10 +84,6 @@ void RunningScriptsWidget::loadSelectedScript() { } } -void RunningScriptsWidget::setBoundary(const QRect& rect) { - _boundary = rect; -} - void RunningScriptsWidget::setRunningScripts(const QStringList& list) { setUpdatesEnabled(false); QLayoutItem* widget; @@ -153,7 +151,27 @@ void RunningScriptsWidget::showEvent(QShowEvent* event) { ui->filterLineEdit->setFocus(); } - const QRect parentGeometry = parentWidget()->geometry(); + QRect parentGeometry = parentWidget()->geometry(); + + // If our parent window is on the HMD, then don't use it's geometry, instead use + // the "main screen" geometry. + HMDToolsDialog* hmdTools = Menu::getInstance()->getHMDToolsDialog(); + if (hmdTools && hmdTools->hasHMDScreen()) { + QScreen* hmdScreen = hmdTools->getHMDScreen(); + QWindow* appWindow = parentWidget()->windowHandle(); + QScreen* appScreen = appWindow->screen(); + + // if our app's screen is the hmd screen, we don't want to place the + // running scripts widget on it. So we need to pick a better screen. + // we will use the screen for the HMDTools since it's a guarenteed + // better screen. + if (appScreen == hmdScreen) { + QScreen* betterScreen = hmdTools->windowHandle()->screen(); + parentGeometry = betterScreen->geometry(); + } + + } + int titleBarHeight = UIUtil::getWindowTitleBarHeight(this); int menuBarHeight = Menu::getInstance()->geometry().height(); int topMargin = titleBarHeight + menuBarHeight; diff --git a/interface/src/ui/RunningScriptsWidget.h b/interface/src/ui/RunningScriptsWidget.h index 7493a1a5ce..8eace0c7b1 100644 --- a/interface/src/ui/RunningScriptsWidget.h +++ b/interface/src/ui/RunningScriptsWidget.h @@ -44,7 +44,6 @@ protected: public slots: void scriptStopped(const QString& scriptName); - void setBoundary(const QRect& rect); private slots: void allScriptsStopped(); @@ -61,7 +60,6 @@ private: ScriptsTableWidget* _recentlyLoadedScriptsTable; QStringList _recentlyLoadedScripts; QString _lastStoppedScript; - QRect _boundary; }; #endif // hifi_RunningScriptsWidget_h