RenderWidget: watch for activation/deactivation, not focus in/out

"Focus" refers mainly to keyboard focus. "Window focus" is exposed
through the window activation and deactivation events.
This commit is contained in:
Michael Maltese 2017-07-13 12:56:33 -07:00
parent 8d5fe1f1c4
commit 8e55374662
2 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,6 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
setAttribute(Qt::WA_NoSystemBackground, true);
connect(Host::GetInstance(), &Host::RequestTitle, this, &RenderWidget::setWindowTitle);
connect(this, &RenderWidget::FocusChanged, Host::GetInstance(), &Host::SetRenderFocus);
connect(this, &RenderWidget::StateChanged, Host::GetInstance(), &Host::SetRenderFullscreen);
connect(this, &RenderWidget::HandleChanged, Host::GetInstance(), &Host::SetRenderHandle);
emit HandleChanged((void*)winId());
@ -43,9 +42,11 @@ bool RenderWidget::event(QEvent* event)
case QEvent::WinIdChange:
emit HandleChanged((void*)winId());
break;
case QEvent::FocusIn:
case QEvent::FocusOut:
emit FocusChanged(hasFocus());
case QEvent::WindowActivate:
Host::GetInstance()->SetRenderFocus(true);
break;
case QEvent::WindowDeactivate:
Host::GetInstance()->SetRenderFocus(false);
break;
case QEvent::WindowStateChange:
emit StateChanged(isFullScreen());

View File

@ -20,7 +20,6 @@ signals:
void EscapePressed();
void Closed();
void HandleChanged(void* handle);
void FocusChanged(bool focus);
void StateChanged(bool fullscreen);
private: