version 1.93, 2004/01/19 13:53:05
|
version 1.94, 2004/03/29 16:05:18
|
Line 16
|
Line 16
|
* J. K./S. Gully GTK routines |
* J. K./S. Gully GTK routines |
* |
* |
*/ |
*/ |
#ifdef _GTK |
|
|
#if defined(_GTK) |
#include <glib.h> |
#include <glib.h> |
#endif /* _GTK */ |
#endif /* _GTK */ |
|
|
|
#ifdef _WX |
|
#include "wxAmayaTimer.h" |
|
#include "wxAmayaSocketEvent.h" |
|
#endif /* _WX */ |
|
|
#define THOT_EXPORT extern |
#define THOT_EXPORT extern |
#include "amaya.h" |
#include "amaya.h" |
#include "AHTBridge_f.h" |
#include "AHTBridge_f.h" |
Line 38
|
Line 44
|
extern ThotAppContext app_cont; |
extern ThotAppContext app_cont; |
#endif /* #ifdef _MOTIF */ |
#endif /* #ifdef _MOTIF */ |
|
|
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) |
/* Private functions */ |
/* Private functions */ |
static void RequestRegisterReadXtevent (SOCKET); |
static void RequestRegisterReadXtevent (SOCKET); |
static void RequestKillReadXtevent (SOCKET); |
static void RequestKillReadXtevent (SOCKET); |
Line 71 static const HTEventType ExceptBits = (H
|
Line 77 static const HTEventType ExceptBits = (H
|
} SocketStatus; |
} SocketStatus; |
#endif /*! #ifdef _MOTIF */ |
#endif /*! #ifdef _MOTIF */ |
|
|
#ifdef _GTK |
#if defined(_GTK) |
typedef struct sStatus { |
typedef struct sStatus { |
gint read; /* the different GTK Id's */ |
gint read; /* the different GTK Id's */ |
gint write; |
gint write; |
Line 79 static const HTEventType ExceptBits = (H
|
Line 85 static const HTEventType ExceptBits = (H
|
} SocketStatus; |
} SocketStatus; |
#endif /* _GTK */ |
#endif /* _GTK */ |
|
|
#ifdef _NOGUI |
#if defined(_WX) |
|
typedef struct sStatus { |
|
int read; |
|
int write; |
|
int except; |
|
} SocketStatus; |
|
#endif /* _WX */ |
|
|
|
#if defined(_NOGUI) |
typedef struct sStatus { |
typedef struct sStatus { |
int read; |
int read; |
int write; |
int write; |
Line 87 static const HTEventType ExceptBits = (H
|
Line 101 static const HTEventType ExceptBits = (H
|
} SocketStatus; |
} SocketStatus; |
#endif /* #ifdef _NOGUI */ |
#endif /* #ifdef _NOGUI */ |
|
|
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) |
#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 /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) */ |
|
|
/*-------------------------------------------------------------------- |
/*-------------------------------------------------------------------- |
AHTCallback_bridge |
AHTCallback_bridge |
Line 156 void *AHTCallback_bridge (caddr_t cd, in
|
Line 170 void *AHTCallback_bridge (caddr_t cd, in
|
return (0); |
return (0); |
} |
} |
|
|
#ifdef _GTK |
#if defined(_GTK) |
static void AHTCallback_bridgeGTK (gpointer data, gint source, GdkInputCondition condition) |
static void AHTCallback_bridgeGTK (gpointer data, gint source, GdkInputCondition condition) |
{ |
{ |
int status; /* the status result of the libwwww call */ |
int status; /* the status result of the libwwww call */ |
Line 199 static void AHTCallback_bridgeGTK (gpoin
|
Line 213 static void AHTCallback_bridgeGTK (gpoin
|
} |
} |
/*** CanDoStop_set (TRUE); **/ |
/*** CanDoStop_set (TRUE); **/ |
} |
} |
#endif /* _GTK */ |
#endif /* _GTK */ |
|
|
|
|
|
#if defined(_WX) |
|
static void AHTCallback_bridgeWX ( int register_id, int socket, wxAmayaSocketCondition condition) |
|
{ |
|
int status; /* the status result of the libwwww call */ |
|
HTEventType type = HTEvent_ALL; |
|
int v; |
|
ms_t now = HTGetTimeInMillis(); |
|
|
|
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 WXAMAYASOCKET_READ: |
|
type = HTEvent_READ; |
|
break; |
|
case WXAMAYASOCKET_WRITE: |
|
type = HTEvent_WRITE; |
|
break; |
|
case WXAMAYASOCKET_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 /* _WX */ |
|
|
/*-------------------------------------------------------------------- |
/*-------------------------------------------------------------------- |
ProcessTerminateRequest |
ProcessTerminateRequest |
Line 346 int AHTEvent_register (SOCKET sock, HTEv
|
Line 404 int AHTEvent_register (SOCKET sock, HTEv
|
return (0); |
return (0); |
} |
} |
|
|
#if defined(_MOTIF) || defined(_GTK) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) |
/* need something special for HTEvent_CLOSE */ |
/* need something special for HTEvent_CLOSE */ |
if (type & ReadBits) |
if (type & ReadBits) |
RequestRegisterReadXtevent (sock); |
RequestRegisterReadXtevent (sock); |
|
|
Line 356 int AHTEvent_register (SOCKET sock, HTEv
|
Line 414 int AHTEvent_register (SOCKET sock, HTEv
|
|
|
if (type & ExceptBits) |
if (type & ExceptBits) |
RequestRegisterExceptXtevent (sock); |
RequestRegisterExceptXtevent (sock); |
#endif /* #if defined(_MOTIF) || defined(_GTK) */ |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_WX) */ |
|
|
#ifdef _WINGUI |
#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, type | HTEvent_CLOSE , event); |
status = HTEventList_register (sock, type | HTEvent_CLOSE , event); |
#endif /* _WINGUI */ |
#endif /* _WINDOWS */ |
|
|
#if defined(_MOTIF) || defined(_GTK) |
#if defined(_UNIX) |
status = HTEventList_register (sock, type, event); |
status = HTEventList_register (sock, type, event); |
#endif /* #if defined(_MOTIF) || defined(_GTK) */ |
#endif /* #if defined(_UNIX) */ |
|
|
return (status); |
return (status); |
} |
} |
Line 385 int AHTEvent_unregister (SOCKET sock, HT
|
Line 443 int AHTEvent_unregister (SOCKET sock, HT
|
if (sock == INVSOC) |
if (sock == INVSOC) |
return HT_OK; |
return HT_OK; |
|
|
#if defined(_MOTIF) || defined(_GTK) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) |
/* remove the Xt event hooks */ |
/* remove the Xt event hooks */ |
if (type & ReadBits) |
if (type & ReadBits) |
RequestKillReadXtevent (sock); |
RequestKillReadXtevent (sock); |
Line 395 int AHTEvent_unregister (SOCKET sock, HT
|
Line 453 int AHTEvent_unregister (SOCKET sock, HT
|
|
|
if (type & ExceptBits) |
if (type & ExceptBits) |
RequestKillExceptXtevent (sock); |
RequestKillExceptXtevent (sock); |
#endif /* #if defined(_MOTIF) || defined(_GTK) */ |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_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 415 int AHTEvent_unregister (SOCKET sock, HT
|
Line 473 int AHTEvent_unregister (SOCKET sock, HT
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void RequestKillAllXtevents (AHTReqContext * me) |
void RequestKillAllXtevents (AHTReqContext * me) |
{ |
{ |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) |
int sock = INVSOC; |
int sock = INVSOC; |
|
|
return; |
return; |
Line 439 void RequestKillAllXtevents (AHTReqConte
|
Line 497 void RequestKillAllXtevents (AHTReqConte
|
RequestKillReadXtevent (sock); |
RequestKillReadXtevent (sock); |
RequestKillWriteXtevent (sock); |
RequestKillWriteXtevent (sock); |
RequestKillExceptXtevent (sock); |
RequestKillExceptXtevent (sock); |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 448 void RequestKillAllXtevents (AHTReqConte
|
Line 506 void RequestKillAllXtevents (AHTReqConte
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static void RequestRegisterReadXtevent (SOCKET sock) |
static void RequestRegisterReadXtevent (SOCKET sock) |
{ |
{ |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) |
int v; |
int v; |
|
|
v = HASH (sock); |
v = HASH (sock); |
Line 465 static void RequestRegisterReadXtevent (
|
Line 523 static void RequestRegisterReadXtevent (
|
(XtPointer) XtInputReadMask); |
(XtPointer) XtInputReadMask); |
#endif /* _MOTIF */ |
#endif /* _MOTIF */ |
|
|
#ifdef _GTK |
#if defined(_GTK) |
persSockets[v].read = |
persSockets[v].read = |
gdk_input_add ((gint) sock, |
gdk_input_add ((gint) sock, |
GDK_INPUT_READ, |
GDK_INPUT_READ, |
AHTCallback_bridgeGTK, |
AHTCallback_bridgeGTK, |
(gpointer) sock); |
(gpointer) sock); |
#endif /* !_GTK */ |
#endif /* _GTK */ |
|
|
|
#if defined(_WX) |
|
persSockets[v].read = |
|
wxAmayaSocketEvent::RegisterSocket( sock, |
|
WXAMAYASOCKET_READ, |
|
AHTCallback_bridgeWX ); |
|
#endif /* _WX */ |
|
|
#ifdef DEBUG_LIBWWW |
#ifdef DEBUG_LIBWWW |
if (THD_TRACE) |
if (THD_TRACE) |
Line 479 static void RequestRegisterReadXtevent (
|
Line 544 static void RequestRegisterReadXtevent (
|
persSockets[v].read, sock); |
persSockets[v].read, sock); |
#endif /* DEBUG_LIBWWW */ |
#endif /* DEBUG_LIBWWW */ |
} |
} |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 488 static void RequestRegisterReadXtevent (
|
Line 553 static void RequestRegisterReadXtevent (
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static void RequestKillReadXtevent (SOCKET sock) |
static void RequestKillReadXtevent (SOCKET sock) |
{ |
{ |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) |
int v; |
int v; |
|
|
v = HASH (sock); |
v = HASH (sock); |
Line 506 static void RequestKillReadXtevent (SOCK
|
Line 571 static void RequestKillReadXtevent (SOCK
|
persSockets[v].read = (XtInputId) NULL; |
persSockets[v].read = (XtInputId) NULL; |
#endif /* _MOTIF */ |
#endif /* _MOTIF */ |
|
|
#ifdef _GTK |
#if defined(_GTK) |
gdk_input_remove (persSockets[v].read); |
gdk_input_remove (persSockets[v].read); |
persSockets[v].read = (gint) 0; |
persSockets[v].read = (gint) 0; |
#endif /* !_GTK */ |
#endif /* !_GTK */ |
|
|
|
#if defined(_WX) |
|
wxAmayaSocketEvent::UnregisterSocket( persSockets[v].read ); |
|
persSockets[v].read = 0; |
|
#endif /* _WX */ |
|
|
} |
} |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 521 static void RequestKillReadXtevent (SOCK
|
Line 591 static void RequestKillReadXtevent (SOCK
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static void RequestRegisterWriteXtevent (SOCKET sock) |
static void RequestRegisterWriteXtevent (SOCKET sock) |
{ |
{ |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) |
int v; |
int v; |
v = HASH (sock); |
v = HASH (sock); |
|
|
Line 536 static void RequestRegisterWriteXtevent
|
Line 606 static void RequestRegisterWriteXtevent
|
(XtPointer) XtInputWriteMask); |
(XtPointer) XtInputWriteMask); |
#endif /* _MOTIF */ |
#endif /* _MOTIF */ |
|
|
#ifdef _GTK |
#if defined(_GTK) |
persSockets[v].write = |
persSockets[v].write = |
gdk_input_add ((gint) sock, |
gdk_input_add ((gint) sock, |
GDK_INPUT_WRITE, |
GDK_INPUT_WRITE, |
AHTCallback_bridgeGTK, |
AHTCallback_bridgeGTK, |
(gpointer) sock); |
(gpointer) sock); |
#endif /* _GTK */ |
#endif /* _GTK */ |
|
|
|
#if defined(_WX) |
|
persSockets[v].write = |
|
wxAmayaSocketEvent::RegisterSocket( sock, |
|
WXAMAYASOCKET_WRITE, |
|
AHTCallback_bridgeWX ); |
|
#endif /* _WX */ |
|
|
#ifdef DEBUG_LIBWWW |
#ifdef DEBUG_LIBWWW |
if (THD_TRACE) |
if (THD_TRACE) |
Line 551 static void RequestRegisterWriteXtevent
|
Line 628 static void RequestRegisterWriteXtevent
|
#endif /* DEBUG_LIBWWW */ |
#endif /* DEBUG_LIBWWW */ |
|
|
} |
} |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 561 static void RequestRegisterWriteXtevent
|
Line 638 static void RequestRegisterWriteXtevent
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static void RequestKillWriteXtevent (SOCKET sock) |
static void RequestKillWriteXtevent (SOCKET sock) |
{ |
{ |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) |
int v; |
int v; |
|
|
v = HASH (sock); |
v = HASH (sock); |
Line 580 static void RequestKillWriteXtevent (SOC
|
Line 657 static void RequestKillWriteXtevent (SOC
|
persSockets[v].write = (XtInputId) NULL; |
persSockets[v].write = (XtInputId) NULL; |
#endif /* _MOTIF */ |
#endif /* _MOTIF */ |
|
|
#ifdef _GTK |
#if defined(_GTK) |
gdk_input_remove (persSockets[v].write); |
gdk_input_remove (persSockets[v].write); |
persSockets[v].write = (gint) 0; |
persSockets[v].write = (gint) 0; |
#endif /* _GTK */ |
#endif /* _GTK */ |
|
|
|
#if defined(_WX) |
|
wxAmayaSocketEvent::UnregisterSocket( persSockets[v].write ); |
|
persSockets[v].write = 0; |
|
#endif /* _WX */ |
|
|
} |
} |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 595 static void RequestKillWriteXtevent (SOC
|
Line 677 static void RequestKillWriteXtevent (SOC
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static void RequestRegisterExceptXtevent (SOCKET sock) |
static void RequestRegisterExceptXtevent (SOCKET sock) |
{ |
{ |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) |
int v; |
int v; |
|
|
v = HASH (sock); |
v = HASH (sock); |
Line 611 static void RequestRegisterExceptXtevent
|
Line 693 static void RequestRegisterExceptXtevent
|
(XtPointer) XtInputExceptMask); |
(XtPointer) XtInputExceptMask); |
#endif /* _MOTIF */ |
#endif /* _MOTIF */ |
|
|
#ifdef _GTK |
#if defined(_GTK) |
persSockets[v].except = |
persSockets[v].except = |
gdk_input_add ((gint) sock, |
gdk_input_add ((gint) sock, |
GDK_INPUT_EXCEPTION, |
GDK_INPUT_EXCEPTION, |
AHTCallback_bridgeGTK, |
AHTCallback_bridgeGTK, |
(gpointer) sock); |
(gpointer) sock); |
#endif /* _GTK */ |
#endif /* _GTK */ |
|
|
#ifdef DEBUG_LIBWWW |
#if defined(_WX) |
|
persSockets[v].except = |
|
wxAmayaSocketEvent::RegisterSocket( sock, |
|
WXAMAYASOCKET_EXCEPTION, |
|
AHTCallback_bridgeWX ); |
|
#endif /* _WX */ |
|
|
|
#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 /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 635 static void RequestRegisterExceptXtevent
|
Line 724 static void RequestRegisterExceptXtevent
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static void RequestKillExceptXtevent (SOCKET sock) |
static void RequestKillExceptXtevent (SOCKET sock) |
{ |
{ |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) |
int v; |
int v; |
|
|
v = HASH (sock); |
v = HASH (sock); |
Line 652 static void RequestKillExceptXtevent (SO
|
Line 741 static void RequestKillExceptXtevent (SO
|
persSockets[v].except = (XtInputId) NULL; |
persSockets[v].except = (XtInputId) NULL; |
#endif /* _MOTIF */ |
#endif /* _MOTIF */ |
|
|
#ifdef _GTK |
#if defined(_GTK) |
gdk_input_remove (persSockets[v].except); |
gdk_input_remove (persSockets[v].except); |
persSockets[v].except = (gint) 0; |
persSockets[v].except = (gint) 0; |
#endif /* _GTK */ |
#endif /* _GTK */ |
|
|
|
#if defined(_WX) |
|
wxAmayaSocketEvent::UnregisterSocket( persSockets[v].except ); |
|
persSockets[v].except = 0; |
|
#endif /* _WX */ |
|
|
} |
} |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 685 struct _AmayaTimer {
|
Line 779 struct _AmayaTimer {
|
guint xt_timer; |
guint xt_timer; |
#endif /* _GTK */ |
#endif /* _GTK */ |
|
|
|
#ifdef _WX |
|
wxAmayaTimer * xt_timer; |
|
#endif /* _WX */ |
|
|
#ifdef _NOGUI |
#ifdef _NOGUI |
unsigned int xt_timer; |
unsigned int xt_timer; |
#endif /* #ifdef _NOGUI */ |
#endif /* #ifdef _NOGUI */ |
Line 734 void *TimerCallback (XtPointer cdata, Xt
|
Line 832 void *TimerCallback (XtPointer cdata, Xt
|
|
|
} |
} |
|
|
|
|
#ifdef _GTK |
#ifdef _GTK |
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
TimerCallbackGTK |
TimerCallbackGTK |
Line 770 gboolean TimerCallbackGTK (gpointer id)
|
Line 867 gboolean TimerCallbackGTK (gpointer id)
|
TtaFreeMemory (me); |
TtaFreeMemory (me); |
HTTimer_dispatch (libwww_timer); |
HTTimer_dispatch (libwww_timer); |
} |
} |
|
|
return (FALSE); |
return (FALSE); |
} |
} |
#endif /* _GTK */ |
#endif /* _GTK */ |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
|
TimerCallbackWX |
|
called when a timer is throw |
|
----------------------------------------------------------------------*/ |
|
void TimerCallbackWX( void * p_context ) |
|
{ |
|
#ifdef _WX |
|
HTList *cur, *last; |
|
AmayaTimer *me; |
|
HTTimer *libwww_timer; |
|
AmayaTimer *data; |
|
|
|
data = (AmayaTimer *)p_context; |
|
|
|
if (!AmayaIsAlive () |
|
|| Timers == NULL) |
|
return; |
|
|
|
/* 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); |
|
|
|
/* delete explicitely the AmayaTimer */ |
|
delete wxDynamicCast(me->xt_timer, wxAmayaTimer); |
|
|
|
TtaFreeMemory (me); |
|
HTTimer_dispatch (libwww_timer); |
|
} |
|
#endif /* _WX */ |
|
} |
|
|
|
/*---------------------------------------------------------------------- |
KillAllTimers |
KillAllTimers |
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void KillAllTimers (void) |
void KillAllTimers (void) |
{ |
{ |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) |
/* @@@ 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 /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 793 void KillAllTimers (void)
|
Line 931 void KillAllTimers (void)
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void AMAYA_SetTimer (HTTimer *libwww_timer) |
void AMAYA_SetTimer (HTTimer *libwww_timer) |
{ |
{ |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) |
HTList *cur, *last; |
HTList *cur, *last; |
AmayaTimer *me; |
AmayaTimer *me; |
|
|
Line 819 void AMAYA_SetTimer (HTTimer *libwww_tim
|
Line 957 void AMAYA_SetTimer (HTTimer *libwww_tim
|
/* remove the old timer */ |
/* remove the old timer */ |
if (me->xt_timer) |
if (me->xt_timer) |
{ |
{ |
|
|
#ifdef _MOTIF |
#ifdef _MOTIF |
XtRemoveTimeOut (me->xt_timer); |
XtRemoveTimeOut (me->xt_timer); |
me->xt_timer = (XtIntervalId) NULL; |
me->xt_timer = (XtIntervalId) NULL; |
Line 830 void AMAYA_SetTimer (HTTimer *libwww_tim
|
Line 967 void AMAYA_SetTimer (HTTimer *libwww_tim
|
me->xt_timer = (guint) 0; |
me->xt_timer = (guint) 0; |
#endif /* !_GTK */ |
#endif /* !_GTK */ |
|
|
} |
#ifdef _WX |
|
delete wxDynamicCast(me->xt_timer, wxTimer); |
|
me->xt_timer = NULL; |
|
#endif /* _WX */ |
|
} |
} |
} |
else |
else |
{ |
{ |
Line 854 void AMAYA_SetTimer (HTTimer *libwww_tim
|
Line 995 void AMAYA_SetTimer (HTTimer *libwww_tim
|
(GtkFunction) TimerCallbackGTK, |
(GtkFunction) TimerCallbackGTK, |
(gpointer) me); |
(gpointer) me); |
#endif /* _GTK */ |
#endif /* _GTK */ |
|
|
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
#ifdef _WX |
|
me->xt_timer = new wxAmayaTimer( TimerCallbackWX, me); |
|
/* start a one shot timer */ |
|
me->xt_timer->Start( me->libwww_timer->millis, TRUE ); |
|
#endif /* _WX */ |
|
|
|
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) */ |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 863 void AMAYA_SetTimer (HTTimer *libwww_tim
|
Line 1010 void AMAYA_SetTimer (HTTimer *libwww_tim
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void AMAYA_DeleteTimer (HTTimer *libwww_timer) |
void AMAYA_DeleteTimer (HTTimer *libwww_timer) |
{ |
{ |
#if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) |
#if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) |
HTList *cur, *last; |
HTList *cur, *last; |
AmayaTimer *me; |
AmayaTimer *me; |
|
|
Line 889 void AMAYA_DeleteTimer (HTTimer *libwww_
|
Line 1036 void AMAYA_DeleteTimer (HTTimer *libwww_
|
#ifdef _GTK |
#ifdef _GTK |
gtk_timeout_remove (me->xt_timer); |
gtk_timeout_remove (me->xt_timer); |
#endif /* _GTK */ |
#endif /* _GTK */ |
|
|
|
#ifdef _WX |
|
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 /* #if defined(_MOTIF) || defined(_GTK) || defined(_NOGUI) */ |
#endif /* #if defined(_MOTIF) || defined(_GTK) || defined(_WX) || defined(_NOGUI) */ |
} |
} |
|
|