summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormobserveur <mobserveur@gmail.com>2026-07-01 21:27:05 +0200
committermobserveur <mobserveur@gmail.com>2026-07-01 21:27:05 +0200
commit5f358290c162064d515188c8afa45226e92530f4 (patch)
treeaefcf4a289ae927e2189db7e8c3db37a7ff33cd2
parentb370bd8fdb441f3eb86c4c103112ed0874e29e99 (diff)
Fix for AZERTY keyboards on Mac
this fix properly set keyboard shortcuts for AZERTY keyboards on Mac (such as the moving keys but also cmd + A to select all, cmd + Z to revert a change)
-rw-r--r--indra/llwindow/llkeyboardmacosx.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/indra/llwindow/llkeyboardmacosx.cpp b/indra/llwindow/llkeyboardmacosx.cpp
index 89ff7c6d3f..101e035135 100644
--- a/indra/llwindow/llkeyboardmacosx.cpp
+++ b/indra/llwindow/llkeyboardmacosx.cpp
@@ -32,9 +32,32 @@
#include "llwindowmacosx-objc.h"
+#include <CoreServices/CoreServices.h> // Required for TIS functions
+#include <Carbon/Carbon.h>
+
LLKeyboardMacOSX::LLKeyboardMacOSX()
{
// Virtual keycode mapping table. Yes, this was as annoying to generate as it looks.
+
+ bool isAzerty = false;
+
+ TISInputSourceRef source = TISCopyCurrentKeyboardLayoutInputSource();
+ if (source)
+ {
+ CFStringRef inputSourceID = (CFStringRef)TISGetInputSourceProperty(source, kTISPropertyInputSourceID);
+ if (inputSourceID)
+ {
+ char buf[128];
+ // Convert CFString to a C-string for easy comparison
+ if (CFStringGetCString(inputSourceID, buf, sizeof(buf), kCFStringEncodingUTF8))
+ {
+ // On macOS, AZERTY layouts are identified by "French" in their Input Source ID
+ isAzerty = (strstr(buf, "French") != nullptr);
+ }
+ }
+ CFRelease(source);
+ }
+
mTranslateKeyMap[0x00] = 'A';
mTranslateKeyMap[0x01] = 'S';
mTranslateKeyMap[0x02] = 'D';
@@ -52,6 +75,7 @@ LLKeyboardMacOSX::LLKeyboardMacOSX()
mTranslateKeyMap[0x0f] = 'R';
mTranslateKeyMap[0x10] = 'Y';
mTranslateKeyMap[0x11] = 'T';
+
mTranslateKeyMap[0x12] = '1';
mTranslateKeyMap[0x13] = '2';
mTranslateKeyMap[0x14] = '3';
@@ -132,6 +156,16 @@ LLKeyboardMacOSX::LLKeyboardMacOSX()
mTranslateKeyMap[0x7d] = KEY_DOWN;
mTranslateKeyMap[0x7e] = KEY_UP;
+ // azerty fix
+ if(isAzerty)
+ {
+ LL_WARNS() << "keyboard is AZERTY" << LL_ENDL;
+ mTranslateKeyMap[0x00] = 'Q';
+ mTranslateKeyMap[0x06] = 'W';
+ mTranslateKeyMap[0x0c] = 'A';
+ mTranslateKeyMap[0x0d] = 'Z';
+ }
+
// Build inverse map
std::map<U16, KEY>::iterator iter;
for (iter = mTranslateKeyMap.begin(); iter != mTranslateKeyMap.end(); iter++)