summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authormobserveur <mobserveur@gmail.com>2026-07-01 21:27:05 +0200
committerErik Kundiman <erik@megapahit.org>2026-07-02 20:23:03 +0800
commit05af673abec6135b60d6c9d54dccc1e181efda4e (patch)
tree7bdf55e03050bdfbad797ab4139f1f29c5031d51 /indra/llwindow
parent0f5b40798a6c122b7104d6bafefcb7decaad2fc3 (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)
Diffstat (limited to 'indra/llwindow')
-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++)