summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkWindow.c146
-rw-r--r--unix/Makefile.in11
2 files changed, 81 insertions, 76 deletions
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 1ffdd56..df1bf86 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -63,14 +63,14 @@ TCL_DECLARE_MUTEX(windowMutex)
* on internal windows: these events are generated internally.
*/
-static XWindowChanges defChanges = {
+static const XWindowChanges defChanges = {
0, 0, 1, 1, 0, 0, Above
};
#define ALL_EVENTS_MASK \
KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask| \
EnterWindowMask|LeaveWindowMask|PointerMotionMask|ExposureMask| \
VisibilityChangeMask|PropertyChangeMask|ColormapChangeMask
-static XSetWindowAttributes defAtts= {
+static const XSetWindowAttributes defAtts= {
None, /* background_pixmap */
0, /* background_pixel */
CopyFromParent, /* border_pixmap */
@@ -93,89 +93,87 @@ static XSetWindowAttributes defAtts= {
* the C functions that execute them.
*/
+#define ISSAFE 1
+#define PASSMAINWINDOW 2
+
typedef struct {
- char *name; /* Name of command. */
+ const char *name; /* Name of command. */
Tcl_CmdProc *cmdProc; /* Command's string-based function. */
Tcl_ObjCmdProc *objProc; /* Command's object-based function. */
- int isSafe; /* If !0, this command will be exposed in a
- * safe interpreter. Otherwise it will be
- * hidden in a safe interpreter. */
- int passMainWindow; /* 0 means provide NULL clientData to command
- * function; 1 means pass main window as
- * clientData to command function. */
+ int flags;
} TkCmd;
-static TkCmd commands[] = {
+static const TkCmd commands[] = {
/*
* Commands that are part of the intrinsics:
*/
- {"bell", NULL, Tk_BellObjCmd, 0, 1},
- {"bind", NULL, Tk_BindObjCmd, 1, 1},
- {"bindtags", NULL, Tk_BindtagsObjCmd, 1, 1},
- {"clipboard", NULL, Tk_ClipboardObjCmd, 0, 1},
- {"destroy", NULL, Tk_DestroyObjCmd, 1, 1},
- {"event", NULL, Tk_EventObjCmd, 1, 1},
- {"focus", NULL, Tk_FocusObjCmd, 1, 1},
- {"font", NULL, Tk_FontObjCmd, 1, 1},
- {"grab", NULL, Tk_GrabObjCmd, 0, 1},
- {"grid", NULL, Tk_GridObjCmd, 1, 1},
- {"image", NULL, Tk_ImageObjCmd, 1, 1},
- {"lower", NULL, Tk_LowerObjCmd, 1, 1},
- {"option", NULL, Tk_OptionObjCmd, 1, 1},
- {"pack", NULL, Tk_PackObjCmd, 1, 1},
- {"place", NULL, Tk_PlaceObjCmd, 1, 0},
- {"raise", NULL, Tk_RaiseObjCmd, 1, 1},
- {"selection", NULL, Tk_SelectionObjCmd, 0, 1},
- {"tk", NULL, Tk_TkObjCmd, 1, 1},
- {"tkwait", NULL, Tk_TkwaitObjCmd, 1, 1},
- {"update", NULL, Tk_UpdateObjCmd, 1, 1},
- {"winfo", NULL, Tk_WinfoObjCmd, 1, 1},
- {"wm", NULL, Tk_WmObjCmd, 0, 1},
+ {"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},
+ {"update", NULL, Tk_UpdateObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"winfo", NULL, Tk_WinfoObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"wm", NULL, Tk_WmObjCmd, PASSMAINWINDOW},
/*
* Default widget class commands.
*/
- {"button", NULL, Tk_ButtonObjCmd, 1, 0},
- {"canvas", NULL, Tk_CanvasObjCmd, 1, 1},
- {"checkbutton", NULL, Tk_CheckbuttonObjCmd, 1, 0},
- {"entry", NULL, Tk_EntryObjCmd, 1, 0},
- {"frame", NULL, Tk_FrameObjCmd, 1, 0},
- {"label", NULL, Tk_LabelObjCmd, 1, 0},
- {"labelframe", NULL, Tk_LabelframeObjCmd, 1, 0},
- {"listbox", NULL, Tk_ListboxObjCmd, 1, 0},
- {"menubutton", NULL, Tk_MenubuttonObjCmd, 1, 0},
- {"message", NULL, Tk_MessageObjCmd, 1, 0},
- {"panedwindow", NULL, Tk_PanedWindowObjCmd, 1, 0},
- {"radiobutton", NULL, Tk_RadiobuttonObjCmd, 1, 0},
- {"scale", NULL, Tk_ScaleObjCmd, 1, 0},
- {"scrollbar", Tk_ScrollbarCmd, NULL, 1, 1},
- {"spinbox", NULL, Tk_SpinboxObjCmd, 1, 0},
- {"text", NULL, Tk_TextObjCmd, 1, 1},
+ {"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", NULL, Tk_TextObjCmd, PASSMAINWINDOW|ISSAFE},
{"toplevel", NULL, Tk_ToplevelObjCmd, 0, 0},
/*
* Classic widget class commands.
*/
- {"::tk::button", NULL, Tk_ButtonObjCmd, 1, 0},
- {"::tk::canvas", NULL, Tk_CanvasObjCmd, 1, 1},
- {"::tk::checkbutton",NULL, Tk_CheckbuttonObjCmd, 1, 0},
- {"::tk::entry", NULL, Tk_EntryObjCmd, 1, 0},
- {"::tk::frame", NULL, Tk_FrameObjCmd, 1, 0},
- {"::tk::label", NULL, Tk_LabelObjCmd, 1, 0},
- {"::tk::labelframe",NULL, Tk_LabelframeObjCmd, 1, 0},
- {"::tk::listbox", NULL, Tk_ListboxObjCmd, 1, 0},
- {"::tk::menubutton",NULL, Tk_MenubuttonObjCmd, 1, 0},
- {"::tk::message", NULL, Tk_MessageObjCmd, 1, 0},
- {"::tk::panedwindow",NULL, Tk_PanedWindowObjCmd, 1, 0},
- {"::tk::radiobutton",NULL, Tk_RadiobuttonObjCmd, 1, 0},
- {"::tk::scale", NULL, Tk_ScaleObjCmd, 1, 0},
- {"::tk::scrollbar", Tk_ScrollbarCmd, NULL, 1, 1},
- {"::tk::spinbox", NULL, Tk_SpinboxObjCmd, 1, 0},
- {"::tk::text", NULL, Tk_TextObjCmd, 1, 1},
- {"::tk::toplevel", NULL, Tk_ToplevelObjCmd, 0, 0},
+ {"::tk::button", NULL, Tk_ButtonObjCmd, ISSAFE},
+ {"::tk::canvas", NULL, Tk_CanvasObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"::tk::checkbutton",NULL, Tk_CheckbuttonObjCmd, ISSAFE},
+ {"::tk::entry", NULL, Tk_EntryObjCmd, ISSAFE},
+ {"::tk::frame", NULL, Tk_FrameObjCmd, ISSAFE},
+ {"::tk::label", NULL, Tk_LabelObjCmd, ISSAFE},
+ {"::tk::labelframe",NULL, Tk_LabelframeObjCmd, ISSAFE},
+ {"::tk::listbox", NULL, Tk_ListboxObjCmd, ISSAFE},
+ {"::tk::menubutton",NULL, Tk_MenubuttonObjCmd, ISSAFE},
+ {"::tk::message", NULL, Tk_MessageObjCmd, ISSAFE},
+ {"::tk::panedwindow",NULL, Tk_PanedWindowObjCmd, ISSAFE},
+ {"::tk::radiobutton",NULL, Tk_RadiobuttonObjCmd, ISSAFE},
+ {"::tk::scale", NULL, Tk_ScaleObjCmd, ISSAFE},
+ {"::tk::scrollbar", Tk_ScrollbarCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"::tk::spinbox", NULL, Tk_SpinboxObjCmd, ISSAFE},
+ {"::tk::text", NULL, Tk_TextObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"::tk::toplevel", NULL, Tk_ToplevelObjCmd, 0},
/*
* Standard dialog support. Note that the Unix/X11 platform implements
@@ -183,11 +181,11 @@ static TkCmd commands[] = {
*/
#if defined(__WIN32__) || defined(MAC_OSX_TK)
- {"tk_chooseColor", NULL, Tk_ChooseColorObjCmd, 0, 1},
- {"tk_chooseDirectory", NULL, Tk_ChooseDirectoryObjCmd,0,1},
- {"tk_getOpenFile", NULL, Tk_GetOpenFileObjCmd, 0, 1},
- {"tk_getSaveFile", NULL, Tk_GetSaveFileObjCmd, 0, 1},
- {"tk_messageBox", NULL, Tk_MessageBoxObjCmd, 0, 1},
+ {"tk_chooseColor", NULL, Tk_ChooseColorObjCmd, PASSMAINWINDOW},
+ {"tk_chooseDirectory", NULL, Tk_ChooseDirectoryObjCmd,PASSMAINWINDOW},
+ {"tk_getOpenFile", NULL, Tk_GetOpenFileObjCmd, PASSMAINWINDOW},
+ {"tk_getSaveFile", NULL, Tk_GetSaveFileObjCmd, PASSMAINWINDOW},
+ {"tk_messageBox", NULL, Tk_MessageBoxObjCmd, PASSMAINWINDOW},
#endif
/*
@@ -196,9 +194,9 @@ static TkCmd commands[] = {
#if defined(MAC_OSX_TK)
{"::tk::unsupported::MacWindowStyle",
- NULL, TkUnsupported1ObjCmd, 1, 1},
+ NULL, TkUnsupported1ObjCmd, PASSMAINWINDOW|ISSAFE},
#endif
- {NULL, NULL, NULL, 0, 0}
+ {NULL, NULL, NULL, 0}
};
/*
@@ -949,7 +947,7 @@ TkCreateMainWindow(
if ((cmdPtr->cmdProc == NULL) && (cmdPtr->objProc == NULL)) {
Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs");
}
- if (cmdPtr->passMainWindow) {
+ if (cmdPtr->flags & PASSMAINWINDOW) {
clientData = (ClientData) tkwin;
} else {
clientData = (ClientData) NULL;
@@ -962,7 +960,7 @@ TkCreateMainWindow(
clientData, NULL);
}
if (isSafe) {
- if (!(cmdPtr->isSafe)) {
+ if (!(cmdPtr->flags & ISSAFE)) {
Tcl_HideCommand(interp, cmdPtr->name, cmdPtr->name);
}
}
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 0096d27..ed5474d 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -716,8 +716,15 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) wish@EXEEXT@
(\
echo "if {[catch {package present Tcl 8.5.0}]} { return }";\
relative=`echo | awk '{ORS=" "; split("$(TK_PKG_DIR)",a,"/"); for (f in a) {print ".."}}'`;\
- echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL)\
- [list load [file join \$$dir $${relative}$(TK_LIB_FILE)] Tk]";\
+ echo "if {[string match CYGWIN* \$$::tcl_platform(os)]} {";\
+ echo " if {([info exists ::env(DISPLAY)] || [lsearch -exact \$$::argv -display] > -1)} {";\
+ echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file join \$$dir $${relative}.. bin $(TK_LIB_FILE)] Tk]";\
+ echo " } else {";\
+ echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file join \$$dir $${relative}.. bin tk${MAJOR_VERSION}${MINOR_VERSION}.dll] Tk]";\
+ echo " }";\
+ echo "} else {";\
+ echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file join \$$dir $${relative}$(TK_LIB_FILE)] Tk]";\
+ echo "}";\
) > "$(PKG_INDEX)"; \
fi
@echo "Installing $(LIB_FILE) to $(LIB_INSTALL_DIR)/"