mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-05 02:25:56 +02:00
make sure the running scripts widget doesn't start on the HMD screen
This commit is contained in:
parent
fd69b6b5b4
commit
d058b5554e
5 changed files with 25 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -22,6 +22,8 @@ public:
|
|||
~HMDToolsDialog();
|
||||
|
||||
QString getDebugDetails() const;
|
||||
QScreen* getHMDScreen() const { return _hmdScreen; }
|
||||
bool hasHMDScreen() const { return _hmdScreenNumber >= -1; }
|
||||
|
||||
signals:
|
||||
void closed();
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
#include <QFileInfo>
|
||||
#include <QKeyEvent>
|
||||
#include <QPainter>
|
||||
#include <QScreen>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QWindow>
|
||||
|
||||
#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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue