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 23 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 797 of file FlutterEmbedderKeyResponder.mm.

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

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 784 of file FlutterEmbedderKeyResponder.mm.

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

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