diff options
author | welch <welch@noemail.net> | 1999-07-02 06:05:33 (GMT) |
---|---|---|
committer | welch <welch@noemail.net> | 1999-07-02 06:05:33 (GMT) |
commit | 6bc59a191b1c2f2cdc48a44b9a21c55947c4ced2 (patch) | |
tree | de5ebe9540617f5e8a6f8ecf7eff5984a4ff95cf /unix/tclXtNotify.c | |
parent | da067cc860f485d0e9b08381c535b21e4655c9e9 (diff) | |
download | tcl-6bc59a191b1c2f2cdc48a44b9a21c55947c4ced2.zip tcl-6bc59a191b1c2f2cdc48a44b9a21c55947c4ced2.tar.gz tcl-6bc59a191b1c2f2cdc48a44b9a21c55947c4ced2.tar.bz2 |
Added hook points to the notifier
Updated Xt tests to use new Tcl_SetNotifier
FossilOrigin-Name: b68062ca8928a01becfae18eefb6fd7a0711a7cb
Diffstat (limited to 'unix/tclXtNotify.c')
-rw-r--r-- | unix/tclXtNotify.c | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/unix/tclXtNotify.c b/unix/tclXtNotify.c index 0b5a3b5..31157ff 100644 --- a/unix/tclXtNotify.c +++ b/unix/tclXtNotify.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclXtNotify.c,v 1.3 1999/02/03 02:59:08 stanton Exp $ + * RCS: @(#) $Id: tclXtNotify.c,v 1.4 1999/07/02 06:05:34 welch Exp $ */ #include <X11/Intrinsic.h> @@ -79,11 +79,16 @@ static int FileHandlerEventProc _ANSI_ARGS_((Tcl_Event *evPtr, int flags)); static void FileProc _ANSI_ARGS_((caddr_t clientData, int *source, XtInputId *id)); -static void InitNotifier _ANSI_ARGS_((void)); +void InitNotifier _ANSI_ARGS_((void)); static void NotifierExitHandler _ANSI_ARGS_(( ClientData clientData)); static void TimerProc _ANSI_ARGS_((caddr_t clientData, XtIntervalId *id)); +static void CreateFileHandler _ANSI_ARGS_((int fd, int mask, + Tcl_FileProc * proc, ClientData clientData)); +static void DeleteFileHandler _ANSI_ARGS_((int fd)); +static void SetTimer _ANSI_ARGS_((Tcl_Time * timePtr)); +static int WaitForEvent _ANSI_ARGS_((Tcl_Time * timePtr)); /* * Functions defined in this file for use by users of the Xt Notifier: @@ -180,9 +185,10 @@ TclSetAppContext(appContext) *---------------------------------------------------------------------- */ -static void -InitNotifier(void) +void +InitNotifier() { + Tcl_NotifierProcs notifier; /* * Only reinitialize if we are not in exit handling. The notifier * can get reinitialized after its own exit handler has run, because @@ -193,6 +199,12 @@ InitNotifier(void) return; } + notifier.createFileHandlerProc = CreateFileHandler; + notifier.deleteFileHandlerProc = DeleteFileHandler; + notifier.setTimerProc = SetTimer; + notifier.waitForEventProc = WaitForEvent; + Tcl_SetNotifier(¬ifier); + /* * DO NOT create the application context yet; doing so would prevent * external applications from setting it for us to their own ones. @@ -241,7 +253,7 @@ NotifierExitHandler( /* *---------------------------------------------------------------------- * - * Tcl_SetTimer -- + * SetTimer -- * * This procedure sets the current notifier timeout value. * @@ -254,8 +266,8 @@ NotifierExitHandler( *---------------------------------------------------------------------- */ -void -Tcl_SetTimer(timePtr) +static void +SetTimer(timePtr) Tcl_Time *timePtr; /* Timeout value, may be NULL. */ { long timeout; @@ -311,7 +323,7 @@ TimerProc(data, id) /* *---------------------------------------------------------------------- * - * Tcl_CreateFileHandler -- + * CreateFileHandler -- * * This procedure registers a file handler with the Xt notifier. * @@ -325,8 +337,8 @@ TimerProc(data, id) *---------------------------------------------------------------------- */ -void -Tcl_CreateFileHandler(fd, mask, proc, clientData) +static void +CreateFileHandler(fd, mask, proc, clientData) int fd; /* Handle of stream to watch. */ int mask; /* OR'ed combination of TCL_READABLE, * TCL_WRITABLE, and TCL_EXCEPTION: @@ -407,7 +419,7 @@ Tcl_CreateFileHandler(fd, mask, proc, clientData) /* *---------------------------------------------------------------------- * - * Tcl_DeleteFileHandler -- + * DeleteFileHandler -- * * Cancel a previously-arranged callback arrangement for * a file. @@ -421,8 +433,8 @@ Tcl_CreateFileHandler(fd, mask, proc, clientData) *---------------------------------------------------------------------- */ -void -Tcl_DeleteFileHandler(fd) +static void +DeleteFileHandler(fd) int fd; /* Stream id for which to remove * callback procedure. */ { @@ -609,7 +621,7 @@ FileHandlerEventProc(evPtr, flags) /* *---------------------------------------------------------------------- * - * Tcl_WaitForEvent -- + * WaitForEvent -- * * This function is called by Tcl_DoOneEvent to wait for new * events on the message queue. If the block time is 0, then @@ -626,8 +638,8 @@ FileHandlerEventProc(evPtr, flags) *---------------------------------------------------------------------- */ -int -Tcl_WaitForEvent( +static int +WaitForEvent( Tcl_Time *timePtr) /* Maximum block time, or NULL. */ { int timeout; |