Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Mouse focus when cursor leaves window #423

Merged
merged 4 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/QCefView.h
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,8 @@ class QCEFVIEW_EXPORT QCefView : public QWidget
/// <returns>True to allow the close, false to cancel the close</returns>
virtual bool onRequestCloseFromWeb();

virtual void leaveEvent(QEvent* event) override;
EdnY1 marked this conversation as resolved.
Show resolved Hide resolved

#pragma region QWidget
public slots:
/// <summary>
Expand Down
14 changes: 14 additions & 0 deletions src/QCefView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,20 @@ QCefView::onRequestCloseFromWeb()
return true;
}

void
EdnY1 marked this conversation as resolved.
Show resolved Hide resolved
QCefView::leaveEvent(QEvent* event)
{
QWidget::leaveEvent(event);

if (d_ptr->isOSRModeEnabled()) {
QPoint localPos{ -1, -1 };
EdnY1 marked this conversation as resolved.
Show resolved Hide resolved
QPoint globalPos = mapToGlobal(localPos);

QMouseEvent moveEvent(QEvent::MouseMove, localPos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier);
mouseMoveEvent(&moveEvent);
EdnY1 marked this conversation as resolved.
Show resolved Hide resolved
}
}

QVariant
QCefView::inputMethodQuery(Qt::InputMethodQuery query) const
{
Expand Down
Loading