From 33a515dc43875ae40c07d1cd3356b84b0c05f72a Mon Sep 17 00:00:00 2001 From: tsukasa Date: Wed, 12 Aug 2026 19:05:30 +0800 Subject: [PATCH] Added default zoomlevel --- config.h | 5 ++++- page.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config.h b/config.h index a45c919..11a951e 100644 --- a/config.h +++ b/config.h @@ -17,6 +17,9 @@ static const int WINDOW_HEIGHT = 800; /* Fraction added/removed per zoom keypress. */ static const double ZOOM_STEP = 0.1; +/* Zoom level applied to every new view on startup (1.0 = 100%) */ +static const double ZOOM_DEFAULT = 1.0; + /* Pixels scrolled per Ctrl+Shift+J/K press. */ static const int SCROLL_STEP = 120; @@ -77,4 +80,4 @@ static const PageKeybind KEYBINDINGS[] = { static const size_t N_KEYBINDINGS = sizeof(KEYBINDINGS) / sizeof(KEYBINDINGS[0]); -#endif +#endif diff --git a/page.c b/page.c index 5feeeae..1a613ea 100644 --- a/page.c +++ b/page.c @@ -101,7 +101,7 @@ static void zoom_by(PageApp *app, double delta) { } static void zoom_reset(PageApp *app) { - webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(app->web_view), 1.0); + webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(app->web_view), ZOOM_DEFAULT); } static void toggle_fullscreen(PageApp *app) { @@ -274,6 +274,8 @@ static void activate(GtkApplication *gtk_app, gpointer user_data) { WebKitSettings *settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(app->web_view)); webkit_settings_set_enable_developer_extras(settings, ENABLE_DEV_TOOLS); + webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(app->web_view), ZOOM_DEFAULT); + g_signal_connect(app->web_view, "load-changed", G_CALLBACK(on_load_changed), app); g_signal_connect(app->web_view, "notify::estimated-load-progress", G_CALLBACK(on_progress_changed), app);