version 1.107, 2008/01/28 16:17:08
|
version 1.108, 2009/11/26 15:22:19
|
Line 1
|
Line 1
|
/* |
/* |
* |
* |
* (c) COPYRIGHT INRIA and W3C, 1996-2008 |
* (c) COPYRIGHT INRIA and W3C, 1996-2009 |
* Please first read the full copyright statement in file COPYRIGHT. |
* Please first read the full copyright statement in file COPYRIGHT. |
* |
* |
*/ |
*/ |
Line 17
|
Line 17
|
* |
* |
*/ |
*/ |
|
|
#if defined(_GTK) |
|
#include <glib.h> |
|
#endif /* _GTK */ |
|
|
|
#ifdef _WX |
#ifdef _WX |
#include "wxAmayaTimer.h" |
#include "wxAmayaTimer.h" |
#include "wxAmayaSocketEvent.h" |
#include "wxAmayaSocketEvent.h" |
Line 38
|
Line 34
|
#define DEBUG_LIBWWW |
#define DEBUG_LIBWWW |
#define THD_TRACE 1 |
#define THD_TRACE 1 |
#endif |
#endif |
|
#ifdef _WX |
#if defined(_GTK) || defined(_WX) |
|
/* Private functions */ |
/* Private functions */ |
static void RequestRegisterReadXtevent (SOCKET); |
static void RequestRegisterReadXtevent (SOCKET); |
static void RequestKillReadXtevent (SOCKET); |
static void RequestKillReadXtevent (SOCKET); |
Line 47 static void RequestRegisterWrite
|
Line 42 static void RequestRegisterWrite
|
static void RequestKillWriteXtevent (SOCKET); |
static void RequestKillWriteXtevent (SOCKET); |
static void RequestRegisterExceptXtevent ( SOCKET); |
static void RequestRegisterExceptXtevent ( SOCKET); |
static void RequestKillExceptXtevent (SOCKET); |
static void RequestKillExceptXtevent (SOCKET); |
#endif /* #if defined(_GTK) */ |
#endif /* _WX */ |
|
|
/* Private variables */ |
/* Private variables */ |
|
|
/* |
/* |
* this set of HTEventType map our WinSock "socket event HTEventType" into |
* this set of HTEventType map our WinSock "socket event HTEventType" into |
* our read and write sets. Note that under the canonical Unix model, |
* our read and write sets. Note that under the canonical Unix model, |
Line 64 static const HTEventType ReadBits = (HTE
|
Line 58 static const HTEventType ReadBits = (HTE
|
static const HTEventType WriteBits = (HTEventType)(HTEvent_WRITE | HTEvent_CONNECT); |
static const HTEventType WriteBits = (HTEventType)(HTEvent_WRITE | HTEvent_CONNECT); |
static const HTEventType ExceptBits = (HTEventType)HTEvent_OOB; |
static const HTEventType ExceptBits = (HTEventType)HTEvent_OOB; |
|
|
#if defined(_GTK) |
#ifdef _WX |
typedef struct sStatus { |
|
gint read; /* the different GTK Id's */ |
|
gint write; |
|
gint except; |
|
} SocketStatus; |
|
#endif /* _GTK */ |
|
#if defined(_WX) |
|
typedef struct sStatus { |
typedef struct sStatus { |
int read; |
int read; |
int write; |
int write; |
int except; |
int except; |
} SocketStatus; |
} SocketStatus; |
#endif /* _WX */ |
#endif /* _WX */ |
#if defined(_GTK) || defined(_WX) |
#ifdef _WX |
#define SOCK_TABLE_SIZE 67 |
#define SOCK_TABLE_SIZE 67 |
#define HASH(s) ((s) % SOCK_TABLE_SIZE) |
#define HASH(s) ((s) % SOCK_TABLE_SIZE) |
static SocketStatus persSockets[SOCK_TABLE_SIZE]; |
static SocketStatus persSockets[SOCK_TABLE_SIZE]; |
#endif /* defined(_GTK) || defined(_WX) */ |
#endif /* _WX */ |
|
|
/*-------------------------------------------------------------------- |
/*-------------------------------------------------------------------- |
AHTCallback_bridge |
AHTCallback_bridge |
Line 105 void *AHTCallback_bridge (caddr_t cd, in
|
Line 92 void *AHTCallback_bridge (caddr_t cd, in
|
return (0); |
return (0); |
} |
} |
|
|
#if defined(_GTK) |
|
static void AHTCallback_bridgeGTK (gpointer data, gint source, GdkInputCondition condition) |
|
{ |
|
int status; /* the status result of the libwwww call */ |
|
HTEventType type = HTEvent_ALL; |
|
int v; |
|
int socket; |
|
ms_t now = HTGetTimeInMillis(); |
|
|
|
socket = (SOCKET) ((intptr_t) data); |
|
v = HASH (socket); |
|
|
|
/* convert the FD into an HTEventType which will allow us to find the |
|
request associated with the socket */ |
|
|
|
/* I could send some other data here, like the event itself, right */ |
|
switch (condition) |
|
{ |
|
case GDK_INPUT_READ: |
|
type = HTEvent_READ; |
|
break; |
|
case GDK_INPUT_WRITE: |
|
type = HTEvent_WRITE; |
|
break; |
|
case GDK_INPUT_EXCEPTION: |
|
type = HTEvent_OOB; |
|
break; |
|
default: |
|
type = HTEvent_ALL; |
|
break; |
|
} /* switch */ |
|
|
|
/* Invokes the callback associated to the requests */ |
|
|
|
/** CanDoStop_set (FALSE); **/ |
|
if ((status = HTEventList_dispatch (socket, type, now)) != HT_OK) |
|
{ |
|
#ifdef DEBUG_LIBWWW |
|
HTTrace ("Callback.... returned a value != HT_OK"); |
|
#endif |
|
} |
|
/*** CanDoStop_set (TRUE); **/ |
|
} |
|
#endif /* _GTK */ |
|
|
|
|
|
#if defined(_WX) |
#if defined(_WX) |
static void AHTCallback_bridgeWX ( int register_id, int socket, wxAmayaSocketCondition condition) |
static void AHTCallback_bridgeWX ( int register_id, int socket, wxAmayaSocketCondition condition) |
{ |
{ |
Line 345 int AHTEvent_register (SOCKET sock, HTEv
|
Line 286 int AHTEvent_register (SOCKET sock, HTEv
|
} |
} |
else |
else |
{ |
{ |
#if defined(_GTK) || defined(_WX) |
#ifdef _WX |
/* need something special for HTEvent_CLOSE */ |
/* need something special for HTEvent_CLOSE */ |
if (type & ReadBits) |
if (type & ReadBits) |
RequestRegisterReadXtevent (sock); |
RequestRegisterReadXtevent (sock); |
Line 355 int AHTEvent_register (SOCKET sock, HTEv
|
Line 296 int AHTEvent_register (SOCKET sock, HTEv
|
|
|
if (type & ExceptBits) |
if (type & ExceptBits) |
RequestRegisterExceptXtevent (sock); |
RequestRegisterExceptXtevent (sock); |
#endif /* defined(_GTK) || defined(_WX) */ |
#endif /* _WX */ |
#ifdef _WINDOWS |
#ifdef _WINDOWS |
/* under windows, libwww requires an explicit FD_CLOSE registration |
/* under windows, libwww requires an explicit FD_CLOSE registration |
to detect HTTP responses not having a Content-Length header */ |
to detect HTTP responses not having a Content-Length header */ |
status = HTEventList_register (sock, (HTEventType)(type | HTEvent_CLOSE) , event); |
status = HTEventList_register (sock, (HTEventType)(type | HTEvent_CLOSE) , event); |
#endif /* _WINDOWS */ |
#endif /* _WINDOWS */ |
#if defined(_UNIX) |
#ifdef _UNIX |
status = HTEventList_register (sock, type, event); |
status = HTEventList_register (sock, type, event); |
#endif /* #if defined(_UNIX) */ |
#endif /* _UNIX */ |
|
|
return (status); |
return (status); |
} |
} |
} |
} |
Line 383 int AHTEvent_unregister (SOCKET sock, HT
|
Line 323 int AHTEvent_unregister (SOCKET sock, HT
|
if (sock == INVSOC) |
if (sock == INVSOC) |
return HT_OK; |
return HT_OK; |
|
|
#if defined(_GTK) || defined(_WX) |
#ifdef _WX |
/* remove the Xt event hooks */ |
/* remove the Xt event hooks */ |
if (type & ReadBits) |
if (type & ReadBits) |
RequestKillReadXtevent (sock); |
RequestKillReadXtevent (sock); |
Line 393 int AHTEvent_unregister (SOCKET sock, HT
|
Line 333 int AHTEvent_unregister (SOCKET sock, HT
|
|
|
if (type & ExceptBits) |
if (type & ExceptBits) |
RequestKillExceptXtevent (sock); |
RequestKillExceptXtevent (sock); |
#endif /* #if defined(_GTK) || defined(_WX) */ |
#endif /* _WX */ |
|
|
/* @@@ if this is the default for windows, no need to have AHTEvent_.. |
/* @@@ if this is the default for windows, no need to have AHTEvent_.. |
in windows!! */ |
in windows!! */ |
Line 403 int AHTEvent_unregister (SOCKET sock, HT
|
Line 343 int AHTEvent_unregister (SOCKET sock, HT
|
} |
} |
|
|
/* Private functions */ |
/* Private functions */ |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
RequestKillAllXtevents |
RequestKillAllXtevents |
front-end for kill all Xt events associated with the request pointed |
front-end for kill all Xt events associated with the request pointed |
Line 411 int AHTEvent_unregister (SOCKET sock, HT
|
Line 350 int AHTEvent_unregister (SOCKET sock, HT
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void RequestKillAllXtevents (AHTReqContext * me) |
void RequestKillAllXtevents (AHTReqContext * me) |
{ |
{ |
#if defined(_GTK) || defined(_WX) |
#ifdef _WX |
int sock = INVSOC; |
int sock = INVSOC; |
|
|
return; |
return; |
Line 433 void RequestKillAllXtevents (AHTReqConte
|
Line 372 void RequestKillAllXtevents (AHTReqConte
|
RequestKillReadXtevent (sock); |
RequestKillReadXtevent (sock); |
RequestKillWriteXtevent (sock); |
RequestKillWriteXtevent (sock); |
RequestKillExceptXtevent (sock); |
RequestKillExceptXtevent (sock); |
#endif /* defined(_GTK) || defined(_WX) */ |
#endif /* _WX */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 442 void RequestKillAllXtevents (AHTReqConte
|
Line 381 void RequestKillAllXtevents (AHTReqConte
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static void RequestRegisterReadXtevent (SOCKET sock) |
static void RequestRegisterReadXtevent (SOCKET sock) |
{ |
{ |
#if defined(_GTK) || defined(_WX) |
#ifdef _WX |
int v; |
int v; |
|
|
v = HASH (sock); |
v = HASH (sock); |
if (!persSockets[v].read) |
if (!persSockets[v].read) |
{ |
{ |
#if defined(_GTK) |
|
persSockets[v].read = gdk_input_add ((gint) sock, |
|
GDK_INPUT_READ, |
|
AHTCallback_bridgeGTK, |
|
(gpointer) sock); |
|
#endif /* _GTK */ |
|
#if defined(_WX) |
|
persSockets[v].read = wxAmayaSocketEvent::RegisterSocket( sock, |
persSockets[v].read = wxAmayaSocketEvent::RegisterSocket( sock, |
WXAMAYASOCKET_READ, |
WXAMAYASOCKET_READ, |
AHTCallback_bridgeWX ); |
AHTCallback_bridgeWX ); |
#endif /* _WX */ |
|
|
|
#ifdef DEBUG_LIBWWW |
#ifdef DEBUG_LIBWWW |
if (THD_TRACE) |
if (THD_TRACE) |
fprintf (stderr, "RegisterReadXtEvent: adding XtInput %lu Socket %d\n", |
fprintf (stderr, "RegisterReadXtEvent: adding XtInput %lu Socket %d\n", |
persSockets[v].read, sock); |
persSockets[v].read, sock); |
#endif /* DEBUG_LIBWWW */ |
#endif /* DEBUG_LIBWWW */ |
} |
} |
#endif /* defined(_GTK) || defined(_WX) */ |
#endif /* _WX */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 475 static void RequestRegisterReadXtevent (
|
Line 405 static void RequestRegisterReadXtevent (
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static void RequestKillReadXtevent (SOCKET sock) |
static void RequestKillReadXtevent (SOCKET sock) |
{ |
{ |
#if defined(_GTK) || defined(_WX) |
#ifdef _WX |
int v; |
int v; |
|
|
v = HASH (sock); |
v = HASH (sock); |
Line 486 static void RequestKillReadXtevent (SOCK
|
Line 416 static void RequestKillReadXtevent (SOCK
|
fprintf (stderr, "UnregisterReadXtEvent: Clearing XtInput %lu\n", |
fprintf (stderr, "UnregisterReadXtEvent: Clearing XtInput %lu\n", |
persSockets[v].read); |
persSockets[v].read); |
#endif /* DEBUG_LIBWWW */ |
#endif /* DEBUG_LIBWWW */ |
|
|
#if defined(_GTK) |
|
gdk_input_remove (persSockets[v].read); |
|
persSockets[v].read = (gint) 0; |
|
#endif /* !_GTK */ |
|
#if defined(_WX) |
|
wxAmayaSocketEvent::UnregisterSocket( persSockets[v].read ); |
wxAmayaSocketEvent::UnregisterSocket( persSockets[v].read ); |
persSockets[v].read = 0; |
persSockets[v].read = 0; |
#endif /* _WX */ |
|
|
|
} |
} |
#endif /* defined(_GTK) || defined(_WX) */ |
#endif /* _WX */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 506 static void RequestKillReadXtevent (SOCK
|
Line 428 static void RequestKillReadXtevent (SOCK
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static void RequestRegisterWriteXtevent (SOCKET sock) |
static void RequestRegisterWriteXtevent (SOCKET sock) |
{ |
{ |
#if defined(_GTK) || defined(_WX) |
#ifdef _WX |
int v; |
int v; |
|
|
v = HASH (sock); |
v = HASH (sock); |
if (!persSockets[v].write) |
if (!persSockets[v].write) |
{ |
{ |
#if defined(_GTK) |
|
persSockets[v].write = gdk_input_add ((gint) sock, |
|
GDK_INPUT_WRITE, |
|
AHTCallback_bridgeGTK, |
|
(gpointer) sock); |
|
#endif /* _GTK */ |
|
#if defined(_WX) |
|
persSockets[v].write = wxAmayaSocketEvent::RegisterSocket( sock, |
persSockets[v].write = wxAmayaSocketEvent::RegisterSocket( sock, |
WXAMAYASOCKET_WRITE, |
WXAMAYASOCKET_WRITE, |
AHTCallback_bridgeWX ); |
AHTCallback_bridgeWX ); |
#endif /* _WX */ |
|
|
|
#ifdef DEBUG_LIBWWW |
#ifdef DEBUG_LIBWWW |
if (THD_TRACE) |
if (THD_TRACE) |
fprintf (stderr, "RegisterWriteXtEvent: Adding XtInput %lu Socket %d\n", |
fprintf (stderr, "RegisterWriteXtEvent: Adding XtInput %lu Socket %d\n", |
Line 531 static void RequestRegisterWriteXtevent
|
Line 444 static void RequestRegisterWriteXtevent
|
#endif /* DEBUG_LIBWWW */ |
#endif /* DEBUG_LIBWWW */ |
|
|
} |
} |
#endif /* defined(_GTK) || defined(_WX) */ |
#endif /* _WX */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 541 static void RequestRegisterWriteXtevent
|
Line 454 static void RequestRegisterWriteXtevent
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static void RequestKillWriteXtevent (SOCKET sock) |
static void RequestKillWriteXtevent (SOCKET sock) |
{ |
{ |
#if defined(_GTK) || defined(_WX) |
#ifdef _WX |
int v; |
int v; |
|
|
v = HASH (sock); |
v = HASH (sock); |
Line 553 static void RequestKillWriteXtevent (SOC
|
Line 466 static void RequestKillWriteXtevent (SOC
|
"%lu\n", |
"%lu\n", |
persSockets[v].write); |
persSockets[v].write); |
#endif /* DEBUG_LIBWWW */ |
#endif /* DEBUG_LIBWWW */ |
|
|
#if defined(_GTK) |
|
gdk_input_remove (persSockets[v].write); |
|
persSockets[v].write = (gint) 0; |
|
#endif /* _GTK */ |
|
#if defined(_WX) |
|
wxAmayaSocketEvent::UnregisterSocket( persSockets[v].write ); |
wxAmayaSocketEvent::UnregisterSocket( persSockets[v].write ); |
persSockets[v].write = 0; |
persSockets[v].write = 0; |
#endif /* _WX */ |
|
|
|
} |
} |
#endif /* defined(_GTK) || defined(_WX) */ |
#endif /* _WX */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 573 static void RequestKillWriteXtevent (SOC
|
Line 478 static void RequestKillWriteXtevent (SOC
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static void RequestRegisterExceptXtevent (SOCKET sock) |
static void RequestRegisterExceptXtevent (SOCKET sock) |
{ |
{ |
#if defined(_GTK) || defined(_WX) |
#ifdef _WX |
int v; |
int v; |
|
|
v = HASH (sock); |
v = HASH (sock); |
if (!persSockets[v].except) |
if (!persSockets[v].except) |
{ |
{ |
#if defined(_GTK) |
|
persSockets[v].except = gdk_input_add ((gint) sock, |
|
GDK_INPUT_EXCEPTION, |
|
AHTCallback_bridgeGTK, |
|
(gpointer) sock); |
|
#endif /* _GTK */ |
|
#if defined(_WX) |
|
persSockets[v].except = |
persSockets[v].except = |
wxAmayaSocketEvent::RegisterSocket( sock, |
wxAmayaSocketEvent::RegisterSocket( sock, |
WXAMAYASOCKET_EXCEPTION, |
WXAMAYASOCKET_EXCEPTION, |
AHTCallback_bridgeWX ); |
AHTCallback_bridgeWX ); |
#endif /* _WX */ |
|
|
|
#ifdef DEBUG_LIBWWW |
#ifdef DEBUG_LIBWWW |
if (THD_TRACE) |
if (THD_TRACE) |
fprintf (stderr, "RegisterExceptXtEvent: adding XtInput %lu Socket %d\n", |
fprintf (stderr, "RegisterExceptXtEvent: adding XtInput %lu Socket %d\n", |
persSockets[v].except, sock); |
persSockets[v].except, sock); |
#endif /* DEBUG_LIBWWW */ |
#endif /* DEBUG_LIBWWW */ |
} |
} |
#endif /* defined(_GTK) || defined(_WX) */ |
#endif /* _WX */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 608 static void RequestRegisterExceptXtevent
|
Line 504 static void RequestRegisterExceptXtevent
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static void RequestKillExceptXtevent (SOCKET sock) |
static void RequestKillExceptXtevent (SOCKET sock) |
{ |
{ |
#if defined(_GTK) || defined(_WX) |
#ifdef _WX |
int v; |
int v; |
|
|
v = HASH (sock); |
v = HASH (sock); |
Line 619 static void RequestKillExceptXtevent (SO
|
Line 515 static void RequestKillExceptXtevent (SO
|
fprintf (stderr, "UnregisterExceptXtEvent: Clearing Except XtInputs " |
fprintf (stderr, "UnregisterExceptXtEvent: Clearing Except XtInputs " |
"%lu\n", persSockets[v].except); |
"%lu\n", persSockets[v].except); |
#endif /* DEBUG_LIBWWW */ |
#endif /* DEBUG_LIBWWW */ |
|
|
#if defined(_GTK) |
|
gdk_input_remove (persSockets[v].except); |
|
persSockets[v].except = (gint) 0; |
|
#endif /* _GTK */ |
|
#if defined(_WX) |
|
wxAmayaSocketEvent::UnregisterSocket( persSockets[v].except ); |
wxAmayaSocketEvent::UnregisterSocket( persSockets[v].except ); |
persSockets[v].except = 0; |
persSockets[v].except = 0; |
#endif /* _WX */ |
|
} |
} |
#endif /* defined(_GTK) || defined(_WX) */ |
#endif /* _WX */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 647 struct _HTTimer {
|
Line 536 struct _HTTimer {
|
|
|
struct _AmayaTimer { |
struct _AmayaTimer { |
HTTimer *libwww_timer; |
HTTimer *libwww_timer; |
#ifdef _GTK |
|
guint xt_timer; |
|
#endif /* _GTK */ |
|
#ifdef _WX |
#ifdef _WX |
wxAmayaTimer * xt_timer; |
wxAmayaTimer * xt_timer; |
#endif /* _WX */ |
#endif /* _WX */ |
Line 668 void *TimerCallback (XtPointer cdata, Xt
|
Line 554 void *TimerCallback (XtPointer cdata, Xt
|
return (0); |
return (0); |
} |
} |
|
|
#ifdef _GTK |
|
/*---------------------------------------------------------------------- |
|
TimerCallbackGTK |
|
The callback returns FALSE to destroy the timer that called it. |
|
----------------------------------------------------------------------*/ |
|
gboolean TimerCallbackGTK (gpointer id) |
|
{ |
|
HTList *cur, *last; |
|
AmayaTimer *me; |
|
HTTimer *libwww_timer; |
|
AmayaTimer *data; |
|
|
|
data = (AmayaTimer *) id; |
|
|
|
if (!AmayaIsAlive () |
|
|| Timers == NULL) |
|
return (FALSE); |
|
|
|
/* find the timer from the uid */ |
|
last = cur = Timers; |
|
while ((me = (AmayaTimer * ) HTList_nextObject (cur))) |
|
{ |
|
if (me == data) |
|
break; |
|
last = cur; |
|
} |
|
|
|
if (me) |
|
{ |
|
libwww_timer = me->libwww_timer; |
|
/* remove the element from the list @@@ can be optimized later */ |
|
HTList_quickRemoveElement(cur, last); |
|
TtaFreeMemory (me); |
|
HTTimer_dispatch (libwww_timer); |
|
} |
|
return (FALSE); |
|
} |
|
#endif /* _GTK */ |
|
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
TimerCallbackWX |
TimerCallbackWX |
called when a timer is throw |
called when a timer is throw |
Line 755 void TimerCallbackWX( void * p_context )
|
Line 602 void TimerCallbackWX( void * p_context )
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void KillAllTimers (void) |
void KillAllTimers (void) |
{ |
{ |
#if defined(_GTK) || defined(_WX) |
#ifdef _WX |
/* @@@ maybe add something else to kill the Xt things */ |
/* @@@ maybe add something else to kill the Xt things */ |
if (Timers) |
if (Timers) |
HTList_delete (Timers); |
HTList_delete (Timers); |
Timers = NULL; |
Timers = NULL; |
#endif /* defined(_GTK) || defined(_WX) */ |
#endif /* _WX */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 768 void KillAllTimers (void)
|
Line 615 void KillAllTimers (void)
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void AMAYA_SetTimer (HTTimer *libwww_timer) |
void AMAYA_SetTimer (HTTimer *libwww_timer) |
{ |
{ |
#if defined(_GTK) || defined(_WX) |
#ifdef _WX |
HTList *cur, *last; |
HTList *cur, *last; |
AmayaTimer *me; |
AmayaTimer *me; |
|
|
Line 794 void AMAYA_SetTimer (HTTimer *libwww_tim
|
Line 641 void AMAYA_SetTimer (HTTimer *libwww_tim
|
/* remove the old timer */ |
/* remove the old timer */ |
if (me->xt_timer) |
if (me->xt_timer) |
{ |
{ |
#ifdef _GTK |
|
gtk_timeout_remove (me->xt_timer); |
|
me->xt_timer = (guint) 0; |
|
#endif /* !_GTK */ |
|
#ifdef _WX |
|
wxDynamicCast(me->xt_timer, wxTimer)->Stop(); |
wxDynamicCast(me->xt_timer, wxTimer)->Stop(); |
delete wxDynamicCast(me->xt_timer, wxTimer); |
delete wxDynamicCast(me->xt_timer, wxTimer); |
me->xt_timer = NULL; |
me->xt_timer = NULL; |
#endif /* _WX */ |
|
} |
} |
} |
} |
else |
else |
Line 815 void AMAYA_SetTimer (HTTimer *libwww_tim
|
Line 656 void AMAYA_SetTimer (HTTimer *libwww_tim
|
} |
} |
|
|
/* add a new time out */ |
/* add a new time out */ |
#ifdef _GTK |
|
me->xt_timer = gtk_timeout_add ((guint32) me->libwww_timer->millis, |
|
(GtkFunction) TimerCallbackGTK, |
|
(gpointer) me); |
|
#endif /* _GTK */ |
|
#ifdef _WX |
|
me->xt_timer = new wxAmayaTimer( TimerCallbackWX, me); |
me->xt_timer = new wxAmayaTimer( TimerCallbackWX, me); |
/* start a one shot timer */ |
/* start a one shot timer */ |
me->xt_timer->Start( me->libwww_timer->millis, TRUE ); |
me->xt_timer->Start( me->libwww_timer->millis, TRUE ); |
#endif /* _WX */ |
#endif /* _WX */ |
|
|
#endif /* defined(_GTK) || defined(_WX) */ |
|
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 834 void AMAYA_SetTimer (HTTimer *libwww_tim
|
Line 667 void AMAYA_SetTimer (HTTimer *libwww_tim
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void AMAYA_DeleteTimer (HTTimer *libwww_timer) |
void AMAYA_DeleteTimer (HTTimer *libwww_timer) |
{ |
{ |
#if defined(_GTK) || defined(_WX) |
#ifdef _WX |
HTList *cur, *last; |
HTList *cur, *last; |
AmayaTimer *me; |
AmayaTimer *me; |
|
|
Line 853 void AMAYA_DeleteTimer (HTTimer *libwww_
|
Line 686 void AMAYA_DeleteTimer (HTTimer *libwww_
|
if (me) |
if (me) |
{ |
{ |
/* remove the Xt timer */ |
/* remove the Xt timer */ |
#ifdef _GTK |
|
gtk_timeout_remove (me->xt_timer); |
|
#endif /* _GTK */ |
|
#ifdef _WX |
|
wxDynamicCast(me->xt_timer, wxTimer)->Stop(); |
wxDynamicCast(me->xt_timer, wxTimer)->Stop(); |
delete wxDynamicCast(me->xt_timer, wxTimer); |
delete wxDynamicCast(me->xt_timer, wxTimer); |
#endif /* _WX */ |
|
|
|
/* and the element from the list */ |
/* and the element from the list */ |
HTList_removeObject (Timers, me); |
HTList_removeObject (Timers, me); |
TtaFreeMemory (me); |
TtaFreeMemory (me); |
} |
} |
#endif /* defined(_GTK) || defined(_WX) */ |
#endif /* _WX */ |
} |
} |
|
|