diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2007-02-13 00:16:39 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2007-02-13 00:16:39 (GMT) |
commit | 971dfdb4ef14052e797b88dbdb0a31590db0cbc6 (patch) | |
tree | 62f602231325c26fb1a3e9c1b6adbb79fb68bd61 | |
parent | c2ce98d7781db329352d954fd196b04b564b3219 (diff) | |
download | tk-971dfdb4ef14052e797b88dbdb0a31590db0cbc6.zip tk-971dfdb4ef14052e797b88dbdb0a31590db0cbc6.tar.gz tk-971dfdb4ef14052e797b88dbdb0a31590db0cbc6.tar.bz2 |
Fix minor K&R-ism
-rw-r--r-- | generic/tkStubLib.c | 48 | ||||
-rw-r--r-- | generic/tkWindow.c | 354 |
2 files changed, 204 insertions, 198 deletions
diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c index 3fe18a6..9409c07 100644 --- a/generic/tkStubLib.c +++ b/generic/tkStubLib.c @@ -1,4 +1,4 @@ -/* +/* * tkStubLib.c -- * * Stub object that will be statically linked into extensions that wish @@ -7,17 +7,16 @@ * Copyright (c) 1998 Paul Duffin. * Copyright (c) 1998-1999 by Scriptics Corporation. * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkStubLib.c,v 1.11 2006/10/20 22:39:57 nijtmans Exp $ + * RCS: @(#) $Id: tkStubLib.c,v 1.12 2007/02/13 00:24:12 dkf Exp $ */ - /* - * We need to ensure that we use the stub macros so that this file contains - * no references to any of the stub functions. This will make it possible - * to build an extension that references Tk_InitStubs but doesn't end up + * We need to ensure that we use the stub macros so that this file contains no + * references to any of the stub functions. This will make it possible to + * build an extension that references Tk_InitStubs but doesn't end up * including the rest of the stub functions. */ @@ -49,7 +48,7 @@ #include "tkIntXlibDecls.h" /* - * Ensure that Tk_InitStubs is built as an exported symbol. The other stub + * Ensure that Tk_InitStubs is built as an exported symbol. The other stub * symbols should be built as non-exported symbols. */ @@ -67,19 +66,18 @@ TkPlatStubs *tkPlatStubsPtr; TkIntStubs *tkIntStubsPtr; TkIntPlatStubs *tkIntPlatStubsPtr; TkIntXlibStubs *tkIntXlibStubsPtr; - /* *---------------------------------------------------------------------- * * Tk_InitStubs -- * - * Checks that the correct version of Tk is loaded and that it - * supports stubs. It then initialises the stub table pointers. + * Checks that the correct version of Tk is loaded and that it supports + * stubs. It then initialises the stub table pointers. * * Results: - * The actual version of Tk that satisfies the request, or - * NULL to indicate that an error occurred. + * The actual version of Tk that satisfies the request, or NULL to + * indicate that an error occurred. * * Side effects: * Sets the stub table pointers. @@ -92,15 +90,15 @@ TkIntXlibStubs *tkIntXlibStubsPtr; #endif MODULE_SCOPE CONST char * -Tk_InitStubs(interp, version, exact) - Tcl_Interp *interp; - CONST char *version; - int exact; +Tk_InitStubs( + Tcl_Interp *interp, + CONST char *version, + int exact) { CONST char *actualVersion; actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, exact, - (ClientData *) &tkStubsPtr); + (ClientData *) &tkStubsPtr); if (!actualVersion) { return NULL; } @@ -111,11 +109,19 @@ Tk_InitStubs(interp, version, exact) TCL_STATIC); return NULL; } - + tkPlatStubsPtr = tkStubsPtr->hooks->tkPlatStubs; tkIntStubsPtr = tkStubsPtr->hooks->tkIntStubs; tkIntPlatStubsPtr = tkStubsPtr->hooks->tkIntPlatStubs; tkIntXlibStubsPtr = tkStubsPtr->hooks->tkIntXlibStubs; - + return actualVersion; } + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 9558f4c..4a821e0 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.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: tkWindow.c,v 1.79 2006/10/31 01:42:26 hobbs Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.80 2007/02/13 00:16:39 dkf Exp $ */ #include "tkPort.h" @@ -273,7 +273,8 @@ static void UnlinkWindow(TkWindow *winPtr); */ static void -TkCloseDisplay(TkDisplay *dispPtr) +TkCloseDisplay( + TkDisplay *dispPtr) { TkClipCleanup(dispPtr); @@ -337,19 +338,19 @@ TkCloseDisplay(TkDisplay *dispPtr) */ static Tk_Window -CreateTopLevelWindow(interp, parent, name, screenName, flags) - Tcl_Interp *interp; /* Interpreter to use for error reporting. */ - Tk_Window parent; /* Token for logical parent of new window +CreateTopLevelWindow( + Tcl_Interp *interp, /* Interpreter to use for error reporting. */ + Tk_Window parent, /* Token for logical parent of new window * (used for naming, options, etc.). May be * NULL. */ - CONST char *name; /* Name for new window; if parent is non-NULL, + CONST char *name, /* Name for new window; if parent is non-NULL, * must be unique among parent's children. */ - CONST char *screenName; /* Name of screen on which to create window. + CONST char *screenName, /* Name of screen on which to create window. * NULL means use DISPLAY environment variable * to determine. Empty string means use * parent's screen, or DISPLAY if no * parent. */ - unsigned int flags; /* Additional flags to set on the window. */ + unsigned int flags) /* Additional flags to set on the window. */ { register TkWindow *winPtr; register TkDisplay *dispPtr; @@ -444,11 +445,11 @@ CreateTopLevelWindow(interp, parent, name, screenName, flags) */ static TkDisplay * -GetScreen(interp, screenName, screenPtr) - Tcl_Interp *interp; /* Place to leave error message. */ - CONST char *screenName; /* Name for screen. NULL or empty means use +GetScreen( + Tcl_Interp *interp, /* Place to leave error message. */ + CONST char *screenName, /* Name for screen. NULL or empty means use * DISPLAY envariable. */ - int *screenPtr; /* Where to store screen number. */ + int *screenPtr) /* Where to store screen number. */ { register TkDisplay *dispPtr; CONST char *p; @@ -560,8 +561,8 @@ GetScreen(interp, screenName, screenPtr) */ TkDisplay * -TkGetDisplay(display) - Display *display; /* X's display pointer */ +TkGetDisplay( + Display *display) /* X's display pointer */ { TkDisplay *dispPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) @@ -595,7 +596,7 @@ TkGetDisplay(display) */ TkDisplay * -TkGetDisplayList() +TkGetDisplayList(void) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -622,7 +623,7 @@ TkGetDisplayList() */ TkMainInfo * -TkGetMainInfoList() +TkGetMainInfoList(void) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -647,10 +648,10 @@ TkGetMainInfoList() */ TkWindow * -TkAllocWindow(dispPtr, screenNum, parentPtr) - TkDisplay *dispPtr; /* Display associated with new window. */ - int screenNum; /* Index of screen for new window. */ - TkWindow *parentPtr; /* Parent from which this window should +TkAllocWindow( + TkDisplay *dispPtr, /* Display associated with new window. */ + int screenNum, /* Index of screen for new window. */ + TkWindow *parentPtr) /* Parent from which this window should * inherit visual information. NULL means use * screen defaults instead of inheriting. */ { @@ -731,12 +732,12 @@ TkAllocWindow(dispPtr, screenNum, parentPtr) */ static int -NameWindow(interp, winPtr, parentPtr, name) - Tcl_Interp *interp; /* Interpreter to use for error reporting. */ - register TkWindow *winPtr; /* Window that is to be named and inserted. */ - TkWindow *parentPtr; /* Pointer to logical parent for winPtr (used +NameWindow( + Tcl_Interp *interp, /* Interpreter to use for error reporting. */ + register TkWindow *winPtr, /* Window that is to be named and inserted. */ + TkWindow *parentPtr, /* Pointer to logical parent for winPtr (used * for naming, options, etc.). */ - CONST char *name; /* Name for winPtr; must be unique among + CONST char *name) /* Name for winPtr; must be unique among * parentPtr's children. */ { #define FIXED_SIZE 200 @@ -851,17 +852,16 @@ NameWindow(interp, winPtr, parentPtr, name) */ Tk_Window -TkCreateMainWindow(interp, screenName, baseName) - Tcl_Interp *interp; /* Interpreter to use for error reporting. */ - CONST char *screenName; /* Name of screen on which to create window. +TkCreateMainWindow( + Tcl_Interp *interp, /* Interpreter to use for error reporting. */ + CONST char *screenName, /* Name of screen on which to create window. * Empty or NULL string means use DISPLAY * environment variable. */ - char *baseName; /* Base name for application; usually of the + char *baseName) /* Base name for application; usually of the * form "prog instance". */ { Tk_Window tkwin; - int dummy; - int isSafe; + int dummy, isSafe; Tcl_HashEntry *hPtr; register TkMainInfo *mainPtr; register TkWindow *winPtr; @@ -919,8 +919,8 @@ TkCreateMainWindow(interp, screenName, baseName) Tcl_ResetResult(interp); } if (Tcl_LinkVar(interp, "::tk::AlwaysShowSelection", - (char *) &mainPtr->alwaysShowSelection, - TCL_LINK_BOOLEAN) != TCL_OK) { + (char *) &mainPtr->alwaysShowSelection, + TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } mainPtr->nextPtr = tsdPtr->mainWindowList; @@ -1007,14 +1007,14 @@ TkCreateMainWindow(interp, screenName, baseName) */ Tk_Window -Tk_CreateWindow(interp, parent, name, screenName) - Tcl_Interp *interp; /* Interpreter to use for error reporting. +Tk_CreateWindow( + Tcl_Interp *interp, /* Interpreter to use for error reporting. * the interp's result is assumed to be * initialized by the caller. */ - Tk_Window parent; /* Token for parent of new window. */ - CONST char *name; /* Name for new window. Must be unique among + Tk_Window parent, /* Token for parent of new window. */ + CONST char *name, /* Name for new window. Must be unique among * parent's children. */ - CONST char *screenName; /* If NULL, new window will be internal on + CONST char *screenName) /* If NULL, new window will be internal on * same screen as its parent. If non-NULL, * gives name of screen on which to create new * window; window will be a top-level @@ -1033,19 +1033,18 @@ Tk_CreateWindow(interp, parent, name, screenName) "can't create window: its parent has -container = yes", NULL); return NULL; } + if (screenName == NULL) { winPtr = TkAllocWindow(parentPtr->dispPtr, parentPtr->screenNum, parentPtr); if (NameWindow(interp, winPtr, parentPtr, name) != TCL_OK) { Tk_DestroyWindow((Tk_Window) winPtr); return NULL; - } else { - return (Tk_Window) winPtr; } - } else { - return CreateTopLevelWindow(interp, parent, name, screenName, - /* flags */ 0); + return (Tk_Window) winPtr; } + return CreateTopLevelWindow(interp, parent, name, screenName, + /* flags */ 0); } /* @@ -1072,12 +1071,12 @@ Tk_CreateWindow(interp, parent, name, screenName) */ Tk_Window -Tk_CreateAnonymousWindow(interp, parent, screenName) - Tcl_Interp *interp; /* Interpreter to use for error reporting. +Tk_CreateAnonymousWindow( + Tcl_Interp *interp, /* Interpreter to use for error reporting. * the interp's result is assumed to be * initialized by the caller. */ - Tk_Window parent; /* Token for parent of new window. */ - CONST char *screenName; /* If NULL, new window will be internal on + Tk_Window parent, /* Token for parent of new window. */ + CONST char *screenName) /* If NULL, new window will be internal on * same screen as its parent. If non-NULL, * gives name of screen on which to create new * window; window will be a top-level @@ -1110,10 +1109,9 @@ Tk_CreateAnonymousWindow(interp, parent, screenName) return NULL; } return (Tk_Window) winPtr; - } else { - return CreateTopLevelWindow(interp, parent, NULL, screenName, - TK_ANONYMOUS_WINDOW); } + return CreateTopLevelWindow(interp, parent, NULL, screenName, + TK_ANONYMOUS_WINDOW); } /* @@ -1139,17 +1137,17 @@ Tk_CreateAnonymousWindow(interp, parent, screenName) */ Tk_Window -Tk_CreateWindowFromPath(interp, tkwin, pathName, screenName) - Tcl_Interp *interp; /* Interpreter to use for error reporting. +Tk_CreateWindowFromPath( + Tcl_Interp *interp, /* Interpreter to use for error reporting. * the interp's result is assumed to be * initialized by the caller. */ - Tk_Window tkwin; /* Token for any window in application that is + Tk_Window tkwin, /* Token for any window in application that is * to contain new window. */ - CONST char *pathName; /* Path name for new window within the + CONST char *pathName, /* Path name for new window within the * application of tkwin. The parent of this * window must already exist, but the window * itself must not exist. */ - CONST char *screenName; /* If NULL, new window will be on same screen + CONST char *screenName) /* If NULL, new window will be on same screen * as its parent. If non-NULL, gives name of * screen on which to create new window; * window will be a top-level window. */ @@ -1203,7 +1201,8 @@ Tk_CreateWindowFromPath(interp, tkwin, pathName, screenName) Tcl_AppendResult(interp, "can't create window: parent has been destroyed", NULL); return NULL; - } else if (((TkWindow *) parent)->flags & TK_CONTAINER) { + } + if (((TkWindow *) parent)->flags & TK_CONTAINER) { Tcl_AppendResult(interp, "can't create window: its parent has -container = yes", NULL); return NULL; @@ -1223,13 +1222,12 @@ Tk_CreateWindowFromPath(interp, tkwin, pathName, screenName) != TCL_OK) { Tk_DestroyWindow((Tk_Window) winPtr); return NULL; - } else { - return (Tk_Window) winPtr; } - } else { - return CreateTopLevelWindow(interp, parent, pathName+numChars+1, - screenName, /* flags */ 0); + return (Tk_Window) winPtr; } + + return CreateTopLevelWindow(interp, parent, pathName+numChars+1, + screenName, /* flags */ 0); } /* @@ -1253,8 +1251,8 @@ Tk_CreateWindowFromPath(interp, tkwin, pathName, screenName) */ void -Tk_DestroyWindow(tkwin) - Tk_Window tkwin; /* Window to destroy. */ +Tk_DestroyWindow( + Tk_Window tkwin) /* Window to destroy. */ { TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; @@ -1526,12 +1524,10 @@ Tk_DestroyWindow(tkwin) (!Tcl_InterpDeleted(winPtr->mainPtr->interp))) { for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) { Tcl_CreateCommand(winPtr->mainPtr->interp, cmdPtr->name, - TkDeadAppCmd, (ClientData) NULL, - (void (*) _ANSI_ARGS_((ClientData))) NULL); + TkDeadAppCmd, NULL, NULL); } Tcl_CreateCommand(winPtr->mainPtr->interp, "send", - TkDeadAppCmd, (ClientData) NULL, - (void (*) _ANSI_ARGS_((ClientData))) NULL); + TkDeadAppCmd, NULL, NULL); Tcl_UnlinkVar(winPtr->mainPtr->interp, "tk_strictMotif"); Tcl_UnlinkVar(winPtr->mainPtr->interp, "::tk::AlwaysShowSelection"); @@ -1633,8 +1629,8 @@ Tk_DestroyWindow(tkwin) */ void -Tk_MapWindow(tkwin) - Tk_Window tkwin; /* Token for window to map. */ +Tk_MapWindow( + Tk_Window tkwin) /* Token for window to map. */ { TkWindow *winPtr = (TkWindow *) tkwin; XEvent event; @@ -1687,8 +1683,8 @@ Tk_MapWindow(tkwin) */ void -Tk_MakeWindowExist(tkwin) - Tk_Window tkwin; /* Token for window. */ +Tk_MakeWindowExist( + Tk_Window tkwin) /* Token for window. */ { register TkWindow *winPtr = (TkWindow *) tkwin; TkWindow *winPtr2; @@ -1795,8 +1791,8 @@ Tk_MakeWindowExist(tkwin) */ void -Tk_UnmapWindow(tkwin) - Tk_Window tkwin; /* Token for window to unmap. */ +Tk_UnmapWindow( + Tk_Window tkwin) /* Token for window to unmap. */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -1829,11 +1825,11 @@ Tk_UnmapWindow(tkwin) } void -Tk_ConfigureWindow(tkwin, valueMask, valuePtr) - Tk_Window tkwin; /* Window to re-configure. */ - unsigned int valueMask; /* Mask indicating which parts of *valuePtr +Tk_ConfigureWindow( + Tk_Window tkwin, /* Window to re-configure. */ + unsigned int valueMask, /* Mask indicating which parts of *valuePtr * are to be used. */ - XWindowChanges *valuePtr; /* New values. */ + XWindowChanges *valuePtr) /* New values. */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -1867,9 +1863,9 @@ Tk_ConfigureWindow(tkwin, valueMask, valuePtr) } void -Tk_MoveWindow(tkwin, x, y) - Tk_Window tkwin; /* Window to move. */ - int x, y; /* New location for window (within parent). */ +Tk_MoveWindow( + Tk_Window tkwin, /* Window to move. */ + int x, int y) /* New location for window (within parent). */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -1885,9 +1881,9 @@ Tk_MoveWindow(tkwin, x, y) } void -Tk_ResizeWindow(tkwin, width, height) - Tk_Window tkwin; /* Window to resize. */ - int width, height; /* New dimensions for window. */ +Tk_ResizeWindow( + Tk_Window tkwin, /* Window to resize. */ + int width, int height) /* New dimensions for window. */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -1904,10 +1900,10 @@ Tk_ResizeWindow(tkwin, width, height) } void -Tk_MoveResizeWindow(tkwin, x, y, width, height) - Tk_Window tkwin; /* Window to move and resize. */ - int x, y; /* New location for window (within parent). */ - int width, height; /* New dimensions for window. */ +Tk_MoveResizeWindow( + Tk_Window tkwin, /* Window to move and resize. */ + int x, int y, /* New location for window (within parent). */ + int width, int height) /* New dimensions for window. */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -1926,9 +1922,9 @@ Tk_MoveResizeWindow(tkwin, x, y, width, height) } void -Tk_SetWindowBorderWidth(tkwin, width) - Tk_Window tkwin; /* Window to modify. */ - int width; /* New border width for window. */ +Tk_SetWindowBorderWidth( + Tk_Window tkwin, /* Window to modify. */ + int width) /* New border width for window. */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -1944,11 +1940,11 @@ Tk_SetWindowBorderWidth(tkwin, width) } void -Tk_ChangeWindowAttributes(tkwin, valueMask, attsPtr) - Tk_Window tkwin; /* Window to manipulate. */ - unsigned long valueMask; /* OR'ed combination of bits, indicating which +Tk_ChangeWindowAttributes( + Tk_Window tkwin, /* Window to manipulate. */ + unsigned long valueMask, /* OR'ed combination of bits, indicating which * fields of *attsPtr are to be used. */ - register XSetWindowAttributes *attsPtr; + register XSetWindowAttributes *attsPtr) /* New values for some attributes. */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -2009,9 +2005,9 @@ Tk_ChangeWindowAttributes(tkwin, valueMask, attsPtr) } void -Tk_SetWindowBackground(tkwin, pixel) - Tk_Window tkwin; /* Window to manipulate. */ - unsigned long pixel; /* Pixel value to use for window's +Tk_SetWindowBackground( + Tk_Window tkwin, /* Window to manipulate. */ + unsigned long pixel) /* Pixel value to use for window's * background. */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -2027,9 +2023,9 @@ Tk_SetWindowBackground(tkwin, pixel) } void -Tk_SetWindowBackgroundPixmap(tkwin, pixmap) - Tk_Window tkwin; /* Window to manipulate. */ - Pixmap pixmap; /* Pixmap to use for window's background. */ +Tk_SetWindowBackgroundPixmap( + Tk_Window tkwin, /* Window to manipulate. */ + Pixmap pixmap) /* Pixmap to use for window's background. */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -2045,9 +2041,9 @@ Tk_SetWindowBackgroundPixmap(tkwin, pixmap) } void -Tk_SetWindowBorder(tkwin, pixel) - Tk_Window tkwin; /* Window to manipulate. */ - unsigned long pixel; /* Pixel value to use for window's border. */ +Tk_SetWindowBorder( + Tk_Window tkwin, /* Window to manipulate. */ + unsigned long pixel) /* Pixel value to use for window's border. */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -2062,9 +2058,9 @@ Tk_SetWindowBorder(tkwin, pixel) } void -Tk_SetWindowBorderPixmap(tkwin, pixmap) - Tk_Window tkwin; /* Window to manipulate. */ - Pixmap pixmap; /* Pixmap to use for window's border. */ +Tk_SetWindowBorderPixmap( + Tk_Window tkwin, /* Window to manipulate. */ + Pixmap pixmap) /* Pixmap to use for window's border. */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -2080,9 +2076,9 @@ Tk_SetWindowBorderPixmap(tkwin, pixmap) } void -Tk_DefineCursor(tkwin, cursor) - Tk_Window tkwin; /* Window to manipulate. */ - Tk_Cursor cursor; /* Cursor to use for window (may be None). */ +Tk_DefineCursor( + Tk_Window tkwin, /* Window to manipulate. */ + Tk_Cursor cursor) /* Cursor to use for window (may be None). */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -2100,16 +2096,16 @@ Tk_DefineCursor(tkwin, cursor) } void -Tk_UndefineCursor(tkwin) - Tk_Window tkwin; /* Window to manipulate. */ +Tk_UndefineCursor( + Tk_Window tkwin) /* Window to manipulate. */ { Tk_DefineCursor(tkwin, None); } void -Tk_SetWindowColormap(tkwin, colormap) - Tk_Window tkwin; /* Window to manipulate. */ - Colormap colormap; /* Colormap to use for window. */ +Tk_SetWindowColormap( + Tk_Window tkwin, /* Window to manipulate. */ + Colormap colormap) /* Colormap to use for window. */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -2147,15 +2143,15 @@ Tk_SetWindowColormap(tkwin, colormap) */ int -Tk_SetWindowVisual(tkwin, visual, depth, colormap) - Tk_Window tkwin; /* Window to manipulate. */ - Visual *visual; /* New visual for window. */ - int depth; /* New depth for window. */ - Colormap colormap; /* An appropriate colormap for the visual. */ +Tk_SetWindowVisual( + Tk_Window tkwin, /* Window to manipulate. */ + Visual *visual, /* New visual for window. */ + int depth, /* New depth for window. */ + Colormap colormap) /* An appropriate colormap for the visual. */ { register TkWindow *winPtr = (TkWindow *) tkwin; - if( winPtr->window != None ){ + if (winPtr->window != None) { /* Too late! */ return 0; } @@ -2195,8 +2191,8 @@ Tk_SetWindowVisual(tkwin, visual, depth, colormap) */ void -TkDoConfigureNotify(winPtr) - register TkWindow *winPtr; /* Window whose configuration was just +TkDoConfigureNotify( + register TkWindow *winPtr) /* Window whose configuration was just * changed. */ { XEvent event; @@ -2238,9 +2234,9 @@ TkDoConfigureNotify(winPtr) */ void -Tk_SetClass(tkwin, className) - Tk_Window tkwin; /* Token for window to assign class. */ - CONST char *className; /* New class for tkwin. */ +Tk_SetClass( + Tk_Window tkwin, /* Token for window to assign class. */ + CONST char *className) /* New class for tkwin. */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -2270,10 +2266,10 @@ Tk_SetClass(tkwin, className) */ void -Tk_SetClassProcs(tkwin, procs, instanceData) - Tk_Window tkwin; /* Token for window to modify. */ - Tk_ClassProcs *procs; /* Class procs structure. */ - ClientData instanceData; /* Data to be passed to class functions. */ +Tk_SetClassProcs( + Tk_Window tkwin, /* Token for window to modify. */ + Tk_ClassProcs *procs, /* Class procs structure. */ + ClientData instanceData) /* Data to be passed to class functions. */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -2302,10 +2298,10 @@ Tk_SetClassProcs(tkwin, procs, instanceData) */ Tk_Window -Tk_NameToWindow(interp, pathName, tkwin) - Tcl_Interp *interp; /* Where to report errors. */ - CONST char *pathName; /* Path name of window. */ - Tk_Window tkwin; /* Token for window: name is assumed to belong +Tk_NameToWindow( + Tcl_Interp *interp, /* Where to report errors. */ + CONST char *pathName, /* Path name of window. */ + Tk_Window tkwin) /* Token for window: name is assumed to belong * to the same main window as tkwin. */ { Tcl_HashEntry *hPtr; @@ -2354,9 +2350,9 @@ Tk_NameToWindow(interp, pathName, tkwin) */ Tk_Window -Tk_IdToWindow(display, window) - Display *display; /* X display containing the window. */ - Window window; /* X window window id. */ +Tk_IdToWindow( + Display *display, /* X display containing the window. */ + Window window) /* X window window id. */ { TkDisplay *dispPtr; Tcl_HashEntry *hPtr; @@ -2395,8 +2391,8 @@ Tk_IdToWindow(display, window) */ CONST char * -Tk_DisplayName(tkwin) - Tk_Window tkwin; /* Window whose display name is desired. */ +Tk_DisplayName( + Tk_Window tkwin) /* Window whose display name is desired. */ { return ((TkWindow *) tkwin)->dispPtr->name; } @@ -2418,7 +2414,8 @@ Tk_DisplayName(tkwin) */ Tcl_Interp * -Tk_Interp(Tk_Window tkwin) +Tk_Interp( + Tk_Window tkwin) { if (tkwin != NULL && ((TkWindow *)tkwin)->mainPtr != NULL) { return ((TkWindow *)tkwin)->mainPtr->interp; @@ -2443,8 +2440,8 @@ Tk_Interp(Tk_Window tkwin) */ static void -UnlinkWindow(winPtr) - TkWindow *winPtr; /* Child window to be unlinked. */ +UnlinkWindow( + TkWindow *winPtr) /* Child window to be unlinked. */ { TkWindow *prevPtr; @@ -2489,12 +2486,12 @@ UnlinkWindow(winPtr) */ int -Tk_RestackWindow(tkwin, aboveBelow, other) - Tk_Window tkwin; /* Token for window whose position in the +Tk_RestackWindow( + Tk_Window tkwin, /* Token for window whose position in the * stacking order is to change. */ - int aboveBelow; /* Indicates new position of tkwin relative to + int aboveBelow, /* Indicates new position of tkwin relative to * other; must be Above or Below. */ - Tk_Window other; /* Tkwin will be moved to a position that puts + Tk_Window other) /* Tkwin will be moved to a position that puts * it just above or below this window. If NULL * then tkwin goes above or below all windows * in the same parent. */ @@ -2617,8 +2614,8 @@ Tk_RestackWindow(tkwin, aboveBelow, other) */ Tk_Window -Tk_MainWindow(interp) - Tcl_Interp *interp; /* Interpreter that embodies the application. +Tk_MainWindow( + Tcl_Interp *interp) /* Interpreter that embodies the application. * Used for error reporting also. */ { TkMainInfo *mainPtr; @@ -2666,8 +2663,8 @@ Tk_MainWindow(interp) */ int -Tk_StrictMotif(tkwin) - Tk_Window tkwin; /* Window whose application is to be +Tk_StrictMotif( + Tk_Window tkwin) /* Window whose application is to be * checked. */ { return ((TkWindow *) tkwin)->mainPtr->strictMotif; @@ -2691,7 +2688,7 @@ Tk_StrictMotif(tkwin) */ int -Tk_GetNumMainWindows() +Tk_GetNumMainWindows(void) { ThreadSpecificData *tsdPtr; @@ -2728,9 +2725,9 @@ Tk_GetNumMainWindows() */ int -TkpAlwaysShowSelection(tkwin) - Tk_Window tkwin; /* Window whose application is - * to be checked. */ +TkpAlwaysShowSelection( + Tk_Window tkwin) /* Window whose application is to be + * checked. */ { return ((TkWindow *) tkwin)->mainPtr->alwaysShowSelection; } @@ -2755,8 +2752,8 @@ TkpAlwaysShowSelection(tkwin) */ static void -DeleteWindowsExitProc(clientData) - ClientData clientData; /* tsdPtr when handler was created. */ +DeleteWindowsExitProc( + ClientData clientData) /* tsdPtr when handler was created. */ { TkDisplay *dispPtr, *nextPtr; Tcl_Interp *interp; @@ -2847,8 +2844,8 @@ DeleteWindowsExitProc(clientData) */ int -Tk_Init(interp) - Tcl_Interp *interp; /* Interpreter to initialize. */ +Tk_Init( + Tcl_Interp *interp) /* Interpreter to initialize. */ { return Initialize(interp); } @@ -2872,8 +2869,8 @@ Tk_Init(interp) */ int -Tk_SafeInit(interp) - Tcl_Interp *interp; /* Interpreter to initialize. */ +Tk_SafeInit( + Tcl_Interp *interp) /* Interpreter to initialize. */ { /* * Initialize the interpreter with Tk, safely. This removes all the Tk @@ -2936,8 +2933,8 @@ extern TkStubs tkStubs; */ static int -Initialize(interp) - Tcl_Interp *interp; /* Interpreter to initialize. */ +Initialize( + Tcl_Interp *interp) /* Interpreter to initialize. */ { char *p; int argc, code; @@ -3022,7 +3019,8 @@ Initialize(interp) * Construct the name (rewalk...) */ - if ((code = Tcl_GetInterpPath(master, interp)) != TCL_OK) { + code = Tcl_GetInterpPath(master, interp); + if (code != TCL_OK) { Tcl_AppendResult(interp, "error in Tcl_GetInterpPath", NULL); goto done; } @@ -3040,7 +3038,8 @@ Initialize(interp) * path of the slave. */ - if ((code = Tcl_Eval(master, Tcl_DStringValue(&ds))) != TCL_OK) { + code = Tcl_Eval(master, Tcl_DStringValue(&ds)); + if (code != TCL_OK) { /* * We might want to transfer the error message or not. We don't. * (No API to do it and maybe security reasons). @@ -3099,6 +3098,7 @@ Initialize(interp) Tcl_DStringInit(&class); if (name == NULL) { int offset; + TkpGetAppName(interp, &class); offset = Tcl_DStringLength(&class)+1; Tcl_DStringSetLength(&class, offset); @@ -3191,21 +3191,21 @@ Initialize(interp) * Provide Tk and its stub table. */ - code = Tcl_PkgProvideEx(interp, "Tk", TK_PATCH_LEVEL, (ClientData) &tkStubs); + code = Tcl_PkgProvideEx(interp, "Tk", TK_PATCH_LEVEL, + (ClientData) &tkStubs); if (code != TCL_OK) { goto done; - } else { - /* - * If we were able to provide ourselves as a package, then set the - * main loop function in Tcl to our main loop proc. This will cause - * tclsh to be event-aware when Tk is dynamically loaded. This will - * have no effect in wish, which already is prepared to run the event - * loop. - */ - - Tcl_SetMainLoop(Tk_MainLoop); } + /* + * If we were able to provide ourselves as a package, then set the main + * loop function in Tcl to our main loop proc. This will cause tclsh to be + * event-aware when Tk is dynamically loaded. This will have no effect in + * wish, which already is prepared to run the event loop. + */ + + Tcl_SetMainLoop(Tk_MainLoop); + #ifdef Tk_InitStubs #undef Tk_InitStubs #endif @@ -3222,9 +3222,9 @@ Initialize(interp) } /* - * Invoke platform-specific initialization. - * Unlock mutex before entering TkpInit, as that may run through the - * Tk_Init routine again for the console window interpreter. + * Invoke platform-specific initialization. Unlock mutex before entering + * TkpInit, as that may run through the Tk_Init routine again for the + * console window interpreter. */ Tcl_MutexUnlock(&windowMutex); |