quickscreen: make %QT hide built-in UI

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 789d796120d2b97c588057f5fc839cdb25fbcd00
Author: Christian Soffke <[email protected]>
Date:   Thu Aug 13 14:17:00 2026 +0200

    quickscreen: make %QT hide built-in UI
    
    When an SBS uses the new %QT tag (added in 96f42a5)
    to retrieve the name of the top Quickscreen setting
    (thus likely wants to draw its own QS UI), we disable
    the built-in interface until a new SBS file is applied.
    
    Fixes lag encountered in Themify 2 due to invisible
    built-in Quickscreen UI that kept being re-drawn.
    
    Change-Id: Id4f295f959c2d16d1650f6fc066c3ceca6685405

diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c
index 083bebe06e..087a879f9c 100644
--- a/apps/gui/quickscreen.c
+++ b/apps/gui/quickscreen.c
@@ -61,6 +61,16 @@ struct quickscreen
     enum quickscreen_item volume_item;
 };
 
+/* Skin draws custom Quickscreen UI */
+static bool qs_skinned[NB_SCREENS];
+
+/* Toggle built-in interface, based on
+   whether skin draws custom QS UI. */
+void quickscreen_set_skinned(enum screen_type screen, bool skinned)
+{
+    qs_skinned[screen] = skinned;
+}
+
 static void quickscreen_fix_viewports(struct quickscreen *qs, enum screen_type screen)
 {
     int char_height, width, pad = 0;
@@ -207,6 +217,9 @@ static void quickscreen_update(struct quickscreen *qs, enum quickscreen_item sel
         struct screen *display = &screens[screen];
         struct viewport *vps = qs->vps[screen];
 
+        if (qs_skinned[screen])
+            continue;
+
         for (int i = 0; i < QUICKSCREEN_ITEM_COUNT; i++)
             if (qs->items[i] == qs->items[selected])
             {
@@ -266,7 +279,8 @@ static void quickscreen_draw_cb(unsigned short id, void *data, void *userdata)
     (void)data;
 
     FOR_NB_SCREENS(i)
-        quickscreen_draw((struct quickscreen *) userdata, i);
+        if (!qs_skinned[i])
+            quickscreen_draw((struct quickscreen *) userdata, i);
 }
 
 static void talk_qs_option(const struct settings_list *opt, bool enqueue)
@@ -372,8 +386,9 @@ static void cleanup(void *parameter)
 
     FOR_NB_SCREENS(i)
     {
-        for (int j = 0; j < QUICKSCREEN_ITEM_COUNT; j++)
-            screens[i].scroll_stop_viewport(&qs->vps[i][j]);
+        if (!qs_skinned[i])
+            for (int j = 0; j < QUICKSCREEN_ITEM_COUNT; j++)
+                screens[i].scroll_stop_viewport(&qs->vps[i][j]);
         viewportmanager_theme_undo(i, !(qs->result & QUICKSCREEN_GOTO_SHORTCUTS_MENU));
     }
     /* Eliminate flashing of parent during transition to Shortcuts */
@@ -400,8 +415,11 @@ static void quickscreen_run(struct quickscreen * qs)
         screens[i].set_viewport(NULL);
         screens[i].scroll_stop();
         viewportmanager_theme_enable(i, true, &qs->parent[i]);
-        quickscreen_fix_viewports(qs, i);
-        quickscreen_draw(qs, i);
+        if (!qs_skinned[i])
+        {
+            quickscreen_fix_viewports(qs, i);
+            quickscreen_draw(qs, i);
+        }
     }
     /* Announce current selection on entering this screen. This is all
        queued up, but can be interrupted as soon as a setting is
diff --git a/apps/gui/quickscreen.h b/apps/gui/quickscreen.h
index 1631a62e02..669da7a277 100644
--- a/apps/gui/quickscreen.h
+++ b/apps/gui/quickscreen.h
@@ -45,6 +45,7 @@ enum quickscreen_return {
 };
 
 extern int quick_screen_quick(int button_enter);
+void quickscreen_set_skinned(enum screen_type screen, bool skinned);
 bool is_setting_quickscreenable(const struct settings_list *setting);
 
 #endif /*_GUI_QUICK_SCREEN_H_*/
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 106fd6f85c..a7c023d667 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -762,7 +762,7 @@ int skin_wait_for_action(enum skinnable_screens skin, int context, int timeout)
     /* Skip updates if peak meter disabled. */
     bool peak_meter_enabled = false;
     FOR_NB_SCREENS(i)
-       peak_meter_enabled |= skin_get_gwps(skin, i)->data->peak_meter_enabled;
+        peak_meter_enabled |= skin_get_gwps(skin, i)->data->peak_meter_enabled;
     if (!peak_meter_enabled)
         return get_action(context, timeout);
 
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 14ec327a67..8957d9ae49 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -2450,6 +2450,14 @@ static int skin_element_callback(struct skin_element* element, void* data)
                 case SKIN_TOKEN_DRAW_INBUILTBAR:
                     function = parse_statusbar_tags;
                     break;
+#if defined(HAVE_QUICKSCREEN) && !defined(__PCTOOL__)
+                case SKIN_TOKEN_TOP_QUICKSETTING_NAME:
+                    /* Disable built-in Quickscreen UI if skin draws its own,
+                       as suggested by the use of the %QT tag */
+                    if (curr_skin == CUSTOM_STATUSBAR)
+                        quickscreen_set_skinned(curr_screen, true);
+                    break;
+#endif
                 case SKIN_TOKEN_LIST_TITLE_TEXT:
 #ifndef __PCTOOL__
                     sb_skin_has_title(curr_screen);
diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c
index 6fcb90ece5..27d3a924f2 100644
--- a/apps/gui/statusbar-skinned.c
+++ b/apps/gui/statusbar-skinned.c
@@ -101,6 +101,9 @@ void sb_process(enum screen_type screen, struct wps_data *data, bool preprocess)
     {
         sbs_loaded[screen] = false;
         sbs_has_title[screen] = false;
+#ifdef HAVE_QUICKSCREEN
+        quickscreen_set_skinned(screen, false); /* Revert to built-in QS UI */
+#endif
         viewportmanager_theme_enable(screen, false, NULL);
         return;
     }
diff --git a/manual/appendix/wps_tags.tex b/manual/appendix/wps_tags.tex
index 7c6dbe713a..121bb7a0cf 100644
--- a/manual/appendix/wps_tags.tex
+++ b/manual/appendix/wps_tags.tex
@@ -319,6 +319,32 @@ Examples:
 
 \config{\%?if(\%cs, =, 2)<This is the WPS>}
 
+\opt{quickscreen}{
+\section{Drawing the Quickscreen using a skin}
+
+Quickscreen settings can be displayed using the following tags.
+
+\begin{tagmap}
+    \config{\%QT} & Top Quickscreen setting (name)\\
+    \config{\%Qt} & Top Quickscreen setting (value)\\
+    \config{\%QR} & Right Quickscreen setting (name)\\
+    \config{\%Qr} & Right Quickscreen setting (value)\\
+    \config{\%QB} & Bottom Quickscreen setting (name)\\
+    \config{\%Qb} & Bottom Quickscreen setting (value)\\
+    \config{\%QL} & Left Quickscreen setting (name)\\
+    \config{\%Ql} & Left Quickscreen setting (value)\\
+  \end{tagmap}
+
+  Define viewports containing these tags for each Quickscreen position, with your
+  desired font and formatting. Check if \config{\%cs} is equal to \config{10}
+  (i.e. Quickscreen is the current screen) before displaying them.
+
+  If \config{\%QT} is present anywhere in the \fname{.sbs}, then the un-skinned
+  Quickscreen will not be shown.
+
+  \note{If a preset does not match a legal setting, or has no setting applied, all tags will display "ERR".}
+}
+
 \section{List Title (\fname{.sbs} only)}
   \begin{tagmap}
     \config{\%Lt} & Title text. Should be used in a conditional so that non-list
@@ -390,25 +416,6 @@ Examples:
 \item As a conditional: \config{\%?St(eq enabled)<Eq is enabled|Eq is disabled>}
 \end{enumerate}
 
-\opt{quickscreen}{
-\subsection{Displaying Quickscreen settings}
-
-If your player has a quickscreen, the preset settings can be displayed using the following.
-
-\begin{tagmap}
-    \config{\%QT} & Display the name of the top quickscreen setting.\\
-    \config{\%Qt} & Display the value of the top quickscreen setting.\\
-    \config{\%QR} & Display the name of the right quickscreen setting.\\
-    \config{\%Qr} & Display the value of the right quickscreen setting.\\
-    \config{\%QB} & Display the name of the bottom quickscreen setting.\\
-    \config{\%Qb} & Display the value of the bottom quickscreen setting.\\
-    \config{\%QL} & Display the name of the left quickscreen setting.\\
-    \config{\%Ql} & Display the value of the left quickscreen setting.\\
-  \end{tagmap}
-
-  \note{If a preset does not match a legal setting, or has no setting applied, all tags will display "ERR".}
-}
-
 \section{\label{ref:wps_images}Images}
   \begin{tagmap}
     \config{\%X(filename.bmp)}
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.