From 827c8dd61468237dead148dbbf1b78e0ff1b37af Mon Sep 17 00:00:00 2001 From: Alexey Shurygin Date: Sun, 15 Mar 2026 01:33:38 +0300 Subject: [PATCH] Address PR review feedback --- glfw/cocoa_init.m | 2 ++ kitty_tests/check_build.py | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/glfw/cocoa_init.m b/glfw/cocoa_init.m index c5a1205cc..8bac2837d 100644 --- a/glfw/cocoa_init.m +++ b/glfw/cocoa_init.m @@ -844,6 +844,8 @@ has_apple_fn_global_shortcut(void) { NSDictionary *hitoolbox_settings = [[NSUserDefaults standardUserDefaults] persistentDomainForName:@"com.apple.HIToolbox"]; id obj = [hitoolbox_settings objectForKey:@"AppleFnUsageType"]; if (![obj isKindOfClass:[NSNumber class]]) return false; + // Non-zero AppleFnUsageType means macOS has reserved Fn/Globe for a + // system action such as input source switching, emoji picker, or dictation. return [obj integerValue] != 0; } diff --git a/kitty_tests/check_build.py b/kitty_tests/check_build.py index fbbdcf9dc..dd11e31c4 100644 --- a/kitty_tests/check_build.py +++ b/kitty_tests/check_build.py @@ -47,6 +47,7 @@ class TestBuild(BaseTest): #import #import #import + #import static int start_calls = 0; static int stop_calls = 0; @@ -91,7 +92,9 @@ class TestBuild(BaseTest): require_true(view_cls != Nil, "GLFWContentView class not loaded"); require_true(context_cls != Nil, "GLFWTextInputContext class not loaded"); - id view = [[view_cls alloc] initWithFrame:NSMakeRect(0, 0, 10, 10)]; + SEL init_with_glfw_window = NSSelectorFromString(@"initWithGlfwWindow:"); + id view = ((id (*)(id, SEL, void *)) objc_msgSend)([view_cls alloc], init_with_glfw_window, NULL); + require_true(view != nil, "GLFWContentView initWithGlfwWindow: failed"); require_true([view respondsToSelector:start], "GLFWContentView does not expose startDictation:"); require_true([view respondsToSelector:stop], "GLFWContentView does not expose stopDictation:"); @@ -106,8 +109,9 @@ class TestBuild(BaseTest): require_true(start_calls == 2, "doCommandBySelector:startDictation: was swallowed"); require_true(last_sender == view, "doCommandBySelector:startDictation: should forward self as sender"); - id context = [[context_cls alloc] initWithClient:view]; - require_true(context != nil, "GLFWTextInputContext initWithClient: failed"); + id context = [view inputContext]; + require_true(context != nil, "GLFWContentView inputContext missing"); + require_true([context isKindOfClass:context_cls], "GLFWContentView inputContext has wrong class"); [context doCommandBySelector:stop]; require_true(stop_calls == 1, "GLFWTextInputContext did not forward stopDictation:"); require_true(last_sender == nil, "GLFWTextInputContext should forward nil sender");