Browse Source

fix: pointer lock permission after focus loss and regain (#45627)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <[email protected]>
trop[bot] 2 months ago
parent
commit
6210a9e82c

+ 6 - 0
shell/browser/api/electron_api_web_contents.cc

@@ -1544,6 +1544,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) {

+ 2 - 0
shell/browser/api/electron_api_web_contents.h

@@ -615,6 +615,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);