• Tong Mu's avatar
    New scheme for keyboard logical key ID (#85121) · c8d0b1d9
    Tong Mu authored
    This PR updates the ID used by logical keyboard keys.
    
    The logical key ID is still composed of 2 parts: 32 bits of value, and 8 bits of plane. But the assignment of planes has been drastically changed. HID plane is removed, and unprintable plane and Flutter plane are added. This is to reflect the new generation method for logical key IDs. Now keys that are defined by Flutter but not by dom_key_data are placed into the Flutter plane, including numpad keys, sided modifier keys, and gamepad keys. The values for platform planes have also been adjusted.
    
    The generation script and README have been updated accordingly as well.
    
    A new file, test_utils/key_codes.h is now generated to assist engine unit testing.
    
    All lists generated by the script are now sorted by the key.
    Unverified
    c8d0b1d9
gtk_key_mapping_cc.tmpl 1.05 KB
// 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.

#include "key_mapping.h"

#include <glib.h>
#include <map>

#include "flutter/shell/platform/linux/fl_key_embedder_responder_private.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 dev/tools/gen_keycodes/data/gtk_key_mapping_cc.tmpl
// instead. See dev/tools/gen_keycodes/README.md for more information.

std::map<uint64_t, uint64_t> xkb_to_physical_key_map = {
@@@XKB_SCAN_CODE_MAP@@@
};

std::map<uint64_t, uint64_t> gtk_keyval_to_logical_key_map = {
@@@GTK_KEYVAL_CODE_MAP@@@
};

void initialize_modifier_bit_to_checked_keys(GHashTable* table) {
  FlKeyEmbedderCheckedKey* data;
@@@GTK_MODIFIER_BIT_MAP@@@
}

void initialize_lock_bit_to_checked_keys(GHashTable* table) {
  FlKeyEmbedderCheckedKey* data;
@@@GTK_MODE_BIT_MAP@@@
}

@@@MASK_CONSTANTS@@@