Added default zoomlevel

This commit is contained in:
tsukasa 2026-08-12 19:05:30 +08:00
parent 3861c94c2c
commit 33a515dc43
2 changed files with 7 additions and 2 deletions

View file

@ -17,6 +17,9 @@ static const int WINDOW_HEIGHT = 800;
/* Fraction added/removed per zoom keypress. */ /* Fraction added/removed per zoom keypress. */
static const double ZOOM_STEP = 0.1; 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. */ /* Pixels scrolled per Ctrl+Shift+J/K press. */
static const int SCROLL_STEP = 120; static const int SCROLL_STEP = 120;

4
page.c
View file

@ -101,7 +101,7 @@ static void zoom_by(PageApp *app, double delta) {
} }
static void zoom_reset(PageApp *app) { 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) { 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)); WebKitSettings *settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(app->web_view));
webkit_settings_set_enable_developer_extras(settings, ENABLE_DEV_TOOLS); 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, "load-changed", G_CALLBACK(on_load_changed), app);
g_signal_connect(app->web_view, "notify::estimated-load-progress", g_signal_connect(app->web_view, "notify::estimated-load-progress",
G_CALLBACK(on_progress_changed), app); G_CALLBACK(on_progress_changed), app);