Fix Window.raiseMainWindow()

This commit is contained in:
David Rowe 2018-03-14 13:38:48 +13:00
parent 025d2807f4
commit 966d711e56
4 changed files with 17 additions and 5 deletions

View file

@ -7362,9 +7362,20 @@ void Application::setFocus() {
// flashes the taskbar icon.
auto window = qApp->getWindow();
window->activateWindow();
// Do NOT do the following because it takes focus away from the _displayPlugin.
//window->setFocus();
}
void Application::raise() {
auto windowState = qApp->getWindow()->windowState();
if (windowState & Qt::WindowMinimized) {
if (windowState & Qt::WindowMaximized) {
qApp->getWindow()->showMaximized();
} else if (windowState & Qt::WindowFullScreen) {
qApp->getWindow()->showFullScreen();
} else {
qApp->getWindow()->showNormal();
}
}
qApp->getWindow()->raise();
}
void Application::setMaxOctreePacketsPerSecond(int maxOctreePPS) {

View file

@ -162,6 +162,7 @@ public:
glm::vec2 getDeviceSize() const;
bool hasFocus() const;
void setFocus();
void raise();
void showCursor(const Cursor::Icon& cursor);

View file

@ -81,7 +81,7 @@ void WindowScriptingInterface::setFocus() {
void WindowScriptingInterface::raiseMainWindow() {
// It's forbidden to call raise() from another thread.
qApp->postLambdaEvent([] {
qApp->getWindow()->raise();
qApp->raise();
});
}

View file

@ -69,7 +69,7 @@ public slots:
void setFocus();
/**jsdoc
* Raise the Interface window if it is minimized, and give it focus.
* Raise the Interface window if it is minimized. If raised, the window gains focus.
* @function Window.raiseMainWindow
*/
void raiseMainWindow();