feat: per-place fonts + live theme preview in wbconf#71
Merged
Conversation
Add Openbox-style font configuration and make wbconf fancier with a live theme/fonts preview. Compositor: - Theme gains FontSpec fields per place (active/inactive title, menu header, menu item, OSD); FontSpec.family is now std::string (safe to own parsed names). The frame/menu/switcher style adapters set each resolved TextStyle.font from them, so a configured title font also drives the titlebar height (frame_metrics measures the label font). - config.cpp parses Openbox <theme><font place="..."><name>/<size>/<weight>, applied onto the loaded theme. New pure wb::font_place_from_name() maps the Openbox place names (incl. OSD aliases) to FontPlace; unit-tested. wbconf: - New Fonts tab with a GtkFontDialogButton per place; RcDocument reads/writes the structured <font> elements as Pango "Family [Bold] Size" strings (round-trip unit-tested, including create/update/remove). - New live Preview pane on the Theme tab: a GtkDrawingArea that renders sample active/inactive titlebars (with window buttons) and a menu using the SAME theme/style/render pipeline as the compositor, so it is pixel-faithful. It reflects the live, unsaved selection and redraws when the theme or any font changes. wbconf now links style/widget/render in addition to theme. - data/rc.xml documents the <font> block. Tests: font_place_from_name + theme-font-flow + wbconf font round-trip; full suite 27 green (g++/ASan), clang + release clean. Headless: a 20pt title font enlarges the titlebar; wbconf maps with the Fonts tab and the preview renders with no Cairo/Pango/GTK errors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Adds Openbox-style per-place font configuration (you asked for font family/size selection) and makes wbconf fancier with a live, pixel-faithful theme preview.
Compositor — honour rc.xml fonts
waybox previously used a hardcoded
sans 10pteverywhere. Now:Themegains aFontSpecper place (active/inactive title, menu header, menu item, OSD);FontSpec.familyis nowstd::stringso parsed names are safely owned.TextStyle.fontfrom them — so a configured title font also drives the titlebar height (the metrics measure the label font).config.cppparses the Openbox<theme><font place="..."><name>/<size>/<weight>block onto the loaded theme. New purewb::font_place_from_name()maps the place names (incl. OSD aliases); unit-tested.wbconf — fonts + preview (fancier)
GtkFontDialogButtonper place.RcDocumentreads/writes the structured<font>elements as Pango"Family [Bold] Size"strings (round-trip unit-tested, incl. create/update/remove).GtkDrawingAreathat renders sample active/inactive titlebars (with window buttons) and a menu using the same theme/style/render pipeline as the compositor, so it's pixel-faithful. It reflects the live, unsaved selection and redraws when the theme or any font changes. wbconf now links style/widget/render.data/rc.xmldocuments the<font>block.Testing
font_place_from_name, theme-font → resolved-style flow, and wbconf<font>round-trip.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com