mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 09:18:45 +02:00
Check if our canvas has focus. If not, then ignore events passed to it.
This commit is contained in:
parent
b40af0f02b
commit
151a6edfb4
1 changed files with 18 additions and 6 deletions
|
@ -104,27 +104,39 @@ void GLCanvas::resizeGL(int width, int height) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas::keyPressEvent(QKeyEvent* event) {
|
void GLCanvas::keyPressEvent(QKeyEvent* event) {
|
||||||
Application::getInstance()->keyPressEvent(event);
|
if (hasFocus()) {
|
||||||
|
Application::getInstance()->keyPressEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas::keyReleaseEvent(QKeyEvent* event) {
|
void GLCanvas::keyReleaseEvent(QKeyEvent* event) {
|
||||||
Application::getInstance()->keyReleaseEvent(event);
|
if (hasFocus()) {
|
||||||
|
Application::getInstance()->keyReleaseEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas::mouseMoveEvent(QMouseEvent* event) {
|
void GLCanvas::mouseMoveEvent(QMouseEvent* event) {
|
||||||
Application::getInstance()->mouseMoveEvent(event);
|
if (hasFocus()) {
|
||||||
|
Application::getInstance()->mouseMoveEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas::mousePressEvent(QMouseEvent* event) {
|
void GLCanvas::mousePressEvent(QMouseEvent* event) {
|
||||||
Application::getInstance()->mousePressEvent(event);
|
if (hasFocus()) {
|
||||||
|
Application::getInstance()->mousePressEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas::mouseReleaseEvent(QMouseEvent* event) {
|
void GLCanvas::mouseReleaseEvent(QMouseEvent* event) {
|
||||||
Application::getInstance()->mouseReleaseEvent(event);
|
if (hasFocus()) {
|
||||||
|
Application::getInstance()->mouseReleaseEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas::wheelEvent(QWheelEvent* event) {
|
void GLCanvas::wheelEvent(QWheelEvent* event) {
|
||||||
Application::getInstance()->wheelEvent(event);
|
if (hasFocus()) {
|
||||||
|
Application::getInstance()->wheelEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::Application(int& argc, char** argv, timeval &startup_time) :
|
Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||||
|
|
Loading…
Reference in a new issue