osd: parse custom message FIFO by newline and render multi-line popups#124
Merged
henkwiedig merged 1 commit intoMay 20, 2026
Merged
Conversation
Closes OpenIPC#98 - CustomMsgManager now buffers partial reads and emits one fact per `\n`-terminated message instead of whatever happens to fit in a single read() call. If a writer never sends a newline the buffer is flushed after 512 bytes so the process cannot grow unboundedly. - Each message is unescaped before publishing: `\n` becomes a literal newline, letting writers that cannot produce a raw newline (e.g. plain `echo`) still build multi-line messages. - PopupWidget splits the message on `\n` and draws each line on its own row with a single background box sized to the longest line, so cairo no longer renders embedded newlines as a tofu glyph.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #98.
/run/pixelpilot.msgwas read once per second and whatever fit in a single non-blockingread()became one fact, so concurrent writers got glued together and a literal\nin the message rendered as a tofu square in the popup widget.Changes
src/main.cpp—CustomMsgManagerstd::stringbuffer instead of being published verbatim.\n-terminated chunk in the buffer is emitted as its ownosd.custom_messagefact, so multiple messages written during a single 1-second tick no longer collide.MAX_MSG_LEN(512 bytes) so we cannot grow unboundedly.\nbecomes a real newline. This lets writers that cannot emit raw newlines (e.g. plainecho, shellprintfwithout-e, some scripting hosts) still produce multi-line messages.src/osd.cpp—PopupWidget::drawcairo_show_text, which doesn't honour\n— embedded newlines used to render as a tofu glyph. Each message is now split on\nand drawn as separate lines.Testing
librockchip-mpp-dev,libdrm-dev, etc., which I don't have set up locally. The changed code only uses<string>/<vector>and existing cairo calls that were already in the file, so it should compile on the target.Notes
MAX_MSG_LENis 512 (well above the previous 119-byte single-read cap, but small enough to stay safe). Happy to bump it if you'd prefer a different ceiling.