@geastack/engine 0.1.20 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,9 @@ class ViewportRegion {
7
7
  public:
8
8
  static int clipRect(int width, int height, int *x, int *y, int *w, int *h);
9
9
  static void replayDisplayRegion(int x, int y, int w, int h);
10
+ // Same, rastered through the display's SRAM strips where it has them: for
11
+ // the rare large repaints whose raw PSRAM writes would starve the scanout.
12
+ static void replayDisplayRegionStaged(int x, int y, int w, int h);
10
13
  };
11
14
 
12
15
  } // namespace gea::embedded::ui
@@ -52,6 +52,10 @@
52
52
  #include "events.h"
53
53
  #include "pixel.h"
54
54
  #include "style.h"
55
+ #if GEA_UI_IMAGE_NODES
56
+ #include <image.h>
57
+ #include "virtual_keyboard_icons.h"
58
+ #endif
55
59
 
56
60
  #include <cstdint>
57
61
  #include <cstring>
@@ -62,7 +66,9 @@ namespace gea::embedded::ui {
62
66
  namespace {
63
67
 
64
68
  constexpr int kRowCount = 4;
65
- constexpr int kColCount = 10;
69
+ // Slots per row: the compact layout uses ten, the wide (LVGL) one up to 13.
70
+ constexpr int kColCount = 13;
71
+ constexpr int kCompactColCount = 10;
66
72
  constexpr int kSlotCount = kRowCount * kColCount;
67
73
  constexpr int kPressIdBase = 30000;
68
74
  constexpr int kKeyboardHeight = 192;
@@ -76,9 +82,17 @@ constexpr int kCodeSpace = 32;
76
82
  constexpr int kCodeModeSymbols = 1001;
77
83
  constexpr int kCodeModeAlpha = 1002;
78
84
  constexpr int kCodeModeMoreSymbols = 1003;
85
+ constexpr int kCodeModeUpper = 1004;
86
+ constexpr int kCodeHide = 1005;
87
+ constexpr int kCodeOk = 1006;
88
+ constexpr int kCodeLeft = 1007;
89
+ constexpr int kCodeRight = 1008;
79
90
 
80
91
  enum class KeyKind : std::uint8_t { Light = 0, Utility = 1, Primary = 2 };
81
92
  enum class LabelKind : std::uint8_t { Normal = 0, Wide = 1, Small = 2 };
93
+ // Symbol keys of the wide layout; indexes keyboard_icons::kIcons (minus one).
94
+ enum class Icon : std::int8_t { None = 0, Backspace, NewLine, Keyboard, Left, Right, Ok };
95
+ constexpr int kIconCount = 6;
82
96
 
83
97
  struct KeyDef {
84
98
  const char *label;
@@ -87,6 +101,7 @@ struct KeyDef {
87
101
  LabelKind labelKind;
88
102
  std::int16_t width;
89
103
  std::int16_t flex;
104
+ Icon icon;
90
105
  };
91
106
 
92
107
  struct RowDef {
@@ -207,14 +222,101 @@ constexpr RowDef kMoreSymbolsRows[kRowCount] = {
207
222
  #undef KEY_P_SMALL
208
223
  #undef KEY_L_WIDE
209
224
 
210
- enum class Mode { Alpha, Symbols, MoreSymbols };
225
+ // Wide layout: LVGL 8.3's lv_keyboard, key for key. Landscape panels get
226
+ // it -- the CrowPanel 7.0 runs LVGL's widgets demo, whose keyboard this
227
+ // is. Flex factors are lv_btnmatrix's width units; LVGL's "checked"
228
+ // (grey) keys are the Utility kind.
229
+ #define W_L(LABEL, CODE, UNITS) {LABEL, CODE, KeyKind::Light, LabelKind::Normal, 0, UNITS, Icon::None}
230
+ #define W_U(LABEL, CODE, UNITS) {LABEL, CODE, KeyKind::Utility, LabelKind::Normal, 0, UNITS, Icon::None}
231
+ #define W_I(ICON, LABEL, CODE, UNITS) {LABEL, CODE, KeyKind::Utility, LabelKind::Normal, 0, UNITS, Icon::ICON}
232
+ #define W_BOTTOM_ROW {5, 11, 0, 0, { \
233
+ W_I(Keyboard, "kb", kCodeHide, 2), W_I(Left, "<", kCodeLeft, 2), W_L(" ", kCodeSpace, 6), \
234
+ W_I(Right, ">", kCodeRight, 2), W_I(Ok, "ok", kCodeOk, 2), \
235
+ }}
236
+
237
+ constexpr RowDef kWideLowerRows[kRowCount] = {
238
+ {12, 11, 0, 0, {
239
+ W_U("1#", kCodeModeSymbols, 5),
240
+ W_L("q", 'q', 4), W_L("w", 'w', 4), W_L("e", 'e', 4), W_L("r", 'r', 4), W_L("t", 't', 4),
241
+ W_L("y", 'y', 4), W_L("u", 'u', 4), W_L("i", 'i', 4), W_L("o", 'o', 4), W_L("p", 'p', 4),
242
+ W_I(Backspace, "del", kCodeBackspace, 7),
243
+ }},
244
+ {11, 11, 0, 0, {
245
+ W_U("ABC", kCodeModeUpper, 6),
246
+ W_L("a", 'a', 3), W_L("s", 's', 3), W_L("d", 'd', 3), W_L("f", 'f', 3), W_L("g", 'g', 3),
247
+ W_L("h", 'h', 3), W_L("j", 'j', 3), W_L("k", 'k', 3), W_L("l", 'l', 3),
248
+ W_I(NewLine, "ret", kCodeReturn, 7),
249
+ }},
250
+ {12, 11, 0, 0, {
251
+ W_U("_", '_', 1), W_U("-", '-', 1),
252
+ W_L("z", 'z', 1), W_L("x", 'x', 1), W_L("c", 'c', 1), W_L("v", 'v', 1),
253
+ W_L("b", 'b', 1), W_L("n", 'n', 1), W_L("m", 'm', 1),
254
+ W_U(".", '.', 1), W_U(",", ',', 1), W_U(":", ':', 1),
255
+ }},
256
+ W_BOTTOM_ROW,
257
+ };
258
+
259
+ constexpr RowDef kWideUpperRows[kRowCount] = {
260
+ {12, 11, 0, 0, {
261
+ W_U("1#", kCodeModeSymbols, 5),
262
+ W_L("Q", 'Q', 4), W_L("W", 'W', 4), W_L("E", 'E', 4), W_L("R", 'R', 4), W_L("T", 'T', 4),
263
+ W_L("Y", 'Y', 4), W_L("U", 'U', 4), W_L("I", 'I', 4), W_L("O", 'O', 4), W_L("P", 'P', 4),
264
+ W_I(Backspace, "del", kCodeBackspace, 7),
265
+ }},
266
+ {11, 11, 0, 0, {
267
+ W_U("abc", kCodeModeAlpha, 6),
268
+ W_L("A", 'A', 3), W_L("S", 'S', 3), W_L("D", 'D', 3), W_L("F", 'F', 3), W_L("G", 'G', 3),
269
+ W_L("H", 'H', 3), W_L("J", 'J', 3), W_L("K", 'K', 3), W_L("L", 'L', 3),
270
+ W_I(NewLine, "ret", kCodeReturn, 7),
271
+ }},
272
+ {12, 11, 0, 0, {
273
+ W_U("_", '_', 1), W_U("-", '-', 1),
274
+ W_L("Z", 'Z', 1), W_L("X", 'X', 1), W_L("C", 'C', 1), W_L("V", 'V', 1),
275
+ W_L("B", 'B', 1), W_L("N", 'N', 1), W_L("M", 'M', 1),
276
+ W_U(".", '.', 1), W_U(",", ',', 1), W_U(":", ':', 1),
277
+ }},
278
+ W_BOTTOM_ROW,
279
+ };
280
+
281
+ constexpr RowDef kWideSpecialRows[kRowCount] = {
282
+ {11, 11, 0, 0, {
283
+ W_L("1", '1', 1), W_L("2", '2', 1), W_L("3", '3', 1), W_L("4", '4', 1), W_L("5", '5', 1),
284
+ W_L("6", '6', 1), W_L("7", '7', 1), W_L("8", '8', 1), W_L("9", '9', 1), W_L("0", '0', 1),
285
+ W_I(Backspace, "del", kCodeBackspace, 2),
286
+ }},
287
+ {13, 11, 0, 0, {
288
+ W_U("abc", kCodeModeAlpha, 2),
289
+ W_L("+", '+', 1), W_L("&", '&', 1), W_L("/", '/', 1), W_L("*", '*', 1), W_L("=", '=', 1),
290
+ W_L("%", '%', 1), W_L("!", '!', 1), W_L("?", '?', 1), W_L("#", '#', 1), W_L("<", '<', 1),
291
+ W_L(">", '>', 1),
292
+ }},
293
+ {12, 11, 0, 0, {
294
+ W_L("\\", '\\', 1), W_L("@", '@', 1), W_L("$", '$', 1), W_L("(", '(', 1), W_L(")", ')', 1),
295
+ W_L("{", '{', 1), W_L("}", '}', 1), W_L("[", '[', 1), W_L("]", ']', 1), W_L(";", ';', 1),
296
+ W_L("\"", '"', 1), W_L("'", '\'', 1),
297
+ }},
298
+ W_BOTTOM_ROW,
299
+ };
300
+
301
+ #undef W_L
302
+ #undef W_U
303
+ #undef W_I
304
+ #undef W_BOTTOM_ROW
305
+
306
+ enum class Mode { Alpha, Upper, Symbols, MoreSymbols };
211
307
 
212
308
  struct KeyboardState {
213
309
  int rootNode = -1;
214
310
  int rowNodes[kRowCount] = {-1, -1, -1, -1};
215
311
  int keyNodes[kSlotCount];
216
312
  int labelNodes[kSlotCount];
313
+ int iconNodes[kSlotCount];
217
314
  int keyCodes[kSlotCount];
315
+ // Decoded symbol images of the wide layout (ImageStore ids), -1 until
316
+ // the keyboard first mounts wide.
317
+ int iconImages[kIconCount] = {-1, -1, -1, -1, -1, -1};
318
+ // The layout chosen at mount: LVGL's for landscape panels.
319
+ bool wide = false;
218
320
  bool visible = false;
219
321
  bool shiftHeld = false;
220
322
  Mode mode = Mode::Alpha;
@@ -250,6 +352,7 @@ struct KeyboardState {
250
352
  for (int i = 0; i < kSlotCount; i++) {
251
353
  keyNodes[i] = -1;
252
354
  labelNodes[i] = -1;
355
+ iconNodes[i] = -1;
253
356
  keyCodes[i] = 0;
254
357
  }
255
358
  }
@@ -259,6 +362,14 @@ KeyboardState gState;
259
362
 
260
363
  const RowDef *rowsForMode(Mode mode)
261
364
  {
365
+ if (gState.wide) {
366
+ switch (mode) {
367
+ case Mode::Upper: return kWideUpperRows;
368
+ case Mode::Symbols:
369
+ case Mode::MoreSymbols: return kWideSpecialRows;
370
+ case Mode::Alpha: default: return kWideLowerRows;
371
+ }
372
+ }
262
373
  switch (mode) {
263
374
  case Mode::Symbols: return kSymbolsRows;
264
375
  case Mode::MoreSymbols: return kMoreSymbolsRows;
@@ -283,6 +394,18 @@ bool fullSizeKeyboard()
283
394
  return vh * 2 >= vw * 3; // vh / vw >= 1.5
284
395
  }
285
396
 
397
+ // Landscape panels (the CrowPanel 7.0 at 800x480) get LVGL's keyboard:
398
+ // the bottom half of the screen, 13-unit-wide rows with symbol keys.
399
+ bool wideKeyboard()
400
+ {
401
+ Tree &tree = Tree::instance();
402
+ const int vw = tree.mountedWidth() > 0 ? tree.mountedWidth() : 410;
403
+ const int vh = tree.mountedHeight() > 0 ? tree.mountedHeight() : 502;
404
+ return vw > vh;
405
+ }
406
+
407
+ int colCount() { return gState.wide ? kColCount : kCompactColCount; }
408
+
286
409
  struct KbMetrics {
287
410
  int keyHeight;
288
411
  int rootGap;
@@ -295,13 +418,27 @@ struct KbMetrics {
295
418
  int fontWide;
296
419
  int borderRadius;
297
420
  int height; // total keyboard root height
421
+ int lastRowExtra; // pixels the bottom row is taller than keyHeight
298
422
  };
299
423
 
300
424
  KbMetrics kbMetrics()
301
425
  {
426
+ if (gState.wide) {
427
+ // LVGL 8.3's default theme at DISP_LARGE and 130 DPI: pad_small and
428
+ // row/column gaps of 11, key radius 10, Montserrat 16, and the
429
+ // keyboard half the screen tall (the widgets demo's size). LVGL
430
+ // hands the leftover pixel of the four rows to the bottom one.
431
+ Tree &tree = Tree::instance();
432
+ const int vh = tree.mountedHeight() > 0 ? tree.mountedHeight() : 480;
433
+ const int height = vh / 2;
434
+ const int pad = 11;
435
+ const int rows = height - 2 * pad - (kRowCount - 1) * pad;
436
+ const int keyH = rows / kRowCount;
437
+ return {keyH, pad, pad, pad, pad, pad, 16, 16, 16, 10, height, rows - keyH * kRowCount};
438
+ }
302
439
  if (!fullSizeKeyboard()) {
303
440
  // Unchanged compact default — keeps the ESP32 keyboard identical.
304
- return {38, 5, 8, 8, 12, 12, 19, 15, 17, 9, kKeyboardHeight};
441
+ return {38, 5, 8, 8, 12, 12, 19, 15, 17, 9, kKeyboardHeight, 0};
305
442
  }
306
443
  // 1.5x taller keys. Height is computed from the parts so the
307
444
  // background exactly wraps the four rows + gaps + padding.
@@ -310,7 +447,7 @@ KbMetrics kbMetrics()
310
447
  const int padTop = 12;
311
448
  const int padBottom = 12;
312
449
  const int height = padTop + kRowCount * keyH + (kRowCount - 1) * rootGap + padBottom;
313
- return {keyH, rootGap, padTop, padBottom, 16, 16, 28, 22, 25, 13, height};
450
+ return {keyH, rootGap, padTop, padBottom, 16, 16, 28, 22, 25, 13, height, 0};
314
451
  }
315
452
 
316
453
  // Total height the keyboard occupies plus the reserved bottom overlay
@@ -323,12 +460,16 @@ int keyboardOccupiedHeight() { return kbMetrics().height + bottomInset(); }
323
460
  // the bytes in the wrong order on the wire (the earlier "purple
324
461
  // keyboard on purple background" symptom). Use `rgb565FromRgb888`
325
462
  // which returns the plain RGB565 value the framework expects.
326
- std::uint16_t kbBg() { return gea::framework::graphics::pixel::rgb565FromRgb888(0xd1, 0xd3, 0xda); }
327
- std::uint16_t keyLightBg() { return gea::framework::graphics::pixel::rgb565FromRgb888(0xf2, 0xf2, 0xf7); }
328
- std::uint16_t keyUtilityBg() { return gea::framework::graphics::pixel::rgb565FromRgb888(0x6f, 0x73, 0x7d); }
463
+ // The wide layout wears LVGL's default light theme: a #f5f5f5 screen
464
+ // background, white keys, #e0e0e0 "checked" keys, #212121 text, and a
465
+ // pressed state darkened by LV_OPA_35 of black.
466
+ std::uint16_t rgb(int r, int g, int b) { return gea::framework::graphics::pixel::rgb565FromRgb888(r, g, b); }
467
+ std::uint16_t kbBg() { return gState.wide ? rgb(0xf5, 0xf5, 0xf5) : rgb(0xd1, 0xd3, 0xda); }
468
+ std::uint16_t keyLightBg() { return gState.wide ? rgb(0xff, 0xff, 0xff) : rgb(0xf2, 0xf2, 0xf7); }
469
+ std::uint16_t keyUtilityBg() { return gState.wide ? rgb(0xe0, 0xe0, 0xe0) : rgb(0x6f, 0x73, 0x7d); }
329
470
  std::uint16_t keyPrimaryBg() { return gea::framework::graphics::pixel::rgb565FromRgb888(0x0a, 0x84, 0xff); }
330
471
  std::uint16_t keyShiftActiveBg() { return gea::framework::graphics::pixel::rgb565FromRgb888(0xff, 0xff, 0xff); }
331
- std::uint16_t labelDark() { return gea::framework::graphics::pixel::rgb565FromRgb888(0x11, 0x11, 0x16); }
472
+ std::uint16_t labelDark() { return gState.wide ? rgb(0x21, 0x21, 0x21) : rgb(0x11, 0x11, 0x16); }
332
473
  std::uint16_t labelLight() { return gea::framework::graphics::pixel::rgb565FromRgb888(0xff, 0xff, 0xff); }
333
474
 
334
475
  void applyKeyStyle(Tree &tree, int node, KeyKind kind, bool shiftActiveKey, const KbMetrics &m)
@@ -355,11 +496,15 @@ void applyKeyStyle(Tree &tree, int node, KeyKind kind, bool shiftActiveKey, cons
355
496
  break;
356
497
  case KeyKind::Utility:
357
498
  bg = shiftActiveKey ? keyShiftActiveBg() : keyUtilityBg();
358
- activeBg = gea::framework::graphics::pixel::rgb565FromRgb888(0x55, 0x59, 0x63);
499
+ activeBg = gState.wide ? rgb(0xc1, 0xc1, 0xc1) : rgb(0x55, 0x59, 0x63);
359
500
  break;
360
501
  case KeyKind::Light:
361
502
  default:
362
503
  bg = keyLightBg();
504
+ if (gState.wide) {
505
+ activeBg = rgb(0xdc, 0xdc, 0xdc);
506
+ break;
507
+ }
363
508
  // Light keys go slightly darker to a visible iOS-press grey rather
364
509
  // than the framework's default "lighten" which would push #f2f2f7
365
510
  // past pure white and look like nothing happened.
@@ -375,14 +520,31 @@ void applyKeyStyle(Tree &tree, int node, KeyKind kind, bool shiftActiveKey, cons
375
520
  tree.setStyle(node, Property::HasActiveBackground, 1);
376
521
  }
377
522
 
523
+ // The font the keys are labelled in: the focused input's, else the first
524
+ // font found under the mounted root, else -1 (the bitmap fallback).
525
+ int keyboardFontId()
526
+ {
527
+ Tree &tree = Tree::instance();
528
+ const int active = tree.activeInputId();
529
+ if (active >= 0 && tree.node(active).computedStyle().font_id >= 0) return tree.node(active).computedStyle().font_id;
530
+ for (int id = 0; id < tree.nodeCount(); id++) {
531
+ if (tree.node(id).computedStyle().font_id >= 0) return tree.node(id).computedStyle().font_id;
532
+ }
533
+ return -1;
534
+ }
535
+
378
536
  void applyLabelStyle(Tree &tree, int node, LabelKind kind, KeyKind keyKind, bool shiftActiveKey, const KbMetrics &m)
379
537
  {
380
538
  int fontSize = m.fontNormal;
381
539
  if (kind == LabelKind::Small) fontSize = m.fontSmall;
382
540
  else if (kind == LabelKind::Wide) fontSize = m.fontWide;
383
541
  tree.setStyle(node, Property::FontSize, fontSize);
542
+ // Runtime-created text has no font from the stylesheet; take the
543
+ // focused input's, so the keys read in the app's own face instead of
544
+ // the 8x16 bitmap fallback.
545
+ tree.setStyle(node, Property::FontId, keyboardFontId());
384
546
  std::uint16_t color;
385
- if (keyKind == KeyKind::Light || (keyKind == KeyKind::Utility && shiftActiveKey)) color = labelDark();
547
+ if (gState.wide || keyKind == KeyKind::Light || (keyKind == KeyKind::Utility && shiftActiveKey)) color = labelDark();
386
548
  else color = labelLight();
387
549
  tree.setStyle(node, Property::Color, static_cast<int>(color));
388
550
  }
@@ -412,6 +574,17 @@ void mountIfNeeded()
412
574
  tree.mount(wrapper, w, h);
413
575
  }
414
576
 
577
+ gState.wide = wideKeyboard();
578
+ #if GEA_UI_IMAGE_NODES
579
+ if (gState.wide) {
580
+ auto &images = gea::framework::graphics::ImageStore::instance();
581
+ for (int i = 0; i < kIconCount; i++) {
582
+ if (gState.iconImages[i] >= 0) continue;
583
+ const auto &icon = keyboard_icons::kIcons[i];
584
+ gState.iconImages[i] = images.decode(icon.png, icon.length);
585
+ }
586
+ }
587
+ #endif
415
588
  const int kbRoot = tree.createView();
416
589
  if (kbRoot < 0) return;
417
590
  gState.rootNode = kbRoot;
@@ -446,23 +619,24 @@ void mountIfNeeded()
446
619
  tree.setStyle(kbRoot, Property::PaddingRight, m.padRight);
447
620
  tree.setStyle(kbRoot, Property::Gap, m.rootGap);
448
621
  tree.setStyle(kbRoot, Property::FlexDirection, 0); // column
449
- tree.setStyle(kbRoot, Property::Display, 1); // hidden until shown
622
+ tree.setStyle(kbRoot, Property::Display, kDisplayNone); // hidden until shown
450
623
 
451
624
  for (int row = 0; row < kRowCount; row++) {
452
625
  const int rowNode = tree.createView();
453
626
  if (rowNode < 0) return;
454
627
  gState.rowNodes[row] = rowNode;
455
628
  tree.setParent(rowNode, kbRoot);
629
+ tree.setStyle(rowNode, Property::Display, kDisplayFlex);
456
630
  tree.setStyle(rowNode, Property::FlexDirection, 1); // row
457
631
  tree.setStyle(rowNode, Property::AlignItems, 1); // center (cross-axis)
458
632
  tree.setStyle(rowNode, Property::JustifyContent, 1); // center (main-axis)
459
- tree.setStyle(rowNode, Property::Height, m.keyHeight);
633
+ tree.setStyle(rowNode, Property::Height, m.keyHeight + (row == kRowCount - 1 ? m.lastRowExtra : 0));
460
634
  // Rows stretch the full keyboard width so they share the leftover
461
635
  // horizontal space between fixed-width keys (Shift, delete) and
462
636
  // flex:1 letters. Without this they shrink to content width and
463
637
  // the row sits left-justified.
464
- tree.setStyle(rowNode, Property::Width, viewportW - 24);
465
- for (int col = 0; col < kColCount; col++) {
638
+ tree.setStyle(rowNode, Property::Width, viewportW - m.padLeft - m.padRight);
639
+ for (int col = 0; col < colCount(); col++) {
466
640
  const int slot = row * kColCount + col;
467
641
  const int keyNode = tree.createView();
468
642
  if (keyNode < 0) return;
@@ -474,6 +648,15 @@ void mountIfNeeded()
474
648
  if (labelNode < 0) return;
475
649
  gState.labelNodes[slot] = labelNode;
476
650
  tree.setParent(labelNode, keyNode);
651
+ #if GEA_UI_IMAGE_NODES
652
+ if (gState.wide) {
653
+ const int iconNode = tree.createImage();
654
+ if (iconNode < 0) return;
655
+ gState.iconNodes[slot] = iconNode;
656
+ tree.setParent(iconNode, keyNode);
657
+ tree.setStyle(iconNode, Property::Display, kDisplayNone);
658
+ }
659
+ #endif
477
660
  }
478
661
  }
479
662
 
@@ -487,6 +670,34 @@ void mountIfNeeded()
487
670
  }
488
671
  }
489
672
 
673
+ // Shows the key's symbol image (wide layout) and hides it on every other
674
+ // key. True when the key shows a symbol instead of its text label; false
675
+ // keeps the label -- also where the build has no image nodes, so the
676
+ // symbol keys fall back to their text.
677
+ bool applyIcon(Tree &tree, int slot, Icon icon)
678
+ {
679
+ #if GEA_UI_IMAGE_NODES
680
+ const int iconNode = gState.iconNodes[slot];
681
+ if (iconNode < 0) return false;
682
+ const int image = icon == Icon::None ? -1 : gState.iconImages[static_cast<int>(icon) - 1];
683
+ if (image < 0) {
684
+ tree.setStyle(iconNode, Property::Display, kDisplayNone);
685
+ return false;
686
+ }
687
+ auto &images = gea::framework::graphics::ImageStore::instance();
688
+ tree.setStyle(iconNode, Property::ImageId, image);
689
+ tree.setStyle(iconNode, Property::Width, images.width(image));
690
+ tree.setStyle(iconNode, Property::Height, images.height(image));
691
+ tree.setStyle(iconNode, Property::Display, kDisplayBlock);
692
+ return true;
693
+ #else
694
+ (void)tree;
695
+ (void)slot;
696
+ (void)icon;
697
+ return false;
698
+ #endif
699
+ }
700
+
490
701
  void applyMode()
491
702
  {
492
703
  Tree &tree = Tree::instance();
@@ -501,7 +712,7 @@ void applyMode()
501
712
  tree.setStyle(rowNode, Property::PaddingLeft, rdef.paddingLeft);
502
713
  tree.setStyle(rowNode, Property::PaddingRight, rdef.paddingRight);
503
714
 
504
- for (int col = 0; col < kColCount; col++) {
715
+ for (int col = 0; col < colCount(); col++) {
505
716
  const int slot = row * kColCount + col;
506
717
  const int keyNode = gState.keyNodes[slot];
507
718
  const int labelNode = gState.labelNodes[slot];
@@ -510,19 +721,24 @@ void applyMode()
510
721
  if (col >= rdef.count || rdef.keys[col].label == nullptr) {
511
722
  // Hide unused slot.
512
723
  gState.keyCodes[slot] = 0;
513
- tree.setStyle(keyNode, Property::Display, 1);
724
+ tree.setStyle(keyNode, Property::Display, kDisplayNone);
514
725
  continue;
515
726
  }
516
727
 
517
728
  const KeyDef &kdef = rdef.keys[col];
518
729
  gState.keyCodes[slot] = kdef.code;
519
730
 
520
- tree.setStyle(keyNode, Property::Display, 0);
731
+ tree.setStyle(keyNode, Property::Display, kDisplayFlex);
521
732
  tree.setStyle(keyNode, Property::Width, kdef.width);
522
733
  tree.setStyle(keyNode, Property::Flex, kdef.flex);
523
734
  const bool shiftActive = kdef.code == kCodeShift && gState.shiftHeld;
524
735
  applyKeyStyle(tree, keyNode, kdef.kind, shiftActive, m);
736
+ if (row == kRowCount - 1 && m.lastRowExtra) tree.setStyle(keyNode, Property::Height, m.keyHeight + m.lastRowExtra);
525
737
  applyLabelStyle(tree, labelNode, kdef.labelKind, kdef.kind, shiftActive, m);
738
+ if (applyIcon(tree, slot, kdef.icon)) {
739
+ tree.setText(labelNode, "");
740
+ continue;
741
+ }
526
742
 
527
743
  // Capitalize alpha keys when shift is held — matches what
528
744
  // the user expects to type and what the press handler
@@ -564,9 +780,36 @@ void applyKeyToActiveInput(int code)
564
780
  applyMode();
565
781
  return;
566
782
  }
783
+ if (code == kCodeModeUpper) {
784
+ gState.mode = Mode::Upper;
785
+ applyMode();
786
+ return;
787
+ }
788
+ // LVGL's keyboard / OK keys: CANCEL and READY. The widgets demo answers
789
+ // both by closing the keyboard and dropping focus (ta_event_cb); the text
790
+ // typed stays either way -- a text area has no undo.
791
+ if (code == kCodeHide || code == kCodeOk) {
792
+ tree.commitActiveInput();
793
+ tree.setActiveInput(-1);
794
+ return;
795
+ }
567
796
 
568
797
  const char *currentValue = tree.getAttribute(activeId, "value");
569
798
  std::string next = currentValue ? std::string(currentValue) : std::string();
799
+ const int caret = tree.activeInputCaret();
800
+
801
+ // lv_textarea_cursor_left / _right: the caret moves one character; the
802
+ // app also sees the keydown (ArrowLeft / ArrowRight).
803
+ if (code == kCodeLeft || code == kCodeRight) {
804
+ const int moved = code == kCodeLeft ? caret - 1 : caret + 1;
805
+ if (moved >= 0 && moved <= static_cast<int>(next.size())) tree.setActiveInputCaret(moved);
806
+ gea::framework::events::PointerEvent kd{};
807
+ kd.type = gea::framework::events::PointerEventType::KeyDown;
808
+ kd.targetId = activeId;
809
+ kd.keyCode = code == kCodeLeft ? 37 : 39;
810
+ tree.dispatchEvent(kd);
811
+ return;
812
+ }
570
813
 
571
814
  // Helper: marking commands dirty + setting displayListDirty isn't
572
815
  // enough — the framework's DirtyRegions tracker computes the per-
@@ -586,10 +829,12 @@ void applyKeyToActiveInput(int code)
586
829
  #endif
587
830
  };
588
831
 
832
+ // lv_textarea_del_char: the character before the caret.
589
833
  if (code == kCodeBackspace) {
590
- if (!next.empty()) {
591
- next.pop_back();
834
+ if (caret > 0) {
835
+ next.erase(static_cast<std::size_t>(caret - 1), 1);
592
836
  tree.setAttribute(activeId, "value", next.c_str());
837
+ tree.setActiveInputCaret(caret - 1);
593
838
  tree.markActiveInputEdited();
594
839
  markInputDirty(activeId);
595
840
  gea::framework::events::PointerEvent ev{};
@@ -613,7 +858,12 @@ void applyKeyToActiveInput(int code)
613
858
  kd.targetId = activeId;
614
859
  kd.keyCode = kCodeReturn;
615
860
  tree.dispatchEvent(kd);
616
- if(commitsReturn && originalInput.valid() && tree.activeInputId()==activeId)tree.commitActiveInput();
861
+ if(commitsReturn && originalInput.valid() && tree.activeInputId()==activeId){
862
+ tree.commitActiveInput();
863
+ // LVGL's new-line key on a one-line field is READY: the
864
+ // keyboard closes.
865
+ if(gState.wide)tree.setActiveInput(-1);
866
+ }
617
867
  return;
618
868
  }
619
869
 
@@ -624,8 +874,11 @@ void applyKeyToActiveInput(int code)
624
874
  gState.shiftHeld = false; // single-shot shift
625
875
  applyMode();
626
876
  }
627
- next.push_back(c);
877
+ // lv_textarea_add_char: at the caret, which then moves past it.
878
+ next.insert(static_cast<std::size_t>(caret), 1, c);
628
879
  tree.setAttribute(activeId, "value", next.c_str());
880
+ tree.setActiveInputCaret(caret + 1);
881
+ tree.noteActiveInputTyped(caret, caret + 1);
629
882
  tree.markActiveInputEdited();
630
883
  markInputDirty(activeId);
631
884
 
@@ -863,7 +1116,7 @@ void VirtualKeyboard::sync()
863
1116
  if (gState.rootNode < 0) return;
864
1117
  if (!gState.visible) {
865
1118
  gState.visible = true;
866
- tree.setStyle(gState.rootNode, Property::Display, 0);
1119
+ tree.setStyle(gState.rootNode, Property::Display, kDisplayFlex);
867
1120
  applyMode();
868
1121
  // Shrink the app's content area so the rows it holds can
869
1122
  // scroll above the keyboard rather than being permanently
@@ -872,6 +1125,9 @@ void VirtualKeyboard::sync()
872
1125
  // dynamically because we don't want to assume a fixed
873
1126
  // tree shape across apps.
874
1127
  applyAppResize();
1128
+ // Bring the focused field above the keys, the way LVGL's
1129
+ // widgets demo scrolls it into the shrunken tabview.
1130
+ tree.scrollIntoViewKeepingPadding(activeId);
875
1131
  tree.setDisplayListRebuildRequired(true);
876
1132
  // The resize relayout moves the whole app (a centered fixed-height
877
1133
  // shell re-centers in the shrunken box); per-node dirty rects have
@@ -884,7 +1140,7 @@ void VirtualKeyboard::sync()
884
1140
  } else {
885
1141
  if (gState.visible && gState.rootNode >= 0) {
886
1142
  gState.visible = false;
887
- tree.setStyle(gState.rootNode, Property::Display, 1);
1143
+ tree.setStyle(gState.rootNode, Property::Display, kDisplayNone);
888
1144
  restoreAppResize();
889
1145
  tree.setDisplayListRebuildRequired(true);
890
1146
  // The keyboard's rows may extend below everything the app paints
@@ -0,0 +1,114 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // The wide keyboard's six symbol keys, as PNGs (alpha masks in #212121).
3
+ // They are the FontAwesome symbols LVGL 8.3 ships in its Montserrat 16 font
4
+ // (LV_SYMBOL_BACKSPACE, _NEW_LINE, _KEYBOARD, _LEFT, _RIGHT, _OK), lifted from
5
+ // LVGL's own render of lv_keyboard so the landscape layout matches it
6
+ // pixel for pixel. Regenerate from elecrow/7.0/factory_code/reference.
7
+ #pragma once
8
+
9
+ #include <cstdint>
10
+
11
+ namespace gea::embedded::ui::keyboard_icons {
12
+
13
+ inline constexpr std::uint8_t kBackspace[] = {
14
+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
15
+ 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x0c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x62, 0x0c, 0x9d,
16
+ 0xfb, 0x00, 0x00, 0x00, 0xae, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xad, 0x92, 0xd1, 0x09, 0xc3,
17
+ 0x30, 0x0c, 0x05, 0x2f, 0x26, 0x03, 0xb8, 0x23, 0x18, 0x8f, 0xd0, 0x6c, 0xd0, 0x74, 0x83, 0x7a,
18
+ 0xca, 0x64, 0x83, 0xa6, 0x1b, 0xa4, 0x23, 0x84, 0x8e, 0x50, 0x8f, 0xd0, 0x1f, 0x05, 0x84, 0x63,
19
+ 0x62, 0xa7, 0xed, 0x03, 0x83, 0x90, 0xc5, 0xa1, 0x27, 0xa9, 0x71, 0xce, 0x91, 0xe8, 0x04, 0x0c,
20
+ 0xc0, 0x85, 0x63, 0x8a, 0x40, 0x68, 0x33, 0xb0, 0x27, 0xe0, 0x38, 0x2e, 0x0b, 0x0c, 0xa6, 0x12,
21
+ 0x36, 0x4a, 0x07, 0xba, 0x9b, 0x31, 0x07, 0x35, 0x95, 0xb0, 0x00, 0x74, 0x02, 0x8a, 0x12, 0x87,
22
+ 0x1c, 0xb4, 0xad, 0xb0, 0xd9, 0x03, 0x1e, 0x58, 0x04, 0x84, 0xc4, 0x5e, 0xfe, 0x36, 0xc0, 0x7b,
23
+ 0x61, 0x66, 0x16, 0x98, 0x05, 0xb6, 0x48, 0xce, 0x4b, 0xce, 0xa6, 0xc5, 0x86, 0x3f, 0xcb, 0x00,
24
+ 0x57, 0xe0, 0x55, 0x38, 0x87, 0x4e, 0xd9, 0xd4, 0xf6, 0x63, 0x0e, 0xf8, 0x06, 0xce, 0x3b, 0xd0,
25
+ 0x49, 0xc1, 0x66, 0x79, 0x2b, 0x74, 0x4a, 0x8b, 0x1b, 0x75, 0xd8, 0xa5, 0x4d, 0xf7, 0x6a, 0x66,
26
+ 0x51, 0x60, 0xb7, 0x3d, 0xe0, 0xaf, 0x87, 0x0d, 0x10, 0xd3, 0xa5, 0xac, 0xf6, 0x1f, 0xdf, 0xc0,
27
+ 0x80, 0xf0, 0x01, 0xdc, 0x75, 0x2b, 0xe5, 0xa7, 0x81, 0x31, 0x20, 0x00, 0x00, 0x00, 0x00, 0x49,
28
+ 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
29
+ };
30
+ inline constexpr std::uint8_t kNewLine[] = {
31
+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
32
+ 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x0b, 0x08, 0x06, 0x00, 0x00, 0x00, 0x99, 0x20, 0x66,
33
+ 0x07, 0x00, 0x00, 0x00, 0x8b, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xa5, 0xd1, 0x51, 0x0d, 0xc2,
34
+ 0x30, 0x14, 0x05, 0xd0, 0xb3, 0x65, 0x02, 0x18, 0x0e, 0x1a, 0x24, 0x80, 0x03, 0xb0, 0x00, 0x16,
35
+ 0x86, 0x13, 0x66, 0x01, 0x0f, 0x38, 0x18, 0x12, 0xa6, 0x01, 0x09, 0x0c, 0x09, 0xfc, 0x14, 0xd2,
36
+ 0x34, 0x21, 0xdb, 0xd8, 0xfd, 0x6a, 0x5f, 0xf2, 0x4e, 0x6e, 0xda, 0x22, 0x84, 0x60, 0x41, 0x6a,
37
+ 0x0c, 0xe5, 0x02, 0x60, 0x87, 0x07, 0x94, 0x3f, 0xf4, 0xb1, 0x6c, 0xd0, 0x61, 0x85, 0x3a, 0x47,
38
+ 0xee, 0x78, 0x4e, 0x40, 0x8e, 0x11, 0x90, 0x37, 0xe9, 0xb1, 0x9f, 0xd1, 0xe6, 0x9b, 0x2a, 0x2e,
39
+ 0x74, 0xd8, 0x26, 0xf3, 0x66, 0x64, 0xef, 0x90, 0x5e, 0x8a, 0x10, 0x42, 0x9f, 0x01, 0x73, 0xb3,
40
+ 0x2e, 0x71, 0x5b, 0x00, 0xbc, 0x30, 0x54, 0x68, 0xe3, 0xe0, 0x92, 0xea, 0x18, 0xa6, 0x4a, 0x9f,
41
+ 0x87, 0x6d, 0x71, 0xfe, 0xb7, 0x4e, 0x95, 0x9c, 0xaf, 0xf1, 0x7b, 0x4f, 0x73, 0x5a, 0xc0, 0x1b,
42
+ 0x89, 0x54, 0x12, 0x44, 0x43, 0xef, 0x30, 0xca, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44,
43
+ 0xae, 0x42, 0x60, 0x82,
44
+ };
45
+ inline constexpr std::uint8_t kKeyboard[] = {
46
+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
47
+ 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x0c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x6f, 0x12, 0xed,
48
+ 0xbc, 0x00, 0x00, 0x00, 0x65, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0x54, 0x54, 0x54, 0xec,
49
+ 0x60, 0x60, 0x60, 0x28, 0x67, 0xa0, 0x0c, 0x74, 0x32, 0x2a, 0x2a, 0x2a, 0xfe, 0x67, 0xa0, 0x02,
50
+ 0x60, 0x42, 0x62, 0x33, 0x42, 0x31, 0x39, 0x6c, 0x14, 0x83, 0x28, 0x02, 0x2c, 0x48, 0xec, 0xff,
51
+ 0x14, 0xb0, 0x19, 0x98, 0x05, 0x05, 0x05, 0x1b, 0x90, 0x03, 0x8d, 0x81, 0x81, 0xc1, 0x96, 0x81,
52
+ 0x81, 0x81, 0x93, 0x81, 0x81, 0xe1, 0x28, 0x11, 0x6c, 0x1b, 0xaa, 0x7b, 0x8d, 0x6a, 0xb1, 0xc6,
53
+ 0x82, 0x16, 0x6b, 0x30, 0xbf, 0x33, 0x12, 0xd0, 0xf7, 0x1f, 0x4d, 0x3d, 0x7d, 0x63, 0x0d, 0x9f,
54
+ 0xab, 0x50, 0x12, 0x64, 0x27, 0x15, 0x1c, 0xd4, 0x09, 0x00, 0x10, 0x03, 0x15, 0xbf, 0xf3, 0x19,
55
+ 0xd9, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
56
+ };
57
+ inline constexpr std::uint8_t kLeft[] = {
58
+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
59
+ 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0e, 0x08, 0x06, 0x00, 0x00, 0x00, 0x12, 0x56, 0x5d,
60
+ 0x96, 0x00, 0x00, 0x00, 0x74, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x7d, 0xd1, 0x51, 0x0d, 0x02,
61
+ 0x41, 0x0c, 0x45, 0xd1, 0xb3, 0x0d, 0x06, 0xc0, 0xc1, 0x68, 0xc0, 0x0a, 0x60, 0x65, 0x2d, 0x60,
62
+ 0x01, 0x34, 0xe0, 0x80, 0x20, 0x01, 0x09, 0x04, 0x09, 0x58, 0xe0, 0x87, 0x26, 0xcb, 0x66, 0xa6,
63
+ 0xfd, 0x6b, 0xee, 0x4d, 0x93, 0xd7, 0x37, 0xb5, 0xd6, 0x74, 0x66, 0x8b, 0x2b, 0x2e, 0x9b, 0x01,
64
+ 0x7c, 0xa2, 0xe1, 0x10, 0x05, 0x84, 0x5b, 0x54, 0x10, 0xc7, 0xa8, 0x20, 0x44, 0x05, 0x53, 0xb8,
65
+ 0x8f, 0x60, 0x0a, 0xbb, 0xc5, 0xfe, 0x5a, 0x47, 0x0a, 0xec, 0xf1, 0xfe, 0xed, 0x33, 0xce, 0x6b,
66
+ 0xe1, 0x53, 0x49, 0x99, 0x62, 0x28, 0x2d, 0x3f, 0x99, 0x52, 0x26, 0x9a, 0x61, 0xea, 0x74, 0xf1,
67
+ 0x17, 0x3b, 0x3a, 0x5d, 0xe4, 0xa5, 0x07, 0x4e, 0x5f, 0x23, 0x83, 0x1b, 0xbf, 0xb9, 0x0c, 0x44,
68
+ 0x79, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
69
+ };
70
+ inline constexpr std::uint8_t kRight[] = {
71
+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
72
+ 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0e, 0x08, 0x06, 0x00, 0x00, 0x00, 0x12, 0x56, 0x5d,
73
+ 0x96, 0x00, 0x00, 0x00, 0x7f, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x7d, 0xd1, 0xc1, 0x0d, 0xc2,
74
+ 0x30, 0x0c, 0x46, 0xe1, 0xaf, 0x81, 0x05, 0xd2, 0x0d, 0x3c, 0x43, 0x57, 0xe8, 0x0a, 0xac, 0x00,
75
+ 0x23, 0xb0, 0x02, 0xc3, 0xb0, 0x41, 0x67, 0xe0, 0xca, 0x0d, 0x31, 0x42, 0x47, 0x80, 0x4b, 0x90,
76
+ 0x4a, 0xd4, 0x24, 0x92, 0x95, 0x27, 0xfd, 0x4f, 0x96, 0x2d, 0x0f, 0x11, 0x31, 0xe3, 0x82, 0x33,
77
+ 0x56, 0xd5, 0x3b, 0x62, 0x29, 0x3c, 0x95, 0xfa, 0x93, 0x12, 0xee, 0x85, 0x03, 0x0f, 0xe4, 0x5a,
78
+ 0x38, 0xf5, 0xa4, 0x54, 0xfe, 0xa6, 0x94, 0x36, 0xdd, 0x76, 0xa5, 0x54, 0x0d, 0x5d, 0x4b, 0x4b,
79
+ 0x2d, 0xc0, 0x6b, 0xc3, 0x63, 0x2d, 0xdc, 0x70, 0x2d, 0xfc, 0xc6, 0x94, 0x7a, 0x21, 0xd6, 0xd4,
80
+ 0x0b, 0x7f, 0x5b, 0x34, 0x43, 0x18, 0x22, 0xe2, 0xd3, 0x0a, 0xe1, 0x90, 0x73, 0x7e, 0x62, 0xc4,
81
+ 0xbc, 0x77, 0xac, 0x2f, 0x56, 0xd4, 0x1f, 0xca, 0x69, 0x34, 0xa1, 0x7c, 0x00, 0x00, 0x00, 0x00,
82
+ 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
83
+ };
84
+ inline constexpr std::uint8_t kOk[] = {
85
+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
86
+ 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x6b, 0xe7, 0x3d,
87
+ 0x81, 0x00, 0x00, 0x00, 0x87, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xa5, 0xd2, 0xd1, 0x0d, 0x83,
88
+ 0x20, 0x14, 0x46, 0xe1, 0x4f, 0xe2, 0x02, 0x1d, 0xc1, 0x19, 0xea, 0x06, 0xb2, 0x42, 0xa7, 0xec,
89
+ 0x08, 0xea, 0x06, 0xed, 0x2e, 0x8e, 0xd0, 0x17, 0x4c, 0x6e, 0x88, 0x4d, 0xa9, 0xde, 0x27, 0x92,
90
+ 0xcb, 0x39, 0x70, 0xf9, 0xe9, 0x86, 0x61, 0x70, 0xa2, 0x9e, 0xb8, 0xe1, 0xd1, 0x9f, 0x80, 0x17,
91
+ 0x4c, 0x65, 0x3d, 0xa7, 0x0b, 0x30, 0x6c, 0xe9, 0x02, 0xfc, 0x46, 0x4e, 0x65, 0x96, 0xa5, 0xcc,
92
+ 0xf5, 0x0f, 0x3c, 0x42, 0x8f, 0x19, 0xf7, 0xb0, 0x31, 0xb7, 0xc2, 0x90, 0xb0, 0x85, 0xe6, 0x54,
93
+ 0x80, 0x26, 0x18, 0xba, 0x12, 0xe3, 0x2b, 0xdc, 0x02, 0xd6, 0x20, 0xfc, 0x0a, 0x47, 0xc1, 0x91,
94
+ 0x44, 0x25, 0xcc, 0x47, 0x8d, 0x98, 0xc2, 0x58, 0x4e, 0x69, 0x86, 0x6b, 0xc1, 0x2e, 0x59, 0x5b,
95
+ 0xe1, 0x3d, 0x85, 0xba, 0x72, 0x78, 0xc8, 0xfc, 0xeb, 0x77, 0x7c, 0x00, 0xd2, 0x48, 0x1d, 0x9c,
96
+ 0xb0, 0x7f, 0x9b, 0xef, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
97
+ };
98
+
99
+ struct Icon {
100
+ const std::uint8_t *png;
101
+ int length;
102
+ };
103
+
104
+ // Indexed by the keyboard's Icon enum minus one.
105
+ inline constexpr Icon kIcons[] = {
106
+ {kBackspace, static_cast<int>(sizeof(kBackspace))},
107
+ {kNewLine, static_cast<int>(sizeof(kNewLine))},
108
+ {kKeyboard, static_cast<int>(sizeof(kKeyboard))},
109
+ {kLeft, static_cast<int>(sizeof(kLeft))},
110
+ {kRight, static_cast<int>(sizeof(kRight))},
111
+ {kOk, static_cast<int>(sizeof(kOk))},
112
+ };
113
+
114
+ } // namespace gea::embedded::ui::keyboard_icons