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