mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 06:22:14 +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>();
|
||||
#if !defined(DISABLE_QML)
|
||||
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
|
||||
DependencyManager::set<Midi>();
|
||||
DependencyManager::set<PathUtils>();
|
||||
|
|
|
@ -104,6 +104,15 @@ public:
|
|||
int getWidth();
|
||||
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:
|
||||
static int flagAlwaysOnTop() { return AlwaysOnTop; }
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "Application.h"
|
||||
#include "scripting/HMDScriptingInterface.h"
|
||||
#include "Constants.h"
|
||||
#include "scripting/DesktopScriptingInterface.h"
|
||||
|
||||
HIFI_QML_DEF(LoginDialog)
|
||||
|
||||
|
@ -67,6 +68,7 @@ void LoginDialog::showWithSelection() {
|
|||
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
||||
|
||||
if (!qApp->isHMDMode()) {
|
||||
emit DependencyManager::get<DesktopScriptingInterface>()->uiFocusChanged(true);
|
||||
if (qApp->getLoginDialogPoppedUp()) {
|
||||
LoginDialog::show();
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue