hide desktop windows when switching into HMD mode

This commit is contained in:
Dante Ruiz 2018-04-04 11:05:25 -07:00
parent a1ce9481bb
commit 09ced24710
4 changed files with 20 additions and 0 deletions

View file

@ -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
}

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();