v0.0.9 - Fix tab height: scale favicons to 16x16 and pin favicon image size so large favicons no longer inflate the tab strip
This commit is contained in:
Generated
+1
-1
@@ -3055,7 +3055,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sovereign_browser"
|
||||
version = "0.0.8"
|
||||
version = "0.0.9"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64",
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
+11
-2
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user