Flutter macOS Embedder
FlutterEmbedderKeyResponder() Category Reference

Instance Methods

(void) - synchronizeModifiers:ignoringFlags:timestamp:guard:
 
(void) - updateKey:asPressed:
 
(void) - sendPrimaryFlutterEvent:callback:
 
(void) - sendSynthesizedFlutterEvent:guard:
 
(void) - sendCapsLockTapWithTimestamp:synthesizeDown:callback:
 
(void) - sendModifierEventOfType:timestamp:keyCode:synthesized:callback:
 
(void) - handleDownEvent:callback:
 
(void) - handleUpEvent:callback:
 
(void) - handleCapsLockEvent:callback:
 
(void) - handleFlagEvent:callback:
 
(void) - handleResponse:forId:
 

Properties

FlutterSendEmbedderKeyEvent sendEvent
 
NSMutableDictionary< NSNumber *, NSNumber * > * pressingRecords
 
NSUInteger modifierFlagOfInterestMask
 
NSUInteger lastModifierFlagsOfInterest
 
uint64_t responseId
 
NSMutableDictionary< NSNumber *, FlutterAsyncKeyCallback > * pendingResponses
 

Detailed Description

Definition at line 331 of file FlutterEmbedderKeyResponder.mm.

Method Documentation

◆ handleCapsLockEvent:callback:

- (void) handleCapsLockEvent: (nonnull NSEvent *)  event
callback: (nonnull FlutterKeyCallbackGuard *)  callback 

Processes an event from the system for the CapsLock key.

◆ handleDownEvent:callback:

- (void) handleDownEvent: (nonnull NSEvent *)  event
callback: (nonnull FlutterKeyCallbackGuard *)  callback 

Processes a down event from the system.

◆ handleFlagEvent:callback:

- (void) handleFlagEvent: (nonnull NSEvent *)  event
callback: (nonnull FlutterKeyCallbackGuard *)  callback 

Processes a flags changed event from the system, where modifier keys are pressed or released.

◆ handleResponse:forId:

- (void) handleResponse: (BOOL)  handled
forId: (uint64_t)  responseId 

Processes the response from the framework.

◆ handleUpEvent:callback:

- (void) handleUpEvent: (nonnull NSEvent *)  event
callback: (nonnull FlutterKeyCallbackGuard *)  callback 

Processes an up event from the system.

◆ sendCapsLockTapWithTimestamp:synthesizeDown:callback:

- (void) sendCapsLockTapWithTimestamp: (NSTimeInterval)  timestamp
synthesizeDown: (bool)  synthesizeDown
callback: (nonnull FlutterKeyCallbackGuard *)  callback 

Send a CapsLock down event, then a CapsLock up event.

If synthesizeDown is TRUE, then both events will be synthesized. Otherwise, the callback will be used as the callback for the down event, which is not synthesized, while the up event will always be synthesized.

◆ sendModifierEventOfType:timestamp:keyCode:synthesized:callback:

- (void) sendModifierEventOfType: (BOOL)  isDownEvent
timestamp: (NSTimeInterval)  timestamp
keyCode: (unsigned short)  keyCode
synthesized: (bool)  synthesized
callback: (nonnull FlutterKeyCallbackGuard *)  callback 

Send a key event for a modifier key.

◆ sendPrimaryFlutterEvent:callback:

- (void) sendPrimaryFlutterEvent: (const FlutterKeyEvent &)  event
callback: (nonnull FlutterKeyCallbackGuard *)  callback 

Send an event to the framework, expecting its response.

◆ sendSynthesizedFlutterEvent:guard:

- (void) sendSynthesizedFlutterEvent: (const FlutterKeyEvent &)  event
guard: (FlutterKeyCallbackGuard *)  guard 

Send a synthesized key event, never expecting its event result.

The |guard| is basically a regular guarded callback, but instead of being called, it is only used to record whether an event is sent.

◆ synchronizeModifiers:ignoringFlags:timestamp:guard:

- (void) synchronizeModifiers: (NSUInteger)  currentFlags
ignoringFlags: (NSUInteger)  ignoringFlags
timestamp: (NSTimeInterval)  timestamp
guard: (nonnull FlutterKeyCallbackGuard *)  guard 

Compare the last modifier flags and the current, and dispatch synthesized key events for each different modifier flag bit.

The flags compared are all flags after masking with |modifierFlagOfInterestMask| and excluding |ignoringFlags|.

The |guard| is basically a regular guarded callback, but instead of being called, it is only used to record whether an event is sent.

◆ updateKey:asPressed:

- (void) updateKey: (uint64_t)  physicalKey
asPressed: (uint64_t)  logicalKey 

Update the pressing state.

If logicalKey is not 0, physicalKey is pressed as logicalKey. Otherwise, physicalKey is released.

Property Documentation

◆ lastModifierFlagsOfInterest

- (NSUInteger) lastModifierFlagsOfInterest
readwritenonatomicassign

The modifier flags of the last received key event, excluding uninterested bits.

This should be kept synchronized with the last |NSEvent.modifierFlags| after masking with |modifierFlagOfInterestMask|. This should also be kept synchronized with the corresponding keys of |pressingRecords|.

This is used by |synchronizeModifiers| to quickly find out modifier keys that are desynchronized.

Definition at line 372 of file FlutterEmbedderKeyResponder.mm.

◆ modifierFlagOfInterestMask

- (NSUInteger) modifierFlagOfInterestMask
readwritenonatomicassign

A constant mask for NSEvent.modifierFlags that Flutter synchronizes with.

Flutter keeps track of the last |modifierFlags| and compares it with the incoming one. Any bit within |modifierFlagOfInterestMask| that is different (except for the one that corresponds to the event key) indicates that an event for this modifier was missed, and Flutter synthesizes an event to make up for the state difference.

It is computed by computeModifierFlagOfInterestMask.

Definition at line 359 of file FlutterEmbedderKeyResponder.mm.

◆ pendingResponses

- (NSMutableDictionary<NSNumber*, FlutterAsyncKeyCallback>*) pendingResponses
readwritenonatomicassign

A map of unresponded key events sent to the framework.

Its values are |responseId|s, and keys are the callback that was received along with the event.

Definition at line 385 of file FlutterEmbedderKeyResponder.mm.

◆ pressingRecords

- (NSMutableDictionary<NSNumber*, NSNumber*>*) pressingRecords
readwritenonatomicassign

A map of presessd keys.

The keys of the dictionary are physical keys, while the values are the logical keys of the key down event.

Definition at line 346 of file FlutterEmbedderKeyResponder.mm.

◆ responseId

- (uint64_t) responseId
readwritenonatomicassign

A self-incrementing ID used to label key events sent to the framework.

Definition at line 377 of file FlutterEmbedderKeyResponder.mm.

◆ sendEvent

- (FlutterSendEmbedderKeyEvent) sendEvent
readwritenonatomiccopy

The function to send converted events to.

Set by the initializer.

Definition at line 338 of file FlutterEmbedderKeyResponder.mm.


The documentation for this category was generated from the following file: