mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-02-23 01:44:42 +03:00
ensure favicon is correctly set
svn path=/trunk/netsurf/; revision=13358
This commit is contained in:
parent
e0596793e1
commit
7124d96b1f
@ -1998,7 +1998,7 @@ void gui_window_set_icon(struct gui_window *_g, hlcache_handle *icon)
|
||||
{
|
||||
struct gtk_scaffolding *g = nsgtk_get_scaffold(_g);
|
||||
struct bitmap *icon_bitmap = NULL;
|
||||
GdkPixbuf *icon_pixbuf;
|
||||
GdkPixbuf *icon_pixbuf = NULL;
|
||||
|
||||
if (g->top_level != _g) {
|
||||
return;
|
||||
@ -2007,11 +2007,13 @@ void gui_window_set_icon(struct gui_window *_g, hlcache_handle *icon)
|
||||
if (icon != NULL) {
|
||||
icon_bitmap = content_get_bitmap(icon);
|
||||
if (icon_bitmap != NULL) {
|
||||
LOG(("Using %p bitmap", icon_bitmap));
|
||||
icon_pixbuf = nsgdk_pixbuf_get_from_surface(icon_bitmap->surface, 16, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (icon_pixbuf == NULL) {
|
||||
LOG(("Using default favicon"));
|
||||
g_object_ref(favicon_pixbuf);
|
||||
icon_pixbuf = favicon_pixbuf;
|
||||
}
|
||||
|
13
gtk/tabs.c
13
gtk/tabs.c
@ -197,20 +197,11 @@ void nsgtk_tab_add(struct gui_window *window,
|
||||
gtk_widget_show_all(tab_contents);
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(tabs),
|
||||
gtk_notebook_get_n_pages(GTK_NOTEBOOK(tabs)) - 1);
|
||||
if (option_new_blank) {
|
||||
/*char *blankpage = malloc(strlen(res_dir_location) +
|
||||
SLEN("file:///blankpage") + 1);
|
||||
blankpage = g_strconcat("file:///", res_dir_location,
|
||||
"blankpage", NULL); */
|
||||
/* segfaults
|
||||
struct browser_window *bw =
|
||||
nsgtk_get_browser_window(window);
|
||||
browser_window_go(bw, blankpage, 0, true); */
|
||||
/* free(blankpage); */
|
||||
}
|
||||
|
||||
if (background) {
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(tabs), remember);
|
||||
}
|
||||
|
||||
gtk_widget_grab_focus(GTK_WIDGET(nsgtk_scaffolding_urlbar(
|
||||
nsgtk_get_scaffold(window))));
|
||||
}
|
||||
|
16
image/ico.c
16
image/ico.c
@ -135,6 +135,7 @@ static bool nsico_convert(struct content *c)
|
||||
bmp = ico_find(ico->ico, 255, 255);
|
||||
if (bmp == NULL) {
|
||||
/* return error */
|
||||
LOG(("Failed to select icon"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -155,12 +156,18 @@ static bool nsico_redraw(struct content *c, struct content_redraw_data *data,
|
||||
|
||||
/* select most appropriate sized icon for size */
|
||||
bmp = ico_find(ico->ico, data->width, data->height);
|
||||
if (bmp == NULL) {
|
||||
/* return error */
|
||||
LOG(("Failed to select icon"));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ensure its decided */
|
||||
if (bmp->decoded == false) {
|
||||
if (bmp_decode(bmp) != BMP_OK) {
|
||||
return false;
|
||||
} else {
|
||||
LOG(("Decoding bitmap"));
|
||||
bitmap_modified(bmp->bitmap);
|
||||
}
|
||||
|
||||
@ -218,7 +225,14 @@ static void *nsico_get_internal(const struct content *c, void *context)
|
||||
nsico_content *ico = (nsico_content *) c;
|
||||
/* TODO: Pick best size for purpose.
|
||||
* Currently assumes it's for a URL bar. */
|
||||
struct bmp_image *bmp = ico_find(ico->ico, 16, 16);
|
||||
struct bmp_image *bmp;
|
||||
|
||||
bmp = ico_find(ico->ico, 16, 16);
|
||||
if (bmp == NULL) {
|
||||
/* return error */
|
||||
LOG(("Failed to select icon"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (bmp->decoded == false) {
|
||||
if (bmp_decode(bmp) != BMP_OK) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user