From 33123f8a45e3d3a5606060d598f13b969613786c Mon Sep 17 00:00:00 2001 From: Laan Tungir Date: Sun, 27 Sep 2026 19:20:10 -0400 Subject: [PATCH] v0.0.9 - Fix tab height: scale favicons to 16x16 and pin favicon image size so large favicons no longer inflate the tab strip --- Cargo.lock | 2 +- Cargo.toml | 2 +- VERSION | 2 +- src/tab_manager.rs | 13 +++++++++++-- src/version.rs | 4 ++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index de7fded..e3a709e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3055,7 +3055,7 @@ dependencies = [ [[package]] name = "sovereign_browser" -version = "0.0.8" +version = "0.0.9" dependencies = [ "anyhow", "base64", diff --git a/Cargo.toml b/Cargo.toml index ff116c4..bbfde8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ members = [ [package] name = "sovereign_browser" -version = "0.0.8" +version = "0.0.9" edition = "2021" license = "MIT" description = "A Linux x86 web browser built on WebKitGTK with Nostr identity" diff --git a/VERSION b/VERSION index d169b2f..c5d54ec 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.8 +0.0.9 diff --git a/src/tab_manager.rs b/src/tab_manager.rs index 25c50ae..f52ceb1 100644 --- a/src/tab_manager.rs +++ b/src/tab_manager.rs @@ -455,6 +455,8 @@ pub fn tab_manager_new_tab(notebook: >k::Notebook, ctx: &WebContext, url: Opti let favicon = gtk::Image::new(); favicon.set_valign(gtk::Align::Center); + // Fixed 16×16 so a large favicon can never inflate the tab height. + favicon.set_size_request(16, 16); tab_label.pack_start(&favicon, false, false, 0); let title_label = gtk::Label::new(Some("New Tab")); @@ -526,7 +528,8 @@ pub fn tab_manager_new_tab(notebook: >k::Notebook, ctx: &WebContext, url: Opti // WebKitGTK's favicon database (enabled in web_context) fetches and // caches favicons; `notify::favicon` fires when one is ready and // `webview.favicon()` returns a cairo surface. Mirrors the C - // `on_favicon_changed` (tab_manager.c:948). + // `on_favicon_changed` (tab_manager.c:948), including scaling large + // favicons down to 16×16 so they don't inflate the tab height. let favicon_clone = favicon.clone(); webview.connect_favicon_notify(move |wv| { if let Some(surface) = wv.favicon() { @@ -534,7 +537,13 @@ pub fn tab_manager_new_tab(notebook: >k::Notebook, ctx: &WebContext, url: Opti let w = img.width(); let h = img.height(); if w > 0 && h > 0 { - if let Some(pixbuf) = gdk::pixbuf_get_from_surface(&img, 0, 0, w, h) { + if let Some(raw) = gdk::pixbuf_get_from_surface(&img, 0, 0, w, h) { + let pixbuf = if w > 16 || h > 16 { + raw.scale_simple(16, 16, gdk_pixbuf::InterpType::Bilinear) + .unwrap_or(raw) + } else { + raw + }; favicon_clone.set_from_pixbuf(Some(&pixbuf)); } } diff --git a/src/version.rs b/src/version.rs index 2124ecd..12894f0 100644 --- a/src/version.rs +++ b/src/version.rs @@ -1,7 +1,7 @@ //! Version information for sovereign_browser /// The current version of sovereign_browser (with leading 'v'). -pub const VERSION: &str = "v0.0.8"; +pub const VERSION: &str = "v0.0.9"; /// Major version number. pub const VERSION_MAJOR: u32 = 0; @@ -10,4 +10,4 @@ pub const VERSION_MAJOR: u32 = 0; pub const VERSION_MINOR: u32 = 0; /// Patch version number. -pub const VERSION_PATCH: u32 = 8; +pub const VERSION_PATCH: u32 = 9;