From 09ced247105e1ff4236b9554c46dd8f49bb0d4a0 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 4 Apr 2018 11:05:25 -0700 Subject: [PATCH 1/3] hide desktop windows when switching into HMD mode --- interface/resources/qml/desktop/Desktop.qml | 10 ++++++++++ libraries/ui/src/OffscreenUi.cpp | 7 +++++++ libraries/ui/src/OffscreenUi.h | 1 + libraries/ui/src/ui/TabletScriptingInterface.cpp | 2 ++ 4 files changed, 20 insertions(+) diff --git a/interface/resources/qml/desktop/Desktop.qml b/interface/resources/qml/desktop/Desktop.qml index e7c68b2a47..3535a49880 100644 --- a/interface/resources/qml/desktop/Desktop.qml +++ b/interface/resources/qml/desktop/Desktop.qml @@ -323,6 +323,16 @@ 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")) { + console.log(child); + child.setShown(false); + } + } + } + function setPinned(newPinned) { pinned = newPinned } diff --git a/libraries/ui/src/OffscreenUi.cpp b/libraries/ui/src/OffscreenUi.cpp index 7a938f39c8..a1d09139e3 100644 --- a/libraries/ui/src/OffscreenUi.cpp +++ b/libraries/ui/src/OffscreenUi.cpp @@ -154,6 +154,13 @@ void OffscreenUi::show(const QUrl& url, const QString& name, std::function f) { QQuickItem* item = getRootItem()->findChild(name); if (!item) { diff --git a/libraries/ui/src/OffscreenUi.h b/libraries/ui/src/OffscreenUi.h index cb8ee29068..26f9f58dd5 100644 --- a/libraries/ui/src/OffscreenUi.h +++ b/libraries/ui/src/OffscreenUi.h @@ -60,6 +60,7 @@ public: void createDesktop(const QUrl& url); void show(const QUrl& url, const QString& name, std::function 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 f = [](QQmlContext*, QObject*) {}); bool shouldSwallowShortcut(QEvent* event); diff --git a/libraries/ui/src/ui/TabletScriptingInterface.cpp b/libraries/ui/src/ui/TabletScriptingInterface.cpp index 0191baca5e..a079609bb7 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.cpp +++ b/libraries/ui/src/ui/TabletScriptingInterface.cpp @@ -387,6 +387,8 @@ void TabletProxy::setToolbarMode(bool toolbarMode) { offscreenUi->hide("RunningScripts"); _showRunningScripts = true; } + + offscreenUi->hideDesktopWindows(); // destroy desktop window if (_desktopWindow) { _desktopWindow->deleteLater(); From 475a3a29acdd36fe72270dde3f23cd9d3ac4a3ca Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 4 Apr 2018 11:14:53 -0700 Subject: [PATCH 2/3] remvoe debug statement --- interface/resources/qml/desktop/Desktop.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/interface/resources/qml/desktop/Desktop.qml b/interface/resources/qml/desktop/Desktop.qml index 3535a49880..df15c8b5fc 100644 --- a/interface/resources/qml/desktop/Desktop.qml +++ b/interface/resources/qml/desktop/Desktop.qml @@ -327,7 +327,6 @@ FocusScope { for (var index = 0; index < desktop.visibleChildren.length; index++) { var child = desktop.visibleChildren[index]; if (child.topLevelWindow && child.hasOwnProperty("modality")) { - console.log(child); child.setShown(false); } } From 31783726a8f7fae4b55c1a31b2143058760a097d Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 4 Apr 2018 16:30:06 -0700 Subject: [PATCH 3/3] fix toolbar disappearing --- interface/resources/qml/desktop/Desktop.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interface/resources/qml/desktop/Desktop.qml b/interface/resources/qml/desktop/Desktop.qml index df15c8b5fc..c0709ad033 100644 --- a/interface/resources/qml/desktop/Desktop.qml +++ b/interface/resources/qml/desktop/Desktop.qml @@ -327,7 +327,10 @@ FocusScope { for (var index = 0; index < desktop.visibleChildren.length; index++) { var child = desktop.visibleChildren[index]; if (child.topLevelWindow && child.hasOwnProperty("modality")) { - child.setShown(false); + var TOOLBAR_NAME = "com.highfidelity.interface.toolbar.system" + if (child.objectName !== TOOLBAR_NAME) { + child.setShown(false); + } } } }