Move timer.device stuff to schedule.c

svn path=/trunk/netsurf/; revision=11712
This commit is contained in:
Chris Young 2011-02-19 17:19:38 +00:00
parent b76ef4333a
commit 3123192dfc
4 changed files with 38 additions and 28 deletions

View File

@ -79,7 +79,6 @@
#include <proto/keymap.h>
#include <proto/locale.h>
#include <proto/Picasso96API.h>
#include <proto/timer.h>
#include <proto/utility.h>
#include <proto/wb.h>
@ -133,8 +132,6 @@ char *quirks_stylesheet_url;
char *adblock_stylesheet_url;
struct MsgPort *appport;
struct Device *TimerBase;
struct TimerIFace *ITimer;
struct Library *PopupMenuBase = NULL;
struct PopupMenuIFace *IPopupMenu = NULL;
struct Library *KeymapBase = NULL;
@ -272,20 +269,7 @@ void ami_open_resources(void)
urlStringClass = MakeStringClass();
msgport = AllocSysObjectTags(ASOT_PORT,
ASO_NoTrack,FALSE,
TAG_DONE);
tioreq = (struct TimeRequest *)AllocSysObjectTags(ASOT_IOREQUEST,
ASOIOR_Size,sizeof(struct TimeRequest),
ASOIOR_ReplyPort,msgport,
ASO_NoTrack,FALSE,
TAG_DONE);
OpenDevice("timer.device",UNIT_WAITUNTIL,(struct IORequest *)tioreq,0);
TimerBase = (struct Device *)tioreq->Request.io_Device;
ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase,"main",1,NULL);
ami_schedule_open_timer();
if(!(appport = AllocSysObjectTags(ASOT_PORT,
ASO_NoTrack,FALSE,
@ -2131,15 +2115,7 @@ void gui_quit(void)
if(IKeymap) DropInterface((struct Interface *)IKeymap);
if(KeymapBase) CloseLibrary(KeymapBase);
if(ITimer)
{
DropInterface((struct Interface *)ITimer);
}
CloseDevice((struct IORequest *) tioreq);
FreeSysObject(ASOT_IOREQUEST,tioreq);
FreeSysObject(ASOT_PORT,msgport);
ami_schedule_close_timer();
ami_schedule_free();
FreeObjList(window_list);

View File

@ -133,7 +133,7 @@ void schedule_run(BOOL poll)
nscb = pblHeapGetFirst(schedule_list);
if(nscb == -1) return false;
if(nscb == -1) return;
if(poll)
{
@ -188,3 +188,33 @@ void ami_schedule_free(void)
{
pblHeapFree(schedule_list);
}
void ami_schedule_open_timer(void)
{
msgport = AllocSysObjectTags(ASOT_PORT,
ASO_NoTrack,FALSE,
TAG_DONE);
tioreq = (struct TimeRequest *)AllocSysObjectTags(ASOT_IOREQUEST,
ASOIOR_Size,sizeof(struct TimeRequest),
ASOIOR_ReplyPort,msgport,
ASO_NoTrack,FALSE,
TAG_DONE);
OpenDevice("timer.device", UNIT_WAITUNTIL, (struct IORequest *)tioreq, 0);
TimerBase = (struct Device *)tioreq->Request.io_Device;
ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase,"main",1,NULL);
}
void ami_schedule_close_timer(void)
{
if(ITimer)
{
DropInterface((struct Interface *)ITimer);
}
CloseDevice((struct IORequest *) tioreq);
FreeSysObject(ASOT_IOREQUEST,tioreq);
FreeSysObject(ASOT_PORT,msgport);
}

View File

@ -22,9 +22,14 @@
#include "amiga/os3support.h"
struct Device *TimerBase;
struct TimerIFace *ITimer;
struct TimeRequest *tioreq;
struct MsgPort *msgport;
void ami_schedule_open_timer(void);
void ami_schedule_close_timer(void);
BOOL ami_schedule_create(void);
void ami_schedule_free(void);
void schedule_run(BOOL poll);

View File

@ -30,7 +30,6 @@
#include <proto/graphics.h>
#include <proto/intuition.h>
#include <intuition/screens.h>
#include <datatypes/pictureclass.h>
struct gui_system_colour_ctx {
const char *name;