From a1d24028b8b041064241e66eb4ee4d2b64b16a87 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Sat, 30 Oct 2021 16:13:33 +0200 Subject: [PATCH] Fix Clang warning Without this, kitty fails to compile: ``` glfw/cocoa_init.m:462:14: error: case value not in enumerated type 'NSEventModifierFlags' (aka 'enum NSEventModifierFlags') [-Werror,-Wswitch] case (NSEventModifierFlagShift | NSEventModifierFlagOption): ^ glfw/cocoa_init.m:465:14: error: case value not in enumerated type 'NSEventModifierFlags' (aka 'enum NSEventModifierFlags') [-Werror,-Wswitch] case (NSEventModifierFlagShift | NSEventModifierFlagCommand): ^ ``` I thought about changing the type of the `modifierFlags` function parameter from `NSEventModifierFlags` to `NSUInteger` since `NSEventModifierFlags` is defined as an enum according to https://developer.apple.com/documentation/appkit/nseventmodifierflags?language=objc and is technically not the proper type for a bit field. But since Apple themselves define `modifierFlags` as `NSEventModifierFlags` according to https://developer.apple.com/documentation/appkit/nsevent/1534405-modifierflags?language=objc, I think the fix in this commit is better. This warning was introduced with commit f9944e614088c4977ad9c9f1d1b44d97643e8d5b. --- glfw/cocoa_init.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glfw/cocoa_init.m b/glfw/cocoa_init.m index 5fa230ffa..6b4f0b78c 100644 --- a/glfw/cocoa_init.m +++ b/glfw/cocoa_init.m @@ -455,7 +455,7 @@ void* _glfwLoadLocalVulkanLoaderNS(void) static bool is_modified_tab(NSEvent *event, NSEventModifierFlags modifierFlags) { - switch (modifierFlags) { + switch ((NSUInteger)modifierFlags) { // No need to handle shift+tab, [shift]+option+tab case NSEventModifierFlagShift: case NSEventModifierFlagOption: