From 5f05d668532ae180c48e486f16deb7380b451dd6 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Sat, 7 Jun 2025 23:59:54 +0200 Subject: [PATCH] quickscreen: fix disappearing elements in misbehaved themes Adjusting certain settings from the Quickscreen causes a GUI_EVENT_NEED_UI_UPDATE event to be sent. For example: Changing the Repeat or Shuffle setting while music is playing or paused (which results in audio being flushed and tracks being reloaded immediately since commit 1c80f53) This creates an issue with themes such as Terminal(Two), FreshOS, or Themify, which appear to have viewports that overlap with the UI viewport, thereby wiping out the Quickscreen viewports. We now redraw the Quickscreen when a full SBS update is requested, similar to how it is done by lists. You'll still see the viewport flash in case of misbehaved themes, so, ideally, these themes would receive an update by their authors, removing any viewports that overlap the UI viewport. Change-Id: I7affbb70fc2e72fd6e1418196559204aec125e12 --- apps/gui/quickscreen.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 109414336f..fe2a240a38 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c @@ -42,6 +42,7 @@ #ifdef HAVE_ALBUMART #include "playback.h" #endif +#include "appevents.h" /* 1 top, 1 bottom, 2 on either side, 1 for the icons * if enough space, top and bottom have 2 lines */ @@ -52,6 +53,18 @@ #define MARGIN 10 #define CENTER_ICONAREA_SIZE (MARGIN+8*2) +static bool redraw; + +static void quickscreen_update_callback(unsigned short id, + void *data, void *userdata) +{ + (void)id; + (void)data; + (void)userdata; + + redraw = true; +} + static void quickscreen_fix_viewports(struct gui_quickscreen *qs, struct screen *display, struct viewport *parent, @@ -335,6 +348,8 @@ static int gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter push_current_activity(ACTIVITY_QUICKSCREEN); + add_event_ex(GUI_EVENT_NEED_UI_UPDATE, false, quickscreen_update_callback, NULL); + FOR_NB_SCREENS(i) { screens[i].set_viewport(NULL); @@ -355,6 +370,13 @@ static int gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter if (qs->items[QUICKSCREEN_LEFT] != qs->items[QUICKSCREEN_RIGHT]) talk_qs_option(qs->items[QUICKSCREEN_RIGHT], true); while (true) { + if (redraw) + { + redraw = false; + FOR_NB_SCREENS(i) + gui_quickscreen_draw(qs, &screens[i], &parent[i], + vps[i], &vp_icons[i]); + } button = get_action(CONTEXT_QUICKSCREEN, HZ/5); #ifdef HAVE_TOUCHSCREEN if (button == ACTION_TOUCHSCREEN) @@ -369,9 +391,8 @@ static int gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter { ret |= QUICKSCREEN_CHANGED; can_quit = true; - FOR_NB_SCREENS(i) - gui_quickscreen_draw(qs, &screens[i], &parent[i], - vps[i], &vp_icons[i]); + redraw = true; + if (qs->callback) qs->callback(qs); } @@ -412,6 +433,8 @@ static int gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter else pop_current_activity(); + remove_event_ex(GUI_EVENT_NEED_UI_UPDATE, quickscreen_update_callback, NULL); + return ret; }