mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-08 06:32:35 +02:00
Added an API function to check if an overlay has keyboard focus
This commit is contained in:
parent
3d4a993476
commit
025f530db6
2 changed files with 11 additions and 1 deletions
|
@ -60,7 +60,9 @@ static const QVariantMap RELATIVE_POSITION_ANCHOR {
|
|||
};
|
||||
|
||||
DesktopScriptingInterface::DesktopScriptingInterface(QObject* parent, bool restricted)
|
||||
: QObject(parent), _restricted(restricted) { }
|
||||
: QObject(parent), _restricted(restricted) {
|
||||
connect(this, &DesktopScriptingInterface::uiFocusChanged, [this] (bool isActive) { _isOverlayWindowFocused = isActive; });
|
||||
}
|
||||
|
||||
int DesktopScriptingInterface::getWidth() {
|
||||
QSize size = qApp->getWindow()->windowHandle()->screen()->virtualSize();
|
||||
|
|
|
@ -104,6 +104,13 @@ public:
|
|||
int getWidth();
|
||||
int getHeight();
|
||||
|
||||
/*@jsdoc
|
||||
* Checks whether the keyboard focus belongs to overlay UI window.
|
||||
* @function Desktop.isOverlayWindowFocused
|
||||
* @returns {boolean} <code>true</code> if the keyboard focus is on overlay UI window, <code>false</code> if not.
|
||||
*/
|
||||
Q_INVOKABLE bool isOverlayWindowFocused() { return _isOverlayWindowFocused; };
|
||||
|
||||
signals:
|
||||
|
||||
/*@jsdoc
|
||||
|
@ -124,6 +131,7 @@ private:
|
|||
static QVariantMap getRelativePositionAnchor();
|
||||
Q_INVOKABLE static QVariantMap getPresentationMode();
|
||||
const bool _restricted;
|
||||
std::atomic<bool> _isOverlayWindowFocused { false };
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue