Skip to content

Commit ce4ae5a

Browse files
Merge pull request #1144 from LedgerHQ/fix-fweo-1462-apex-dashed-lines-25
Fix FWEO-1462 - Apex - Outlined dotted buttons or keyboard can be glitched
2 parents 8cb49b9 + 2d80876 commit ce4ae5a

15 files changed

+137
-100
lines changed
193 Bytes
Loading
125 Bytes
Loading
2 Bytes
Loading

lib_nbgl/src/nbgl_draw.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ static const radiusIcons_t radiusIcons44px
117117
= {&C_half_disc_left_88px_1bpp, &C_half_circle_left_88px_1bpp};
118118
#endif
119119
#if SMALL_BUTTON_RADIUS == 20
120-
static const radiusIcons_t radiusIcons20px = {&C_half_disc_left_40px_1bpp, NULL};
120+
static const radiusIcons_t radiusIcons20px
121+
= {&C_half_disc_left_40px_1bpp, &C_half_circle_left_40px_1bpp};
121122
#elif SMALL_BUTTON_RADIUS == 32
122123
static const radiusIcons_t radiusIcons32px
123124
= {&C_half_disc_left_64px_1bpp, &C_half_circle_left_64px_1bpp};
@@ -415,7 +416,10 @@ void nbgl_drawRoundedBorderedRect(const nbgl_area_t *area,
415416
}
416417
if ((2 * circle_width) < area->width) {
417418
if ((area->height - stroke) > VERTICAL_ALIGNMENT) {
419+
// draw the 2 horizontal lines
418420
rectArea.height = stroke;
421+
rectArea.width = area->width - 2 * circle_width;
422+
rectArea.x0 += circle_width;
419423
nbgl_frontDrawLine(&rectArea, 1, borderColor); // top
420424
rectArea.y0 = area->y0 + area->height - stroke;
421425
nbgl_frontDrawLine(&rectArea, 1, borderColor); // bottom

lib_nbgl/src/nbgl_layout.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,7 +1955,7 @@ int nbgl_layoutAddQRCode(nbgl_layout_t *layout, const nbgl_layoutQRCode_t *info)
19551955
textArea->obj.alignmentMarginY = QR_INTER_TEXTS_MARGIN;
19561956
}
19571957
else {
1958-
textArea->obj.alignmentMarginY = 32;
1958+
textArea->obj.alignmentMarginY = QR_PRE_TEXT_MARGIN + 8;
19591959
}
19601960

19611961
fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY + 8;
@@ -2377,7 +2377,7 @@ int nbgl_layoutAddButton(nbgl_layout_t *layout, const nbgl_layoutButton_t *butto
23772377
button->borderColor = BLACK;
23782378
}
23792379
else {
2380-
button->borderColor = INACTIVE_COLOR;
2380+
button->borderColor = LIGHT_GRAY;
23812381
}
23822382
}
23832383
button->text = PIC(buttonInfo->text);

lib_nbgl/src/nbgl_obj.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,19 @@ static void draw_button(nbgl_button_t *obj, nbgl_obj_t *prevObj, bool computePos
437437
nbgl_drawRoundedRect((nbgl_area_t *) obj, obj->radius, obj->innerColor);
438438
}
439439
else {
440+
#ifdef TARGET_APEX
441+
// on Apex, top-right button (54x56) is drawned as an icon
442+
if ((obj->radius == RADIUS_28_PIXELS) && (obj->obj.area.width == BUTTON_WIDTH)) {
443+
nbgl_drawIcon(&obj->obj.area, NO_TRANSFORMATION, BLACK, &C_dashed_button_56px);
444+
}
445+
else {
446+
nbgl_drawRoundedBorderedRect(
447+
(nbgl_area_t *) obj, obj->radius, BUTTON_STROKE, obj->innerColor, obj->borderColor);
448+
}
449+
#else // TARGET_APEX
440450
nbgl_drawRoundedBorderedRect(
441451
(nbgl_area_t *) obj, obj->radius, BUTTON_STROKE, obj->innerColor, obj->borderColor);
452+
#endif // TARGET_APEX
442453
}
443454
// get the text of the button from the callback if not NULL
444455
if (obj->onDrawCallback != NULL) {

lib_nbgl/src/nbgl_obj_keyboard.c

Lines changed: 48 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -163,20 +163,20 @@ static void keyboardDrawCommonLines(nbgl_keyboard_t *keyboard)
163163
rectArea.y0 = keyboard->obj.area.y0;
164164
rectArea.width = keyboard->obj.area.width;
165165
rectArea.height = 1;
166-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor); // 1st line (top)
166+
nbgl_frontDrawLine(&rectArea, 1, keyboard->borderColor); // 1st line (top)
167167
rectArea.y0 += KEYBOARD_KEY_HEIGHT;
168-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor); // 2nd line
168+
nbgl_frontDrawLine(&rectArea, 1, keyboard->borderColor); // 2nd line
169169
rectArea.y0 += KEYBOARD_KEY_HEIGHT;
170-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor); // 3rd line
170+
nbgl_frontDrawLine(&rectArea, 1, keyboard->borderColor); // 3rd line
171171
// in letter only mode, only draw the last line if not at bottom of screen
172172
if ((keyboard->obj.alignmentMarginY > 0) || (!keyboard->lettersOnly)) {
173173
rectArea.y0 += KEYBOARD_KEY_HEIGHT;
174-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor); // 4th line
174+
nbgl_frontDrawLine(&rectArea, 1, keyboard->borderColor); // 4th line
175175
}
176176
// in non letter only mode, only draw the last line if not at bottom of screen
177177
if ((keyboard->obj.alignmentMarginY > 0) && (!keyboard->lettersOnly)) {
178178
rectArea.y0 += KEYBOARD_KEY_HEIGHT;
179-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor); // 5th line
179+
nbgl_frontDrawLine(&rectArea, 1, keyboard->borderColor); // 5th line
180180
}
181181
#ifdef TARGET_STAX
182182
/// then draw vertical line
@@ -191,8 +191,8 @@ static void keyboardDrawCommonLines(nbgl_keyboard_t *keyboard)
191191
#endif // TARGET_STAX
192192
}
193193

194-
// draw full grid for letters mode
195-
static void keyboardDrawLetterGrid(nbgl_keyboard_t *keyboard)
194+
// draw full grid
195+
static void keyboardDrawGrid(nbgl_keyboard_t *keyboard)
196196
{
197197
nbgl_area_t rectArea;
198198
uint8_t i;
@@ -206,91 +206,66 @@ static void keyboardDrawLetterGrid(nbgl_keyboard_t *keyboard)
206206
rectArea.y0 = keyboard->obj.area.y0;
207207
rectArea.width = 1;
208208
rectArea.height = KEYBOARD_KEY_HEIGHT;
209-
// First row of keys: 10 letters (qwertyuiop)
209+
#ifdef TARGET_APEX
210+
// On Apex, we start all lines 1px under the horizontal one
211+
rectArea.y0++;
212+
rectArea.height--;
213+
#endif
214+
215+
// First row of keys: 10 letters (qwertyuiop) or digits, so 9 separations
210216
for (i = 0; i < 9; i++) {
211217
rectArea.x0 += NORMAL_KEY_WIDTH;
212-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor);
218+
nbgl_frontDrawLine(&rectArea, 2, keyboard->borderColor);
213219
}
214220

215-
// Second row: 9 letters (asdfghjkl)
221+
// Second row: 9 letters (asdfghjkl) or digits
216222
rectArea.x0 = keyboard->obj.area.x0 + SECOND_LINE_OFFSET;
217223
rectArea.y0 += KEYBOARD_KEY_HEIGHT;
218-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor);
224+
nbgl_frontDrawLine(&rectArea, 2, keyboard->borderColor);
219225
for (i = 10; i < 19; i++) {
220226
rectArea.x0 += NORMAL_KEY_WIDTH;
221-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor);
227+
nbgl_frontDrawLine(&rectArea, 2, keyboard->borderColor);
222228
}
223-
// Third row: Shift key, 7 letters (zxcvbnm) and backspace in normal mode
224-
// Third row: 7 letters (zxcvbnm) and backspace in letters only mode
225-
rectArea.y0 += KEYBOARD_KEY_HEIGHT;
226-
if (!keyboard->lettersOnly) {
227-
rectArea.x0 = keyboard->obj.area.x0 + SHIFT_KEY_WIDTH;
229+
230+
// Third row, it depends of the mode:
231+
// - 9 keys: Shift, 7 letters (zxcvbnm) and backspace in normal mode
232+
// - 8 keys: 7 letters (zxcvbnm) and backspace in letters only mode
233+
// - 7 keys: Special char key, 5 keys and backspace in digits mode
234+
uint8_t nbLines, firstShift;
235+
if (keyboard->mode == MODE_LETTERS) {
236+
if (keyboard->lettersOnly) {
237+
nbLines = 7;
238+
firstShift = NORMAL_KEY_WIDTH;
239+
}
240+
else {
241+
nbLines = 8;
242+
firstShift = SHIFT_KEY_WIDTH;
243+
}
228244
}
229245
else {
230-
rectArea.x0 = NORMAL_KEY_WIDTH;
231-
}
232-
for (i = 0; i < 6; i++) {
233-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor);
234-
rectArea.x0 += NORMAL_KEY_WIDTH;
246+
nbLines = 6;
247+
firstShift = SPECIAL_CHARS_KEY_WIDTH;
235248
}
236-
if (!keyboard->lettersOnly) {
237-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor);
249+
rectArea.x0 = keyboard->obj.area.x0 + firstShift;
250+
rectArea.y0 += KEYBOARD_KEY_HEIGHT;
251+
for (i = 0; i < nbLines; i++) {
252+
nbgl_frontDrawLine(&rectArea, 2, keyboard->borderColor);
238253
rectArea.x0 += NORMAL_KEY_WIDTH;
239254
}
240-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor);
241255

242256
// 4th row, only in Full mode
243-
if (!keyboard->lettersOnly) {
244-
rectArea.y0 += KEYBOARD_KEY_HEIGHT;
257+
if (!keyboard->lettersOnly || (keyboard->mode != MODE_LETTERS)) {
245258
rectArea.x0 = keyboard->obj.area.x0 + SWITCH_KEY_WIDTH;
259+
rectArea.y0 += KEYBOARD_KEY_HEIGHT;
260+
#ifdef TARGET_APEX
261+
// On Apex, we start the last line 2px under the horizontal one
262+
rectArea.y0 += 2;
263+
rectArea.height -= 2;
264+
#endif
246265
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor);
247266
}
248267
}
249268

250-
// draw full grid for digits/special mode
251-
static void keyboardDrawDigitsGrid(nbgl_keyboard_t *keyboard)
252-
{
253-
nbgl_area_t rectArea;
254-
uint8_t i;
255-
256-
/// draw common lines
257-
keyboardDrawCommonLines(keyboard);
258-
259-
// then all vertical lines separating keys
260-
rectArea.backgroundColor = keyboard->obj.area.backgroundColor;
261-
rectArea.x0 = keyboard->obj.area.x0;
262-
rectArea.y0 = keyboard->obj.area.y0;
263-
rectArea.width = 1;
264-
rectArea.height = KEYBOARD_KEY_HEIGHT;
265-
// First row of keys: 10 keys so 9 separations
266-
for (i = 0; i < 9; i++) {
267-
rectArea.x0 += NORMAL_KEY_WIDTH;
268-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor);
269-
}
270-
271-
// Second row: 9 keys
272-
rectArea.x0 = keyboard->obj.area.x0 + SECOND_LINE_OFFSET;
273-
rectArea.y0 += KEYBOARD_KEY_HEIGHT;
274-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor);
275-
for (i = 10; i < 19; i++) {
276-
rectArea.x0 += NORMAL_KEY_WIDTH;
277-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor);
278-
}
279-
// Third row: Special char key, 5 keys and backspace
280-
rectArea.x0 = keyboard->obj.area.x0 + SPECIAL_CHARS_KEY_WIDTH;
281-
rectArea.y0 += KEYBOARD_KEY_HEIGHT;
282-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor);
283-
for (i = 0; i < 5; i++) {
284-
rectArea.x0 += NORMAL_KEY_WIDTH;
285-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor);
286-
}
287-
288-
// 4th row, switch to letters and space
289-
rectArea.y0 += KEYBOARD_KEY_HEIGHT;
290-
rectArea.x0 = keyboard->obj.area.x0 + SWITCH_KEY_WIDTH;
291-
nbgl_frontDrawLine(&rectArea, 0, keyboard->borderColor);
292-
}
293-
294269
// draw letters for letters mode
295270
static void keyboardDrawLetters(nbgl_keyboard_t *keyboard)
296271
{
@@ -525,17 +500,13 @@ static void keyboardDrawDigits(nbgl_keyboard_t *keyboard)
525500

526501
static void keyboardDraw(nbgl_keyboard_t *keyboard)
527502
{
503+
// At first, draw grid
504+
keyboardDrawGrid(keyboard);
528505
if (keyboard->mode == MODE_LETTERS) {
529-
// At first, draw grid
530-
keyboardDrawLetterGrid(keyboard);
531-
532506
// then draw key content
533507
keyboardDrawLetters(keyboard);
534508
}
535509
else {
536-
////// At first, draw grid //////
537-
keyboardDrawDigitsGrid(keyboard);
538-
539510
////// then draw key content //////
540511
keyboardDrawDigits(keyboard);
541512
}

lib_nbgl/src/nbgl_obj_keypad.c

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ static uint8_t getKeypadIndex(uint16_t x, uint16_t y)
9696
static void keypadDrawGrid(nbgl_keypad_t *keypad)
9797
{
9898
nbgl_area_t rectArea;
99+
uint8_t i;
99100

100101
// clean full area
101102
rectArea.backgroundColor = keypad->obj.area.backgroundColor;
@@ -105,19 +106,27 @@ static void keypadDrawGrid(nbgl_keypad_t *keypad)
105106
rectArea.height = keypad->obj.area.height;
106107
nbgl_frontDrawRect(&rectArea);
107108

108-
/// draw horizontal lines
109+
/// draw the 4 horizontal lines
109110
rectArea.backgroundColor = keypad->obj.area.backgroundColor;
110111
rectArea.x0 = keypad->obj.area.x0;
111112
rectArea.y0 = keypad->obj.area.y0;
112-
rectArea.width = keypad->obj.area.width;
113113
rectArea.height = 1;
114-
nbgl_frontDrawLine(&rectArea, 1, LIGHT_GRAY); // 1st line (top)
115-
rectArea.y0 += KEYPAD_KEY_HEIGHT;
116-
nbgl_frontDrawLine(&rectArea, 1, LIGHT_GRAY); // 2nd line
117-
rectArea.y0 += KEYPAD_KEY_HEIGHT;
118-
nbgl_frontDrawLine(&rectArea, 1, LIGHT_GRAY); // 3rd line
119-
rectArea.y0 += KEYPAD_KEY_HEIGHT;
120-
nbgl_frontDrawLine(&rectArea, 1, LIGHT_GRAY); // 4th line
114+
rectArea.width = keypad->obj.area.width;
115+
for (i = 0; i < 4; i++) {
116+
#ifdef TARGET_APEX
117+
// on Apex, draw 3 segments per line, for "intersections"
118+
rectArea.width = KEY_WIDTH - 2;
119+
nbgl_frontDrawLine(&rectArea, 2, LIGHT_GRAY);
120+
rectArea.x0 += KEY_WIDTH + 1;
121+
nbgl_frontDrawLine(&rectArea, 2, LIGHT_GRAY);
122+
rectArea.x0 += KEY_WIDTH + 1;
123+
nbgl_frontDrawLine(&rectArea, 2, LIGHT_GRAY);
124+
rectArea.x0 = keypad->obj.area.x0;
125+
#else // TARGET_APEX
126+
nbgl_frontDrawLine(&rectArea, 2, LIGHT_GRAY);
127+
#endif // TARGET_APEX
128+
rectArea.y0 += KEYPAD_KEY_HEIGHT;
129+
}
121130

122131
/// then draw 2 or 3 (if side) vertical lines
123132
rectArea.x0 = keypad->obj.area.x0;
@@ -128,8 +137,12 @@ static void keypadDrawGrid(nbgl_keypad_t *keypad)
128137
nbgl_frontDrawLine(&rectArea, 0, LIGHT_GRAY); // 1st full line, on the left
129138
#endif // HAVE_SIDE_SCREEN
130139
rectArea.x0 += KEY_WIDTH;
140+
#ifdef TARGET_APEX
141+
// on Apex, the first "column" is only 99px large
142+
rectArea.x0--;
143+
#endif // TARGET_APEX
131144
nbgl_frontDrawLine(&rectArea, 0, LIGHT_GRAY); // 2nd line
132-
rectArea.x0 += KEY_WIDTH;
145+
rectArea.x0 = keypad->obj.area.x0 + 2 * KEY_WIDTH;
133146
nbgl_frontDrawLine(&rectArea, 0, LIGHT_GRAY); // 3rd line
134147
}
135148

tests/screenshots/flows/wallet/app-sdk/flow_address_verif.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,32 +138,32 @@
138138
"targets": [
139139
{
140140
"object": "EXTRA_BUTTON",
141-
"product": "flex",
141+
"product": "flex,apex_p",
142142
"page": "multi-sig-qr_code",
143143
"comment": "view QR"
144144
},
145145
{
146146
"object": "CHOICE_2",
147-
"product": "stax,apex_p",
147+
"product": "stax",
148148
"page": "multi-sig-qr_code",
149149
"comment": "view QR"
150150
},
151151
{
152152
"object": "RIGHT_BUTTON",
153-
"product": "flex",
153+
"product": "flex,apex_p",
154154
"page": "multi-sig-03"
155155
},
156156
{
157157
"object": "VALUE_BUTTON_3",
158-
"product": "stax,apex_p",
158+
"product": "stax",
159159
"page": "multi-sig-signers-01",
160160
"comment": "view signers details (alias)"
161161
}
162162
]
163163
},
164164
{
165165
"name": "multi-sig-03",
166-
"product": "flex",
166+
"product": "flex,apex_p",
167167
"targets": [
168168
{
169169
"object": "VALUE_BUTTON_2",
@@ -195,12 +195,12 @@
195195
"targets": [
196196
{
197197
"object": "BOTTOM_BUTTON",
198-
"product": "flex",
198+
"product": "flex,apex_p",
199199
"page": "multi-sig-03"
200200
},
201201
{
202202
"object": "BOTTOM_BUTTON",
203-
"product": "stax,apex_p",
203+
"product": "stax",
204204
"page": "multi-sig-02"
205205
}
206206
]

tests/screenshots/flows/wallet/app-sdk/flow_app_home_settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
"pages": [
44
{
55
"name": "Entry",
6+
"targets": [
7+
{
8+
"app_event": "ETH_OPEN_2",
9+
"page": "app-with-cta-action-02"
10+
}
11+
]
12+
},
13+
{
14+
"name": "app-with-cta-action-02",
615
"targets": [
716
{
817
"app_event": "ETH_OPEN",

0 commit comments

Comments
 (0)