Preferences own some strings now.
Some checks failed
CI / ubuntu-latest-html-tests (push) Has been cancelled
CI / alpine-mbedtls-3_6_0 (push) Has been cancelled
CI / ubuntu-latest-no-tls (push) Has been cancelled
CI / ubuntu-latest-mbedtls2 (push) Has been cancelled
CI / ubuntu-latest-openssl-3 (push) Has been cancelled
CI / ubuntu-latest-with-old-std (push) Has been cancelled
CI / ubuntu-20-04-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-3 (push) Has been cancelled
CI / freebsd-14-openssl-3 (push) Has been cancelled
CI / windows-mbedtls (push) Has been cancelled

This commit is contained in:
2026-01-07 04:37:28 -05:00
parent be1bc2571f
commit 122d3f894e
5 changed files with 28 additions and 31 deletions

View File

@ -1197,7 +1197,7 @@ static CacheEntry_t *Cache_process_queue(CacheEntry_t *entry)
entry->TypeHdr); entry->TypeHdr);
TypeMismatch = true; TypeMismatch = true;
} }
entry->TypeDet = dStrdup(Type); entry->TypeDet = Type;
entry->Flags |= CA_GotContentType; entry->Flags |= CA_GotContentType;
} else } else
return entry; /* i.e., wait for more data */ return entry; /* i.e., wait for more data */

View File

@ -213,11 +213,11 @@ static void checkFont(const char *name, const char *type)
static void checkPreferredFonts() static void checkPreferredFonts()
{ {
checkFont(prefs.font_sans_serif, "sans-serif"); checkFont(prefs.font_sans_serif.c_str(), "sans-serif");
checkFont(prefs.font_serif, "serif"); checkFont(prefs.font_serif.c_str(), "serif");
checkFont(prefs.font_monospace, "monospace"); checkFont(prefs.font_monospace.c_str(), "monospace");
checkFont(prefs.font_cursive, "cursive"); checkFont(prefs.font_cursive.c_str(), "cursive");
checkFont(prefs.font_fantasy, "fantasy"); checkFont(prefs.font_fantasy.c_str(), "fantasy");
} }
/** /**
@ -428,7 +428,7 @@ int main(int argc, char **argv)
checkPreferredFonts(); checkPreferredFonts();
/* use preferred font for UI */ /* use preferred font for UI */
Fl_Font defaultFont = dw::fltk::FltkFont::get (prefs.font_sans_serif, 0); Fl_Font defaultFont = dw::fltk::FltkFont::get (prefs.font_sans_serif.c_str(), 0);
Fl::set_font(FL_HELVETICA, defaultFont); // this seems to be the Fl::set_font(FL_HELVETICA, defaultFont); // this seems to be the
// only way to set the // only way to set the
// default font in fltk1.3 // default font in fltk1.3

View File

@ -45,15 +45,15 @@ void a_Prefs_init(void)
prefs.contrast_visited_color = TRUE; prefs.contrast_visited_color = TRUE;
prefs.enterpress_forces_submit = FALSE; prefs.enterpress_forces_submit = FALSE;
prefs.focus_new_tab = FALSE; prefs.focus_new_tab = FALSE;
prefs.font_cursive = dStrdup(PREFS_FONT_CURSIVE); prefs.font_cursive = (PREFS_FONT_CURSIVE);
prefs.font_factor = 1.0; prefs.font_factor = 1.0;
prefs.zoom_factor = 1.0; prefs.zoom_factor = 1.0;
prefs.font_max_size = 100; prefs.font_max_size = 100;
prefs.font_min_size = 6; prefs.font_min_size = 6;
prefs.font_fantasy = dStrdup(PREFS_FONT_FANTASY); prefs.font_fantasy = (PREFS_FONT_FANTASY);
prefs.font_monospace = dStrdup(PREFS_FONT_MONOSPACE); prefs.font_monospace = (PREFS_FONT_MONOSPACE);
prefs.font_sans_serif = dStrdup(PREFS_FONT_SANS_SERIF); prefs.font_sans_serif = (PREFS_FONT_SANS_SERIF);
prefs.font_serif = dStrdup(PREFS_FONT_SERIF); prefs.font_serif = (PREFS_FONT_SERIF);
prefs.fullwindow_start = FALSE; prefs.fullwindow_start = FALSE;
/* these four constitute the geometry */ /* these four constitute the geometry */
@ -146,11 +146,6 @@ void a_Prefs_freeall(void)
{ {
int i; int i;
dFree(prefs.font_cursive);
dFree(prefs.font_fantasy);
dFree(prefs.font_monospace);
dFree(prefs.font_sans_serif);
dFree(prefs.font_serif);
delete prefs.home; delete prefs.home;
dFree(prefs.http_language); dFree(prefs.http_language);
delete prefs.http_proxy; delete prefs.http_proxy;

View File

@ -36,7 +36,8 @@ extern "C" {
/** Panel sizes. */ /** Panel sizes. */
enum { P_tiny = 0, P_small, P_medium }; enum { P_tiny = 0, P_small, P_medium };
typedef struct { struct DilloPrefs
{
int width; int width;
int height; int height;
int xpos; int xpos;
@ -107,11 +108,11 @@ typedef struct {
bool http_strict_transport_security; bool http_strict_transport_security;
bool http_force_https; bool http_force_https;
int32_t buffered_drawing; int32_t buffered_drawing;
char *font_serif; std::string font_serif;
char *font_sans_serif; std::string font_sans_serif;
char *font_cursive; std::string font_cursive;
char *font_fantasy; std::string font_fantasy;
char *font_monospace; std::string font_monospace;
bool enterpress_forces_submit; bool enterpress_forces_submit;
bool middle_click_opens_new_tab; bool middle_click_opens_new_tab;
bool right_click_closes_tab; bool right_click_closes_tab;
@ -127,7 +128,7 @@ typedef struct {
int penalty_em_dash_left, penalty_em_dash_right, penalty_em_dash_right_2; int penalty_em_dash_left, penalty_em_dash_right, penalty_em_dash_right_2;
int stretchability_factor; int stretchability_factor;
Dlist *link_actions; Dlist *link_actions;
} DilloPrefs; };
/** Global Data */ /** Global Data */
extern DilloPrefs prefs; extern DilloPrefs prefs;

View File

@ -82,7 +82,7 @@ StyleEngine::StyleEngine (dw::core::Layout *layout,
Node *n = &stack.back (); Node *n = &stack.back ();
/* Create a dummy font, attribute, and tag for the bottom of the stack. */ /* Create a dummy font, attribute, and tag for the bottom of the stack. */
font_attrs.name = prefs.font_sans_serif; font_attrs.name = prefs.font_sans_serif.c_str();
font_attrs.size = roundInt(14 * prefs.font_factor * zoom); font_attrs.size = roundInt(14 * prefs.font_factor * zoom);
if (font_attrs.size < prefs.font_min_size) if (font_attrs.size < prefs.font_min_size)
font_attrs.size = prefs.font_min_size; font_attrs.size = prefs.font_min_size;
@ -356,7 +356,8 @@ void StyleEngine::apply (int i, StyleAttrs *attrs, CssPropertyList *props,
BrowserWindow *bw) { BrowserWindow *bw) {
FontAttrs fontAttrs = *attrs->font; FontAttrs fontAttrs = *attrs->font;
Font *parentFont = stack.at (i - 1).style->font; Font *parentFont = stack.at (i - 1).style->font;
char *c, *fontName; char *c;
const char *fontName;
int lineHeight; int lineHeight;
std::unique_ptr< DilloUrl > imgUrl; std::unique_ptr< DilloUrl > imgUrl;
@ -376,15 +377,15 @@ void StyleEngine::apply (int i, StyleAttrs *attrs, CssPropertyList *props,
dStrstrip(p->value.strVal); dStrstrip(p->value.strVal);
if (dStrAsciiCasecmp (p->value.strVal, "serif") == 0) if (dStrAsciiCasecmp (p->value.strVal, "serif") == 0)
fontName = prefs.font_serif; fontName = prefs.font_serif.c_str();
else if (dStrAsciiCasecmp (p->value.strVal, "sans-serif") == 0) else if (dStrAsciiCasecmp (p->value.strVal, "sans-serif") == 0)
fontName = prefs.font_sans_serif; fontName = prefs.font_sans_serif.c_str();
else if (dStrAsciiCasecmp (p->value.strVal, "cursive") == 0) else if (dStrAsciiCasecmp (p->value.strVal, "cursive") == 0)
fontName = prefs.font_cursive; fontName = prefs.font_cursive.c_str();
else if (dStrAsciiCasecmp (p->value.strVal, "fantasy") == 0) else if (dStrAsciiCasecmp (p->value.strVal, "fantasy") == 0)
fontName = prefs.font_fantasy; fontName = prefs.font_fantasy.c_str();
else if (dStrAsciiCasecmp (p->value.strVal, "monospace") == 0) else if (dStrAsciiCasecmp (p->value.strVal, "monospace") == 0)
fontName = prefs.font_monospace; fontName = prefs.font_monospace.c_str();
else if (Font::exists(layout, p->value.strVal)) else if (Font::exists(layout, p->value.strVal))
fontName = p->value.strVal; fontName = p->value.strVal;