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"
15#include "flutter/shell/platform/windows/keyboard_key_handler.h"
79 struct PendingResponse {
90 uint64_t physical_key;
106 void KeyboardHookImpl(
int key,
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);
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,
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);
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;
std::function< void(const FlutterKeyEvent &, FlutterKeyEventCallback, void *)> SendEventHandler
virtual ~KeyboardKeyEmbedderHandler()
void KeyboardHook(int key, int scancode, int action, char32_t character, bool extended, bool was_down, std::function< void(bool)> callback) override
std::function< SHORT(UINT, bool)> MapVirtualKeyToScanCode
std::map< uint64_t, uint64_t > GetPressedState() override
void SyncModifiersIfNeeded(int modifiers_state) override
KeyboardKeyEmbedderHandler(SendEventHandler send_event, GetKeyStateHandler get_key_state, MapVirtualKeyToScanCode map_vk_to_scan)
std::function< SHORT(int)> GetKeyStateHandler
void(* FlutterKeyEventCallback)(bool, void *)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Dart_NativeFunction function
std::string ConvertChar32ToUtf8(char32_t ch)