| Flutter macOS Embedder |

Instance Methods | Properties | List of all members
FlutterKeyboardLayout Class Reference

`#import <FlutterKeyboardLayout.h>`

Inheritance diagram for FlutterKeyboardLayout:

## Instance Methods
(flutter::LayoutClue) | - lookUpLayoutForKeyCode:shift:

## Properties
id< FlutterKeyboardLayoutDelegate > | delegate

## Detailed Description

A class that allows querying the printable result of a key with a modifier state according to the current keyboard layout. It also provides a delegate protocol for clients interested in listening to keyboard layout changes.

Definition at line 50 of file FlutterKeyboardLayout.h.

## Method Documentation

## ◆ lookUpLayoutForKeyCode:shift:

- (LayoutClue) FlutterKeyboardLayout: |  | (uint16_t) | keyCode
shift: |  | (BOOL) | shift

Querying the printable result of a key under the given modifier state.

Definition at line 40 of file FlutterKeyboardLayout.mm.

75 :(uint16_t)keyCode shift:(BOOL)shift {
76 if (_keyboardLayoutData == nil) {
77 _keyboardLayoutData = CurrentKeyboardLayoutData();
78 }
79 const UCKeyboardLayout* layout = reinterpret_cast<const UCKeyboardLayout*>(
80 CFDataGetBytePtr((__bridge CFDataRef)_keyboardLayoutData));
81
82 UInt32 deadKeyState = 0;
83 UniCharCount stringLength = 0;
84 UniChar resultChar;
85
86 UInt32 modifierState = ((shift ? shiftKey : 0) >> 8) & 0xFF;
87 UInt32 keyboardType = LMGetKbdLast();
88
89 bool isDeadKey = false;
90 OSStatus status =
91 UCKeyTranslate(layout, keyCode, kUCKeyActionDown, modifierState, keyboardType,
92 kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 1, &stringLength, &resultChar);
93 // For dead keys, press the same key again to get the printable representation of the key.
94 if (status == noErr && stringLength == 0 && deadKeyState != 0) {
95 isDeadKey = true;
96 status =
97 UCKeyTranslate(layout, keyCode, kUCKeyActionDown, modifierState, keyboardType,
98 kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 1, &stringLength, &resultChar);
99 }
100
101 if (status == noErr && stringLength == 1 && !std::iscntrl(resultChar)) {
102 return flutter::LayoutClue{resultChar, isDeadKey};
103 }
104 return flutter::LayoutClue{0, false};
105 }
flutter::LayoutClue
Definition: FlutterKeyboardLayout.h:14

## Property Documentation

## ◆ delegate

- (id<FlutterKeyboardLayoutDelegate>) delegate
| read write nonatomic weak

Definition at line 52 of file FlutterKeyboardLayout.h.

The documentation for this class was generated from the following files:

- shell/platform/darwin/macos/framework/Source/FlutterKeyboardLayout.h
- shell/platform/darwin/macos/framework/Source/FlutterKeyboardLayout.mm