From b4972955ce119a227cc0722d14e8b18a004feaca Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 6 Oct 2015 11:03:24 +0200 Subject: [PATCH] HTML5Permissions: Fix granting MouseLock permissions --- .../html5permissions/html5permissionsnotification.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/tools/html5permissions/html5permissionsnotification.cpp b/src/lib/tools/html5permissions/html5permissionsnotification.cpp index 69add2609..325871fbb 100644 --- a/src/lib/tools/html5permissions/html5permissionsnotification.cpp +++ b/src/lib/tools/html5permissions/html5permissionsnotification.cpp @@ -21,6 +21,7 @@ #include "mainapplication.h" #include "iconprovider.h" +#include #include HTML5PermissionsNotification::HTML5PermissionsNotification(const QUrl &origin, QWebEnginePage* page, const QWebEnginePage::Feature &feature) @@ -86,7 +87,12 @@ void HTML5PermissionsNotification::grantPermissions() return; } - m_page->setFeaturePermission(m_origin, m_feature, QWebEnginePage::PermissionGrantedByUser); + if (m_feature == QWebEnginePage::MouseLock) + QCursor::setPos(m_page->view()->mapToGlobal(m_page->view()->rect().center())); + + QTimer::singleShot(0, this, [this]() { + m_page->setFeaturePermission(m_origin, m_feature, QWebEnginePage::PermissionGrantedByUser); + }); if (ui->remember->isChecked()) { mApp->html5PermissionsManager()->rememberPermissions(m_origin, m_feature, QWebEnginePage::PermissionGrantedByUser);