mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 18:21:16 +02:00
Merge pull request #7160 from jherico/auto_show_desktop
Auto-unhide the desktop when showing or raising a window
This commit is contained in:
commit
04bd32e008
5 changed files with 28 additions and 3 deletions
|
@ -10,12 +10,19 @@ import "../js/Utils.js" as Utils
|
||||||
// windows will be childed.
|
// windows will be childed.
|
||||||
FocusScope {
|
FocusScope {
|
||||||
id: desktop
|
id: desktop
|
||||||
anchors.fill: parent;
|
|
||||||
objectName: "desktop"
|
objectName: "desktop"
|
||||||
|
|
||||||
|
// Allow the scale of the desktop to be changed without screwing up the size relative to the parent.
|
||||||
|
height: parent.height / scale
|
||||||
|
width: parent.width / scale
|
||||||
|
|
||||||
onHeightChanged: d.repositionAll();
|
onHeightChanged: d.repositionAll();
|
||||||
onWidthChanged: d.repositionAll();
|
onWidthChanged: d.repositionAll();
|
||||||
|
|
||||||
|
// Controls and windows can trigger this signal to ensure the desktop becomes visible
|
||||||
|
// when they're opened.
|
||||||
|
signal showDesktop();
|
||||||
|
|
||||||
// Allows QML/JS to find the desktop through the parent chain
|
// Allows QML/JS to find the desktop through the parent chain
|
||||||
property bool desktopRoot: true
|
property bool desktopRoot: true
|
||||||
|
|
||||||
|
@ -217,6 +224,8 @@ FocusScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
reposition(targetWindow);
|
reposition(targetWindow);
|
||||||
|
|
||||||
|
showDesktop();
|
||||||
}
|
}
|
||||||
|
|
||||||
function reposition(item) {
|
function reposition(item) {
|
||||||
|
@ -314,7 +323,7 @@ FocusScope {
|
||||||
enabled: DebugQML
|
enabled: DebugQML
|
||||||
onTriggered: focusDebugger.visible = !focusDebugger.visible
|
onTriggered: focusDebugger.visible = !focusDebugger.visible
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1198,7 +1198,8 @@ void Application::initializeUi() {
|
||||||
// OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to
|
// OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to
|
||||||
// support the window management and scripting proxies for VR use
|
// support the window management and scripting proxies for VR use
|
||||||
offscreenUi->createDesktop(QString("hifi/Desktop.qml"));
|
offscreenUi->createDesktop(QString("hifi/Desktop.qml"));
|
||||||
|
connect(offscreenUi.data(), &OffscreenUi::showDesktop, this, &Application::showDesktop);
|
||||||
|
|
||||||
// FIXME either expose so that dialogs can set this themselves or
|
// FIXME either expose so that dialogs can set this themselves or
|
||||||
// do better detection in the offscreen UI of what has focus
|
// do better detection in the offscreen UI of what has focus
|
||||||
offscreenUi->setNavigationFocused(false);
|
offscreenUi->setNavigationFocused(false);
|
||||||
|
@ -5128,3 +5129,9 @@ void Application::readArgumentsFromLocalSocket() {
|
||||||
qApp->openUrl(QString::fromUtf8(message));
|
qApp->openUrl(QString::fromUtf8(message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::showDesktop() {
|
||||||
|
if (!_overlayConductor.getEnabled()) {
|
||||||
|
_overlayConductor.setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
|
@ -280,6 +280,7 @@ public slots:
|
||||||
void runTests();
|
void runTests();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void showDesktop();
|
||||||
void clearDomainOctreeDetails();
|
void clearDomainOctreeDetails();
|
||||||
void idle(uint64_t now);
|
void idle(uint64_t now);
|
||||||
void aboutToQuit();
|
void aboutToQuit();
|
||||||
|
|
|
@ -112,6 +112,7 @@ void OffscreenUi::create(QOpenGLContext* context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenUi::show(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f) {
|
void OffscreenUi::show(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f) {
|
||||||
|
emit showDesktop();
|
||||||
QQuickItem* item = getRootItem()->findChild<QQuickItem*>(name);
|
QQuickItem* item = getRootItem()->findChild<QQuickItem*>(name);
|
||||||
// First load?
|
// First load?
|
||||||
if (!item) {
|
if (!item) {
|
||||||
|
@ -127,6 +128,7 @@ void OffscreenUi::toggle(const QUrl& url, const QString& name, std::function<voi
|
||||||
QQuickItem* item = getRootItem()->findChild<QQuickItem*>(name);
|
QQuickItem* item = getRootItem()->findChild<QQuickItem*>(name);
|
||||||
// Already loaded?
|
// Already loaded?
|
||||||
if (item) {
|
if (item) {
|
||||||
|
emit showDesktop();
|
||||||
item->setVisible(!item->isVisible());
|
item->setVisible(!item->isVisible());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -134,6 +136,7 @@ void OffscreenUi::toggle(const QUrl& url, const QString& name, std::function<voi
|
||||||
load(url, f);
|
load(url, f);
|
||||||
item = getRootItem()->findChild<QQuickItem*>(name);
|
item = getRootItem()->findChild<QQuickItem*>(name);
|
||||||
if (item && !item->isVisible()) {
|
if (item && !item->isVisible()) {
|
||||||
|
emit showDesktop();
|
||||||
item->setVisible(true);
|
item->setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -439,6 +442,8 @@ void OffscreenUi::createDesktop(const QUrl& url) {
|
||||||
new VrMenu(this);
|
new VrMenu(this);
|
||||||
|
|
||||||
new KeyboardFocusHack();
|
new KeyboardFocusHack();
|
||||||
|
|
||||||
|
connect(_desktop, SIGNAL(showDesktop()), this, SLOT(showDesktop()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QQuickItem* OffscreenUi::getDesktop() {
|
QQuickItem* OffscreenUi::getDesktop() {
|
||||||
|
|
|
@ -106,6 +106,9 @@ public:
|
||||||
// Compatibility with QInputDialog::getItem
|
// Compatibility with QInputDialog::getItem
|
||||||
static QString getItem(void *ignored, const QString & title, const QString & label, const QStringList & items, int current = 0, bool editable = true, bool * ok = 0, Qt::WindowFlags flags = 0, Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
|
static QString getItem(void *ignored, const QString & title, const QString & label, const QStringList & items, int current = 0, bool editable = true, bool * ok = 0, Qt::WindowFlags flags = 0, Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void showDesktop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString fileDialog(const QVariantMap& properties);
|
QString fileDialog(const QVariantMap& properties);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue