diff options
Diffstat (limited to 'generic/tkWindow.c')
-rw-r--r-- | generic/tkWindow.c | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/generic/tkWindow.c b/generic/tkWindow.c index a04777f..98b89db 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -101,12 +101,12 @@ static CONST XSetWindowAttributes defAtts= { #define ISSAFE 1 #define PASSMAINWINDOW 2 -#define WINMACONLY 4 +#define NOOBJPROC 4 +#define WINMACONLY 8 typedef struct { CONST char *name; /* Name of command. */ - Tcl_CmdProc *cmdProc; /* Command's string-based procedure. */ - Tcl_ObjCmdProc *objProc; /* Command's object-based procedure. */ + Tcl_ObjCmdProc *objProc; /* Command's object- (or string-) based procedure. */ int flags; } TkCmd; @@ -115,59 +115,59 @@ static CONST TkCmd commands[] = { * Commands that are part of the intrinsics: */ - {"bell", NULL, Tk_BellObjCmd, PASSMAINWINDOW}, - {"bind", NULL, Tk_BindObjCmd, PASSMAINWINDOW|ISSAFE}, - {"bindtags", NULL, Tk_BindtagsObjCmd, PASSMAINWINDOW|ISSAFE}, - {"clipboard", NULL, Tk_ClipboardObjCmd, PASSMAINWINDOW}, - {"destroy", NULL, Tk_DestroyObjCmd, PASSMAINWINDOW|ISSAFE}, - {"event", NULL, Tk_EventObjCmd, PASSMAINWINDOW|ISSAFE}, - {"focus", NULL, Tk_FocusObjCmd, PASSMAINWINDOW|ISSAFE}, - {"font", NULL, Tk_FontObjCmd, PASSMAINWINDOW|ISSAFE}, - {"grab", NULL, Tk_GrabObjCmd, PASSMAINWINDOW}, - {"grid", NULL, Tk_GridObjCmd, PASSMAINWINDOW|ISSAFE}, - {"image", NULL, Tk_ImageObjCmd, PASSMAINWINDOW|ISSAFE}, - {"lower", NULL, Tk_LowerObjCmd, PASSMAINWINDOW|ISSAFE}, - {"option", NULL, Tk_OptionObjCmd, PASSMAINWINDOW|ISSAFE}, - {"pack", NULL, Tk_PackObjCmd, PASSMAINWINDOW|ISSAFE}, - {"place", NULL, Tk_PlaceObjCmd, ISSAFE}, - {"raise", NULL, Tk_RaiseObjCmd, PASSMAINWINDOW|ISSAFE}, - {"selection", NULL, Tk_SelectionObjCmd, PASSMAINWINDOW}, - {"tk", NULL, Tk_TkObjCmd, PASSMAINWINDOW|ISSAFE}, - {"tkwait", NULL, Tk_TkwaitObjCmd, PASSMAINWINDOW|ISSAFE}, + {"bell", Tk_BellObjCmd, PASSMAINWINDOW}, + {"bind", Tk_BindObjCmd, PASSMAINWINDOW|ISSAFE}, + {"bindtags", Tk_BindtagsObjCmd, PASSMAINWINDOW|ISSAFE}, + {"clipboard", Tk_ClipboardObjCmd, PASSMAINWINDOW}, + {"destroy", Tk_DestroyObjCmd, PASSMAINWINDOW|ISSAFE}, + {"event", Tk_EventObjCmd, PASSMAINWINDOW|ISSAFE}, + {"focus", Tk_FocusObjCmd, PASSMAINWINDOW|ISSAFE}, + {"font", Tk_FontObjCmd, PASSMAINWINDOW|ISSAFE}, + {"grab", Tk_GrabObjCmd, PASSMAINWINDOW}, + {"grid", Tk_GridObjCmd, PASSMAINWINDOW|ISSAFE}, + {"image", Tk_ImageObjCmd, PASSMAINWINDOW|ISSAFE}, + {"lower", Tk_LowerObjCmd, PASSMAINWINDOW|ISSAFE}, + {"option", Tk_OptionObjCmd, PASSMAINWINDOW|ISSAFE}, + {"pack", Tk_PackObjCmd, PASSMAINWINDOW|ISSAFE}, + {"place", Tk_PlaceObjCmd, ISSAFE}, + {"raise", Tk_RaiseObjCmd, PASSMAINWINDOW|ISSAFE}, + {"selection", Tk_SelectionObjCmd, PASSMAINWINDOW}, + {"tk", Tk_TkObjCmd, PASSMAINWINDOW|ISSAFE}, + {"tkwait", Tk_TkwaitObjCmd, PASSMAINWINDOW|ISSAFE}, #if defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK) - {"tk_chooseColor", NULL, Tk_ChooseColorObjCmd, PASSMAINWINDOW}, - {"tk_chooseDirectory", NULL, Tk_ChooseDirectoryObjCmd, WINMACONLY|PASSMAINWINDOW}, - {"tk_getOpenFile", NULL, Tk_GetOpenFileObjCmd, WINMACONLY|PASSMAINWINDOW}, - {"tk_getSaveFile", NULL, Tk_GetSaveFileObjCmd, WINMACONLY|PASSMAINWINDOW}, + {"tk_chooseColor", Tk_ChooseColorObjCmd, PASSMAINWINDOW}, + {"tk_chooseDirectory", Tk_ChooseDirectoryObjCmd, WINMACONLY|PASSMAINWINDOW}, + {"tk_getOpenFile", Tk_GetOpenFileObjCmd, WINMACONLY|PASSMAINWINDOW}, + {"tk_getSaveFile", Tk_GetSaveFileObjCmd, WINMACONLY|PASSMAINWINDOW}, #endif #if defined(__WIN32__) || defined(MAC_OSX_TK) - {"tk_messageBox", NULL, Tk_MessageBoxObjCmd, PASSMAINWINDOW}, + {"tk_messageBox", Tk_MessageBoxObjCmd, PASSMAINWINDOW}, #endif - {"update", NULL, Tk_UpdateObjCmd, PASSMAINWINDOW|ISSAFE}, - {"winfo", NULL, Tk_WinfoObjCmd, PASSMAINWINDOW|ISSAFE}, - {"wm", NULL, Tk_WmObjCmd, PASSMAINWINDOW}, + {"update", Tk_UpdateObjCmd, PASSMAINWINDOW|ISSAFE}, + {"winfo", Tk_WinfoObjCmd, PASSMAINWINDOW|ISSAFE}, + {"wm", Tk_WmObjCmd, PASSMAINWINDOW}, /* * Widget class commands. */ - {"button", NULL, Tk_ButtonObjCmd, ISSAFE}, - {"canvas", NULL, Tk_CanvasObjCmd, PASSMAINWINDOW|ISSAFE}, - {"checkbutton", NULL, Tk_CheckbuttonObjCmd, ISSAFE}, - {"entry", NULL, Tk_EntryObjCmd, ISSAFE}, - {"frame", NULL, Tk_FrameObjCmd, ISSAFE}, - {"label", NULL, Tk_LabelObjCmd, ISSAFE}, - {"labelframe", NULL, Tk_LabelframeObjCmd, ISSAFE}, - {"listbox", NULL, Tk_ListboxObjCmd, ISSAFE}, - {"menubutton", NULL, Tk_MenubuttonObjCmd, ISSAFE}, - {"message", NULL, Tk_MessageObjCmd, ISSAFE}, - {"panedwindow", NULL, Tk_PanedWindowObjCmd, ISSAFE}, - {"radiobutton", NULL, Tk_RadiobuttonObjCmd, ISSAFE}, - {"scale", NULL, Tk_ScaleObjCmd, ISSAFE}, - {"scrollbar", Tk_ScrollbarCmd, NULL, PASSMAINWINDOW|ISSAFE}, - {"spinbox", NULL, Tk_SpinboxObjCmd, ISSAFE}, - {"text", Tk_TextCmd, NULL, PASSMAINWINDOW|ISSAFE}, - {"toplevel", NULL, Tk_ToplevelObjCmd, 0}, + {"button", Tk_ButtonObjCmd, ISSAFE}, + {"canvas", Tk_CanvasObjCmd, PASSMAINWINDOW|ISSAFE}, + {"checkbutton", Tk_CheckbuttonObjCmd, ISSAFE}, + {"entry", Tk_EntryObjCmd, ISSAFE}, + {"frame", Tk_FrameObjCmd, ISSAFE}, + {"label", Tk_LabelObjCmd, ISSAFE}, + {"labelframe", Tk_LabelframeObjCmd, ISSAFE}, + {"listbox", Tk_ListboxObjCmd, ISSAFE}, + {"menubutton", Tk_MenubuttonObjCmd, ISSAFE}, + {"message", Tk_MessageObjCmd, ISSAFE}, + {"panedwindow", Tk_PanedWindowObjCmd, ISSAFE}, + {"radiobutton", Tk_RadiobuttonObjCmd, ISSAFE}, + {"scale", Tk_ScaleObjCmd, ISSAFE}, + {"scrollbar", (Tcl_ObjCmdProc *) Tk_ScrollbarCmd, NOOBJPROC|PASSMAINWINDOW|ISSAFE}, + {"spinbox", Tk_SpinboxObjCmd, ISSAFE}, + {"text", (Tcl_ObjCmdProc *) Tk_TextCmd, NOOBJPROC|PASSMAINWINDOW|ISSAFE}, + {"toplevel", Tk_ToplevelObjCmd, 0}, /* * Misc. @@ -175,9 +175,9 @@ static CONST TkCmd commands[] = { #if defined(MAC_TCL) || defined(MAC_OSX_TK) {"::tk::unsupported::MacWindowStyle", - NULL, TkUnsupported1ObjCmd, PASSMAINWINDOW|ISSAFE}, + TkUnsupported1ObjCmd, PASSMAINWINDOW|ISSAFE}, #endif - {(char *) NULL, (int (*) _ANSI_ARGS_((ClientData, Tcl_Interp *, int, CONST char **))) NULL, NULL, 0} + {NULL, NULL, 0} }; /* @@ -950,7 +950,7 @@ TkCreateMainWindow(interp, screenName, baseName) isSafe = Tcl_IsSafe(interp); for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) { - if ((cmdPtr->cmdProc == NULL) && (cmdPtr->objProc == NULL)) { + if (cmdPtr->objProc == NULL) { Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs"); } #ifdef __WIN32__ @@ -963,9 +963,9 @@ TkCreateMainWindow(interp, screenName, baseName) } else { clientData = (ClientData) NULL; } - if (cmdPtr->cmdProc != NULL) { - Tcl_CreateCommand(interp, cmdPtr->name, cmdPtr->cmdProc, - clientData, (void (*) _ANSI_ARGS_((ClientData))) NULL); + if (cmdPtr->flags & NOOBJPROC) { + Tcl_CreateCommand(interp, cmdPtr->name, + (Tcl_CmdProc *) cmdPtr->objProc, clientData, NULL); } else { Tcl_CreateObjCommand(interp, cmdPtr->name, cmdPtr->objProc, clientData, NULL); |