Skip to content

Commit

Permalink
Swap command and control keys on MacOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
espenaf committed Jan 12, 2024
1 parent cad7047 commit 74b4f63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions gen/key_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@
left_hyper Hyper_L - -
left_meta Meta_L - -
right_shift Shift_R 0x3C -
right_control Control_R 0x3E -
right_control Control_R 0x36 -
right_alt Alt_R 0x3D -
right_super Super_R 0x36 -
right_super Super_R 0x3E -
right_hyper Hyper_R - -
right_meta Meta_R - -
iso_level3_shift ISO_Level3_Shift - -
Expand Down
16 changes: 8 additions & 8 deletions glfw/cocoa_window.m
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@
case 0x3a: return GLFW_FKEY_LEFT_ALT;
case 0x37: return GLFW_FKEY_LEFT_SUPER;
case 0x3c: return GLFW_FKEY_RIGHT_SHIFT;
case 0x3e: return GLFW_FKEY_RIGHT_CONTROL;
case 0x36: return GLFW_FKEY_RIGHT_CONTROL;
case 0x3d: return GLFW_FKEY_RIGHT_ALT;
case 0x36: return GLFW_FKEY_RIGHT_SUPER;
case 0x3e: return GLFW_FKEY_RIGHT_SUPER;
/* end vk to functional */
default:
return 0;
Expand Down Expand Up @@ -501,11 +501,11 @@ static void releaseMonitor(_GLFWwindow* window)
if (flags & NSEventModifierFlagShift)
mods |= GLFW_MOD_SHIFT;
if (flags & NSEventModifierFlagControl)
mods |= GLFW_MOD_CONTROL;
mods |= GLFW_MOD_SUPER;
if (flags & NSEventModifierFlagOption)
mods |= GLFW_MOD_ALT;
if (flags & NSEventModifierFlagCommand)
mods |= GLFW_MOD_SUPER;
mods |= GLFW_MOD_CONTROL;
if (flags & NSEventModifierFlagCapsLock)
mods |= GLFW_MOD_CAPS_LOCK;

Expand Down Expand Up @@ -1095,11 +1095,11 @@ - (NSTextInputContext *)inputContext
UInt32 mods = 0;
if (flags & NSEventModifierFlagShift)
mods |= shiftKey;
if (flags & NSEventModifierFlagControl)
if (flags & NSEventModifierFlagCommand)
mods |= controlKey;
if (flags & NSEventModifierFlagOption)
mods |= optionKey;
if (flags & NSEventModifierFlagCommand)
if (flags & NSEventModifierFlagControl)
mods |= cmdKey;
if (flags & NSEventModifierFlagCapsLock)
mods |= alphaLock;
Expand Down Expand Up @@ -3160,9 +3160,9 @@ GLFWAPI int glfwGetCurrentSystemColorTheme(void) {
if (glfw_mods & GLFW_MOD_CONTROL)
*cocoa_mods |= NSEventModifierFlagControl;
if (glfw_mods & GLFW_MOD_ALT)
*cocoa_mods |= NSEventModifierFlagOption;
if (glfw_mods & GLFW_MOD_SUPER)
*cocoa_mods |= NSEventModifierFlagCommand;
if (glfw_mods & GLFW_MOD_SUPER)
*cocoa_mods |= NSEventModifierFlagOption;
if (glfw_mods & GLFW_MOD_CAPS_LOCK)
*cocoa_mods |= NSEventModifierFlagCapsLock;
return _glfwPlatformGetNativeKeyForKey(glfw_key);
Expand Down

0 comments on commit 74b4f63

Please sign in to comment.