summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2022-03-17 13:09:26 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-03-18 17:07:32 +0000
commita980cc295e8e1a7876ab4083cce93151d00162aa (patch)
tree8facca469d3e4fdac6891dec99ef91c345dc84ee /src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
parente88338c87705351cc51f2eedc517033d80676add (diff)
Fix wrong assumption about focus in/out event delivery
In 2947d79d assumption was made that we never get focus in event for popup reason. Unfortunately this is not true as simply creating window menu and switching between webengineview will trigger the issue. Moreover, focus in and out events with popup reason do not mean change of focus, as in qtbase: if (QWidget *fw = active_window->focusWidget()) { if (fw != QApplication::focusWidget()) { fw->setFocus(Qt::PopupFocusReason) } else { QFocusEvent e(QEvent::FocusIn, Qt::PopupFocusReason); QCoreApplication::sendEvent(fw, &e); } } Therefore it is safe to ignore focus in/out events with popup reason. Note that the fact that ASSERT got not triggered for context menu is due to another race condition issue in qquick event stack delivery. This commit amends 2947d79d8210a7ae4ce2bc02e058628e66011be3. Fixes: QTBUG-101706 Change-Id: I3e761fe5d8054aed72461eba7981c69755877d1b Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io> (cherry picked from commit 0625a1e16b8698d9c344548e4e929fb385b6a542) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp')
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
index 3d4e127dc..05ca9e3b1 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -75,16 +75,11 @@ protected:
}
void focusInEvent(QFocusEvent *event) override
{
- Q_ASSERT(event->reason() != Qt::PopupFocusReason);
m_client->forwardEvent(event);
}
void focusOutEvent(QFocusEvent *event) override
{
- // The keyboard events are supposed to go to the parent RenderHostView and WebUI
- // popups should never have focus, therefore ignore focusOutEvent as losing focus
- // will trigger pop close request from blink
- if (event->reason() != Qt::PopupFocusReason)
- m_client->forwardEvent(event);
+ m_client->forwardEvent(event);
}
void inputMethodEvent(QInputMethodEvent *event) override
{