src/video/cocoa/SDL_cocoakeyboard.m
changeset 9898 0da384bef562
parent 9619 b94b6d0bff0f
child 9915 77cf2d1b7215
     1.1 --- a/src/video/cocoa/SDL_cocoakeyboard.m	Fri Oct 23 03:37:53 2015 -0300
     1.2 +++ b/src/video/cocoa/SDL_cocoakeyboard.m	Tue Oct 27 11:17:32 2015 -0700
     1.3 @@ -398,7 +398,7 @@
     1.4  }
     1.5  
     1.6  static void
     1.7 -UpdateKeymap(SDL_VideoData *data)
     1.8 +UpdateKeymap(SDL_VideoData *data, SDL_bool send_event)
     1.9  {
    1.10      TISInputSourceRef key_layout;
    1.11      const void *chr_data;
    1.12 @@ -454,6 +454,9 @@
    1.13              }
    1.14          }
    1.15          SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
    1.16 +        if (send_event) {
    1.17 +            SDL_SendKeymapChangedEvent();
    1.18 +        }
    1.19          return;
    1.20      }
    1.21  
    1.22 @@ -466,7 +469,7 @@
    1.23  {
    1.24      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    1.25  
    1.26 -    UpdateKeymap(data);
    1.27 +    UpdateKeymap(data, SDL_FALSE);
    1.28  
    1.29      /* Set our own names for the platform-dependent but layout-independent keys */
    1.30      /* This key is NumLock on the MacBook keyboard. :) */
    1.31 @@ -564,7 +567,7 @@
    1.32      case NSKeyDown:
    1.33          if (![event isARepeat]) {
    1.34              /* See if we need to rebuild the keyboard layout */
    1.35 -            UpdateKeymap(data);
    1.36 +            UpdateKeymap(data, SDL_TRUE);
    1.37          }
    1.38  
    1.39          SDL_SendKeyboardKey(SDL_PRESSED, code);