Draw favicon when iconyfied

svn path=/trunk/netsurf/; revision=13049
This commit is contained in:
Ole Loots 2011-10-14 20:56:52 +00:00
parent c69e75220d
commit ee7b223eca
2 changed files with 35 additions and 33 deletions

View File

@ -342,9 +342,8 @@ int window_destroy( struct gui_window * gw)
if( input_window == gw ) if( input_window == gw )
input_window = NULL; input_window = NULL;
window_set_icon( gw, NULL );
if( gw->root ) { if( gw->root ) {
window_set_icon( gw, NULL );
if( gw->root->toolbar ) if( gw->root->toolbar )
tb_destroy( gw->root->toolbar ); tb_destroy( gw->root->toolbar );
@ -405,11 +404,12 @@ void window_open( struct gui_window * gw)
void window_set_icon(struct gui_window * gw, struct bitmap * bmp ) void window_set_icon(struct gui_window * gw, struct bitmap * bmp )
{ {
/*
if( gw->icon != NULL ){ if( gw->icon != NULL ){
bitmap_destroy( gw->icon ); bitmap_destroy( gw->icon );
gw->icon = NULL; gw->icon = NULL;
} }*/
gw->icon = bmp; gw->icon = bmp;
} }
@ -634,7 +634,7 @@ static void __CDECL evnt_window_newtop( WINDOW *win, short buff[8], void *data )
LOG(("newtop: iw: %p, win: %p", input_window, win )); LOG(("newtop: iw: %p, win: %p", input_window, win ));
assert( input_window != NULL ); assert( input_window != NULL );
window_redraw_controls(input_window, 0); /* window_redraw_controls(input_window, 0); */
} }
static void __CDECL evnt_window_shaded( WINDOW *win, short buff[8], void *data ) static void __CDECL evnt_window_shaded( WINDOW *win, short buff[8], void *data )
@ -652,7 +652,7 @@ static void __CDECL evnt_window_icondraw( WINDOW *win, short buff[8], void * dat
short x,y,w,h; short x,y,w,h;
struct gui_window * gw = (struct gui_window*)data; struct gui_window * gw = (struct gui_window*)data;
LOG(("")); LOG((""));
WindClear( win); WindClear( win);
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h); WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
@ -669,7 +669,12 @@ static void __CDECL evnt_window_icondraw( WINDOW *win, short buff[8], void * dat
plotter->move( plotter, x, y ); plotter->move( plotter, x, y );
plotter->resize( plotter, w, h ); plotter->resize( plotter, w, h );
plotter->clip(plotter, &clip ); plotter->clip(plotter, &clip );
plotter->bitmap( plotter, gw->icon, 0, 0, 0xffffff, BITMAPF_NONE ); plotter->bitmap_resize( plotter, gw->icon, w, h );
plotter->bitmap(
plotter,
( gw->icon->resized ) ? gw->icon->resized : gw->icon,
0, 0, 0xffffff, BITMAPF_NONE
);
} }
} }

View File

@ -175,7 +175,7 @@ void gui_poll(bool active)
} }
if( evnt.timer != 0 && !active ){ if( evnt.timer != 0 && !active ){
/* this suits for stuff with lower priority */ /* this suits for stuff with lower priority */
//hotlist_redraw(); //hotlist_redraw();
atari_treeview_redraw( hl.tv ); atari_treeview_redraw( hl.tv );
} }
} }
@ -246,14 +246,14 @@ void gui_window_destroy(struct gui_window *w)
} }
if( w->next != NULL ) { if( w->next != NULL ) {
w->next->prev = w->prev; w->next->prev = w->prev;
} }
free(w); free(w);
w = NULL; w = NULL;
w = window_list; w = window_list;
int dummy=0; int dummy=0;
while( w != NULL ) { while( w != NULL ) {
if( w->root ) { if( w->root ) {
input_window = w; input_window = w;
break; break;
} }
@ -539,7 +539,6 @@ void gui_window_place_caret(struct gui_window *w, int x, int y, int height)
CMP_BROWSER b = w->browser; CMP_BROWSER b = w->browser;
if( w->browser->caret.current.g_w > 0 ) if( w->browser->caret.current.g_w > 0 )
gui_window_remove_caret( w ); gui_window_remove_caret( w );
w->browser->caret.requested.g_x = x; w->browser->caret.requested.g_x = x;
w->browser->caret.requested.g_y = y; w->browser->caret.requested.g_y = y;
w->browser->caret.requested.g_w = 2; w->browser->caret.requested.g_w = 2;
@ -577,17 +576,15 @@ gui_window_remove_caret(struct gui_window *w)
void void
gui_window_set_icon(struct gui_window *g, hlcache_handle *icon) gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
{ {
/* Untestet, favicon support has been dropped, so this is dead code. */ /* Untestet, favicon support has been dropped, so this is dead code. */
LOG((""));
/* struct bitmap *icon_bitmap;
struct bitmap *icon_bitmap; icon_bitmap = (icon != NULL) ? content_get_bitmap(icon) : NULL;
icon_bitmap = (icon != NULL) ? content_get_bitmap(icon) : NULL; if (icon_bitmap != NULL) {
if (icon_bitmap != NULL) { window_set_icon( g, icon_bitmap );
window_set_icon( g, icon_bitmap );
} }
*/
} }
void void
@ -962,16 +959,16 @@ nsurl *gui_get_resource_url(const char *path)
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
char *raw; char *raw;
nsurl *url = NULL; nsurl *url = NULL;
atari_find_resource((char*)&buf, path, path); atari_find_resource((char*)&buf, path, path);
raw = path_to_url((char*)&buf); raw = path_to_url((char*)&buf);
if (raw != NULL) { if (raw != NULL) {
nsurl_create(raw, &url); nsurl_create(raw, &url);
free(raw); free(raw);
} }
return url; return url;
} }
static void gui_init(int argc, char** argv) static void gui_init(int argc, char** argv)