mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:08:00 +02:00
API changes for detecting active Window
This commit is contained in:
parent
89f826fa5c
commit
3d4a993476
3 changed files with 27 additions and 0 deletions
|
@ -868,6 +868,22 @@ bool setupEssentials(int& argc, char** argv, const QCommandLineParser& parser, b
|
||||||
DependencyManager::set<SceneScriptingInterface>();
|
DependencyManager::set<SceneScriptingInterface>();
|
||||||
#if !defined(DISABLE_QML)
|
#if !defined(DISABLE_QML)
|
||||||
DependencyManager::set<OffscreenUi>();
|
DependencyManager::set<OffscreenUi>();
|
||||||
|
{
|
||||||
|
auto window = DependencyManager::get<OffscreenUi>()->getWindow();
|
||||||
|
auto desktopScriptingInterface = DependencyManager::get<DesktopScriptingInterface>();
|
||||||
|
QObject::connect(window, &QQuickWindow::focusObjectChanged, [desktopScriptingInterface](QObject *object) {
|
||||||
|
if (object) {
|
||||||
|
if (object->objectName() == QString("desktop")) {
|
||||||
|
emit desktopScriptingInterface->uiFocusChanged(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Signal with empty object name happens in addition to regular named ones and is not necessary here
|
||||||
|
if (!object->objectName().isEmpty()) {
|
||||||
|
emit desktopScriptingInterface->uiFocusChanged(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
DependencyManager::set<Midi>();
|
DependencyManager::set<Midi>();
|
||||||
DependencyManager::set<PathUtils>();
|
DependencyManager::set<PathUtils>();
|
||||||
|
|
|
@ -104,6 +104,15 @@ public:
|
||||||
int getWidth();
|
int getWidth();
|
||||||
int getHeight();
|
int getHeight();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
/*@jsdoc
|
||||||
|
* Triggered when keyboard focus changes to another overlay UI window.
|
||||||
|
* @param {boolean} isActive - <code>true</code> if the keyboard focus is on overlay UI window, <code>false</code> if not.
|
||||||
|
* @function Desktop.uiFocusChanged
|
||||||
|
* @returns {Signal}
|
||||||
|
*/
|
||||||
|
void uiFocusChanged(bool isActive);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int flagAlwaysOnTop() { return AlwaysOnTop; }
|
static int flagAlwaysOnTop() { return AlwaysOnTop; }
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "scripting/HMDScriptingInterface.h"
|
#include "scripting/HMDScriptingInterface.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
|
#include "scripting/DesktopScriptingInterface.h"
|
||||||
|
|
||||||
HIFI_QML_DEF(LoginDialog)
|
HIFI_QML_DEF(LoginDialog)
|
||||||
|
|
||||||
|
@ -67,6 +68,7 @@ void LoginDialog::showWithSelection() {
|
||||||
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
||||||
|
|
||||||
if (!qApp->isHMDMode()) {
|
if (!qApp->isHMDMode()) {
|
||||||
|
emit DependencyManager::get<DesktopScriptingInterface>()->uiFocusChanged(true);
|
||||||
if (qApp->getLoginDialogPoppedUp()) {
|
if (qApp->getLoginDialogPoppedUp()) {
|
||||||
LoginDialog::show();
|
LoginDialog::show();
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue