Flutter Engine
The Flutter Engine
key_mapping.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_PLATFORM_LINUX_KEY_MAPPING_H_
6#define FLUTTER_SHELL_PLATFORM_LINUX_KEY_MAPPING_H_
7
8#include <gdk/gdk.h>
9#include <cinttypes>
10#include <map>
11#include <vector>
12
13inline uint64_t gpointer_to_uint64(gpointer pointer) {
14 return pointer == nullptr ? 0 : reinterpret_cast<uint64_t>(pointer);
15}
16
17inline gpointer uint64_to_gpointer(uint64_t number) {
18 return reinterpret_cast<gpointer>(number);
19}
20
21// Maps XKB specific key code values to Flutter's physical key code values.
22extern std::map<uint64_t, uint64_t> xkb_to_physical_key_map;
23
24// Maps GDK keyval values to Flutter's logical key code values.
25extern std::map<uint64_t, uint64_t> gtk_keyval_to_logical_key_map;
26
28
30
31// Mask for the 32-bit value portion of the key code.
32extern const uint64_t kValueMask;
33
34// The plane value for keys which have a Unicode representation.
35extern const uint64_t kUnicodePlane;
36
37// The plane value for the private keys defined by the GTK embedding.
38extern const uint64_t kGtkPlane;
39
40typedef struct {
41 // The key code for a key that prints `keyChar` in the US keyboard layout.
42 uint16_t keycode;
43
44 // The logical key for this key.
45 uint64_t logical_key;
46
47 // If the goal is mandatory, the keyboard manager will make sure to find a
48 // logical key for this character, falling back to the US keyboard layout.
51
52// NOLINTNEXTLINE(readability-identifier-naming)
53extern const std::vector<LayoutGoal> layout_goals;
54
55#endif // FLUTTER_SHELL_PLATFORM_LINUX_KEY_MAPPING_H_
SI F table(const skcms_Curve *curve, F v)
std::map< uint64_t, uint64_t > xkb_to_physical_key_map
void initialize_modifier_bit_to_checked_keys(GHashTable *table)
gpointer uint64_to_gpointer(uint64_t number)
Definition: key_mapping.h:17
const uint64_t kValueMask
Definition: KeyCodeMap.g.mm:22
const uint64_t kGtkPlane
void initialize_lock_bit_to_checked_keys(GHashTable *table)
const std::vector< LayoutGoal > layout_goals
const uint64_t kUnicodePlane
Definition: KeyCodeMap.g.mm:27
std::map< uint64_t, uint64_t > gtk_keyval_to_logical_key_map
uint64_t gpointer_to_uint64(gpointer pointer)
Definition: key_mapping.h:13
uint16_t keycode
Definition: key_mapping.h:42
bool mandatory
Definition: key_mapping.h:49
uint64_t logical_key
Definition: key_mapping.h:45