summaryrefslogtreecommitdiff
path: root/amiga
diff options
context:
space:
mode:
Diffstat (limited to 'amiga')
-rw-r--r--amiga/gui.c91
-rw-r--r--amiga/menu.c83
-rwxr-xr-xamiga/misc.c6
-rwxr-xr-xamiga/schedule.c171
-rw-r--r--amiga/theme.c103
-rw-r--r--amiga/theme.h4
6 files changed, 278 insertions, 180 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index bc01ff99e..9bf049a15 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -18,6 +18,7 @@
/* NetSurf core includes */
#include "content/backing_store.h"
+#include "content/fetchers.h"
#include "content/fetchers/resource.h"
#include "content/urldb.h"
#include "css/utils.h"
@@ -171,9 +172,6 @@ ULONG screen_signal = -1;
struct MsgPort *applibport = NULL;
ULONG applibsig = 0;
-BOOL refresh_search_ico = FALSE;
-BOOL refresh_favicon = FALSE;
-BOOL refresh_throbber = FALSE;
struct Hook newprefs_hook;
STRPTR temp_homepage_url = NULL;
@@ -1419,6 +1417,12 @@ static void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
g->favicon = icon;
}
+static void ami_gui_refresh_favicon(void *p)
+{
+ struct gui_window_2 *gwin = (struct gui_window_2 *)p;
+ gui_window_set_icon(gwin->bw->window, gwin->bw->window->favicon);
+}
+
void ami_handle_msg(void)
{
ULONG class,result,storage = 0,x,y,xs,ys,width=800,height=600;
@@ -2116,7 +2120,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)
{
@@ -2131,7 +2135,7 @@ void ami_handle_msg(void)
} while(tab=ntab);
}
- refresh_favicon = TRUE;
+ ami_schedule(0, ami_gui_refresh_favicon, gwin);
browser_window_schedule_reformat(gwin->bw);
ami_schedule_redraw(gwin, true);
break;
@@ -2201,31 +2205,8 @@ void ami_handle_msg(void)
// ReplyMsg((struct Message *)message);
}
- if(node->Type == AMINS_WINDOW)
- {
- if(gwin->bw->window->throbbing)
- ami_update_throbber(gwin,false);
- }
} while(node = nnode);
- if(refresh_search_ico)
- {
- search_web_select_provider(-1);
- refresh_search_ico = FALSE;
- }
-
- if(refresh_favicon)
- {
- gui_window_set_icon(gwin->bw->window, gwin->bw->window->favicon);
- 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)
@@ -2456,15 +2437,39 @@ void ami_get_msg(void)
ULONG appsig = 1L << appport->mp_SigBit;
ULONG schedulesig = 1L << msgport->mp_SigBit;
ULONG ctrlcsig = SIGBREAKF_CTRL_C;
- ULONG signal;
+ uint32 signal = 0;
+ fd_set read_fd_set, write_fd_set, except_fd_set;
+ int max_fd = -1;
struct TimerRequest *timermsg = NULL;
struct MsgPort *printmsgport = ami_print_get_msgport();
ULONG printsig = 0;
ULONG helpsignal = ami_help_signal();
if(printmsgport) printsig = 1L << printmsgport->mp_SigBit;
- ULONG signalmask = winsignal | appsig | schedulesig | rxsig | printsig | applibsig | ctrlcsig | helpsignal;
-
- signal = Wait(signalmask);
+ uint32 signalmask = winsignal | appsig | schedulesig | rxsig |
+ printsig | applibsig | helpsignal;
+
+ if ((fetcher_fdset(&read_fd_set, &write_fd_set, &except_fd_set, &max_fd) == NSERROR_OK) &&
+ (max_fd != -1)) {
+ /* max_fd is the highest fd in use, but waitselect() needs to know how many
+ * are in use, so we add 1. */
+ if (waitselect(max_fd + 1, &read_fd_set, &write_fd_set, &except_fd_set,
+ NULL, (unsigned int *)&signalmask) != -1) {
+ signal = signalmask;
+ } else {
+ LOG(("waitselect() returned error"));
+ /* \todo Fix Ctrl-C handling.
+ * WaitSelect() from bsdsocket.library returns -1 if the task was
+ * signalled with a Ctrl-C. waitselect() from newlib.library does not.
+ * Adding the Ctrl-C signal to our user signal mask causes a Ctrl-C to
+ * occur sporadically. Otherwise we never get a -1 except on error.
+ * NetSurf still terminates at the Wait() when network activity is over.
+ */
+ }
+ } else {
+ /* If fetcher_fdset fails or no network activity, do it the old fashioned way. */
+ signalmask |= ctrlcsig;
+ signal = Wait(signalmask);
+ }
if(signal & winsignal)
ami_handle_msg();
@@ -2547,8 +2552,8 @@ void ami_switch_tab(struct gui_window_2 *gwin,bool redraw)
GetAttr(CLICKTAB_CurrentNode, (Object *)gwin->objects[GID_TABS],
(ULONG *)&tabnode);
GetClickTabNodeAttrs(tabnode,
- TNA_UserData, &gwin->bw,
- TAG_DONE);
+ TNA_UserData, &gwin->bw,
+ TAG_DONE);
curbw = gwin->bw;
GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER], (ULONG *)&bbox);
@@ -2572,7 +2577,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,
@@ -2580,8 +2584,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);
}
}
@@ -3128,6 +3132,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;
@@ -3250,6 +3259,7 @@ gui_window_create(struct browser_window *bw,
if(nsoption_bool(new_tab_is_active)) ami_switch_tab(g->shared,false);
ami_update_buttons(g->shared);
+ ami_schedule(0, ami_gui_refresh_favicon, g->shared);
return g;
}
@@ -3772,7 +3782,7 @@ gui_window_create(struct browser_window *bw,
if(locked_screen) UnlockPubScreen(NULL,scrn);
- refresh_search_ico = TRUE;
+ ami_schedule(0, ami_gui_search_ico_refresh, NULL);
ScreenToFront(scrn);
@@ -4676,7 +4686,7 @@ static void gui_window_set_url(struct gui_window *g, const char *url)
static uint32 ami_set_favicon_render_hook(struct Hook *hook, APTR space,
struct gpRender *msg)
{
- refresh_favicon = TRUE;
+ ami_schedule(0, ami_gui_refresh_favicon, hook->h_Data);
return 0;
}
@@ -4736,7 +4746,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;
}
@@ -5129,6 +5140,8 @@ int main(int argc, char** argv)
.llcache = filesystem_llcache_table,
};
+ signal(SIGINT, SIG_IGN);
+
ret = netsurf_register(&amiga_table);
if (ret != NSERROR_OK) {
die("NetSurf operation table failed registration");
diff --git a/amiga/menu.c b/amiga/menu.c
index 784fec163..c1e863a65 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -35,8 +35,6 @@
#include <images/label.h>
#include <proto/bitmap.h>
#include <images/bitmap.h>
-#include <proto/glyph.h>
-#include <images/glyph.h>
#include <reaction/reaction_macros.h>
@@ -358,13 +356,34 @@ void ami_menu_free_glyphs(void)
menu_glyphs_loaded = false;
}
+static int ami_menu_calc_item_width(struct gui_window_2 *gwin, int j, struct RastPort *rp)
+{
+ int space_width = TextLength(rp, " ", 1);
+ int item_size;
+
+ item_size = TextLength(rp, gwin->menulab[j], strlen(gwin->menulab[j]));
+ item_size += space_width;
+
+ if(gwin->menukey[j]) {
+ item_size += TextLength(rp, &gwin->menukey[j], 1);
+ item_size += menu_glyph_width[NSA_GLYPH_AMIGAKEY];
+ /**TODO: take account of the size of other imagery too
+ */
+ }
+
+ return item_size;
+}
+
+
static struct gui_window_2 *ami_menu_layout(struct gui_window_2 *gwin)
{
int i, j;
- int txtlen = 0;
+ int txtlen = 0, subtxtlen = 0;
+ int left_posn;
struct RastPort *rp = &scrn->RastPort;
struct DrawInfo *dri = GetScreenDrawInfo(scrn);
-
+ int space_width = TextLength(rp, " ", 1);
+
if(menu_glyphs_loaded == false)
ami_menu_load_glyphs(dri);
@@ -373,18 +392,10 @@ static struct gui_window_2 *ami_menu_layout(struct gui_window_2 *gwin)
if(gwin->menutype[i] == NM_TITLE) {
j = i + 1;
txtlen = 0;
- int item_size = 0;
do {
if(gwin->menulab[j] != NM_BARLABEL) {
if(gwin->menutype[j] == NM_ITEM) {
- item_size = TextLength(rp, gwin->menulab[j], strlen(gwin->menulab[j]));
- if(gwin->menukey[j]) {
- item_size += TextLength(rp, &gwin->menukey[j], 1);
- item_size += menu_glyph_width[NSA_GLYPH_AMIGAKEY];
- /**TODO: take account of the size of other imagery too
- */
- }
-
+ int item_size = ami_menu_calc_item_width(gwin, j, rp);
if(item_size > txtlen) {
txtlen = item_size;
}
@@ -399,6 +410,7 @@ static struct gui_window_2 *ami_menu_layout(struct gui_window_2 *gwin)
using label.image if there's a bitmap associated with the item. */
if((gwin->menuicon[i] != NULL) && (gwin->menulab[i] != NM_BARLABEL)) {
int icon_width = 0;
+ Object *blank_space = NULL;
Object *submenuarrow = NULL;
Object *icon = BitMapObject,
BITMAP_Screen, scrn,
@@ -413,25 +425,60 @@ static struct gui_window_2 *ami_menu_layout(struct gui_window_2 *gwin)
TAG_DONE);
GetAttr(IA_Width, icon, (ULONG *)&icon_width);
-
+
+ if(gwin->menutype[i] == NM_SUB) {
+ left_posn = subtxtlen;
+ } else {
+ left_posn = txtlen;
+ }
+
+ left_posn = left_posn -
+ TextLength(rp, gwin->menulab[i], strlen(gwin->menulab[i])) -
+ icon_width - space_width;
+
if((gwin->menutype[i] == NM_ITEM) && (gwin->menutype[i+1] == NM_SUB)) {
+ left_posn -= menu_glyph_width[NSA_GLYPH_SUBMENU];
+
submenuarrow = NewObject(NULL, "sysiclass",
- SYSIA_Which, MENUSUB,
- SYSIA_DrawInfo, dri,
- IA_Left, txtlen - TextLength(rp, gwin->menulab[i], strlen(gwin->menulab[i])) -
- menu_glyph_width[NSA_GLYPH_SUBMENU] - icon_width,
+ SYSIA_Which, MENUSUB,
+ SYSIA_DrawInfo, dri,
+ IA_Left, left_posn,
TAG_DONE);
+
+ j = i + 1;
+ subtxtlen = 0;
+ do {
+ if(gwin->menulab[j] != NM_BARLABEL) {
+ if(gwin->menutype[j] == NM_SUB) {
+ int item_size = ami_menu_calc_item_width(gwin, j, rp);
+ if(item_size > subtxtlen) {
+ subtxtlen = item_size;
+ }
+ }
+ }
+ j++;
+ } while((gwin->menutype[j] == NM_SUB));
}
/**TODO: Checkmark/MX images and keyboard shortcuts
*/
+
+ if(gwin->menutype[i] == NM_SUB) {
+ blank_space = NewObject(NULL, "fillrectclass",
+ IA_Height, 0,
+ IA_Width, left_posn + icon_width,
+ TAG_DONE);
+ }
gwin->menuobj[i] = LabelObject,
LABEL_DrawInfo, dri,
LABEL_DisposeImage, TRUE,
LABEL_Image, icon,
+ LABEL_Text, " ",
LABEL_Text, gwin->menulab[i],
LABEL_DisposeImage, TRUE,
+ LABEL_Image, blank_space,
+ LABEL_DisposeImage, TRUE,
LABEL_Image, submenuarrow,
LabelEnd;
diff --git a/amiga/misc.c b/amiga/misc.c
index 67240006d..7d126c906 100755
--- a/amiga/misc.c
+++ b/amiga/misc.c
@@ -112,7 +112,7 @@ void die(const char *error)
/**
* Create a path from a nsurl using amiga file handling.
*
- * @parm[in] url The url to encode.
+ * @param[in] url The url to encode.
* @param[out] path_out A string containing the result path which should
* be freed by the caller.
* @return NSERROR_OK and the path is written to \a path or error code
@@ -254,8 +254,8 @@ char *translate_escape_chars(const char *s)
* @param[in,out] size The size of the space available if \a str not
* NULL on input and if not NULL set to the total
* output length on output.
- * @param[in] nemb The number of elements.
- * @param[in] ... The elements of the path as string pointers.
+ * @param[in] nelm The number of elements.
+ * @param[in] ap The elements of the path as string pointers.
* @return NSERROR_OK and the complete path is written to str
* or error code on faliure.
*/
diff --git a/amiga/schedule.c b/amiga/schedule.c
index 9aa74881f..6222917cf 100755
--- a/amiga/schedule.c
+++ b/amiga/schedule.c
@@ -39,7 +39,15 @@ struct nscallback
PblHeap *schedule_list;
-static void ami_remove_timer_event(struct nscallback *nscb)
+/**
+ * Remove timer event
+ *
+ * \param nscb callback
+ *
+ * The timer event for the callback is aborted
+ */
+
+static void ami_schedule_remove_timer_event(struct nscallback *nscb)
{
if(!nscb) return;
@@ -54,48 +62,112 @@ static void ami_remove_timer_event(struct nscallback *nscb)
}
/**
- * Unschedule a callback.
+ * Add timer event
+ *
+ * \param nscb callback
+ * \param t time in ms
+ *
+ * NetSurf will be signalled in t ms for this event.
+ */
+
+static nserror ami_schedule_add_timer_event(struct nscallback *nscb, int t)
+{
+ struct TimeVal tv;
+ ULONG time_us = t * 1000; /* t converted to µs */
+
+ nscb->tv.Seconds = time_us / 1000000;
+ nscb->tv.Microseconds = time_us % 1000000;
+
+ GetSysTime(&tv);
+ AddTime(&nscb->tv,&tv); // now contains time when event occurs
+
+ if(nscb->treq = AllocVecTagList(sizeof(struct TimeRequest), NULL)) {
+ *nscb->treq = *tioreq;
+ nscb->treq->Request.io_Command=TR_ADDREQUEST;
+ nscb->treq->Time.Seconds=nscb->tv.Seconds; // secs
+ nscb->treq->Time.Microseconds=nscb->tv.Microseconds; // micro
+ SendIO((struct IORequest *)nscb->treq);
+ } else {
+ return NSERROR_NOMEM;
+ }
+
+ return NSERROR_OK;
+}
+
+/**
+ * Locate a scheduled callback
*
* \param callback callback function
* \param p user parameter, passed to callback function
+ * \param remove remove callback from the heap
*
- * All scheduled callbacks matching both callback and p are removed.
+ * A scheduled callback matching both callback and p is returned, or NULL if none present.
*/
-static nserror schedule_remove(void (*callback)(void *p), void *p)
+static struct nscallback *ami_schedule_locate(void (*callback)(void *p), void *p, bool remove)
{
PblIterator *iterator;
struct nscallback *nscb;
- bool restoreheap = false;
-
- /* check there is something on the list to remove */
- if (schedule_list == NULL)
- {
- return NSERROR_OK;
- }
+ bool found_cb = false;
- if(pblHeapIsEmpty(schedule_list))
- {
- return NSERROR_OK;
- }
+ /* check there is something on the list */
+ if (schedule_list == NULL) return NULL;
+ if(pblHeapIsEmpty(schedule_list)) return NULL;
iterator = pblHeapIterator(schedule_list);
- while ((nscb = pblIteratorNext(iterator)) != -1)
- {
- if((nscb->callback == callback) && (nscb->p == p))
- {
- ami_remove_timer_event(nscb);
- pblIteratorRemove(iterator);
- FreeVec(nscb);
- restoreheap = true;
+ while ((nscb = pblIteratorNext(iterator)) != -1) {
+ if ((nscb->callback == callback) && (nscb->p == p)) {
+ if (remove == true) pblIteratorRemove(iterator);
+ found_cb = true;
+ break;
}
};
pblIteratorFree(iterator);
- if(restoreheap)
- {
+ if (found_cb == true) return nscb;
+ else return NULL;
+}
+
+/**
+ * Reschedule a callback.
+ *
+ * \param nscb callback
+ * \param t time in ms
+ *
+ * The nscallback will be rescheduled for t ms.
+ */
+
+static nserror ami_schedule_reschedule(struct nscallback *nscb, int t)
+{
+ ami_schedule_remove_timer_event(nscb);
+ if (ami_schedule_add_timer_event(nscb, t) != NSERROR_OK)
+ return NSERROR_NOMEM;
+
+ pblHeapConstruct(schedule_list);
+ return NSERROR_OK;
+}
+
+/**
+ * Unschedule a callback.
+ *
+ * \param callback callback function
+ * \param p user parameter, passed to callback function
+ *
+ * All scheduled callbacks matching both callback and p are removed.
+ */
+
+static nserror schedule_remove(void (*callback)(void *p), void *p)
+{
+ PblIterator *iterator;
+ struct nscallback *nscb;
+
+ nscb = ami_schedule_locate(callback, p, true);
+
+ if(nscb != NULL) {
+ ami_schedule_remove_timer_event(nscb);
+ FreeVec(nscb);
pblHeapConstruct(schedule_list);
}
@@ -113,7 +185,7 @@ static void schedule_remove_all(void)
while ((nscb = pblIteratorNext(iterator)) != -1)
{
- ami_remove_timer_event(nscb);
+ ami_schedule_remove_timer_event(nscb);
pblIteratorRemove(iterator);
FreeVec(nscb);
};
@@ -155,7 +227,7 @@ void schedule_run(BOOL poll)
callback = nscb->callback;
p = nscb->p;
- ami_remove_timer_event(nscb);
+ ami_schedule_remove_timer_event(nscb);
pblHeapRemoveFirst(schedule_list);
FreeVec(nscb);
callback(p);
@@ -200,11 +272,7 @@ void ami_schedule_open_timer(void)
/* exported function documented in amiga/schedule.h */
void ami_schedule_close_timer(void)
{
- if(ITimer)
- {
- DropInterface((struct Interface *)ITimer);
- }
-
+ if(ITimer) DropInterface((struct Interface *)ITimer);
CloseDevice((struct IORequest *) tioreq);
FreeSysObject(ASOT_IOREQUEST,tioreq);
FreeSysObject(ASOT_PORT,msgport);
@@ -214,41 +282,19 @@ void ami_schedule_close_timer(void)
nserror ami_schedule(int t, void (*callback)(void *p), void *p)
{
struct nscallback *nscb;
- struct TimeVal tv;
- ULONG time_us = 0;
-
- if(schedule_list == NULL)
- {
- return NSERROR_INIT_FAILED;
- }
- if(t < 0)
- {
- return schedule_remove(callback, p);
+ if(schedule_list == NULL) return NSERROR_INIT_FAILED;
+ if (t < 0) return schedule_remove(callback, p);
+
+ if (nscb = ami_schedule_locate(callback, p, false)) {
+ return ami_schedule_reschedule(nscb, t);
}
nscb = AllocVecTagList(sizeof(struct nscallback), NULL);
- if(!nscb)
- {
- return NSERROR_NOMEM;
- }
-
- time_us = t * 1000; /* t converted to µs */
-
- nscb->tv.Seconds = time_us / 1000000;
- nscb->tv.Microseconds = time_us % 1000000;
+ if(!nscb) return NSERROR_NOMEM;
- GetSysTime(&tv);
- AddTime(&nscb->tv,&tv); // now contains time when event occurs
-
- if(nscb->treq = AllocVecTagList(sizeof(struct TimeRequest), NULL))
- {
- *nscb->treq = *tioreq;
- nscb->treq->Request.io_Command=TR_ADDREQUEST;
- nscb->treq->Time.Seconds=nscb->tv.Seconds; // secs
- nscb->treq->Time.Microseconds=nscb->tv.Microseconds; // micro
- SendIO((struct IORequest *)nscb->treq);
- }
+ if (ami_schedule_add_timer_event(nscb, t) != NSERROR_OK)
+ return NSERROR_NOMEM;
nscb->callback = callback;
nscb->p = p;
@@ -257,3 +303,4 @@ nserror ami_schedule(int t, void (*callback)(void *p), void *p)
return NSERROR_OK;
}
+
diff --git a/amiga/theme.c b/amiga/theme.c
index 29c72574b..cc8b55d7f 100644
--- a/amiga/theme.c
+++ b/amiga/theme.c
@@ -36,11 +36,12 @@
#include "amiga/bitmap.h"
#include "amiga/drag.h"
-#include "desktop/browser_private.h"
-#include "utils/nsoption.h"
+#include "amiga/schedule.h"
#include "amiga/theme.h"
+#include "desktop/browser_private.h"
#include "desktop/searchweb.h"
#include "utils/messages.h"
+#include "utils/nsoption.h"
#include "utils/utils.h"
struct BitMap *throbber = NULL;
@@ -157,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);
@@ -423,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);
- }
+ if(g->shared->throbber_frame == 0) g->shared->throbber_frame = 1;
+ ami_throbber_redraw_schedule(throbber_update_interval, g);
}
void gui_window_stop_throbber(struct gui_window *g)
@@ -452,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],
@@ -462,60 +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;
+ 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;
}
- 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;
+ if(g->tab_node && (g->shared->tabs > 1))
+ {
+ GetAttr(CLICKTAB_Current, g->shared->objects[GID_TABS],
+ (ULONG *)&cur_tab);
+ }
- g->throbber_frame++;
- if(g->throbber_frame > (throbber_frames-1))
- g->throbber_frame=1;
+ 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->shared->win->RPort,
+ BLITA_SrcType, BLITT_BITMAP,
+ BLITA_DestType, BLITT_RASTPORT,
+ // BLITA_UseSrcAlpha, TRUE,
+ TAG_DONE);
}
- GetAttr(SPACE_AreaBox,(Object *)g->objects[GID_THROBBER],(ULONG *)&bbox);
+ if(frame > 0) ami_throbber_redraw_schedule(throbber_update_interval, g);
+}
-/*
- EraseRect(g->win->RPort,bbox->Left,bbox->Top,
- bbox->Left+throbber_width,bbox->Top+throbber_height);
-*/
-
- 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,
- TAG_DONE);
+void ami_throbber_redraw_schedule(int t, struct gui_window *g)
+{
+ ami_schedule(t, ami_throbber_update, g);
}
+
diff --git a/amiga/theme.h b/amiga/theme.h
index e81db33dd..c1aca15d7 100644
--- a/amiga/theme.h
+++ b/amiga/theme.h
@@ -44,6 +44,8 @@ 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 gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape);
+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
+