diff options
Diffstat (limited to 'generic/tkMessage.c')
-rw-r--r-- | generic/tkMessage.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 0fd57a9..5df3875 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -133,7 +133,7 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_MESSAGE_FG, -1, Tk_Offset(Message, fgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_MESSAGE_HIGHLIGHT_BG, -1, - Tk_Offset(Message, highlightBgColorPtr), 0, 0}, + Tk_Offset(Message, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_MESSAGE_HIGHLIGHT, -1, Tk_Offset(Message, highlightColorPtr), 0, 0, 0}, @@ -160,7 +160,7 @@ static const Tk_OptionSpec optionSpecs[] = { TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", DEF_MESSAGE_WIDTH, -1, Tk_Offset(Message, width), 0, 0 ,0}, - {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0} + {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* @@ -171,15 +171,15 @@ static void MessageCmdDeletedProc(ClientData clientData); static void MessageEventProc(ClientData clientData, XEvent *eventPtr); static char * MessageTextVarProc(ClientData clientData, - Tcl_Interp *interp, CONST char *name1, - CONST char *name2, int flags); + Tcl_Interp *interp, const char *name1, + const char *name2, int flags); static int MessageWidgetObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static void MessageWorldChanged(ClientData instanceData); static void ComputeMessageGeometry(Message *msgPtr); static int ConfigureMessage(Tcl_Interp *interp, Message *msgPtr, - int objc, Tcl_Obj *CONST objv[], int flags); + int objc, Tcl_Obj *const objv[], int flags); static void DestroyMessage(char *memPtr); static void DisplayMessage(ClientData clientData); @@ -188,9 +188,11 @@ static void DisplayMessage(ClientData clientData); * that can be invoked from generic window code. */ -static Tk_ClassProcs messageClass = { +static const Tk_ClassProcs messageClass = { sizeof(Tk_ClassProcs), /* size */ MessageWorldChanged, /* worldChangedProc */ + NULL, /* createProc */ + NULL /* modalProc */ }; /* @@ -215,14 +217,14 @@ Tk_MessageObjCmd( ClientData clientData, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument strings. */ + Tcl_Obj *const objv[]) /* Argument strings. */ { register Message *msgPtr; Tk_OptionTable optionTable; Tk_Window tkwin; if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?"); + Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); return TCL_ERROR; } @@ -239,7 +241,7 @@ Tk_MessageObjCmd( optionTable = Tk_CreateOptionTable(interp, optionSpecs); - msgPtr = (Message *) ckalloc(sizeof(Message)); + msgPtr = ckalloc(sizeof(Message)); memset(msgPtr, 0, (size_t) sizeof(Message)); /* @@ -250,8 +252,8 @@ Tk_MessageObjCmd( msgPtr->display = Tk_Display(tkwin); msgPtr->interp = interp; msgPtr->widgetCmd = Tcl_CreateObjCommand(interp, - Tk_PathName(msgPtr->tkwin), MessageWidgetObjCmd, - (ClientData) msgPtr, MessageCmdDeletedProc); + Tk_PathName(msgPtr->tkwin), MessageWidgetObjCmd, msgPtr, + MessageCmdDeletedProc); msgPtr->optionTable = optionTable; msgPtr->relief = TK_RELIEF_FLAT; msgPtr->textGC = None; @@ -261,10 +263,10 @@ Tk_MessageObjCmd( msgPtr->cursor = None; Tk_SetClass(msgPtr->tkwin, "Message"); - Tk_SetClassProcs(msgPtr->tkwin, &messageClass, (ClientData) msgPtr); + Tk_SetClassProcs(msgPtr->tkwin, &messageClass, msgPtr); Tk_CreateEventHandler(msgPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, - MessageEventProc, (ClientData) msgPtr); + MessageEventProc, msgPtr); if (Tk_InitOptions(interp, (char *)msgPtr, optionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(msgPtr->tkwin); return TCL_ERROR; @@ -302,17 +304,17 @@ MessageWidgetObjCmd( ClientData clientData, /* Information about message widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument strings. */ + Tcl_Obj *const objv[]) /* Argument strings. */ { - register Message *msgPtr = (Message *) clientData; - static CONST char *optionStrings[] = { "cget", "configure", NULL }; + register Message *msgPtr = clientData; + static const char *const optionStrings[] = { "cget", "configure", NULL }; enum options { MESSAGE_CGET, MESSAGE_CONFIGURE }; int index; int result = TCL_OK; Tcl_Obj *objPtr; if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?"); + Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); return TCL_ERROR; } @@ -321,7 +323,7 @@ MessageWidgetObjCmd( return TCL_ERROR; } - Tcl_Preserve((ClientData) msgPtr); + Tcl_Preserve(msgPtr); switch ((enum options) index) { case MESSAGE_CGET: @@ -356,7 +358,7 @@ MessageWidgetObjCmd( break; } - Tcl_Release((ClientData) msgPtr); + Tcl_Release(msgPtr); return result; } @@ -388,7 +390,7 @@ DestroyMessage( Tcl_DeleteCommandFromToken(msgPtr->interp, msgPtr->widgetCmd); if (msgPtr->flags & REDRAW_PENDING) { - Tcl_CancelIdleCall(DisplayMessage, (ClientData) msgPtr); + Tcl_CancelIdleCall(DisplayMessage, msgPtr); } /* @@ -405,11 +407,11 @@ DestroyMessage( if (msgPtr->textVarName != NULL) { Tcl_UntraceVar(msgPtr->interp, msgPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MessageTextVarProc, (ClientData) msgPtr); + MessageTextVarProc, msgPtr); } Tk_FreeConfigOptions((char *) msgPtr, msgPtr->optionTable, msgPtr->tkwin); msgPtr->tkwin = NULL; - ckfree((char *) msgPtr); + ckfree(msgPtr); } /* @@ -438,7 +440,7 @@ ConfigureMessage( register Message *msgPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ - Tcl_Obj *CONST objv[], /* Arguments. */ + Tcl_Obj *const objv[], /* Arguments. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { Tk_SavedOptions savedOptions; @@ -450,7 +452,7 @@ ConfigureMessage( if (msgPtr->textVarName != NULL) { Tcl_UntraceVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MessageTextVarProc, (ClientData) msgPtr); + MessageTextVarProc, msgPtr); } if (Tk_SetOptions(interp, (char *) msgPtr, msgPtr->optionTable, objc, objv, @@ -466,7 +468,7 @@ ConfigureMessage( */ if (msgPtr->textVarName != NULL) { - CONST char *value; + const char *value; value = Tcl_GetVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY); if (value == NULL) { @@ -480,7 +482,7 @@ ConfigureMessage( } Tcl_TraceVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MessageTextVarProc, (ClientData) msgPtr); + MessageTextVarProc, msgPtr); } /* @@ -496,7 +498,7 @@ ConfigureMessage( } Tk_FreeSavedOptions(&savedOptions); - MessageWorldChanged((ClientData) msgPtr); + MessageWorldChanged(msgPtr); return TCL_OK; } @@ -525,9 +527,7 @@ MessageWorldChanged( XGCValues gcValues; GC gc = None; Tk_FontMetrics fm; - Message *msgPtr; - - msgPtr = (Message *) instanceData; + Message *msgPtr = instanceData; if (msgPtr->border != NULL) { Tk_SetBackgroundFromBorder(msgPtr->tkwin, msgPtr->border); @@ -557,7 +557,7 @@ MessageWorldChanged( ComputeMessageGeometry(msgPtr); if ((msgPtr->tkwin != NULL) && Tk_IsMapped(msgPtr->tkwin) && !(msgPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayMessage, (ClientData) msgPtr); + Tcl_DoWhenIdle(DisplayMessage, msgPtr); msgPtr->flags |= REDRAW_PENDING; } } @@ -666,7 +666,7 @@ static void DisplayMessage( ClientData clientData) /* Information about window. */ { - register Message *msgPtr = (Message *) clientData; + register Message *msgPtr = clientData; register Tk_Window tkwin = msgPtr->tkwin; int x, y; int borderWidth = msgPtr->highlightWidth; @@ -742,13 +742,13 @@ MessageEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - Message *msgPtr = (Message *) clientData; + Message *msgPtr = clientData; if (((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) || (eventPtr->type == ConfigureNotify)) { goto redraw; } else if (eventPtr->type == DestroyNotify) { - DestroyMessage((char *) clientData); + DestroyMessage(clientData); } else if (eventPtr->type == FocusIn) { if (eventPtr->xfocus.detail != NotifyInferior) { msgPtr->flags |= GOT_FOCUS; @@ -768,7 +768,7 @@ MessageEventProc( redraw: if ((msgPtr->tkwin != NULL) && !(msgPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayMessage, (ClientData) msgPtr); + Tcl_DoWhenIdle(DisplayMessage, msgPtr); msgPtr->flags |= REDRAW_PENDING; } } @@ -795,7 +795,7 @@ static void MessageCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Message *msgPtr = (Message *) clientData; + Message *msgPtr = clientData; /* * This function could be invoked either because the window was destroyed @@ -831,12 +831,12 @@ static char * MessageTextVarProc( ClientData clientData, /* Information about message. */ Tcl_Interp *interp, /* Interpreter containing variable. */ - CONST char *name1, /* Name of variable. */ - CONST char *name2, /* Second part of variable name. */ + const char *name1, /* Name of variable. */ + const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register Message *msgPtr = (Message *) clientData; - CONST char *value; + register Message *msgPtr = clientData; + const char *value; /* * If the variable is unset, then immediately recreate it unless the whole @@ -862,13 +862,13 @@ MessageTextVarProc( ckfree(msgPtr->string); } msgPtr->numChars = Tcl_NumUtfChars(value, -1); - msgPtr->string = (char *) ckalloc((unsigned) (strlen(value) + 1)); + msgPtr->string = ckalloc(strlen(value) + 1); strcpy(msgPtr->string, value); ComputeMessageGeometry(msgPtr); if ((msgPtr->tkwin != NULL) && Tk_IsMapped(msgPtr->tkwin) && !(msgPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayMessage, (ClientData) msgPtr); + Tcl_DoWhenIdle(DisplayMessage, msgPtr); msgPtr->flags |= REDRAW_PENDING; } return NULL; |