From 47dbab3856d1a33b8de51e8c189827ef3a6359ea Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 14 Feb 2025 10:22:13 +0100 Subject: [PATCH] fix: pointer lock permission after focus loss and regain (#45574) --- shell/browser/api/electron_api_web_contents.cc | 6 ++++++ shell/browser/api/electron_api_web_contents.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index f0cc5b03a88f..15f07ab865cb 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -1608,6 +1608,12 @@ void WebContents::LostPointerLock() { ->ExitExclusiveAccessToPreviousState(); } +bool WebContents::IsWaitingForPointerLockPrompt( + content::WebContents* web_contents) { + return exclusive_access_manager_.pointer_lock_controller() + ->IsWaitingForPointerLockPrompt(web_contents); +} + void WebContents::OnRequestKeyboardLock(content::WebContents* web_contents, bool esc_key_locked, bool allowed) { diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h index 057d6e01201e..1ae4e56e5a8f 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -613,6 +613,8 @@ class WebContents final : public ExclusiveAccessContext, bool user_gesture, bool last_unlocked_by_target) override; void LostPointerLock() override; + bool IsWaitingForPointerLockPrompt( + content::WebContents* web_contents) override; void OnRequestKeyboardLock(content::WebContents* web_contents, bool esc_key_locked, bool allowed);