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:
parent
8d5fe1f1c4
commit
8e55374662
|
@ -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());
|
||||
|
|
|
@ -20,7 +20,6 @@ signals:
|
|||
void EscapePressed();
|
||||
void Closed();
|
||||
void HandleChanged(void* handle);
|
||||
void FocusChanged(bool focus);
|
||||
void StateChanged(bool fullscreen);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue