• Greg Spencer's avatar
    Add iOS key map generation, make macOS var naming consistent with repo (#83146) · 6b087c74
    Greg Spencer authored
    This adds iOS key map generation that uses std::maps. It uses std::maps because on iOS if we use NSDictionaries, then when XCode loads the dylib, the initialization of those status NSDictionaries hasn't yet occurred, and it crashes the app. std::maps have a well-defined static behavior, and are correctly initialized.
    
    I also made the naming of variables, fields, etc. consistent for macOS. We variously had macosFoo, macOSFoo, and macOsFoo. I eliminated macOsFoo and macosFoo, since the rest of the repo uses macOSFoo for lowerCamelCase names (with only a few exceptions). I used iOSFoo for iOS.
    6b087c74
macos_key_code_map_cc.tmpl 1006 Bytes
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#include "./KeyCodeMap_internal.h"

// DO NOT EDIT -- DO NOT EDIT -- DO NOT EDIT
// This file is generated by
// flutter/flutter:dev/tools/gen_keycodes/bin/gen_keycodes.dart and should not
// be edited directly.
//
// Edit the template
// flutter/flutter:dev/tools/gen_keycodes/data/keyboard_map_macos_cc.tmpl
// instead.
//
// See flutter/flutter:dev/tools/gen_keycodes/README.md for more information.

@@@MASK_CONSTANTS@@@

const NSDictionary* keyCodeToPhysicalKey = @{
@@@MACOS_SCAN_CODE_MAP@@@
};

const NSDictionary* keyCodeToLogicalKey = @{
@@@MACOS_KEYCODE_LOGICAL_MAP@@@
};

const NSDictionary* keyCodeToModifierFlag = @{
@@@KEYCODE_TO_MODIFIER_FLAG_MAP@@@
};

const NSDictionary* modifierFlagToKeyCode = @{
@@@MODIFIER_FLAG_TO_KEYCODE_MAP@@@
};

@@@SPECIAL_KEY_CONSTANTS@@@