1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Fix pointer flicker when enabling mouse lock

This commit is contained in:
David Rosca 2015-10-06 11:15:17 +02:00
parent b4972955ce
commit d2a84319e7

View File

@ -87,10 +87,13 @@ void HTML5PermissionsNotification::grantPermissions()
return;
}
if (m_feature == QWebEnginePage::MouseLock)
QCursor::setPos(m_page->view()->mapToGlobal(m_page->view()->rect().center()));
QTimer::singleShot(0, this, [this]() {
// We need to have cursor inside view to correctly grab mouse
if (m_feature == QWebEnginePage::MouseLock) {
QWidget *view = m_page->view();
QCursor::setPos(view->mapToGlobal(view->rect().center()));
}
m_page->setFeaturePermission(m_origin, m_feature, QWebEnginePage::PermissionGrantedByUser);
});