What changed, and why it matters
This commit is a user-interface styling fix. It adds a more compact QR-code popup layout, switches one Bitcoin screen to use that compact layout, tweaks a label font style, and comments out a simulator-only macro. There is no indication of any security bug being fixed.
No security action required; treat as a normal UI/UX improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change refactors gui_qr_hintbox.c to support two layout parameter sets (DEFAULT and COMPACT) via GuiQRCodeHintBoxOpenByLayout, exposes GuiQRCodeHintBoxOpenCompact, and updates OpenInputRefQrCode in gui_btc.c to call the compact variant. It also replaces a direct font style call with SetContentLableStyle for a fee label, and comments out GET_QR_DATA_FROM_SCREEN in the UI simulator. The QR hintbox refactor also resets global pointers and layout state on removal, but this appears to be cleanup consistency rather than a security fix.
Changed components
src/ui/gui_components/gui_qr_hintbox.csrc/ui/gui_components/gui_qr_hintbox.hsrc/ui/gui_chain/gui_btc.cui_simulator/simulator_model.cInspect captured patch +63 / −11
diff --git a/src/ui/gui_chain/gui_btc.c b/src/ui/gui_chain/gui_btc.c
index 12dfcc6..46aa4ca 100644
--- a/src/ui/gui_chain/gui_btc.c
+++ b/src/ui/gui_chain/gui_btc.c
@@ -795,7 +795,7 @@ static void OpenInputRefQrCode(lv_event_t *e)
snprintf_s(outpoint, sizeof(outpoint), "%s:\n%s:%u", _("btc_outpoint"), inputData->input_txid,
inputData->input_vout);
- GuiQRCodeHintBoxOpen(url, _("btc_input_reference"), outpoint);
+ GuiQRCodeHintBoxOpenCompact(url, _("btc_input_reference"), outpoint);
}
static bool IsAvalancheTx(DisplayTx *data)
@@ -1007,8 +1007,7 @@ static lv_obj_t *CreateOverviewAmountView(lv_obj_t *parent, DisplayTxOverview *o
overviewData->fee_is_lower_bound, overviewData->fee_is_unknown);
lv_label_set_text(feeValue, feeText);
lv_obj_align_to(feeValue, label, LV_ALIGN_OUT_RIGHT_MID, 16, 0);
-
- lv_obj_set_style_text_font(feeValue, &openSansEnIllustrate, LV_PART_MAIN);
+ SetContentLableStyle(feeValue);
if (overviewData->fee_larger_than_amount) {
lv_obj_set_style_text_color(feeValue, lv_color_hex(0xf55831), LV_PART_MAIN);
diff --git a/src/ui/gui_components/gui_qr_hintbox.c b/src/ui/gui_components/gui_qr_hintbox.c
index c57b8c2..e73a5d0 100644
--- a/src/ui/gui_components/gui_qr_hintbox.c
+++ b/src/ui/gui_components/gui_qr_hintbox.c
@@ -10,6 +10,39 @@ static lv_obj_t *g_qrHintBox = NULL;
static lv_obj_t *g_qrHintBoxTitle = NULL;
static lv_obj_t *g_qrHintBoxQR = NULL;
static lv_obj_t *g_qrHintBoxSubTitle = NULL;
+static uint8_t g_qrHintBoxLayout = 0xFF;
+
+typedef struct {
+ uint16_t hintBoxHeight;
+ uint16_t qrContainerSize;
+ uint16_t qrCodeSize;
+ lv_coord_t qrBottomOffset;
+ lv_coord_t titleBottomOffset;
+ lv_coord_t subtitleYOffset;
+} GuiQrHintBoxLayoutParam_t;
+
+enum {
+ QR_HINTBOX_LAYOUT_DEFAULT = 0,
+ QR_HINTBOX_LAYOUT_COMPACT,
+};
+
+static const GuiQrHintBoxLayoutParam_t g_qrHintBoxLayoutDefault = {
+ .hintBoxHeight = 656,
+ .qrContainerSize = 408,
+ .qrCodeSize = 360,
+ .qrBottomOffset = -220,
+ .titleBottomOffset = -156,
+ .subtitleYOffset = 40,
+};
+
+static const GuiQrHintBoxLayoutParam_t g_qrHintBoxLayoutCompact = {
+ .hintBoxHeight = 656,
+ .qrContainerSize = 344,
+ .qrCodeSize = 304,
+ .qrBottomOffset = -284,
+ .titleBottomOffset = -220,
+ .subtitleYOffset = 40,
+};
void GuiQRHintBoxRemove();
@@ -35,6 +68,10 @@ static void GuiQRHintBoxCloseHandler(lv_event_t *e)
void GuiQRHintBoxRemove()
{
GUI_DEL_OBJ(g_qrHintBox);
+ g_qrHintBoxTitle = NULL;
+ g_qrHintBoxQR = NULL;
+ g_qrHintBoxSubTitle = NULL;
+ g_qrHintBoxLayout = 0xFF;
}
bool GuiQRHintBoxIsActive()
@@ -150,16 +187,21 @@ void GuiNormalHitBoxOpen(const char *title, const char *content)
}
}
-void GuiQRCodeHintBoxOpen(const char *qrdata, const char *title, const char *subtitle)
+static void GuiQRCodeHintBoxOpenByLayout(const char *qrdata, const char *title, const char *subtitle,
+ const GuiQrHintBoxLayoutParam_t *layout, uint8_t layoutType)
{
lv_obj_t *parent, *button, *qrCodeCont, *qrCode, *label;
+ if (g_qrHintBox != NULL && g_qrHintBoxLayout != layoutType) {
+ GuiQRHintBoxRemove();
+ }
if (g_qrHintBox == NULL) {
- g_qrHintBox = GuiCreateHintBox(656);
+ g_qrHintBox = GuiCreateHintBox(layout->hintBoxHeight);
parent = g_qrHintBox;
+ g_qrHintBoxLayout = layoutType;
qrCodeCont = lv_obj_create(parent);
- lv_obj_set_size(qrCodeCont, 408, 408);
+ lv_obj_set_size(qrCodeCont, layout->qrContainerSize, layout->qrContainerSize);
lv_obj_set_style_border_width(qrCodeCont, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_clip_corner(qrCodeCont, 0, 0);
lv_obj_set_style_pad_all(qrCodeCont, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
@@ -167,21 +209,21 @@ void GuiQRCodeHintBoxOpen(const char *qrdata, const char *title, const char *sub
lv_obj_clear_flag(qrCodeCont, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_clear_flag(qrCodeCont, LV_OBJ_FLAG_CLICKABLE);
lv_obj_set_style_bg_color(qrCodeCont, WHITE_COLOR, LV_PART_MAIN);
- lv_obj_align(qrCodeCont, LV_ALIGN_BOTTOM_MID, 0, -220);
+ lv_obj_align(qrCodeCont, LV_ALIGN_BOTTOM_MID, 0, layout->qrBottomOffset);
- qrCode = lv_qrcode_create(qrCodeCont, 360, BLACK_COLOR, WHITE_COLOR);
+ qrCode = lv_qrcode_create(qrCodeCont, layout->qrCodeSize, BLACK_COLOR, WHITE_COLOR);
lv_obj_align(qrCode, LV_ALIGN_CENTER, 0, 0);
lv_qrcode_update(qrCode, qrdata, (uint32_t)strlen(qrdata));
g_qrHintBoxQR = qrCode;
label = GuiCreateTextLabel(parent, title);
lv_label_set_long_mode(label, LV_LABEL_LONG_SCROLL_CIRCULAR);
- lv_obj_align(label, LV_ALIGN_BOTTOM_LEFT, 36, -156);
+ lv_obj_align(label, LV_ALIGN_BOTTOM_LEFT, 36, layout->titleBottomOffset);
g_qrHintBoxTitle = label;
label = GuiCreateIllustrateLabel(parent, subtitle);
lv_obj_set_style_text_color(label, BLUE_GREEN_COLOR, LV_PART_MAIN);
- GuiAlignToPrevObj(label, LV_ALIGN_DEFAULT, 0, 40);
+ GuiAlignToPrevObj(label, LV_ALIGN_DEFAULT, 0, layout->subtitleYOffset);
g_qrHintBoxSubTitle = label;
button = GuiCreateTextBtn(parent, _("OK"));
@@ -196,3 +238,13 @@ void GuiQRCodeHintBoxOpen(const char *qrdata, const char *title, const char *sub
lv_label_set_text(g_qrHintBoxSubTitle, subtitle);
}
}
+
+void GuiQRCodeHintBoxOpen(const char *qrdata, const char *title, const char *subtitle)
+{
+ GuiQRCodeHintBoxOpenByLayout(qrdata, title, subtitle, &g_qrHintBoxLayoutDefault, QR_HINTBOX_LAYOUT_DEFAULT);
+}
+
+void GuiQRCodeHintBoxOpenCompact(const char *qrdata, const char *title, const char *subtitle)
+{
+ GuiQRCodeHintBoxOpenByLayout(qrdata, title, subtitle, &g_qrHintBoxLayoutCompact, QR_HINTBOX_LAYOUT_COMPACT);
+}
diff --git a/src/ui/gui_components/gui_qr_hintbox.h b/src/ui/gui_components/gui_qr_hintbox.h
index cff75ff..690eb56 100644
--- a/src/ui/gui_components/gui_qr_hintbox.h
+++ b/src/ui/gui_components/gui_qr_hintbox.h
@@ -3,6 +3,7 @@
void GuiQRHintBoxRemove();
void GuiQRCodeHintBoxOpen(const char *qrdata, const char *title, const char *subtitle);
+void GuiQRCodeHintBoxOpenCompact(const char *qrdata, const char *title, const char *subtitle);
void GuiQRCodeHintBoxOpenBig(const char *qrdata, const char *title, const char *content, const char *url);
void GuiNormalHitBoxOpen(const char *title, const char *content);
bool GuiQRHintBoxIsActive();
diff --git a/ui_simulator/simulator_model.c b/ui_simulator/simulator_model.c
index 5461e76..553f5ee 100644
--- a/ui_simulator/simulator_model.c
+++ b/ui_simulator/simulator_model.c
@@ -21,7 +21,7 @@ bool g_reboot = false;
bool g_otpProtect = false;
// Comment out this macro if you need to retrieve data from the file
-#define GET_QR_DATA_FROM_SCREEN
+// #define GET_QR_DATA_FROM_SCREEN
void OTP_PowerOn(void)
{
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.