Flutter Engine
The Flutter Engine
lib
ui
window
key_data.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_LIB_UI_WINDOW_KEY_DATA_H_
6
#define FLUTTER_LIB_UI_WINDOW_KEY_DATA_H_
7
8
#include <cstdint>
9
10
namespace
flutter
{
11
12
// If this value changes, update the encoding code in the following files:
13
//
14
// * KeyData.java (KeyData.FIELD_COUNT)
15
// * platform_dispatcher.dart (_kKeyDataFieldCount)
16
static
constexpr
int
kKeyDataFieldCount
= 6;
17
static
constexpr
int
kBytesPerKeyField
=
sizeof
(int64_t);
18
19
// The change of the key event, used by KeyData.
20
//
21
// Must match the KeyEventType enum in ui/key.dart.
22
enum class
KeyEventType
: int64_t {
23
kDown
= 0,
24
kUp
,
25
kRepeat
,
26
};
27
28
// The source device for the key event.
29
//
30
// Not all platforms supply an accurate source.
31
//
32
// Defaults to [keyboard].
33
// Must match the KeyEventDeviceType enum in ui/key.dart.
34
enum class
KeyEventDeviceType
: int64_t {
35
// The source is a keyboard.
36
kKeyboard
= 0,
37
38
// The source is a directional pad on something like a television remote
39
// control or similar.
40
kDirectionalPad
,
41
42
// The source is a gamepad button.
43
kGamepad
,
44
45
// The source is a joystick button.
46
kJoystick
,
47
48
// The source is a device connected to an HDMI bus.
49
kHdmi
,
50
};
51
52
// The fixed-length sections of a KeyDataPacket.
53
//
54
// KeyData does not contain `character`, for variable-length data are stored in
55
// a different way in KeyDataPacket.
56
//
57
// This structure is unpacked by hooks.dart.
58
//
59
// Changes to this struct must also be made to
60
// io/flutter/embedding/android/KeyData.java.
61
struct
alignas
(8)
KeyData
{
62
// Timestamp in microseconds from an arbitrary and consistent start point
63
uint64_t
timestamp
;
64
KeyEventType
type
;
65
uint64_t
physical
;
66
uint64_t
logical
;
67
// True if the event does not correspond to a native event.
68
//
69
// The value is 1 for true, and 0 for false.
70
uint64_t
synthesized
;
71
KeyEventDeviceType
device_type
;
72
73
// Sets all contents of `Keydata` to 0.
74
void
Clear
();
75
};
76
77
}
// namespace flutter
78
79
#endif
// FLUTTER_LIB_UI_WINDOW_KEY_DATA_H_
kUp
@ kUp
Definition:
embedder.h:973
kDown
@ kDown
Definition:
embedder.h:980
flutter
Definition:
asset_manager.cc:10
flutter::kBytesPerKeyField
static constexpr int kBytesPerKeyField
Definition:
key_data.h:17
flutter::KeyEventType
KeyEventType
Definition:
key_data.h:22
flutter::KeyEventDeviceType
KeyEventDeviceType
Definition:
key_data.h:34
flutter::KeyEventDeviceType::kDirectionalPad
@ kDirectionalPad
flutter::KeyEventDeviceType::kJoystick
@ kJoystick
flutter::KeyEventDeviceType::kGamepad
@ kGamepad
flutter::KeyEventDeviceType::kHdmi
@ kHdmi
flutter::KeyEventDeviceType::kKeyboard
@ kKeyboard
flutter::kKeyDataFieldCount
static constexpr int kKeyDataFieldCount
Definition:
key_data.h:16
flutter::DlTileMode::kRepeat
@ kRepeat
flutter::KeyData
Definition:
key_data.h:61
flutter::KeyData::Clear
void Clear()
Definition:
key_data.cc:14
flutter::KeyData::synthesized
uint64_t synthesized
Definition:
key_data.h:70
flutter::KeyData::device_type
KeyEventDeviceType device_type
Definition:
key_data.h:71
flutter::KeyData::logical
uint64_t logical
Definition:
key_data.h:66
flutter::KeyData::physical
uint64_t physical
Definition:
key_data.h:65
flutter::KeyData::type
KeyEventType type
Definition:
key_data.h:64
flutter::KeyData::timestamp
uint64_t timestamp
Definition:
key_data.h:63
Generated on Sun Jun 23 2024 21:55:06 for Flutter Engine by
1.9.4