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

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

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

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

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