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