summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-20 12:50:11 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-20 12:50:11 (GMT)
commit4536458f719fdc35f247c8139aad6b8b71471048 (patch)
treeac02899a473761587e13b2906482b07f4bb0bb66
parentf4876885b53d6ed34fb1c3577e0c2d238a871953 (diff)
parent8077dd948e9d7c758be18837a1cc637007e50084 (diff)
downloadtk-4536458f719fdc35f247c8139aad6b8b71471048.zip
tk-4536458f719fdc35f247c8139aad6b8b71471048.tar.gz
tk-4536458f719fdc35f247c8139aad6b8b71471048.tar.bz2
fix (hopefully) menu posting in the same way as window placement
-rwxr-xr-xChangeLog8
-rw-r--r--generic/tkArgv.c2
-rw-r--r--generic/tkAtom.c4
-rwxr-xr-xgeneric/tkBind.c12
-rw-r--r--generic/tkButton.c8
-rw-r--r--generic/tkEntry.c4
-rw-r--r--generic/tkFocus.c8
-rw-r--r--generic/tkFrame.c6
-rw-r--r--generic/tkImgBmap.c2
-rw-r--r--generic/tkListbox.c4
-rw-r--r--generic/tkMenuDraw.c27
-rw-r--r--generic/tkMenubutton.c6
-rw-r--r--generic/tkPanedWindow.c2
-rw-r--r--generic/tkPlace.c2
-rw-r--r--generic/tkScale.c4
-rw-r--r--generic/tkTest.c4
-rw-r--r--generic/tkWindow.c127
-rw-r--r--unix/Makefile.in11
18 files changed, 114 insertions, 127 deletions
diff --git a/ChangeLog b/ChangeLog
index b4ac558..37db952 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-04-20 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tk.tcl: Use vroot size in stead of screen size for
+ clipping window coordinates in ::tk::PlaceWindow.
+ * generic/dialog.tcl: Use ::tk::PlaceWindow in dialog.tcl, in
+ stead of dumplicating the code there.
+ (harmless part of [Bug 533519])
+
2012-04-13 Jan Nijtmans <nijtmans@users.sf.net>
* win/rules.vc: [Bug 3517448] TclKit build fails (unresolved
diff --git a/generic/tkArgv.c b/generic/tkArgv.c
index 4821f41..4ee3b78 100644
--- a/generic/tkArgv.c
+++ b/generic/tkArgv.c
@@ -355,7 +355,7 @@ PrintUsage(interp, argTable, flags)
register Tk_ArgvInfo *infoPtr;
int width, i, numSpaces;
#define NUM_SPACES 20
- static char spaces[] = " ";
+ static CONST char spaces[] = " ";
char tmp[TCL_DOUBLE_SPACE];
/*
diff --git a/generic/tkAtom.c b/generic/tkAtom.c
index f94af81..108e989 100644
--- a/generic/tkAtom.c
+++ b/generic/tkAtom.c
@@ -22,7 +22,7 @@
* They should match those found in xatom.h
*/
-static char * atomNameArray[] = {
+static CONST char *atomNameArray[] = {
"PRIMARY", "SECONDARY", "ARC",
"ATOM", "BITMAP", "CARDINAL",
"COLORMAP", "CURSOR", "CUT_BUFFER0",
@@ -199,7 +199,7 @@ AtomInit(dispPtr)
for (atom = 1; atom <= XA_LAST_PREDEFINED; atom++) {
hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, (char *) atom);
if (hPtr == NULL) {
- char *name;
+ CONST char *name;
int new;
name = atomNameArray[atom - 1];
diff --git a/generic/tkBind.c b/generic/tkBind.c
index 3f05ccc..79112a0 100755
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -2626,32 +2626,20 @@ ExpandPercents(winPtr, before, eventPtr, keySym, dsPtr)
case 'X':
if (flags & KEY_BUTTON_MOTION_CROSSING) {
Tk_Window tkwin;
- int x, y;
- int width, height;
number = eventPtr->xkey.x_root;
tkwin = Tk_IdToWindow(eventPtr->xany.display,
eventPtr->xany.window);
- if (tkwin != NULL) {
- Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- number -= x;
- }
goto doNumber;
}
goto doString;
case 'Y':
if (flags & KEY_BUTTON_MOTION_CROSSING) {
Tk_Window tkwin;
- int x, y;
- int width, height;
number = eventPtr->xkey.y_root;
tkwin = Tk_IdToWindow(eventPtr->xany.display,
eventPtr->xany.window);
- if (tkwin != NULL) {
- Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- number -= y;
- }
goto doNumber;
}
goto doString;
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 3783985..e844cec 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -25,14 +25,14 @@ static Tcl_ThreadDataKey dataKey;
* in tkButton.h.
*/
-static char *classNames[] = {"Label", "Button", "Checkbutton", "Radiobutton"};
+static CONST char *classNames[] = {"Label", "Button", "Checkbutton", "Radiobutton"};
/*
* The following table defines the legal values for the -default option.
* It is used together with the "enum defaultValue" declaration in tkButton.h.
*/
-static char *defaultStrings[] = {
+static CONST char *defaultStrings[] = {
"active", "disabled", "normal", (char *) NULL
};
@@ -41,7 +41,7 @@ static char *defaultStrings[] = {
* It is used together with the "enum state" declaration in tkButton.h.
*/
-static char *stateStrings[] = {
+static CONST char *stateStrings[] = {
"active", "disabled", "normal", (char *) NULL
};
@@ -50,7 +50,7 @@ static char *stateStrings[] = {
* It is used with the "enum compound" declaration in tkButton.h
*/
-static char *compoundStrings[] = {
+static CONST char *compoundStrings[] = {
"bottom", "center", "left", "none", "right", "top", (char *) NULL
};
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index afd6b15..c6eed1b 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -35,7 +35,7 @@
#define DOUBLES_EQ(d1, d2) (fabs((d1) - (d2)) < MIN_DBL_VAL)
-static char *stateStrings[] = {
+static CONST char *stateStrings[] = {
"disabled", "normal", "readonly", (char *) NULL
};
@@ -43,7 +43,7 @@ static char *stateStrings[] = {
* Definitions for -validate option values:
*/
-static char *validateStrings[] = {
+static CONST char *validateStrings[] = {
"all", "key", "focus", "focusin", "focusout", "none", (char *) NULL
};
enum validateType {
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index aad1305..93e1617 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -737,7 +737,7 @@ TkFocusKeyEvent(winPtr, eventPtr)
{
DisplayFocusInfo *displayFocusPtr;
TkWindow *focusWinPtr;
- int focusX, focusY, vRootX, vRootY, vRootWidth, vRootHeight;
+ int focusX, focusY;
displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr);
focusWinPtr = displayFocusPtr->focusWinPtr;
@@ -770,11 +770,9 @@ TkFocusKeyEvent(winPtr, eventPtr)
eventPtr->xkey.x = -1;
eventPtr->xkey.y = -1;
} else {
- Tk_GetVRootGeometry((Tk_Window) focusWinPtr, &vRootX, &vRootY,
- &vRootWidth, &vRootHeight);
Tk_GetRootCoords((Tk_Window) focusWinPtr, &focusX, &focusY);
- eventPtr->xkey.x = eventPtr->xkey.x_root - vRootX - focusX;
- eventPtr->xkey.y = eventPtr->xkey.y_root - vRootY - focusY;
+ eventPtr->xkey.x = eventPtr->xkey.x_root - focusX;
+ eventPtr->xkey.y = eventPtr->xkey.y_root - focusY;
}
eventPtr->xkey.window = focusWinPtr->window;
return focusWinPtr;
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index 453ad73..a416b22 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -170,7 +170,7 @@ enum labelanchor {
LABELANCHOR_W, LABELANCHOR_WN, LABELANCHOR_WS
};
-static char *labelAnchorStrings[] = {
+static CONST char *labelAnchorStrings[] = {
"e", "en", "es", "n", "ne", "nw", "s", "se", "sw", "w", "wn", "ws",
(char *) NULL
};
@@ -302,7 +302,7 @@ static Tk_OptionSpec labelframeOptSpec[] = {
* Class names for widgets, indexed by FrameType.
*/
-static char *classNames[] = {"Frame", "Toplevel", "Labelframe"};
+static CONST char *classNames[] = {"Frame", "Toplevel", "Labelframe"};
/*
* The following table maps from FrameType to the option template for
@@ -312,7 +312,7 @@ static char *classNames[] = {"Frame", "Toplevel", "Labelframe"};
static Tk_OptionSpec *optionSpecs[] = {
frameOptSpec,
toplevelOptSpec,
- labelframeOptSpec,
+ labelframeOptSpec
};
/*
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index e1ccecb..2542697 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -1159,7 +1159,7 @@ ImgBmapPsImagemask(interp, width, height, data)
* on the left.) The following array is used to reverse the order of bits
* within a byte so that the bits will be in the order postscript expects.
*/
- static unsigned char bit_reverse[] = {
+ static CONST unsigned char bit_reverse[] = {
0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240,
8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248,
4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244,
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index cc73937..6f8156f 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -210,7 +210,7 @@ enum state {
STATE_DISABLED, STATE_NORMAL
};
-static char *stateStrings[] = {
+static CONST char *stateStrings[] = {
"disabled", "normal", (char *) NULL
};
@@ -218,7 +218,7 @@ enum activeStyle {
ACTIVE_STYLE_DOTBOX, ACTIVE_STYLE_NONE, ACTIVE_STYLE_UNDERLINE
};
-static char *activeStyleStrings[] = {
+static CONST char *activeStyleStrings[] = {
"dotbox", "none", "underline", (char *) NULL
};
diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c
index 33dadc1..6f0499a 100644
--- a/generic/tkMenuDraw.c
+++ b/generic/tkMenuDraw.c
@@ -892,32 +892,21 @@ TkPostTearoffMenu(interp, menuPtr, x, y)
* 2. The menu may not have been mapped yet, so its current size
* might be the default 1x1. To compute how much space it
* needs, use its requested size, not its actual size.
- *
- * Note that this code assumes square screen regions and all
- * positive coordinates. This does not work on a Mac with
- * multiple monitors. But then again, Tk has other problems
- * with this.
*/
Tk_GetVRootGeometry(Tk_Parent(menuPtr->tkwin), &vRootX, &vRootY,
&vRootWidth, &vRootHeight);
- x += vRootX;
- y += vRootY;
- tmp = WidthOfScreen(Tk_Screen(menuPtr->tkwin))
- - Tk_ReqWidth(menuPtr->tkwin);
- if (x > tmp) {
- x = tmp;
+ if (x > vRootX + vRootWidth) {
+ x = vRootX + vRootWidth;
}
- if (x < 0) {
- x = 0;
+ if (x < vRootX) {
+ x = vRootX;
}
- tmp = HeightOfScreen(Tk_Screen(menuPtr->tkwin))
- - Tk_ReqHeight(menuPtr->tkwin);
- if (y > tmp) {
- y = tmp;
+ if (y > vRootY + vRootHeight) {
+ y = vRootY + vRootHeight;
}
- if (y < 0) {
- y = 0;
+ if (y < vRootY) {
+ y = vRootY;
}
Tk_MoveToplevelWindow(menuPtr->tkwin, x, y);
if (!Tk_IsMapped(menuPtr->tkwin)) {
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c
index 8292b32..7e9a11a 100644
--- a/generic/tkMenubutton.c
+++ b/generic/tkMenubutton.c
@@ -21,7 +21,7 @@
* in tkMenubutton.h.
*/
-static char *directionStrings[] = {
+static CONST char *directionStrings[] = {
"above", "below", "flush", "left", "right", (char *) NULL
};
@@ -30,7 +30,7 @@ static char *directionStrings[] = {
* It is used together with the "enum state" declaration in tkMenubutton.h.
*/
-static char *stateStrings[] = {
+static CONST char *stateStrings[] = {
"active", "disabled", "normal", (char *) NULL
};
@@ -39,7 +39,7 @@ static char *stateStrings[] = {
* It is used with the "enum compound" declaration in tkMenuButton.h
*/
-static char *compoundStrings[] = {
+static CONST char *compoundStrings[] = {
"bottom", "center", "left", "none", "right", "top", (char *) NULL
};
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index 57670ba..09106dd 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -34,7 +34,7 @@
* The following table defines the legal values for the -orient option.
*/
-static char *orientStrings[] = {
+static CONST char *orientStrings[] = {
"horizontal", "vertical", (char *) NULL
};
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index b239947..6178d26 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -26,7 +26,7 @@
* master's actual window size.
*/
-static char *borderModeStrings[] = {
+static CONST char *borderModeStrings[] = {
"inside", "outside", "ignore", (char *) NULL
};
diff --git a/generic/tkScale.c b/generic/tkScale.c
index 676f84b..9b582fe 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -30,7 +30,7 @@
* It is used together with the "enum orient" declaration in tkScale.h.
*/
-static char *orientStrings[] = {
+static CONST char *orientStrings[] = {
"horizontal", "vertical", (char *) NULL
};
@@ -39,7 +39,7 @@ static char *orientStrings[] = {
* It is used together with the "enum state" declaration in tkScale.h.
*/
-static char *stateStrings[] = {
+static CONST char *stateStrings[] = {
"active", "disabled", "normal", (char *) NULL
};
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 0d6657a..fdd70b7 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -717,7 +717,7 @@ TestobjconfigObjCmd(clientData, interp, objc, objv)
Tcl_Obj *customPtr;
} TypesRecord;
TypesRecord *recordPtr;
- static char *stringTable[] = {"one", "two", "three", "four",
+ static CONST char *stringTable[] = {"one", "two", "three", "four",
(char *) NULL};
static Tk_OptionSpec typesSpecs[] = {
{TK_OPTION_BOOLEAN,
@@ -1032,7 +1032,7 @@ TestobjconfigObjCmd(clientData, interp, objc, objv)
char *custom;
} InternalRecord;
InternalRecord *recordPtr;
- static char *internalStringTable[] = {
+ static CONST char *internalStringTable[] = {
"one", "two", "three", "four", (char *) NULL
};
static Tk_OptionSpec internalSpecs[] = {
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 422b27e..d3de72d 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -69,14 +69,14 @@ TCL_DECLARE_MUTEX(windowMutex)
* events 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 */
@@ -99,77 +99,74 @@ static XSetWindowAttributes defAtts= {
* Tk, and the C procedures 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 procedure. */
Tcl_ObjCmdProc *objProc; /* Command's object-based procedure. */
- 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 procedure; 1 means pass main
- * window as clientData to command
- * procedure. */
+ 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},
+ {"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},
#if defined(__WIN32__) || defined(MAC_TCL) || 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_chooseColor", NULL, Tk_ChooseColorObjCmd, PASSMAINWINDOW},
+ {"tk_chooseDirectory", NULL, Tk_ChooseDirectoryObjCmd, PASSMAINWINDOW},
+ {"tk_getOpenFile", NULL, Tk_GetOpenFileObjCmd, PASSMAINWINDOW},
+ {"tk_getSaveFile", NULL, Tk_GetSaveFileObjCmd, PASSMAINWINDOW},
#endif
#if defined(__WIN32__) || defined(MAC_OSX_TK)
- {"tk_messageBox", NULL, Tk_MessageBoxObjCmd, 0, 1},
+ {"tk_messageBox", NULL, Tk_MessageBoxObjCmd, PASSMAINWINDOW},
#endif
- {"update", NULL, Tk_UpdateObjCmd, 1, 1},
- {"winfo", NULL, Tk_WinfoObjCmd, 1, 1},
- {"wm", NULL, Tk_WmObjCmd, 0, 1},
+ {"update", NULL, Tk_UpdateObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"winfo", NULL, Tk_WinfoObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"wm", NULL, Tk_WmObjCmd, PASSMAINWINDOW},
/*
* 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", Tk_TextCmd, NULL, 1, 1},
- {"toplevel", NULL, Tk_ToplevelObjCmd, 0, 0},
+ {"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},
/*
* Misc.
@@ -177,7 +174,7 @@ static TkCmd commands[] = {
#if defined(MAC_TCL) || defined(MAC_OSX_TK)
{"::tk::unsupported::MacWindowStyle",
- NULL, TkUnsupported1ObjCmd, 1, 1},
+ NULL, TkUnsupported1ObjCmd, PASSMAINWINDOW|ISSAFE},
#endif
{(char *) NULL, (int (*) _ANSI_ARGS_((ClientData, Tcl_Interp *, int, CONST char **))) NULL, NULL, 0}
};
@@ -857,7 +854,7 @@ TkCreateMainWindow(interp, screenName, baseName)
Tcl_HashEntry *hPtr;
register TkMainInfo *mainPtr;
register TkWindow *winPtr;
- register TkCmd *cmdPtr;
+ register CONST TkCmd *cmdPtr;
ClientData clientData;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -942,9 +939,9 @@ TkCreateMainWindow(interp, screenName, baseName)
isSafe = Tcl_IsSafe(interp);
for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) {
if ((cmdPtr->cmdProc == NULL) && (cmdPtr->objProc == NULL)) {
- panic("TkCreateMainWindow: builtin command with NULL string and object procs");
+ 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;
@@ -956,11 +953,11 @@ TkCreateMainWindow(interp, screenName, baseName)
Tcl_CreateObjCommand(interp, cmdPtr->name, cmdPtr->objProc,
clientData, NULL);
}
- if (isSafe) {
- if (!(cmdPtr->isSafe)) {
- Tcl_HideCommand(interp, cmdPtr->name, cmdPtr->name);
- }
- }
+ if (isSafe) {
+ if (!(cmdPtr->flags & ISSAFE)) {
+ Tcl_HideCommand(interp, cmdPtr->name, cmdPtr->name);
+ }
+ }
}
TkCreateMenuCmd(interp);
@@ -1514,7 +1511,7 @@ Tk_DestroyWindow(tkwin)
}
winPtr->mainPtr->refCount--;
if (winPtr->mainPtr->refCount == 0) {
- register TkCmd *cmdPtr;
+ register CONST TkCmd *cmdPtr;
/*
* We just deleted the last window in the application. Delete
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 27bbb19..b43c1ef 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -632,8 +632,15 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) $(TK_BUILD_EXP_FILE) wish
(\
relative=`echo | awk '{ORS=" "; split("$(TK_PKG_DIR)",a,"/"); for (f in a) {print ".."}}'`;\
echo "if {[package vcompare [package provide Tcl] $(TCLVERSION)] != 0} { return }";\
- echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)\
- [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) [list load [file join \$$dir $${relative}.. bin $(TK_LIB_FILE)] Tk]";\
+ echo " } else {";\
+ echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [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) [list load [file join \$$dir $${relative}$(TK_LIB_FILE)] Tk]";\
+ echo "}";\
) > $(PKG_INDEX); \
fi
@echo "Installing $(LIB_FILE) to $(LIB_INSTALL_DIR)/"