From b2b59a6c0bb6f6f68006f1c346a9c836c3a124bb Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Mon, 17 Feb 2025 11:22:57 +0100 Subject: [PATCH] fix: pointer lock permission after focus loss and regain (#45628) Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr --- 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 fc415e75f5b4..2c94332dab51 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -1561,6 +1561,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 27e0757bad0a..6e3b95c53707 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -609,6 +609,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);