mirror of
https://github.com/lubosz/overte.git
synced 2025-04-08 07:22:43 +02:00
Merge pull request #12787 from druiz17/fix-offscreen-windows
hide desktop windows when switching into HMD mode
This commit is contained in:
commit
008c7be369
4 changed files with 22 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -387,6 +387,8 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
|
|||
offscreenUi->hide("RunningScripts");
|
||||
_showRunningScripts = true;
|
||||
}
|
||||
|
||||
offscreenUi->hideDesktopWindows();
|
||||
// destroy desktop window
|
||||
if (_desktopWindow) {
|
||||
_desktopWindow->deleteLater();
|
||||
|
|
Loading…
Reference in a new issue