Flutter macOS Embedder
FlutterEmbedderKeyResponder Class Reference

#import <FlutterEmbedderKeyResponder.h>

Inheritance diagram for FlutterEmbedderKeyResponder:
<FlutterKeyPrimaryResponder>

Instance Methods

(nonnull instancetype) - initWithSendEvent:
 
(void) - syncModifiersIfNeeded:timestamp:
 
(nonnull NSDictionary *) - getPressedState
 
- Instance Methods inherited from <FlutterKeyPrimaryResponder>
(void) - handleEvent:callback:
 

Additional Inherited Members

- Properties inherited from <FlutterKeyPrimaryResponder>
NSMutableDictionary< NSNumber *, NSNumber * > * layoutMap
 

Detailed Description

A primary responder of |FlutterKeyboardManager| that handles events by sending the converted events through the embedder API.

This class communicates with the HardwareKeyboard API in the framework.

Definition at line 20 of file FlutterEmbedderKeyResponder.h.

Method Documentation

◆ getPressedState

- (nonnull NSDictionary *) getPressedState

Returns the keyboard pressed state.

Returns the keyboard pressed state. The dictionary contains one entry per pressed keys, mapping from the logical key to the physical key.

Definition at line 796 of file FlutterEmbedderKeyResponder.mm.

796  {
797  return [NSDictionary dictionaryWithDictionary:_pressingRecords];
798 }

Referenced by FlutterKeyboardManager::getPressedState.

◆ initWithSendEvent:

- (nonnull instancetype) initWithSendEvent: (_Nonnull FlutterSendEmbedderKeyEvent sendEvent

Create an instance by specifying the function to send converted events to.

The |sendEvent| is typically |FlutterEngine|'s |sendKeyEvent|.

◆ syncModifiersIfNeeded:timestamp:

- (void) syncModifiersIfNeeded: (NSEventModifierFlags)  modifierFlags
timestamp: (NSTimeInterval)  timestamp 

Synthesize modifier keys events.

If needed, synthesize modifier keys up and down events by comparing their current pressing states with the given modifier flags.

Reimplemented from <FlutterKeyPrimaryResponder>.

Definition at line 783 of file FlutterEmbedderKeyResponder.mm.

783  :(NSEventModifierFlags)modifierFlags
784  timestamp:(NSTimeInterval)timestamp {
785  FlutterAsyncKeyCallback replyCallback = ^(BOOL handled) {
786  // Do nothing.
787  };
788  FlutterKeyCallbackGuard* guardedCallback =
789  [[FlutterKeyCallbackGuard alloc] initWithCallback:replyCallback];
790  [self synchronizeModifiers:modifierFlags
791  ignoringFlags:0
792  timestamp:timestamp
793  guard:guardedCallback];
794 }

The documentation for this class was generated from the following files:
FlutterAsyncKeyCallback
void(^ FlutterAsyncKeyCallback)(BOOL handled)
Definition: FlutterKeyPrimaryResponder.h:7
FlutterKeyCallbackGuard
Definition: FlutterEmbedderKeyResponder.mm:266