| Flutter macOS Embedder |

FlutterKeyPrimaryResponder.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 typedef void (^FlutterAsyncKeyCallback)(BOOL handled);
8
9 /**
10 * An interface for a responder that can process a key event and decides whether
11 * to handle an event asynchronously.
12 *
13 * To use this class, add it to a |FlutterKeyboardManager| with |addPrimaryResponder|.
14 */
15 @protocol FlutterKeyPrimaryResponder
16
17 /**
18 * Process the event.
19 *
20 * The |callback| should be called with a value that indicates whether the
21 * responder has handled the given event. The |callback| must be called exactly
22 * once, and can be called before the return of this method, or after.
23 */
24 @required
25 - (void)handleEvent:(nonnull NSEvent*)event callback:(nonnull FlutterAsyncKeyCallback)callback;
26
27 /**
28 * Synchronize the modifier flags if necessary. The new modifier flag would usually come from mouse
29 * event and may be out of sync with current keyboard state if the modifier flags have changed while
30 * window was not key.
31 */
32 @required
33 - (void)syncModifiersIfNeeded:(NSEventModifierFlags)modifierFlags
34 timestamp:(NSTimeInterval)timestamp;
35
36 /* A map from macOS key code to logical keyboard.
37 *
38 * The map is assigned on initialization, and updated when the user changes
39 * keyboard type or layout. The responder should prioritize this map when
40 * deriving logical keys.
41 */
42 @required
43 @property(nonatomic, nullable, strong) NSMutableDictionary<NSNumber*, NSNumber*>* layoutMap;
44
45 @end
FlutterKeyPrimaryResponder-p
Definition: FlutterKeyPrimaryResponder.h:15
FlutterAsyncKeyCallback
void(^ FlutterAsyncKeyCallback)(BOOL handled)
Definition: FlutterKeyPrimaryResponder.h:7
FlutterKeyPrimaryResponder-p::layoutMap
NSMutableDictionary< NSNumber *, NSNumber * > * layoutMap
Definition: FlutterKeyPrimaryResponder.h:43