mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 21:50:56 +02:00
Fix Window.hasFocus()
This commit is contained in:
parent
16aefea2e1
commit
c8b4217a96
1 changed files with 8 additions and 4 deletions
|
@ -7347,10 +7347,14 @@ bool Application::isThrottleRendering() const {
|
|||
}
|
||||
|
||||
bool Application::hasFocus() const {
|
||||
if (_displayPlugin) {
|
||||
return getActiveDisplayPlugin()->hasFocus();
|
||||
}
|
||||
return (QApplication::activeWindow() != nullptr);
|
||||
bool result = (QApplication::activeWindow() != nullptr);
|
||||
#if defined(Q_OS_WIN)
|
||||
// On Windows, QWidget::activateWindow() - as called in setFocus() - makes the application's taskbar icon flash but doesn't
|
||||
// take user focus away from their current window. So also check whether the application is the user's current foreground
|
||||
// window.
|
||||
result = result && (HWND)QApplication::activeWindow()->winId() == GetForegroundWindow();
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
void Application::setFocus() {
|
||||
|
|
Loading…
Reference in a new issue