2
0
Эх сурвалжийг харах

Cocoa: Fix some characters not repeating

Fixes #1010.
Camilla Löwy 8 жил өмнө
parent
commit
58a247b26d
2 өөрчлөгдсөн 8 нэмэгдсэн , 0 устгасан
  1. 1 0
      README.md
  2. 7 0
      src/cocoa_window.m

+ 1 - 0
README.md

@@ -226,6 +226,7 @@ information on what to include when reporting a bug.
 - [Cocoa] Bugfix: A string object for IME was updated non-idiomatically (#1050)
 - [Cocoa] Bugfix: A string object for IME was updated non-idiomatically (#1050)
 - [Cocoa] Bugfix: A hidden or disabled cursor would become visible when a user
 - [Cocoa] Bugfix: A hidden or disabled cursor would become visible when a user
                   notification was shown (#971,#1028)
                   notification was shown (#971,#1028)
+- [Cocoa] Bugfix: Some characters did not repeat due to Press and Hold (#1010)
 - [WGL] Added support for `WGL_EXT_colorspace` for OpenGL ES contexts
 - [WGL] Added support for `WGL_EXT_colorspace` for OpenGL ES contexts
 - [WGL] Added support for `WGL_ARB_create_context_no_error`
 - [WGL] Added support for `WGL_ARB_create_context_no_error`
 - [GLX] Added support for `GLX_ARB_create_context_no_error`
 - [GLX] Added support for `GLX_ARB_create_context_no_error`

+ 7 - 0
src/cocoa_window.m

@@ -999,6 +999,13 @@ static GLFWbool initializeAppKit(void)
     [NSApp setDelegate:_glfw.ns.delegate];
     [NSApp setDelegate:_glfw.ns.delegate];
     [NSApp run];
     [NSApp run];
 
 
+    // Press and Hold prevents some keys from emitting repeated characters
+    NSDictionary* defaults =
+        [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO],
+                                                   @"ApplePressAndHoldEnabled",
+                                                   nil];
+    [[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
+
     return GLFW_TRUE;
     return GLFW_TRUE;
 }
 }