| Flutter Linux Embedder |

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
13 inline uint64_t gpointer_to_uint64(gpointer pointer) {
14 return pointer == nullptr ? 0 : reinterpret_cast<uint64_t>(pointer);
15 }
16
17 inline 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.
22 extern std::map<uint64_t, uint64_t> xkb_to_physical_key_map;
23
24 // Maps GDK keyval values to Flutter's logical key code values.
25 extern std::map<uint64_t, uint64_t> gtk_keyval_to_logical_key_map;
26
27 void initialize_modifier_bit_to_checked_keys(GHashTable* table);
28
29 void initialize_lock_bit_to_checked_keys(GHashTable* table);
30
31 // Mask for the 32-bit value portion of the key code.
32 extern const uint64_t kValueMask;
33
34 // The plane value for keys which have a Unicode representation.
35 extern const uint64_t kUnicodePlane;
36
37 // The plane value for the private keys defined by the GTK embedding.
38 extern const uint64_t kGtkPlane;
39
40 typedef 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 handler will make sure to find a
48 // logical key for this character, falling back to the US keyboard layout.
49 bool mandatory;
50 } LayoutGoal;
51
52 // NOLINTNEXTLINE(readability-identifier-naming)
53 extern const std::vector<LayoutGoal> layout_goals;
54
55 #endif // FLUTTER_SHELL_PLATFORM_LINUX_KEY_MAPPING_H_
xkb_to_physical_key_map
std::map< uint64_t, uint64_t > xkb_to_physical_key_map
Definition: key_mapping.g.cc:20
initialize_modifier_bit_to_checked_keys
void initialize_modifier_bit_to_checked_keys(GHashTable *table)
Definition: key_mapping.g.cc:414
uint64_to_gpointer
gpointer uint64_to_gpointer(uint64_t number)
Definition: key_mapping.h:17
kValueMask
const uint64_t kValueMask
Definition: key_mapping.g.cc:514
kGtkPlane
const uint64_t kGtkPlane
Definition: key_mapping.g.cc:516
initialize_lock_bit_to_checked_keys
void initialize_lock_bit_to_checked_keys(GHashTable *table)
Definition: key_mapping.g.cc:446
layout_goals
const std::vector< LayoutGoal > layout_goals
Definition: key_mapping.g.cc:462
kUnicodePlane
const uint64_t kUnicodePlane
Definition: key_mapping.g.cc:515
gtk_keyval_to_logical_key_map
std::map< uint64_t, uint64_t > gtk_keyval_to_logical_key_map
Definition: key_mapping.g.cc:240
gpointer_to_uint64
uint64_t gpointer_to_uint64(gpointer pointer)
Definition: key_mapping.h:13
LayoutGoal
Definition: key_mapping.h:40
LayoutGoal::keycode
uint16_t keycode
Definition: key_mapping.h:42
LayoutGoal::mandatory
bool mandatory
Definition: key_mapping.h:49
LayoutGoal::logical_key
uint64_t logical_key
Definition: key_mapping.h:45