This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch reproducible-widget-previews
in repository efl.

View the commit online.

commit 27223bac31e927e1238e53bdc45f1821ecb6508d
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Mar 18 09:06:49 2026 -0600

    ecore_cocoa: distinguish left and right modifier keys
    
    The NSEventTypeFlagsChanged handler was always reporting "_L"
    variants for all modifier keys (e.g. "Control_L" for both left
    and right Command).
    
    Use [event keyCode] to distinguish the physical key:
      Left Shift (56) / Right Shift (60)
      Left Command (55) / Right Command (54) → Control_L / Control_R
      Left Control (59) / Right Control (62) → Super_L / Super_R
      Left Option (58) / Right Option (61) → Alt_L / Alt_R
    
    Also populate evDown->keycode so the raw hardware scancode is
    available downstream.
    
    Made-with: Cursor
---
 src/lib/ecore_cocoa/ecore_cocoa.m | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m
index 5b8198ac44..000ea592d2 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa.m
@@ -260,6 +260,7 @@ _ecore_cocoa_feed_events(void *anEvent)
       case NSEventTypeFlagsChanged:
         {
            NSUInteger flags = [event modifierFlags];
+           unsigned short keyCode = [event keyCode];
            EcoreCocoaWindow *window = (EcoreCocoaWindow *)[event window];
 
            Ecore_Event_Key *evDown = NULL;
@@ -267,15 +268,18 @@ _ecore_cocoa_feed_events(void *anEvent)
            const char *key = NULL;
            int keylen;
 
+           /* Use keyCode to distinguish left/right modifier keys.
+            * macOS keyCodes: LShift=56 RShift=60 LCmd=55 RCmd=54
+            *                 LCtrl=59 RCtrl=62 LOpt=58 ROpt=61 */
            // Turn special key flags on
            if (flags & NSEventModifierFlagShift)
-             key = "Shift_L";
+             key = (keyCode == 60) ? "Shift_R" : "Shift_L";
            else if (flags & NSEventModifierFlagCommand)
-             key = "Control_L";
+             key = (keyCode == 54) ? "Control_R" : "Control_L";
            else if (flags & NSEventModifierFlagControl)
-             key = "Super_L";
+             key = (keyCode == 62) ? "Super_R" : "Super_L";
            else if (flags & NSEventModifierFlagOption)
-             key = "Alt_L";
+             key = (keyCode == 61) ? "Alt_R" : "Alt_L";
            else if (flags & NSEventModifierFlagCapsLock)
              key = "Caps_Lock";
            else if (flags & NSEventModifierFlagNumericPad)
@@ -297,6 +301,7 @@ _ecore_cocoa_feed_events(void *anEvent)
                 evDown->event_window = evDown->window;
                 evDown->timestamp = time;
                 evDown->string = NULL;
+                evDown->keycode = keyCode;
                 ecore_event_add(ECORE_EVENT_KEY_DOWN, evDown, NULL, NULL);
                 old_flags = flags;
                 break;
@@ -308,13 +313,13 @@ _ecore_cocoa_feed_events(void *anEvent)
 
            // Turn special key flags off
            if (changed_flags & NSEventModifierFlagShift)
-             key = "Shift_L";
+             key = (keyCode == 60) ? "Shift_R" : "Shift_L";
            else if (changed_flags & NSEventModifierFlagCommand)
-             key = "Control_L";
+             key = (keyCode == 54) ? "Control_R" : "Control_L";
            else if (changed_flags & NSEventModifierFlagControl)
-             key = "Super_L";
+             key = (keyCode == 62) ? "Super_R" : "Super_L";
            else if (changed_flags & NSEventModifierFlagOption)
-             key = "Alt_L";
+             key = (keyCode == 61) ? "Alt_R" : "Alt_L";
            else if (changed_flags & NSEventModifierFlagCapsLock)
              key = "Caps_Lock";
            else if (changed_flags & NSEventModifierFlagNumericPad)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to