Flutter Engine
The Flutter Engine
Classes | Namespaces | Functions | Variables
Window_mac.mm File Reference
#include <Carbon/Carbon.h>
#include "include/core/SkTypes.h"
#include "tools/sk_app/mac/Window_mac.h"
#include "tools/skui/ModifierKey.h"
#include "tools/window/mac/WindowContextFactory_mac.h"

Go to the source code of this file.

Classes

class  WindowDelegate
 
class  MainView
 

Namespaces

namespace  sk_app
 

Functions

static skui::Key get_key (unsigned short vk)
 
static skui::ModifierKey get_modifiers (const NSEvent *event)
 

Variables

NSTrackingArea * fTrackingArea
 
skui::ModifierKey fLastModifiers
 

Function Documentation

◆ get_key()

static skui::Key get_key ( unsigned short  vk)
static

Definition at line 216 of file Window_mac.mm.

216 {
217 // This will work with an ANSI QWERTY keyboard.
218 // Something more robust would be needed to support alternate keyboards.
219 static const struct {
220 unsigned short fVK;
221 skui::Key fKey;
222 } gPair[] = {
223 { kVK_Delete, skui::Key::kBack },
224 { kVK_Return, skui::Key::kOK },
225 { kVK_UpArrow, skui::Key::kUp },
226 { kVK_DownArrow, skui::Key::kDown },
227 { kVK_LeftArrow, skui::Key::kLeft },
228 { kVK_RightArrow, skui::Key::kRight },
229 { kVK_Tab, skui::Key::kTab },
230 { kVK_PageUp, skui::Key::kPageUp },
231 { kVK_PageDown, skui::Key::kPageDown },
232 { kVK_Home, skui::Key::kHome },
233 { kVK_End, skui::Key::kEnd },
234 { kVK_ForwardDelete, skui::Key::kDelete },
235 { kVK_Escape, skui::Key::kEscape },
236 { kVK_Shift, skui::Key::kShift },
237 { kVK_RightShift, skui::Key::kShift },
238 { kVK_Control, skui::Key::kCtrl },
239 { kVK_RightControl, skui::Key::kCtrl },
240 { kVK_Option, skui::Key::kOption },
241 { kVK_RightOption, skui::Key::kOption },
242 { kVK_Command, skui::Key::kSuper },
243 { kVK_RightCommand, skui::Key::kSuper },
244 { kVK_ANSI_A, skui::Key::kA },
245 { kVK_ANSI_C, skui::Key::kC },
246 { kVK_ANSI_V, skui::Key::kV },
247 { kVK_ANSI_X, skui::Key::kX },
248 { kVK_ANSI_Y, skui::Key::kY },
249 { kVK_ANSI_Z, skui::Key::kZ },
250 };
251
252 for (size_t i = 0; i < std::size(gPair); i++) {
253 if (gPair[i].fVK == vk) {
254 return gPair[i].fKey;
255 }
256 }
257
258 return skui::Key::kNONE;
259}
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
vk
Definition: malisc.py:42
Key
Definition: Key.h:6
@ kBack
(CLR)
@ kHome
the home key - added to match android
@ kEnd
the red key
@ kOK
the center key

◆ get_modifiers()

static skui::ModifierKey get_modifiers ( const NSEvent *  event)
static

Definition at line 261 of file Window_mac.mm.

261 {
262 NSUInteger modifierFlags = [event modifierFlags];
264
265 if (modifierFlags & NSEventModifierFlagCommand) {
266 modifiers |= skui::ModifierKey::kCommand;
267 }
268 if (modifierFlags & NSEventModifierFlagShift) {
269 modifiers |= skui::ModifierKey::kShift;
270 }
271 if (modifierFlags & NSEventModifierFlagControl) {
272 modifiers |= skui::ModifierKey::kControl;
273 }
274 if (modifierFlags & NSEventModifierFlagOption) {
275 modifiers |= skui::ModifierKey::kOption;
276 }
277
278 if ((NSKeyDown == [event type] || NSKeyUp == [event type]) && ![event isARepeat]) {
280 }
281
282 return modifiers;
283}
GLenum type
FlKeyEvent * event
ModifierKey
Definition: ModifierKey.h:9

Variable Documentation

◆ fLastModifiers

skui::ModifierKey fLastModifiers

Definition at line 291 of file Window_mac.mm.

◆ fTrackingArea

NSTrackingArea* fTrackingArea
Initial value:

Definition at line 288 of file Window_mac.mm.