5 #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_KEYBOARD_KEY_EMBEDDER_HANDLER_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_KEYBOARD_KEY_EMBEDDER_HANDLER_H_
13 #include "flutter/fml/macros.h"
14 #include "flutter/shell/platform/embedder/embedder.h"
38 std::function<void(
const FlutterKeyEvent& ,
39 FlutterKeyEventCallback ,
43 std::function<SHORT(UINT ,
bool )>;
72 std::function<
void(
bool)>
callback)
override;
79 struct PendingResponse {
80 std::function<void(
bool, uint64_t)>
callback;
90 uint64_t physical_key;
106 void KeyboardHookImpl(
int key,
112 std::function<
void(
bool)>
callback);
117 void UpdateLastSeenCriticalKey(
int virtual_key,
118 uint64_t physical_key,
119 uint64_t logical_key);
122 void SynchronizeCriticalToggledStates(
int event_virtual_key,
124 bool* event_key_can_be_repeat);
127 void SynchronizeCriticalPressedStates(
int event_virtual_key,
128 int event_physical_key,
130 bool event_key_can_be_repeat);
134 void SendEvent(
const FlutterKeyEvent& event,
139 void SendSynthesizeDownEvent(uint64_t physical, uint64_t logical);
142 void SendSynthesizeUpEvent(uint64_t physical, uint64_t logical);
146 void SynthesizeIfNeeded(uint64_t physical_left,
147 uint64_t physical_right,
148 uint64_t logical_left,
151 std::function<void(
const FlutterKeyEvent&, FlutterKeyEventCallback,
void*)>
157 std::map<uint64_t, uint64_t> pressingRecords_;
160 std::map<uint64_t, std::unique_ptr<PendingResponse>> pending_responses_;
163 uint64_t response_id_;
166 bool sent_any_events;
173 std::map<UINT, CriticalKey> critical_keys_;
177 static void HandleResponse(
bool handled,
void*
user_data);
178 static void ConvertUtf32ToUtf8_(
char* out, char32_t ch);
179 static FlutterKeyEvent SynthesizeSimpleEvent(FlutterKeyEventType
type,
183 static uint64_t ApplyPlaneToId(uint64_t
id, uint64_t plane);
185 static std::map<uint64_t, uint64_t> windowsToPhysicalMap_;
186 static std::map<uint64_t, uint64_t> windowsToLogicalMap_;
187 static std::map<uint64_t, uint64_t> scanCodeToLogicalMap_;
190 static const uint64_t valueMask;
193 static const uint64_t unicodePlane;
196 static const uint64_t windowsPlane;
203 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_KEYBOARD_KEY_EMBEDDER_HANDLER_H_