Title: [282919] branches/safari-612-branch/Source/WebCore
Revision
282919
Author
repst...@apple.com
Date
2021-09-22 21:30:24 -0700 (Wed, 22 Sep 2021)

Log Message

Cherry-pick r282822. rdar://problem/83429958

    [iOS] Disable default system gesture on extended gamepad
    https://bugs.webkit.org/show_bug.cgi?id=230297
    <rdar://65610651>

    Reviewed by Brady Eidson.

    Prevent default system behavior for some game pad gestures.
    Not testable on bots.

    * platform/gamepad/cocoa/GameControllerGamepad.mm:
    (WebCore::GameControllerGamepad::setupAsExtendedGamepad):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282822 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (282918 => 282919)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2021-09-23 04:30:21 UTC (rev 282918)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2021-09-23 04:30:24 UTC (rev 282919)
@@ -1,5 +1,38 @@
 2021-09-22  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r282822. rdar://problem/83429958
+
+    [iOS] Disable default system gesture on extended gamepad
+    https://bugs.webkit.org/show_bug.cgi?id=230297
+    <rdar://65610651>
+    
+    Reviewed by Brady Eidson.
+    
+    Prevent default system behavior for some game pad gestures.
+    Not testable on bots.
+    
+    * platform/gamepad/cocoa/GameControllerGamepad.mm:
+    (WebCore::GameControllerGamepad::setupAsExtendedGamepad):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282822 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-09-21  Youenn Fablet  <you...@apple.com>
+
+            [iOS] Disable default system gesture on extended gamepad
+            https://bugs.webkit.org/show_bug.cgi?id=230297
+            <rdar://65610651>
+
+            Reviewed by Brady Eidson.
+
+            Prevent default system behavior for some game pad gestures.
+            Not testable on bots.
+
+            * platform/gamepad/cocoa/GameControllerGamepad.mm:
+            (WebCore::GameControllerGamepad::setupAsExtendedGamepad):
+
+2021-09-22  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r282393. rdar://problem/83429703
 
     [Hardening] Validate IDBValue's blob paths in WebIDBServer::putOrAdd()

Modified: branches/safari-612-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm (282918 => 282919)


--- branches/safari-612-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm	2021-09-23 04:30:21 UTC (rev 282918)
+++ branches/safari-612-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm	2021-09-23 04:30:24 UTC (rev 282919)
@@ -28,6 +28,7 @@
 #if ENABLE(GAMEPAD)
 #import "GameControllerGamepadProvider.h"
 #import "GamepadConstants.h"
+#import <GameController/GCControllerElement.h>
 #import <GameController/GameController.h>
 
 #import "GameControllerSoftLink.h"
@@ -70,6 +71,16 @@
     return nil;
 }
 
+static void disableDefaultSystemAction(GCControllerButtonInput *button)
+{
+#if PLATFORM(IOS_FAMILY)
+    if ([button respondsToSelector:@selector(preferredSystemGestureState)])
+        button.preferredSystemGestureState = GCSystemGestureStateDisabled;
+#else
+    UNUSED_PARAM(button);
+#endif
+}
+
 void GameControllerGamepad::setupAsExtendedGamepad()
 {
     ASSERT(m_extendedGamepad);
@@ -113,13 +124,17 @@
     bindButton(m_extendedGamepad.get().dpad.left, GamepadButtonRole::LeftClusterLeft);
     bindButton(m_extendedGamepad.get().dpad.right, GamepadButtonRole::LeftClusterRight);
 
-    if (homeButton)
+    if (homeButton) {
         bindButton(homeButton, GamepadButtonRole::CenterClusterCenter);
+        disableDefaultSystemAction(homeButton);
+    }
 
     // Select, Start
 #if HAVE(GCEXTENDEDGAMEPAD_BUTTONS_OPTIONS_MENU)
     bindButton(m_extendedGamepad.get().buttonOptions, GamepadButtonRole::CenterClusterLeft);
+    disableDefaultSystemAction(m_extendedGamepad.get().buttonOptions);
     bindButton(m_extendedGamepad.get().buttonMenu, GamepadButtonRole::CenterClusterRight);
+    disableDefaultSystemAction(m_extendedGamepad.get().buttonMenu);
 #endif
 
     // L3, R3
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to