Flutter macOS Embedder
FlutterEmbedderKeyResponder.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_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTEREMBEDDERKEYRESPONDER_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTEREMBEDDERKEYRESPONDER_H_
7 
8 #import <Cocoa/Cocoa.h>
9 
11 #include "flutter/shell/platform/embedder/embedder.h"
12 
13 typedef void (^FlutterSendEmbedderKeyEvent)(const FlutterKeyEvent& /* event */,
14  _Nullable FlutterKeyEventCallback /* callback */,
15  void* _Nullable /* user_data */);
16 
17 /**
18  * A primary responder of |FlutterKeyboardManager| that handles events by
19  * sending the converted events through the embedder API.
20  *
21  * This class communicates with the HardwareKeyboard API in the framework.
22  */
24 
25 /**
26  * Create an instance by specifying the function to send converted events to.
27  *
28  * The |sendEvent| is typically |FlutterEngine|'s |sendKeyEvent|.
29  */
30 - (nonnull instancetype)initWithSendEvent:(_Nonnull FlutterSendEmbedderKeyEvent)sendEvent;
31 
32 /**
33  * Synthesize modifier keys events.
34  *
35  * If needed, synthesize modifier keys up and down events by comparing their
36  * current pressing states with the given modifier flags.
37  */
38 - (void)syncModifiersIfNeeded:(NSEventModifierFlags)modifierFlags
39  timestamp:(NSTimeInterval)timestamp;
40 
41 /**
42  * Returns the keyboard pressed state.
43  *
44  * Returns the keyboard pressed state. The dictionary contains one entry per
45  * pressed keys, mapping from the logical key to the physical key.
46  */
47 - (nonnull NSDictionary*)getPressedState;
48 
49 @end
50 
51 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTEREMBEDDERKEYRESPONDER_H_
FlutterKeyPrimaryResponder-p
Definition: FlutterKeyPrimaryResponder.h:18
-[FlutterEmbedderKeyResponder getPressedState]
nonnull NSDictionary * getPressedState()
Definition: FlutterEmbedderKeyResponder.mm:797
FlutterSendEmbedderKeyEvent
void(^ FlutterSendEmbedderKeyEvent)(const FlutterKeyEvent &, _Nullable FlutterKeyEventCallback, void *_Nullable)
Definition: FlutterEmbedderKeyResponder.h:13
FlutterKeyPrimaryResponder.h
FlutterEmbedderKeyResponder
Definition: FlutterEmbedderKeyResponder.h:23