Move the throbber to proper scheduled operation
This commit is contained in:
parent
0e28071fa3
commit
21a21e8143
25
amiga/gui.c
25
amiga/gui.c
|
@ -173,7 +173,6 @@ ULONG screen_signal = -1;
|
|||
struct MsgPort *applibport = NULL;
|
||||
ULONG applibsig = 0;
|
||||
BOOL refresh_favicon = FALSE;
|
||||
BOOL refresh_throbber = FALSE;
|
||||
struct Hook newprefs_hook;
|
||||
|
||||
STRPTR temp_homepage_url = NULL;
|
||||
|
@ -2116,7 +2115,7 @@ void ami_handle_msg(void)
|
|||
|
||||
case AMINS_WINDOW:
|
||||
ami_set_border_gadget_balance(gwin);
|
||||
ami_update_throbber(gwin,true);
|
||||
ami_throbber_redraw_schedule(0, gwin->bw->window);
|
||||
|
||||
if(gwin->tabs)
|
||||
{
|
||||
|
@ -2208,9 +2207,6 @@ void ami_handle_msg(void)
|
|||
if(gwin->bw->reformat_pending) {
|
||||
ami_schedule_redraw(gwin, true);
|
||||
}
|
||||
|
||||
if(gwin->bw->window->throbbing)
|
||||
ami_update_throbber(gwin,false);
|
||||
}
|
||||
} while(node = nnode);
|
||||
|
||||
|
@ -2220,12 +2216,6 @@ void ami_handle_msg(void)
|
|||
refresh_favicon = FALSE;
|
||||
}
|
||||
|
||||
if(refresh_throbber)
|
||||
{
|
||||
ami_update_throbber(gwin, true);
|
||||
refresh_throbber = FALSE;
|
||||
}
|
||||
|
||||
if(ami_menu_window_close)
|
||||
{
|
||||
if(ami_menu_window_close == (void *)AMI_MENU_WINDOW_CLOSE_ALL)
|
||||
|
@ -2596,7 +2586,6 @@ void ami_switch_tab(struct gui_window_2 *gwin,bool redraw)
|
|||
|
||||
p96RectFill(gwin->win->RPort, bbox->Left, bbox->Top,
|
||||
bbox->Width+bbox->Left, bbox->Height+bbox->Top, 0xffffffff);
|
||||
|
||||
browser_window_update(gwin->bw, false);
|
||||
|
||||
gui_window_set_scroll(gwin->bw->window,
|
||||
|
@ -2604,8 +2593,8 @@ void ami_switch_tab(struct gui_window_2 *gwin,bool redraw)
|
|||
gwin->redraw_scroll = false;
|
||||
|
||||
browser_window_refresh_url_bar(gwin->bw);
|
||||
|
||||
ami_gui_update_hotlist_button(gwin);
|
||||
ami_throbber_redraw_schedule(0, gwin->bw->window);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3155,6 +3144,11 @@ void ami_gui_tabs_toggle_all(void)
|
|||
} while(node = nnode);
|
||||
}
|
||||
|
||||
void ami_gui_search_ico_refresh(void *p)
|
||||
{
|
||||
search_web_select_provider(-1);
|
||||
}
|
||||
|
||||
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin)
|
||||
{
|
||||
nsurl *url;
|
||||
|
@ -3799,7 +3793,7 @@ gui_window_create(struct browser_window *bw,
|
|||
|
||||
if(locked_screen) UnlockPubScreen(NULL,scrn);
|
||||
|
||||
ami_schedule(0, search_web_select_provider, -1);
|
||||
ami_schedule(0, ami_gui_search_ico_refresh, NULL);
|
||||
|
||||
ScreenToFront(scrn);
|
||||
|
||||
|
@ -4756,7 +4750,8 @@ static nserror gui_search_web_provider_update(const char *provider_name,
|
|||
static uint32 ami_set_throbber_render_hook(struct Hook *hook, APTR space,
|
||||
struct gpRender *msg)
|
||||
{
|
||||
refresh_throbber = TRUE;
|
||||
struct gui_window_2 *gwin = hook->h_Data;
|
||||
ami_throbber_redraw_schedule(0, gwin->bw->window);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
105
amiga/theme.c
105
amiga/theme.c
|
@ -158,7 +158,7 @@ void ami_theme_throbber_setup(void)
|
|||
ami_get_theme_filename(throbberfile,"theme_throbber",false);
|
||||
throbber_frames=atoi(messages_get("theme_throbber_frames"));
|
||||
throbber_update_interval = atoi(messages_get("theme_throbber_delay"));
|
||||
if(throbber_update_interval == 0) throbber_update_interval = 100;
|
||||
if(throbber_update_interval == 0) throbber_update_interval = 250;
|
||||
|
||||
bm = ami_bitmap_from_datatype(throbberfile);
|
||||
throbber = ami_bitmap_get_native(bm, bm->width, bm->height, NULL);
|
||||
|
@ -424,16 +424,8 @@ void gui_window_start_throbber(struct gui_window *g)
|
|||
}
|
||||
|
||||
g->throbbing = true;
|
||||
|
||||
if((cur_tab == g->tab) || (g->shared->tabs <= 1))
|
||||
{
|
||||
GetAttr(SPACE_AreaBox, g->shared->objects[GID_THROBBER],
|
||||
(ULONG *)&bbox);
|
||||
|
||||
if(g->shared->throbber_frame == 0) g->shared->throbber_frame=1;
|
||||
|
||||
BltBitMapRastPort(throbber,throbber_width,0,g->shared->win->RPort,bbox->Left,bbox->Top,throbber_width,throbber_height,0x0C0);
|
||||
}
|
||||
g->shared->throbber_frame = 1;
|
||||
ami_throbber_redraw_schedule(throbber_update_interval, g);
|
||||
}
|
||||
|
||||
void gui_window_stop_throbber(struct gui_window *g)
|
||||
|
@ -453,8 +445,6 @@ void gui_window_stop_throbber(struct gui_window *g)
|
|||
g->shared->win, NULL);
|
||||
}
|
||||
|
||||
g->throbbing = false;
|
||||
|
||||
if((cur_tab == g->tab) || (g->shared->tabs <= 1))
|
||||
{
|
||||
GetAttr(SPACE_AreaBox, g->shared->objects[GID_THROBBER],
|
||||
|
@ -463,71 +453,58 @@ void gui_window_stop_throbber(struct gui_window *g)
|
|||
BltBitMapRastPort(throbber, 0, 0, g->shared->win->RPort, bbox->Left,
|
||||
bbox->Top, throbber_width, throbber_height, 0x0C0);
|
||||
}
|
||||
// g->shared->throbber_frame = 0;
|
||||
|
||||
g->throbbing = false;
|
||||
ami_throbber_redraw_schedule(-1, g);
|
||||
}
|
||||
|
||||
void ami_update_throbber(struct gui_window_2 *g, bool redraw)
|
||||
static void ami_throbber_update(void *p)
|
||||
{
|
||||
struct gui_window *g = (struct gui_window *)p;
|
||||
struct IBox *bbox;
|
||||
int frame;
|
||||
int frame = 0;
|
||||
ULONG cur_tab = 0;
|
||||
|
||||
if(!g) return;
|
||||
if(!g->objects[GID_THROBBER]) return;
|
||||
if(!g->shared->objects[GID_THROBBER]) return;
|
||||
|
||||
if(g->bw->window->throbbing == false)
|
||||
{
|
||||
frame = 0;
|
||||
g->throbber_frame = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
frame = g->throbber_frame;
|
||||
|
||||
if(!redraw)
|
||||
{
|
||||
if(g->throbber_update_count < throbber_update_interval)
|
||||
{
|
||||
g->throbber_update_count++;
|
||||
return;
|
||||
}
|
||||
|
||||
g->throbber_update_count = 0;
|
||||
|
||||
g->throbber_frame++;
|
||||
if(g->throbber_frame > (throbber_frames-1))
|
||||
g->throbber_frame=1;
|
||||
|
||||
}
|
||||
if(g->throbbing == true) {
|
||||
frame = g->shared->throbber_frame;
|
||||
g->shared->throbber_frame++;
|
||||
if(g->shared->throbber_frame > (throbber_frames-1))
|
||||
g->shared->throbber_frame=1;
|
||||
}
|
||||
|
||||
GetAttr(SPACE_AreaBox,(Object *)g->objects[GID_THROBBER],(ULONG *)&bbox);
|
||||
if(g->tab_node && (g->shared->tabs > 1))
|
||||
{
|
||||
GetAttr(CLICKTAB_Current, g->shared->objects[GID_TABS],
|
||||
(ULONG *)&cur_tab);
|
||||
}
|
||||
|
||||
/*
|
||||
EraseRect(g->win->RPort,bbox->Left,bbox->Top,
|
||||
bbox->Left+throbber_width,bbox->Top+throbber_height);
|
||||
*/
|
||||
if((cur_tab == g->tab) || (g->shared->tabs <= 1))
|
||||
{
|
||||
GetAttr(SPACE_AreaBox, g->shared->objects[GID_THROBBER],
|
||||
(ULONG *)&bbox);
|
||||
|
||||
BltBitMapTags(BLITA_SrcX, throbber_width * frame,
|
||||
BLITA_SrcY,0,
|
||||
BLITA_DestX,bbox->Left,
|
||||
BLITA_DestY,bbox->Top,
|
||||
BLITA_Width,throbber_width,
|
||||
BLITA_Height,throbber_height,
|
||||
BLITA_Source,throbber,
|
||||
BLITA_Dest,g->win->RPort,
|
||||
BLITA_SrcType,BLITT_BITMAP,
|
||||
BLITA_DestType,BLITT_RASTPORT,
|
||||
// BLITA_UseSrcAlpha,TRUE,
|
||||
BltBitMapTags(BLITA_SrcX, throbber_width * frame,
|
||||
BLITA_SrcY, 0,
|
||||
BLITA_DestX, bbox->Left,
|
||||
BLITA_DestY, bbox->Top,
|
||||
BLITA_Width, throbber_width,
|
||||
BLITA_Height, throbber_height,
|
||||
BLITA_Source, throbber,
|
||||
BLITA_Dest, g->shared->win->RPort,
|
||||
BLITA_SrcType, BLITT_BITMAP,
|
||||
BLITA_DestType, BLITT_RASTPORT,
|
||||
// BLITA_UseSrcAlpha, TRUE,
|
||||
TAG_DONE);
|
||||
}
|
||||
|
||||
if(frame > 0) ami_throbber_redraw_schedule(throbber_update_interval, g);
|
||||
}
|
||||
|
||||
static void ami_throbber_redraw(void *gwin)
|
||||
void ami_throbber_redraw_schedule(int t, struct gui_window *g)
|
||||
{
|
||||
ami_update_throbber((struct gui_window_2 *)gwin, true);
|
||||
}
|
||||
|
||||
void ami_throbber_redraw_schedule(int t, struct gui_window_2 *gwin)
|
||||
{
|
||||
ami_schedule(t, ami_throbber_redraw, (void *)gwin);
|
||||
ami_schedule(t, ami_throbber_update, g);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ void ami_update_pointer(struct Window *win, gui_pointer_shape shape);
|
|||
|
||||
void gui_window_start_throbber(struct gui_window *g);
|
||||
void gui_window_stop_throbber(struct gui_window *g);
|
||||
void ami_throbber_redraw_schedule(int t, struct gui_window_2 *gwin);
|
||||
void ami_throbber_redraw_schedule(int t, struct gui_window *g);
|
||||
|
||||
void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue