| Flutter macOS Embedder |

FlutterKeyboardManager.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/FlutterKeyboardViewDelegate.h"
8
9 /**
10 * Processes keyboard events and cooperate with |TextInputPlugin|.
11 *
12 * A keyboard event goes through a few sections, each can choose to handled the
13 * event, and only unhandled events can move to the next section:
14 *
15 * - Pre-filtering: Events during IME are sent to the system immediately.
16 * - Keyboard: Dispatch to the embedder responder and the channel responder
17 * simultaneously. After both responders have responded (asynchronously), the
18 * event is considered handled if either responder handles.
19 * - Text input: Events are sent to |TextInputPlugin| and are handled
20 * synchronously.
21 * - Next responder: Events are sent to the next responder as specified by
22 * |viewDelegate|.
23 */
24 @interface FlutterKeyboardManager : NSObject
25
26 /**
27 * Create a keyboard manager.
28 *
29 * The |viewDelegate| is a weak reference, typically implemented by
30 * |FlutterViewController|.
31 */
32 - (nonnull instancetype)initWithViewDelegate:(nonnull id<FlutterKeyboardViewDelegate>)viewDelegate;
33
34 /**
35 * Processes a key event.
36 *
37 * Unhandled events will be dispatched to the text input system, and possibly
38 * the next responder afterwards.
39 */
40 - (void)handleEvent:(nonnull NSEvent*)event;
41
42 /**
43 * Returns yes if is event currently being redispatched.
44 *
45 * In some instances (i.e. emoji shortcut) the event may be redelivered by cocoa
46 * as key equivalent to FlutterTextInput, in which case it shouldn't be
47 * processed again.
48 */
49 - (BOOL)isDispatchingKeyEvent:(nonnull NSEvent*)event;
50
51 /**
52 * Synthesize modifier keys events.
53 *
54 * If needed, synthesize modifier keys up and down events by comparing their
55 * current pressing states with the given modifier flags.
56 */
57 - (void)syncModifiersIfNeeded:(NSEventModifierFlags)modifierFlags
58 timestamp:(NSTimeInterval)timestamp;
59
60 /**
61 * Returns the keyboard pressed state.
62 *
63 * Returns the keyboard pressed state. The dictionary contains one entry per
64 * pressed keys, mapping from the logical key to the physical key.
65 */
66 - (nonnull NSDictionary*)getPressedState;
67
68 @end
FlutterKeyboardViewDelegate-p
Definition: FlutterKeyboardViewDelegate.h:39
FlutterKeyboardViewDelegate.h
-[FlutterKeyboardManager getPressedState]
nonnull NSDictionary * getPressedState()
Definition: FlutterKeyboardManager.mm:351
FlutterKeyboardManager
Definition: FlutterKeyboardManager.h:24