diff options
Diffstat (limited to 'generic/tkTextWind.c')
-rw-r--r-- | generic/tkTextWind.c | 66 |
1 files changed, 32 insertions, 34 deletions
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index 4f48b18..8c032c6 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTextWind.c,v 1.23 2007/12/13 15:24:17 dgp Exp $ + * RCS: @(#) $Id: tkTextWind.c,v 1.30 2010/03/11 09:43:19 dkf Exp $ */ #include "tkPort.h" @@ -65,14 +65,14 @@ static void EmbWinStructureProc(ClientData clientData, XEvent *eventPtr); static void EmbWinUndisplayProc(TkText *textPtr, TkTextDispChunk *chunkPtr); -static TkTextEmbWindowClient* EmbWinGetClient(const TkText *textPtr, +static TkTextEmbWindowClient *EmbWinGetClient(const TkText *textPtr, TkTextSegment *ewPtr); /* * The following structure declares the "embedded window" segment type. */ -static const Tk_SegType tkTextEmbWindowType = { +const Tk_SegType tkTextEmbWindowType = { "window", /* name */ 0, /* leftGravity */ NULL, /* splitProc */ @@ -87,7 +87,7 @@ static const Tk_SegType tkTextEmbWindowType = { * Definitions for alignment values: */ -static char *alignStrings[] = { +static const char *const alignStrings[] = { "baseline", "bottom", "center", "top", NULL }; @@ -113,7 +113,7 @@ static const Tk_OptionSpec optionSpecs[] = { "0", -1, Tk_Offset(TkTextEmbWindow, stretch), 0, 0, 0}, {TK_OPTION_WINDOW, "-window", NULL, NULL, NULL, -1, Tk_Offset(TkTextEmbWindow, tkwin), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_END} + {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* @@ -143,7 +143,7 @@ TkTextWindowCmd( * objv[1] is "window". */ { int optionIndex; - static const char *windOptionStrings[] = { + static const char *const windOptionStrings[] = { "cget", "configure", "create", "names", NULL }; enum windOptions { @@ -152,7 +152,7 @@ TkTextWindowCmd( register TkTextSegment *ewPtr; if (objc < 3) { - Tcl_WrongNumArgs(interp, 2, objv, "option ?arg arg ...?"); + Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?"); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[2], windOptionStrings, @@ -204,7 +204,7 @@ TkTextWindowCmd( TkTextSegment *ewPtr; if (objc < 4) { - Tcl_WrongNumArgs(interp, 3, objv, "index ?option value ...?"); + Tcl_WrongNumArgs(interp, 3, objv, "index ?-option value ...?"); return TCL_ERROR; } if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) { @@ -218,7 +218,7 @@ TkTextWindowCmd( } if (objc <= 5) { TkTextEmbWindowClient *client; - Tcl_Obj* objPtr; + Tcl_Obj *objPtr; /* * Copy over client specific value before querying. @@ -265,7 +265,7 @@ TkTextWindowCmd( */ if (objc < 4) { - Tcl_WrongNumArgs(interp, 3, objv, "index ?option value ...?"); + Tcl_WrongNumArgs(interp, 3, objv, "index ?-option value ...?"); return TCL_ERROR; } if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) { @@ -410,8 +410,8 @@ EmbWinConfigure( &textPtr->sharedTextPtr->windowTable, Tk_PathName(oldWindow))); Tk_DeleteEventHandler(oldWindow, StructureNotifyMask, - EmbWinStructureProc, (ClientData) client); - Tk_ManageGeometry(oldWindow, NULL, (ClientData) NULL); + EmbWinStructureProc, client); + Tk_ManageGeometry(oldWindow, NULL, NULL); if (textPtr->tkwin != Tk_Parent(oldWindow)) { Tk_UnmaintainGeometry(oldWindow, textPtr->tkwin); } else { @@ -476,10 +476,9 @@ EmbWinConfigure( * event handler to find out when it is deleted. */ - Tk_ManageGeometry(ewPtr->body.ew.tkwin, &textGeomType, - (ClientData) client); + Tk_ManageGeometry(ewPtr->body.ew.tkwin, &textGeomType, client); Tk_CreateEventHandler(ewPtr->body.ew.tkwin, StructureNotifyMask, - EmbWinStructureProc, (ClientData) client); + EmbWinStructureProc, client); /* * Special trick! Must enter into the hash table *after* calling @@ -520,7 +519,7 @@ EmbWinStructureProc( ClientData clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { - TkTextEmbWindowClient *client = (TkTextEmbWindowClient*)clientData; + TkTextEmbWindowClient *client = clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; Tcl_HashEntry *hPtr; @@ -573,7 +572,7 @@ EmbWinRequestProc( ClientData clientData, /* Pointer to record for window item. */ Tk_Window tkwin) /* Window that changed its desired size. */ { - TkTextEmbWindowClient *client = (TkTextEmbWindowClient*)clientData; + TkTextEmbWindowClient *client = clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; @@ -610,15 +609,15 @@ EmbWinLostSlaveProc( Tk_Window tkwin) /* Window that was claimed away by another * geometry manager. */ { - TkTextEmbWindowClient *client = (TkTextEmbWindowClient*)clientData; + TkTextEmbWindowClient *client = clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; Tcl_HashEntry *hPtr; TkTextEmbWindowClient *loop; Tk_DeleteEventHandler(client->tkwin, StructureNotifyMask, - EmbWinStructureProc, (ClientData) client); - Tcl_CancelIdleCall(EmbWinDelayedUnmap, (ClientData) client); + EmbWinStructureProc, client); + Tcl_CancelIdleCall(EmbWinDelayedUnmap, client); if (client->textPtr->tkwin != Tk_Parent(tkwin)) { Tk_UnmaintainGeometry(tkwin, client->textPtr->tkwin); } else { @@ -700,10 +699,10 @@ TkTextWinFreeClient( if (client->tkwin != NULL) { Tk_DeleteEventHandler(client->tkwin, StructureNotifyMask, - EmbWinStructureProc, (ClientData) client); + EmbWinStructureProc, client); Tk_DestroyWindow(client->tkwin); } - Tcl_CancelIdleCall(EmbWinDelayedUnmap, (ClientData) client); + Tcl_CancelIdleCall(EmbWinDelayedUnmap, client); /* * Free up this client. @@ -911,7 +910,7 @@ EmbWinLayoutProc( } if (code != TCL_OK) { createError: - Tcl_BackgroundError(textPtr->interp); + Tcl_BackgroundException(textPtr->interp, code); goto gotWindow; } Tcl_DStringInit(&name); @@ -960,10 +959,9 @@ EmbWinLayoutProc( } client->tkwin = ewPtr->body.ew.tkwin; - Tk_ManageGeometry(client->tkwin, &textGeomType, - (ClientData) client); + Tk_ManageGeometry(client->tkwin, &textGeomType, client); Tk_CreateEventHandler(client->tkwin, StructureNotifyMask, - EmbWinStructureProc, (ClientData) client); + EmbWinStructureProc, client); /* * Special trick! Must enter into the hash table *after* calling @@ -1015,7 +1013,7 @@ EmbWinLayoutProc( chunkPtr->width = width; chunkPtr->breakIndex = -1; chunkPtr->breakIndex = 1; - chunkPtr->clientData = (ClientData) ewPtr; + chunkPtr->clientData = ewPtr; if (client != NULL) { client->chunkCount += 1; } @@ -1091,7 +1089,7 @@ TkTextEmbWinDisplayProc( { int lineX, windowX, windowY, width, height; Tk_Window tkwin; - TkTextSegment *ewPtr = (TkTextSegment*) chunkPtr->clientData; + TkTextSegment *ewPtr = chunkPtr->clientData; TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr); if (client == NULL) { @@ -1167,7 +1165,7 @@ EmbWinUndisplayProc( TkText *textPtr, /* Overall information about text widget. */ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */ { - TkTextSegment *ewPtr = (TkTextSegment*) chunkPtr->clientData; + TkTextSegment *ewPtr = chunkPtr->clientData; TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr); if (client == NULL) { @@ -1185,7 +1183,7 @@ EmbWinUndisplayProc( */ client->displayed = 0; - Tcl_DoWhenIdle(EmbWinDelayedUnmap, (ClientData) client); + Tcl_DoWhenIdle(EmbWinDelayedUnmap, client); } } @@ -1230,7 +1228,7 @@ EmbWinBboxProc( * pixels. */ { Tk_Window tkwin; - TkTextSegment *ewPtr = (TkTextSegment *) chunkPtr->clientData; + TkTextSegment *ewPtr = chunkPtr->clientData; TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr); if (client == NULL) { @@ -1292,7 +1290,7 @@ static void EmbWinDelayedUnmap( ClientData clientData) /* Token for the window to be unmapped. */ { - TkTextEmbWindowClient *client = (TkTextEmbWindowClient*) clientData; + TkTextEmbWindowClient *client = clientData; if (!client->displayed && (client->tkwin != NULL)) { if (client->textPtr->tkwin != Tk_Parent(client->tkwin)) { @@ -1336,7 +1334,7 @@ TkTextWindowIndex( return 0; } - ewPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr); + ewPtr = Tcl_GetHashValue(hPtr); indexPtr->tree = textPtr->sharedTextPtr->tree; indexPtr->linePtr = ewPtr->body.ew.linePtr; indexPtr->byteIndex = TkTextSegToOffset(ewPtr, indexPtr->linePtr); @@ -1367,7 +1365,7 @@ TkTextWindowIndex( *-------------------------------------------------------------- */ -static TkTextEmbWindowClient* +static TkTextEmbWindowClient * EmbWinGetClient( const TkText *textPtr, /* Information about text widget. */ TkTextSegment *ewPtr) /* Segment containing embedded window. */ |