Merge pull request #12787 from druiz17/fix-offscreen-windows

hide desktop windows when switching into HMD mode
This commit is contained in:
John Conklin II 2018-04-13 12:17:15 -07:00 committed by GitHub
commit 008c7be369
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 0 deletions

View file

@ -324,6 +324,18 @@ FocusScope {
return false;
}
function hideDesktopWindows() {
for (var index = 0; index < desktop.visibleChildren.length; index++) {
var child = desktop.visibleChildren[index];
if (child.topLevelWindow && child.hasOwnProperty("modality")) {
var TOOLBAR_NAME = "com.highfidelity.interface.toolbar.system"
if (child.objectName !== TOOLBAR_NAME) {
child.setShown(false);
}
}
}
}
function setPinned(newPinned) {
pinned = newPinned
}

View file

@ -154,6 +154,13 @@ void OffscreenUi::show(const QUrl& url, const QString& name, std::function<void(
}
}
void OffscreenUi::hideDesktopWindows() {
if (QThread::currentThread() != thread()) {
BLOCKING_INVOKE_METHOD(this, "hideDesktopWindows");
}
QMetaObject::invokeMethod(_desktop, "hideDesktopWindows");
}
void OffscreenUi::toggle(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f) {
QQuickItem* item = getRootItem()->findChild<QQuickItem*>(name);
if (!item) {

View file

@ -60,6 +60,7 @@ public:
void createDesktop(const QUrl& url);
void show(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
void hide(const QString& name);
void hideDesktopWindows();
bool isVisible(const QString& name);
void toggle(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
bool shouldSwallowShortcut(QEvent* event);

View file

@ -387,6 +387,8 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
offscreenUi->hide("RunningScripts");
_showRunningScripts = true;
}
offscreenUi->hideDesktopWindows();
// destroy desktop window
if (_desktopWindow) {
_desktopWindow->deleteLater();