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
Keep track of the type of skin file being parsed,
in case a tag needs this info.
E.g. %Lt should be ignored in any skin other than
SBS files.
Change-Id: Ib7e52c3e6810196cb566adb65619a1b847cf20ef
If volume was set as one of the Quickscreen items,
the value wasn't updated when pressing ACTION_QS_VOLUP
or -DOWN.
Change-Id: Ie6531535745592d7b53006560f1db8c5b7dbfb97
For each setting adjustment, the whole QS was
redrawn, including icons that never change at
all. Only redraw the viewports that contain a
setting that has been adjusted.
Change-Id: I74188fbf382a92c6e8bf517d9518c3a96bdd21ef
Reduces GNU Complexity score from 6 to 2.
Slightly adjusts behavior:
1) With TIMEOUT_NOBLOCK and peak meters enabled,
skin_wait_for_action always returned BUTTON_NONE,
and did nothing else. Presumably unintentional.
WPS was not affected, since it always uses HZ/5 for the
timeout. The FM screen uses TIMEOUT_NOBLOCK only when
fms_do_button_loop is called with update_screen == true.
skin_wait_for_action now returns the result of get_action
in any given scenario.
2) fixes incorrect next_refresh calculation when peak_meters
are enabled on multiple screens
3) button loop now refreshes peak meters when
current_tick >= next_refresh, instead of when
current_tick > next_refresh
Change-Id: Iaca37dbdde6057f593659b2feb97b61ac4cc4b02
The splash contrast workaround for the iPod reFresh themes compares
foreground and background colours against hard-coded RGB565 values.
This prevents the workaround from being applied on targets using other
pixel formats, such as XRGB8888 hosted targets.
Use LCD_RGBPACK() and SCREEN_COLOR_TO_NATIVE() to obtain the equivalent
colours for the active screen instead.
Code change and commit message generated by GPT-5.6 Sol. Compiled on
my hosted Eros Q build and confirmed working correctly.
Change-Id: Id15669bc7b8cec11bd4ee645c0b671db4499d2cd
Quickscreen will ignore update_delay so that the SBS
is updated after each button press, without any lag.
The SBS may display settings that are adjusted by the
Quickscreen (e.g. cabbiev2's Shuffle and Repeat icons,
or the brightness slider included in themes like
Adwaitapod and Themify).
Change-Id: I28716e81cb77e235eb009bff91c96f510365f435
Appears to be a regression introduced in e454a39, where
MIN_LINES was increased from 4 to 5, along with changing
nb_lines <= MIN_LINES to nb_lines < MIN_LINES
The top and bottom sections are supposed to switch
from 2 to 1 lines if there are fewer available lines
than MIN_LINES.
Each of the three vertical section uses two lines,
resulting in overlapping viewports, if there are exactly
5 available lines.
Icons mentioned in the comment don't really play into
that.
Change-Id: I3a0e921d9f53a490fece0ce59457feaf84a80d3b
Tune accel/decel/press coefficients and add a braking force which
kicks in when swiping in the opposite direction of scrolling. This
is instead of the usual acceleration force.
Change-Id: I2b220c98674933a6957d6982020406342cd019bd
Add configurable acceleration settings. There are 3 settings which
are applied at different times during scrolling. "accel" is used to
calculate the acceleration applied to the list based on the swipe
speed. "decel" determines the deceleration force applied based on
the list scroll speed, and "press" is an additional deceleration
force applied if you are pressing on the screen.
All settings have the general form:
kinetic scroll accel: <a0> <a1> <delay>
kinetic scroll decel: <a0> <a1> <delay>
kinetic scroll press: <a0> <a1> <delay>
where the formula for the acceleration is "accel = a0 + a1*vel" and
"vel" is the input velocity (swipe speed for accel, list scroll speed
for decel/press).
The delay parameter is a value in milliseconds which acts as a grace
period where the acceleration will *not* be applied. For example, if
you specify 250ms for decel, then deceleration will not kick in until
250ms after scrolling starts. For press, the delay is based on the
duration of the touchscreen press.
All settings have sane default values and don't need to be configured
to enable kinetic scrolling; it is always enabled. But the settings are
there for those who want to tweak the behavior.
Change-Id: I9723b496b2b5d3fb3643af60b169754fdba497f0
Kinetic scrolling now accelerates when repeatedly swiping over
the screen, so you can scroll through large lists easily without
using the scrollbar. Press & hold to slow down and stop.
Menu items can no longer be selected during a kinetic scroll
event, to reduce the chance of accidental selections.
Change-Id: I05b7d5fe6681a9edf53096b1fa265442fb31bf33
Fixes possible crash during playback with
'Auto-Change Directory' setting enabled.
When the currently playing directory changes, the
skin may be updated on the main thread while the
playback thread is executing create_and_play_dir
and has yet to add any indices to the newly created
playlist.
Introduced in commit 41d5ca3.
Change-Id: I6e930f2db546c7690b362ba8c1a4907d0348ff52
Introduce the generic, target-agnostic pieces for a gadget-driven USB
Audio Class DAC, gated by the HAVE_HOST_USB_AUDIO target flag so they stay
inert unless a target opts in.
Rather than adding a new USB mode, reuse the existing usb_audio setting
(never / always / while charge-only / while mass-storage) with its
LANG_USB_DAC string, usb_set_audio() callback and the
PCM_MIXER_CHAN_USBAUDIO mixer channel. HAVE_HOST_USB_AUDIO becomes the
umbrella capability flag for this common code; USB_ENABLE_AUDIO stays the
native usbstack class-driver contract (which needs HAVE_USBSTACK and so
cannot be used by hosted ports whose kernel owns the USB controller).
usb_set_audio() is declared here and implemented by the target (natively
by the usbstack driver, or in the hosted port for gadget targets, as with
usb_audio_get_active()), and applied at settings load. The playback
interlock in wps.c/playback.c keeps local playback from mixing with host
audio while the DAC is active. Simulator stubs for usb_set_audio() and
usb_audio_get_active() keep sim builds linking.
Co-Authored-By: Claude Opus 4.8
Change-Id: I5b7738508c24721d91d4c32379102a1ac7c6228b
not sure if there's a reason these weren't included
in g#3229
- simple lists
- playlist viewer
- browse_id3
- option select
Change-Id: I0e15aaeb563e68ea21bf5df667ce134d01a95195
add get_metadata_afmt function so we don't have to extra functions
remove unneeded bounds check on audio_format in rbcodec_format_is_atomic()
add bounds check on audio_format in get_metadata_afmt()
Change-Id: I76bd869100b000579c6546f0670ba4ba2c541f22
tagcache.c add_tagcache() and potentially
skin_tokens.c wps_playlist_percent_prepare()
make calls to probe_file_format() prior to calling get_metadata_ex
resulting in some small amout of duplicated work
especially in the case of add_tagcache this can add
up to a lot of duplicated work
breaks out audio_fmt so these can supply the afmt other callers just
supply probe_file_format(trackname) in the function call
Change-Id: I8084213b8ee7e04d76dce0986beb83d443ac804b
%pP reports playlist progress by position index, which treats every
track as equally long. For playlists with tracks of unequal length --
audiobooks with chapters anywhere from two minutes to an hour are the
motivating case -- position is a poor proxy for listening progress.
%pX reports the played percentage of the whole playlist by time: the
summed length of all preceding tracks plus the elapsed time in the
current one, relative to the playlist's total duration. It can be
used as a value, in a conditional, with %if(), or as a bar tag like
%pb.
If a playlist contains more than 500 tracks or the scan is taking too
long and the user aborts the tag will fallback to the behavior of %pP
except the progress through the current track will be included in the
returned percentage
--------------------------------------
Computing this needs every track's length, and reading metadata for
every track is too slow and disk-heavy for a tag that refreshes on the
WPS. Instead each track's length is estimated from its file size: the
skin engine scans the playlist in the background, a batch of files each
skin refresh, opening each file only to read its size (directory
metadata, no header parse). Size is turned into time by calibrating one
file of each type -- the first file of each extension is parsed once
with get_metadata to learn its bytes-per-second, and every later file
of that type reuses it. A single-format playlist, the usual audiobook
case, parses exactly one file and stat's the rest.
The result is an estimate -- bitrate varies within a type, especially
for VBR -- but it is cheap and accurate enough for a progress
indicator, and the playing track always contributes its exact elapsed
time. Per-track lengths are stored as two bytes of minutes each in a
movable buffer sized to the track count and allocated only while the
tag is in use; the cache is keyed on the track count and a crc of the
first, middle and last filenames, so a playlist swap or reshuffle is
caught. If the buffer cannot be allocated (a very large playlist on a
low-memory target) the tag falls back to position-based progress.
The buffer is allocated when playback starts (and when the now-playing
screen is opened with playback already active) rather than lazily on the
first WPS refresh, so the one-time allocation happens at a playback
boundary instead of during steady-state playback; it falls back to
allocating on first use if that point is missed.
Until the scan finishes the tag does not blank: it returns an instant
equal-weight estimate -- (completed tracks + fraction through the
current one) / track count -- which sharpens into the size-based value
as the scan fills in. So a theme can just use %pX and it is correct
from the first frame, and %?pX is true whenever a playlist is loaded.
Tested on a Sansa Clip Zip and in the simulator. On a 216-track,
~745 MB single-format audiobook playlist the length scan dropped from
~4150 ms (get_metadata on every track) to ~174 ms (one parse plus 215
file-size stats), roughly 24x lighter.
Change-Id: I6e572e78a10444bd513ddc77e30da04aa5153ef2
The skin is not unloaded using skin_unload_all in
settings_apply_skins anymore since commit 0ca4b38.
usb_screen was last remaining user until commit a969e1f.
Change-Id: I65a41ed220165587a04e699a7f210c575c00a4eb
Moving the skin update from gui_synclist_set_title to
gui_synclist_draw (c41beeb) had the inadvertent side
effect that, if gui_synclist_select_item was called in
between, it may have missed a configured skinlist that
only got enabled by the skin update. Which could lead
to a selection appearing off screen.
This was mainly an issue if you had popped an activity,
which resets the skinlist cfg to NULL, but didn't perform
a skin update before the call to gui_synclist_select_item.
Now that GUI_EVENT_ACTIONREDRAW can be used instead of
GUI_EVENT_ACTIONUPDATE to prevent the display from being
updated, we may as well update the skin immediately in
gui_synclist_set_title again.
Change-Id: Iaee98d670ffb8d7b6590bd2ba11827fef5fba5a8
This disables custom scroll bars when initializing lists
that are currently always un-skinned, in scenarios where
there is neither a new activity to be pushed, nor is the
theme toggled.
Change-Id: I1bb05fc9be956c71e1adb70e764094082d9bb904
Takes care of disabling scroll bars when the current activity
doesn't change, but the theme is toggled. Applies to confirmation
prompts, for example.
Since we're updating the skin immediately afterwards, the cfg
will be reset as needed.
Change-Id: I8a62b6b4ad0abf5176ab6b3e39281021108cb59f
Some themes, such as Themify, FreshOS, iPod reFresh, Jive,
iPodOS, iPone, iClassic, AbsoluteBlack320, and possibly
others, draw a mask over the album art on the foreground
layer, in order to add rounded corners or to apply a fake
camera perspective (instead of taking advantage of the
backdrop layer).
This results in rendering glitches that can be fixed by
drawing the album art first.
Change-Id: Ie373c51304ab0d0a09b8663a8adff343a32ae5bb
Allow setting context menu items
reuses WPS hotkey items
Runs the item
displays the item
Open plugin shows the item name
Pitch shows the pitch speed amount
add 'Show In Files' hotkey item
devices without a hotkey get an extra item
added Manual entries
Change-Id: I427e70e1cad15364ac5d2a7114032e97cc9eee1a
The skin engine is responsible for drawing custom
scroll bars, but isn't kept in sync with list redraws.
Change-Id: Ieb457a4eb8442d4521c67a46a94c4d2132814c64
Eliminate the somewhat circuitous skin_defer_rendering
and skin_render_deferred functions introduced in commit
c145d19e85.
skin_render (and thus skin_update and sb_skin_update),
along with skinlist_draw, list_draw (and thus
gui_synclist_draw), and quickscreen_draw, will never
update the screen anymore. Instead, the skin is only
marked as dirty now.
GUI_EVENT_ACTIONUPDATE redraws the skin as necessary,
and updates the screen afterwards, if the skin is dirty.
This event is sent from get_action, just like before.
A new event, GUI_EVENT_ACTIONREDRAW allows you to redraw
the skin without causing an immediate update at the same
time.
Change-Id: Ib20644853ead901e32f639000f044d6935135bae
- Eliminate separate display update for USB screen UI vp;
wait for skin_render instead
- Eliminate outer loop around handle_usb_events
- Use handle_usb_events in Simulator as well.
Fixes USB screen being dismissed by any button presses,
or by system events.
- When USB keypad mode is changed, only redraw the title viewport
- Delete unused MODE_NAME_LEN #define
- Hide "USB keypad mode:" prefix. Only display current mode setting,
which requires less scrolling and ensures that the new setting
is always visible immediately after it has been changed
- Change comment from:
/* Don't return until we get SYS_USB_DISCONNECTED or SYS_TIMEOUT */
to: /* Don't return until we get SYS_USB_DISCONNECTED */
which reflects existing behavior (comment may have been
copy-pasted from usb_wait_for_disconnect_w_tmo)
- Don't scroll USB keypad mode unless UI vp's width is > 1, since
some themes try to hide the USB viewport and display a custom UI
instead
Change-Id: I9b9703025b00ad807920ee60a843f269f414f6f9
small bug, /t as the last character should left justify without
adding spaces to the end of string
/t also added too many spaces to the end of tabbed lines
adds info comment for new usage
ifdef removes some functionality for the bootloader
Change-Id: Ia4ba80f631f8bac3a13441912a8560616fa2c784
chris_s reported that a vp width of 1 wpuld cause the trxt reflow to go into an endless loop
check for this and skip displaying the splash
add a warning to the sim for catching unintentional cases of this
Change-Id: I9e1c561f745b5bcf113d0a6cdff57a00cd190fd4
only split a long word across lines if it is larger than screen width
also consider \0 as a valid place to split so we still run through the space finding loop
make /t left justify the splash window (in RTL langs it right justifies)
Change-Id: Id2955878a178c66cb0a1c644e62f943247666d8b
Fixes issues with multiple spaces
adds support for \n and multiple \n
adds support for \t (only at start of line)
adds utf8 aware string splitting
locks to max width/height
adds \f to reset min width / height
larger buffer for units with ram > 8mb
make splash buffer static
Needs testing
Change-Id: I46915043719dce0d696c5ab0da3ed92e4755829c
Regression introduced in commit 7aca1d4.
Quickscreen kept redrawing itself over the USB screen,
because remove_event_ex was only called after returning
from it.
Change-Id: I8a187809781cef46d13ed45392efecb28435a9df
Slight optimization of c145d19. Not supposed to result in
any visible difference.
- if UI viewport is drawn for GUI_EVENT_NEED_UI_UPDATE,
it doesn't need to do a viewport update; skin_render
already updates the display
- skin_render_deferred shouldn't need to request that
the skin perform an immediate update
Change-Id: Id03cf89357eaf0d61af1e928c94942d8c4882dba
In part regression introduced in c145d19e85.
force_waiting not taking multiple screens into
account appears to be pre-existing issue.
Change-Id: Iabfc2933470145eb512c8f2763fb350e170cb1fa
Immediately redraw when skin engine does refresh, so
themes that draw over UI viewport don't cause visible
flickering
Change-Id: I6f314cdfbd1136c710b9fee7526673e2f8b98849