summaryrefslogtreecommitdiffstats
path: root/unix/tclXtNotify.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/tclXtNotify.c')
-rw-r--r--unix/tclXtNotify.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/unix/tclXtNotify.c b/unix/tclXtNotify.c
index e289e8c..b2d1f4d 100644
--- a/unix/tclXtNotify.c
+++ b/unix/tclXtNotify.c
@@ -10,9 +10,6 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#ifndef USE_TCL_STUBS
-# define USE_TCL_STUBS
-#endif
#include <X11/Intrinsic.h>
#include "tclInt.h"
@@ -77,15 +74,15 @@ static int initialized = 0;
*/
static int FileHandlerEventProc(Tcl_Event *evPtr, int flags);
-static void FileProc(ClientData clientData, int *source,
+static void FileProc(XtPointer clientData, int *source,
XtInputId *id);
static void NotifierExitHandler(ClientData clientData);
-static void TimerProc(ClientData clientData, XtIntervalId *id);
+static void TimerProc(XtPointer clientData, XtIntervalId *id);
static void CreateFileHandler(int fd, int mask,
Tcl_FileProc *proc, ClientData clientData);
static void DeleteFileHandler(int fd);
-static void SetTimer(const Tcl_Time * timePtr);
-static int WaitForEvent(const Tcl_Time * timePtr);
+static void SetTimer(Tcl_Time * timePtr);
+static int WaitForEvent(Tcl_Time * timePtr);
/*
* Functions defined in this file for use by users of the Xt Notifier:
@@ -181,7 +178,7 @@ TclSetAppContext(
void
InitNotifier(void)
{
- Tcl_NotifierProcs notifier;
+ Tcl_NotifierProcs np;
/*
* Only reinitialize if we are not in exit handling. The notifier can get
@@ -193,11 +190,15 @@ InitNotifier(void)
return;
}
- notifier.createFileHandlerProc = CreateFileHandler;
- notifier.deleteFileHandlerProc = DeleteFileHandler;
- notifier.setTimerProc = SetTimer;
- notifier.waitForEventProc = WaitForEvent;
- Tcl_SetNotifier(&notifier);
+ np.createFileHandlerProc = CreateFileHandler;
+ np.deleteFileHandlerProc = DeleteFileHandler;
+ np.setTimerProc = SetTimer;
+ np.waitForEventProc = WaitForEvent;
+ np.initNotifierProc = Tcl_InitNotifier;
+ np.finalizeNotifierProc = Tcl_FinalizeNotifier;
+ np.alertNotifierProc = Tcl_AlertNotifier;
+ np.serviceModeHookProc = Tcl_ServiceModeHook;
+ Tcl_SetNotifier(&np);
/*
* DO NOT create the application context yet; doing so would prevent
@@ -205,7 +206,7 @@ InitNotifier(void)
*/
initialized = 1;
- memset(&notifier, 0, sizeof(notifier));
+ memset(&np, 0, sizeof(np));
Tcl_CreateExitHandler(NotifierExitHandler, NULL);
}
@@ -262,7 +263,7 @@ NotifierExitHandler(
static void
SetTimer(
- const Tcl_Time *timePtr) /* Timeout value, may be NULL. */
+ Tcl_Time *timePtr) /* Timeout value, may be NULL. */
{
long timeout;
@@ -301,7 +302,7 @@ SetTimer(
static void
TimerProc(
- ClientData clientData, /* Not used. */
+ XtPointer clientData, /* Not used. */
XtIntervalId *id)
{
if (*id != notifier.currentTimeout) {
@@ -355,7 +356,7 @@ CreateFileHandler(
}
}
if (filePtr == NULL) {
- filePtr = ckalloc(sizeof(FileHandler));
+ filePtr = (FileHandler*) ckalloc(sizeof(FileHandler));
filePtr->fd = fd;
filePtr->read = 0;
filePtr->write = 0;
@@ -466,7 +467,7 @@ DeleteFileHandler(
if (filePtr->mask & TCL_EXCEPTION) {
XtRemoveInput(filePtr->except);
}
- ckfree(filePtr);
+ ckfree((char *) filePtr);
}
/*
@@ -488,7 +489,7 @@ DeleteFileHandler(
static void
FileProc(
- ClientData clientData,
+ XtPointer clientData,
int *fd,
XtInputId *id)
{
@@ -521,7 +522,7 @@ FileProc(
*/
filePtr->readyMask |= mask;
- fileEvPtr = ckalloc(sizeof(FileHandlerEvent));
+ fileEvPtr = (FileHandlerEvent *) ckalloc(sizeof(FileHandlerEvent));
fileEvPtr->header.proc = FileHandlerEventProc;
fileEvPtr->fd = filePtr->fd;
Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL);
@@ -597,7 +598,7 @@ FileHandlerEventProc(
mask = filePtr->readyMask & filePtr->mask;
filePtr->readyMask = 0;
if (mask != 0) {
- filePtr->proc(filePtr->clientData, mask);
+ (*filePtr->proc)(filePtr->clientData, mask);
}
break;
}
@@ -626,7 +627,7 @@ FileHandlerEventProc(
static int
WaitForEvent(
- const Tcl_Time *timePtr) /* Maximum block time, or NULL. */
+ Tcl_Time *timePtr) /* Maximum block time, or NULL. */
{
int timeout;