Tk Source Code

Check-in [b1dda72b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fix (hopefully) menu posting in the same way as window placement
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-533519
Files: files | file ages | folders
SHA1: b1dda72bd7ca796d362f737b69c2184f0a4c5db4
User & Date: jan.nijtmans 2012-04-20 12:50:11
Context
2012-04-20
13:20
unused variable check-in: bfdb0257 user: jan.nijtmans tags: bug-533519
12:50
fix (hopefully) menu posting in the same way as window placement check-in: b1dda72b user: jan.nijtmans tags: bug-533519
12:16
Use vroot size in stead of screen size for clipping window coordinates in ::tk::PlaceWindow. Use ::tk::PlaceWindow in dialog.tcl, in stead of dumplicating the code there. check-in: 53c95a25 user: jan.nijtmans tags: core-8-4-branch
2012-04-16
22:26
set [wm maxsize] as well check-in: d6d2ddb5 user: jan.nijtmans tags: bug-533519
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.









1
2
3
4
5
6
7








2012-04-13  Jan Nijtmans  <[email protected]>

	* win/rules.vc: [Bug 3517448] TclKit build fails (unresolved
	__strtoi64)

2012-04-07  Jan Nijtmans  <[email protected]>

>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2012-04-20  Jan Nijtmans  <[email protected]>

	* 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  <[email protected]>

	* win/rules.vc: [Bug 3517448] TclKit build fails (unresolved
	__strtoi64)

2012-04-07  Jan Nijtmans  <[email protected]>

Changes to generic/tkArgv.c.

351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
    int flags;			/* If the TK_ARGV_NO_DEFAULTS bit is set
				 * in this word, then don't generate
				 * information for default options. */
{
    register Tk_ArgvInfo *infoPtr;
    int width, i, numSpaces;
#define NUM_SPACES 20
    static char spaces[] = "                    ";
    char tmp[TCL_DOUBLE_SPACE];

    /*
     * First, compute the width of the widest option key, so that we
     * can make everything line up.
     */








|







351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
    int flags;			/* If the TK_ARGV_NO_DEFAULTS bit is set
				 * in this word, then don't generate
				 * information for default options. */
{
    register Tk_ArgvInfo *infoPtr;
    int width, i, numSpaces;
#define NUM_SPACES 20
    static CONST char spaces[] = "                    ";
    char tmp[TCL_DOUBLE_SPACE];

    /*
     * First, compute the width of the widest option key, so that we
     * can make everything line up.
     */

Changes to generic/tkAtom.c.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "tkInt.h"

/*
 * The following are a list of the predefined atom strings.
 * They should match those found in xatom.h
 */

static char * atomNameArray[] = {
    "PRIMARY",		"SECONDARY",		"ARC",
    "ATOM",		"BITMAP",		"CARDINAL",
    "COLORMAP",		"CURSOR",		"CUT_BUFFER0",
    "CUT_BUFFER1",	"CUT_BUFFER2",		"CUT_BUFFER3",
    "CUT_BUFFER4",	"CUT_BUFFER5",		"CUT_BUFFER6",
    "CUT_BUFFER7",	"DRAWABLE",		"FONT",
    "INTEGER",		"PIXMAP",		"POINT",







|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "tkInt.h"

/*
 * The following are a list of the predefined atom strings.
 * They should match those found in xatom.h
 */

static CONST char *atomNameArray[] = {
    "PRIMARY",		"SECONDARY",		"ARC",
    "ATOM",		"BITMAP",		"CARDINAL",
    "COLORMAP",		"CURSOR",		"CUT_BUFFER0",
    "CUT_BUFFER1",	"CUT_BUFFER2",		"CUT_BUFFER3",
    "CUT_BUFFER4",	"CUT_BUFFER5",		"CUT_BUFFER6",
    "CUT_BUFFER7",	"DRAWABLE",		"FONT",
    "INTEGER",		"PIXMAP",		"POINT",
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
    dispPtr->atomInit = 1;
    Tcl_InitHashTable(&dispPtr->nameTable, TCL_STRING_KEYS);
    Tcl_InitHashTable(&dispPtr->atomTable, TCL_ONE_WORD_KEYS);

    for (atom = 1; atom <= XA_LAST_PREDEFINED; atom++) {
	hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, (char *) atom);
	if (hPtr == NULL) {
	    char *name;
	    int new;

	    name = atomNameArray[atom - 1];
	    hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, (char *) name,
		&new);
	    Tcl_SetHashValue(hPtr, atom);
	    name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
	    hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, (char *) atom,
		&new);
	    Tcl_SetHashValue(hPtr, name);
	}
    }
}







|













195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
    dispPtr->atomInit = 1;
    Tcl_InitHashTable(&dispPtr->nameTable, TCL_STRING_KEYS);
    Tcl_InitHashTable(&dispPtr->atomTable, TCL_ONE_WORD_KEYS);

    for (atom = 1; atom <= XA_LAST_PREDEFINED; atom++) {
	hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, (char *) atom);
	if (hPtr == NULL) {
	    CONST char *name;
	    int new;

	    name = atomNameArray[atom - 1];
	    hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, (char *) name,
		&new);
	    Tcl_SetHashValue(hPtr, atom);
	    name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
	    hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, (char *) atom,
		&new);
	    Tcl_SetHashValue(hPtr, name);
	}
    }
}

Changes to generic/tkBind.c.

2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
		    string = "??";
		}
		goto doString;
	    }
	    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;
	    default:
		numStorage[0] = before[1];
		numStorage[1] = '\0';
		string = numStorage;







<
<




<
<
<
<






<
<




<
<
<
<







2622
2623
2624
2625
2626
2627
2628


2629
2630
2631
2632




2633
2634
2635
2636
2637
2638


2639
2640
2641
2642




2643
2644
2645
2646
2647
2648
2649
		    string = "??";
		}
		goto doString;
	    }
	    case 'X':
		if (flags & KEY_BUTTON_MOTION_CROSSING) {
		    Tk_Window tkwin;



		    number = eventPtr->xkey.x_root;
		    tkwin = Tk_IdToWindow(eventPtr->xany.display,
			    eventPtr->xany.window);




		    goto doNumber;
		}
		goto doString;
	    case 'Y':
		if (flags & KEY_BUTTON_MOTION_CROSSING) {
		    Tk_Window tkwin;



		    number = eventPtr->xkey.y_root;
		    tkwin = Tk_IdToWindow(eventPtr->xany.display,
			    eventPtr->xany.window);




		    goto doNumber;
		}
		goto doString;
	    default:
		numStorage[0] = before[1];
		numStorage[1] = '\0';
		string = numStorage;

Changes to generic/tkButton.c.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
static Tcl_ThreadDataKey dataKey;

/*
 * Class names for buttons, indexed by one of the type values defined
 * in tkButton.h.
 */

static 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[] = {
    "active", "disabled", "normal", (char *) NULL
};

/*
 * The following table defines the legal values for the -state option.
 * It is used together with the "enum state" declaration in tkButton.h.
 */

static char *stateStrings[] = {
    "active", "disabled", "normal", (char *) NULL
};

/*
 * The following table defines the legal values for the -compound option.
 * It is used with the "enum compound" declaration in tkButton.h
 */

static char *compoundStrings[] = {
    "bottom", "center", "left", "none", "right", "top", (char *) NULL
};

char tkDefButtonBorderWidth[TCL_INTEGER_SPACE] = DEF_BUTTON_BORDER_WIDTH;

/*
 * Information used for parsing configuration options.  There is a







|






|








|








|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
static Tcl_ThreadDataKey dataKey;

/*
 * Class names for buttons, indexed by one of the type values defined
 * in tkButton.h.
 */

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 CONST char *defaultStrings[] = {
    "active", "disabled", "normal", (char *) NULL
};

/*
 * The following table defines the legal values for the -state option.
 * It is used together with the "enum state" declaration in tkButton.h.
 */

static CONST char *stateStrings[] = {
    "active", "disabled", "normal", (char *) NULL
};

/*
 * The following table defines the legal values for the -compound option.
 * It is used with the "enum compound" declaration in tkButton.h
 */

static CONST char *compoundStrings[] = {
    "bottom", "center", "left", "none", "right", "top", (char *) NULL
};

char tkDefButtonBorderWidth[TCL_INTEGER_SPACE] = DEF_BUTTON_BORDER_WIDTH;

/*
 * Information used for parsing configuration options.  There is a

Changes to generic/tkEntry.c.

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * A comparison function for double values.  For Spinboxes.
 */
#define MIN_DBL_VAL		1E-9
#define DOUBLES_EQ(d1, d2)	(fabs((d1) - (d2)) < MIN_DBL_VAL)


static char *stateStrings[] = {
    "disabled", "normal", "readonly", (char *) NULL
};

/*
 * Definitions for -validate option values:
 */

static char *validateStrings[] = {
    "all", "key", "focus", "focusin", "focusout", "none", (char *) NULL
};
enum validateType {
    VALIDATE_ALL, VALIDATE_KEY, VALIDATE_FOCUS,
    VALIDATE_FOCUSIN, VALIDATE_FOCUSOUT, VALIDATE_NONE,
    /*
     * These extra enums are for use with EntryValidateChange







|







|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * A comparison function for double values.  For Spinboxes.
 */
#define MIN_DBL_VAL		1E-9
#define DOUBLES_EQ(d1, d2)	(fabs((d1) - (d2)) < MIN_DBL_VAL)


static CONST char *stateStrings[] = {
    "disabled", "normal", "readonly", (char *) NULL
};

/*
 * Definitions for -validate option values:
 */

static CONST char *validateStrings[] = {
    "all", "key", "focus", "focusin", "focusout", "none", (char *) NULL
};
enum validateType {
    VALIDATE_ALL, VALIDATE_KEY, VALIDATE_FOCUS,
    VALIDATE_FOCUSIN, VALIDATE_FOCUSOUT, VALIDATE_NONE,
    /*
     * These extra enums are for use with EntryValidateChange

Changes to generic/tkFocus.c.

733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
    TkWindow *winPtr;		/* Window that selects an application
				 * and a display. */
    XEvent *eventPtr;		/* X event to redirect (should be KeyPress
				 * or KeyRelease). */
{
    DisplayFocusInfo *displayFocusPtr;
    TkWindow *focusWinPtr;
    int focusX, focusY, vRootX, vRootY, vRootWidth, vRootHeight;

    displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr);
    focusWinPtr = displayFocusPtr->focusWinPtr;

    /*
     * The code below is a debugging aid to make sure that dispPtr->focusPtr
     * is kept properly in sync with the "truth", which is the value in







|







733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
    TkWindow *winPtr;		/* Window that selects an application
				 * and a display. */
    XEvent *eventPtr;		/* X event to redirect (should be KeyPress
				 * or KeyRelease). */
{
    DisplayFocusInfo *displayFocusPtr;
    TkWindow *focusWinPtr;
    int focusX, focusY;

    displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr);
    focusWinPtr = displayFocusPtr->focusWinPtr;

    /*
     * The code below is a debugging aid to make sure that dispPtr->focusPtr
     * is kept properly in sync with the "truth", which is the value in
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
	 */

	if ((focusWinPtr->display != winPtr->display)
		|| (focusWinPtr->screenNum != winPtr->screenNum)) {
	    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.window = focusWinPtr->window;
	return focusWinPtr;
    }

    /*
     * The event doesn't belong to us.  Perhaps, due to embedding, it







<
<

|
|







766
767
768
769
770
771
772


773
774
775
776
777
778
779
780
781
782
	 */

	if ((focusWinPtr->display != winPtr->display)
		|| (focusWinPtr->screenNum != winPtr->screenNum)) {
	    eventPtr->xkey.x = -1;
	    eventPtr->xkey.y = -1;
	} else {


	    Tk_GetRootCoords((Tk_Window) focusWinPtr, &focusX, &focusY);
	    eventPtr->xkey.x = eventPtr->xkey.x_root - focusX;
	    eventPtr->xkey.y = eventPtr->xkey.y_root - focusY;
	}
	eventPtr->xkey.window = focusWinPtr->window;
	return focusWinPtr;
    }

    /*
     * The event doesn't belong to us.  Perhaps, due to embedding, it

Changes to generic/tkFrame.c.

166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
enum labelanchor {
    LABELANCHOR_E, LABELANCHOR_EN, LABELANCHOR_ES,
    LABELANCHOR_N, LABELANCHOR_NE, LABELANCHOR_NW,
    LABELANCHOR_S, LABELANCHOR_SE, LABELANCHOR_SW,
    LABELANCHOR_W, LABELANCHOR_WN, LABELANCHOR_WS
};

static char *labelAnchorStrings[] = {
    "e", "en", "es", "n", "ne", "nw", "s", "se", "sw", "w", "wn", "ws",
    (char *) NULL
};

/*
 * Information used for parsing configuration options.  There are
 * one common table used by all and one table for each widget class.







|







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
enum labelanchor {
    LABELANCHOR_E, LABELANCHOR_EN, LABELANCHOR_ES,
    LABELANCHOR_N, LABELANCHOR_NE, LABELANCHOR_NW,
    LABELANCHOR_S, LABELANCHOR_SE, LABELANCHOR_SW,
    LABELANCHOR_W, LABELANCHOR_WN, LABELANCHOR_WS
};

static CONST char *labelAnchorStrings[] = {
    "e", "en", "es", "n", "ne", "nw", "s", "se", "sw", "w", "wn", "ws",
    (char *) NULL
};

/*
 * Information used for parsing configuration options.  There are
 * one common table used by all and one table for each widget class.
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
	(char *) NULL, 0, 0, 0, (ClientData) commonOptSpec, 0}
};

/*
 * Class names for widgets, indexed by FrameType.
 */

static char *classNames[] = {"Frame", "Toplevel", "Labelframe"};

/*
 * The following table maps from FrameType to the option template for
 * that class of widgets.
 */

static Tk_OptionSpec *optionSpecs[] = {
    frameOptSpec,
    toplevelOptSpec,
    labelframeOptSpec,
};

/*
 * Forward declarations for procedures defined later in this file:
 */

static void		ComputeFrameGeometry _ANSI_ARGS_((Frame *framePtr));







|









|







298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
	(char *) NULL, 0, 0, 0, (ClientData) commonOptSpec, 0}
};

/*
 * Class names for widgets, indexed by FrameType.
 */

static CONST char *classNames[] = {"Frame", "Toplevel", "Labelframe"};

/*
 * The following table maps from FrameType to the option template for
 * that class of widgets.
 */

static Tk_OptionSpec *optionSpecs[] = {
    frameOptSpec,
    toplevelOptSpec,
    labelframeOptSpec
};

/*
 * Forward declarations for procedures defined later in this file:
 */

static void		ComputeFrameGeometry _ANSI_ARGS_((Frame *framePtr));

Changes to generic/tkImgBmap.c.

1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
    /* 
     * The bit order of bitmaps in Tk is the opposite of the bit order that
     * postscript uses.  (In Tk, the least significant bit is on the right
     * side of the bitmap and in postscript the least significant bit is shown
     * 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[] = {
       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,
      12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252,
       2, 130, 66, 194, 34, 162,  98, 226, 18, 146, 82, 210, 50, 178, 114, 242,
      10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250,
       6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246,







|







1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
    /* 
     * The bit order of bitmaps in Tk is the opposite of the bit order that
     * postscript uses.  (In Tk, the least significant bit is on the right
     * side of the bitmap and in postscript the least significant bit is shown
     * 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 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,
      12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252,
       2, 130, 66, 194, 34, 162,  98, 226, 18, 146, 82, 210, 50, 178, 114, 242,
      10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250,
       6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246,

Changes to generic/tkListbox.c.

206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
 * string table below.
 */

enum state {
    STATE_DISABLED, STATE_NORMAL
};

static char *stateStrings[] = {
    "disabled", "normal", (char *) NULL
};

enum activeStyle {
    ACTIVE_STYLE_DOTBOX, ACTIVE_STYLE_NONE, ACTIVE_STYLE_UNDERLINE
};

static char *activeStyleStrings[] = {
    "dotbox", "none", "underline", (char *) NULL
};

/*
 * The optionSpecs table defines the valid configuration options for the
 * listbox widget
 */







|







|







206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
 * string table below.
 */

enum state {
    STATE_DISABLED, STATE_NORMAL
};

static CONST char *stateStrings[] = {
    "disabled", "normal", (char *) NULL
};

enum activeStyle {
    ACTIVE_STYLE_DOTBOX, ACTIVE_STYLE_NONE, ACTIVE_STYLE_UNDERLINE
};

static CONST char *activeStyleStrings[] = {
    "dotbox", "none", "underline", (char *) NULL
};

/*
 * The optionSpecs table defines the valid configuration options for the
 * listbox widget
 */

Changes to generic/tkMenuDraw.c.

888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
     *    (if any) to the real root.  Can't get the virtual root
     *    from the menu itself (it will never be seen by the wm)
     *    so use its parent instead (it would be better to have an
     *    an option that names a window to use for this...).
     * 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 < 0) {
	x = 0;
    }
    tmp = HeightOfScreen(Tk_Screen(menuPtr->tkwin))
	- Tk_ReqHeight(menuPtr->tkwin);
    if (y > tmp) {
	y = tmp;
    }
    if (y < 0) {
	y = 0;
    }
    Tk_MoveToplevelWindow(menuPtr->tkwin, x, y);
    if (!Tk_IsMapped(menuPtr->tkwin)) {
	Tk_MapWindow(menuPtr->tkwin);
    }
    TkWmRestackToplevel((TkWindow *) menuPtr->tkwin, Above, NULL);
    return TCL_OK;







<
<
<
<
<




<
<
<
<
|
|

|
|

<
<
|
|

|
|







888
889
890
891
892
893
894





895
896
897
898




899
900
901
902
903
904


905
906
907
908
909
910
911
912
913
914
915
916
     *    (if any) to the real root.  Can't get the virtual root
     *    from the menu itself (it will never be seen by the wm)
     *    so use its parent instead (it would be better to have an
     *    an option that names a window to use for this...).
     * 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.





     */

    Tk_GetVRootGeometry(Tk_Parent(menuPtr->tkwin), &vRootX, &vRootY,
	&vRootWidth, &vRootHeight);




    if (x > vRootX + vRootWidth) {
	x = vRootX + vRootWidth;
    }
    if (x < vRootX) {
	x = vRootX;
    }


    if (y > vRootY + vRootHeight) {
	y = vRootY + vRootHeight;
    }
    if (y < vRootY) {
	y = vRootY;
    }
    Tk_MoveToplevelWindow(menuPtr->tkwin, x, y);
    if (!Tk_IsMapped(menuPtr->tkwin)) {
	Tk_MapWindow(menuPtr->tkwin);
    }
    TkWmRestackToplevel((TkWindow *) menuPtr->tkwin, Above, NULL);
    return TCL_OK;

Changes to generic/tkMenubutton.c.

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

/*
 * The following table defines the legal values for the -direction 
 * option.  It is used together with the "enum direction" declaration 
 * in tkMenubutton.h.
 */

static char *directionStrings[] = {
    "above", "below", "flush", "left", "right", (char *) NULL
};

/*
 * The following table defines the legal values for the -state option.
 * It is used together with the "enum state" declaration in tkMenubutton.h.
 */

static char *stateStrings[] = {
    "active", "disabled", "normal", (char *) NULL
};

/*
 * The following table defines the legal values for the -compound option.
 * It is used with the "enum compound" declaration in tkMenuButton.h
 */

static char *compoundStrings[] = {
    "bottom", "center", "left", "none", "right", "top", (char *) NULL
};

/*
 * Information used for parsing configuration specs:
 */








|








|








|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

/*
 * The following table defines the legal values for the -direction 
 * option.  It is used together with the "enum direction" declaration 
 * in tkMenubutton.h.
 */

static CONST char *directionStrings[] = {
    "above", "below", "flush", "left", "right", (char *) NULL
};

/*
 * The following table defines the legal values for the -state option.
 * It is used together with the "enum state" declaration in tkMenubutton.h.
 */

static CONST char *stateStrings[] = {
    "active", "disabled", "normal", (char *) NULL
};

/*
 * The following table defines the legal values for the -compound option.
 * It is used with the "enum compound" declaration in tkMenuButton.h
 */

static CONST char *compoundStrings[] = {
    "bottom", "center", "left", "none", "right", "top", (char *) NULL
};

/*
 * Information used for parsing configuration specs:
 */

Changes to generic/tkPanedWindow.c.

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#define STICK_EAST		2
#define STICK_SOUTH		4
#define STICK_WEST		8
/*
 * The following table defines the legal values for the -orient option.
 */

static char *orientStrings[] = {
    "horizontal", "vertical", (char *) NULL
};

enum orient { ORIENT_HORIZONTAL, ORIENT_VERTICAL };

typedef struct {
    Tk_OptionTable pwOptions;	/* Token for paned window option table. */







|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#define STICK_EAST		2
#define STICK_SOUTH		4
#define STICK_WEST		8
/*
 * The following table defines the legal values for the -orient option.
 */

static CONST char *orientStrings[] = {
    "horizontal", "vertical", (char *) NULL
};

enum orient { ORIENT_HORIZONTAL, ORIENT_VERTICAL };

typedef struct {
    Tk_OptionTable pwOptions;	/* Token for paned window option table. */

Changes to generic/tkPlace.c.

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 *			all borders of master window.
 * BM_OUTSIDE:		relative distances computed using outside area
 *			that includes all borders of master.
 * BM_IGNORE:		border issues are ignored:  place relative to
 *			master's actual window size.
 */

static char *borderModeStrings[] = {
    "inside", "outside", "ignore", (char *) NULL
};

typedef enum {BM_INSIDE, BM_OUTSIDE, BM_IGNORE} BorderMode;

/*
 * For each window whose geometry is managed by the placer there is







|







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 *			all borders of master window.
 * BM_OUTSIDE:		relative distances computed using outside area
 *			that includes all borders of master.
 * BM_IGNORE:		border issues are ignored:  place relative to
 *			master's actual window size.
 */

static CONST char *borderModeStrings[] = {
    "inside", "outside", "ignore", (char *) NULL
};

typedef enum {BM_INSIDE, BM_OUTSIDE, BM_IGNORE} BorderMode;

/*
 * For each window whose geometry is managed by the placer there is

Changes to generic/tkScale.c.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "tkScale.h"

/*
 * The following table defines the legal values for the -orient option.
 * It is used together with the "enum orient" declaration in tkScale.h.
 */

static char *orientStrings[] = {
    "horizontal", "vertical", (char *) NULL
};

/*
 * The following table defines the legal values for the -state option.
 * It is used together with the "enum state" declaration in tkScale.h.
 */

static char *stateStrings[] = {
    "active", "disabled", "normal", (char *) NULL
};

static Tk_OptionSpec optionSpecs[] = {
    {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground",
	DEF_SCALE_ACTIVE_BG_COLOR, -1, Tk_Offset(TkScale, activeBorder),
	0, (ClientData) DEF_SCALE_ACTIVE_BG_MONO, 0},







|








|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "tkScale.h"

/*
 * The following table defines the legal values for the -orient option.
 * It is used together with the "enum orient" declaration in tkScale.h.
 */

static CONST char *orientStrings[] = {
    "horizontal", "vertical", (char *) NULL
};

/*
 * The following table defines the legal values for the -state option.
 * It is used together with the "enum state" declaration in tkScale.h.
 */

static CONST char *stateStrings[] = {
    "active", "disabled", "normal", (char *) NULL
};

static Tk_OptionSpec optionSpecs[] = {
    {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground",
	DEF_SCALE_ACTIVE_BG_COLOR, -1, Tk_Offset(TkScale, activeBorder),
	0, (ClientData) DEF_SCALE_ACTIVE_BG_MONO, 0},

Changes to generic/tkTest.c.

713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
		Tcl_Obj *justifyPtr;
		Tcl_Obj *anchorPtr;
		Tcl_Obj *pixelPtr;
		Tcl_Obj *mmPtr;
		Tcl_Obj *customPtr;
	    } TypesRecord;
	    TypesRecord *recordPtr;
	    static char *stringTable[] = {"one", "two", "three", "four", 
		    (char *) NULL};
	    static Tk_OptionSpec typesSpecs[] = {
		{TK_OPTION_BOOLEAN,
			"-boolean", "boolean", "Boolean",
			"1", Tk_Offset(TypesRecord, booleanPtr), -1, 0, 0, 0x1},
		{TK_OPTION_INT,
			"-integer", "integer", "Integer",







|







713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
		Tcl_Obj *justifyPtr;
		Tcl_Obj *anchorPtr;
		Tcl_Obj *pixelPtr;
		Tcl_Obj *mmPtr;
		Tcl_Obj *customPtr;
	    } TypesRecord;
	    TypesRecord *recordPtr;
	    static CONST char *stringTable[] = {"one", "two", "three", "four", 
		    (char *) NULL};
	    static Tk_OptionSpec typesSpecs[] = {
		{TK_OPTION_BOOLEAN,
			"-boolean", "boolean", "Boolean",
			"1", Tk_Offset(TypesRecord, booleanPtr), -1, 0, 0, 0x1},
		{TK_OPTION_INT,
			"-integer", "integer", "Integer",
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
		Tk_Anchor anchor;
		int pixels;
		double mm;
		Tk_Window tkwin;
		char *custom;
	    } InternalRecord;
	    InternalRecord *recordPtr;
	    static char *internalStringTable[] = {
		    "one", "two", "three", "four", (char *) NULL
	    };
	    static Tk_OptionSpec internalSpecs[] = {
		{TK_OPTION_BOOLEAN,
			"-boolean", "boolean", "Boolean",
			"1", -1, Tk_Offset(InternalRecord, boolean), 0, 0, 0x1},
		{TK_OPTION_INT,







|







1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
		Tk_Anchor anchor;
		int pixels;
		double mm;
		Tk_Window tkwin;
		char *custom;
	    } InternalRecord;
	    InternalRecord *recordPtr;
	    static CONST char *internalStringTable[] = {
		    "one", "two", "three", "four", (char *) NULL
	    };
	    static Tk_OptionSpec internalSpecs[] = {
		{TK_OPTION_BOOLEAN,
			"-boolean", "boolean", "Boolean",
			"1", -1, Tk_Offset(InternalRecord, boolean), 0, 0, 0x1},
		{TK_OPTION_INT,

Changes to generic/tkWindow.c.

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

/*
 * Default values for "changes" and "atts" fields of TkWindows.  Note
 * that Tk always requests all events for all windows, except StructureNotify
 * events on internal windows:  these events are generated internally.
 */

static 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= {
    None,			/* background_pixmap */
    0,				/* background_pixel */
    CopyFromParent,		/* border_pixmap */
    0,				/* border_pixel */
    NorthWestGravity,		/* bit_gravity */
    NorthWestGravity,		/* win_gravity */
    NotUseful,			/* backing_store */







|






|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

/*
 * Default values for "changes" and "atts" fields of TkWindows.  Note
 * that Tk always requests all events for all windows, except StructureNotify
 * events on internal windows:  these events are generated internally.
 */

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 CONST XSetWindowAttributes defAtts= {
    None,			/* background_pixmap */
    0,				/* background_pixel */
    CopyFromParent,		/* border_pixmap */
    0,				/* border_pixel */
    NorthWestGravity,		/* bit_gravity */
    NorthWestGravity,		/* win_gravity */
    NotUseful,			/* backing_store */
95
96
97
98
99
100
101



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
};

/*
 * The following structure defines all of the commands supported by
 * Tk, and the C procedures that execute them.
 */




typedef struct {
    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. */
} TkCmd;

static 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},
#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},
#endif
#if defined(__WIN32__) || defined(MAC_OSX_TK)
    {"tk_messageBox",   NULL,			Tk_MessageBoxObjCmd,	0, 1},
#endif
    {"update",		NULL,			Tk_UpdateObjCmd,	1, 1},
    {"winfo",		NULL,			Tk_WinfoObjCmd,		1, 1},
    {"wm",		NULL,			Tk_WmObjCmd,		0, 1},

    /*
     * 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},

    /*
     * Misc.
     */

#if defined(MAC_TCL) || defined(MAC_OSX_TK)
    {"::tk::unsupported::MacWindowStyle",
	    		NULL,	TkUnsupported1ObjCmd,			1, 1},
#endif
    {(char *) NULL,	(int (*) _ANSI_ARGS_((ClientData, Tcl_Interp *, int, CONST char **))) NULL, NULL, 0}
};

/*
 * The variables and table below are used to parse arguments from
 * the "argv" variable in Tk_Init.







>
>
>

|


<
<
|
<
<
<
<


|




|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|


|

|
|
|





|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







|







95
96
97
98
99
100
101
102
103
104
105
106
107
108


109




110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
};

/*
 * The following structure defines all of the commands supported by
 * Tk, and the C procedures that execute them.
 */

#define ISSAFE 1
#define PASSMAINWINDOW 2

typedef struct {
    CONST char *name;			/* Name of command. */
    Tcl_CmdProc *cmdProc;	/* Command's string-based procedure. */
    Tcl_ObjCmdProc *objProc;	/* Command's object-based procedure. */


    int flags;




} TkCmd;

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},
#if defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)
    {"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,	PASSMAINWINDOW},
#endif
    {"update",		NULL,			Tk_UpdateObjCmd,	PASSMAINWINDOW|ISSAFE},
    {"winfo",		NULL,			Tk_WinfoObjCmd,		PASSMAINWINDOW|ISSAFE},
    {"wm",		NULL,			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},

    /*
     * Misc.
     */

#if defined(MAC_TCL) || defined(MAC_OSX_TK)
    {"::tk::unsupported::MacWindowStyle",
	    		NULL,	TkUnsupported1ObjCmd,			PASSMAINWINDOW|ISSAFE},
#endif
    {(char *) NULL,	(int (*) _ANSI_ARGS_((ClientData, Tcl_Interp *, int, CONST char **))) NULL, NULL, 0}
};

/*
 * The variables and table below are used to parse arguments from
 * the "argv" variable in Tk_Init.
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
{
    Tk_Window tkwin;
    int dummy;
    int isSafe;
    Tcl_HashEntry *hPtr;
    register TkMainInfo *mainPtr;
    register TkWindow *winPtr;
    register TkCmd *cmdPtr;
    ClientData clientData;
    ThreadSpecificData *tsdPtr = (ThreadSpecificData *) 
            Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
    
    /*
     * Panic if someone updated the TkWindow structure without
     * also updating the Tk_FakeWin structure (or vice versa).







|







850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
{
    Tk_Window tkwin;
    int dummy;
    int isSafe;
    Tcl_HashEntry *hPtr;
    register TkMainInfo *mainPtr;
    register TkWindow *winPtr;
    register CONST TkCmd *cmdPtr;
    ClientData clientData;
    ThreadSpecificData *tsdPtr = (ThreadSpecificData *) 
            Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
    
    /*
     * Panic if someone updated the TkWindow structure without
     * also updating the Tk_FakeWin structure (or vice versa).
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
    /*
     * Bind in Tk's commands.
     */

    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");
	}
	if (cmdPtr->passMainWindow) {
	    clientData = (ClientData) tkwin;
	} else {
	    clientData = (ClientData) NULL;
	}
	if (cmdPtr->cmdProc != NULL) {
	    Tcl_CreateCommand(interp, cmdPtr->name, cmdPtr->cmdProc,
		    clientData, (void (*) _ANSI_ARGS_((ClientData))) NULL);
	} else {
	    Tcl_CreateObjCommand(interp, cmdPtr->name, cmdPtr->objProc,
		    clientData, NULL);
	}
        if (isSafe) {
            if (!(cmdPtr->isSafe)) {
                Tcl_HideCommand(interp, cmdPtr->name, cmdPtr->name);
            }
        }
    }

    TkCreateMenuCmd(interp);

    /*
     * Set variables for the intepreter.
     */







|

|











|
|
|
|
|







935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
    /*
     * Bind in Tk's commands.
     */

    isSafe = Tcl_IsSafe(interp);
    for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) {
	if ((cmdPtr->cmdProc == NULL) && (cmdPtr->objProc == NULL)) {
	    Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs");
	}
	if (cmdPtr->flags & PASSMAINWINDOW) {
	    clientData = (ClientData) tkwin;
	} else {
	    clientData = (ClientData) NULL;
	}
	if (cmdPtr->cmdProc != NULL) {
	    Tcl_CreateCommand(interp, cmdPtr->name, cmdPtr->cmdProc,
		    clientData, (void (*) _ANSI_ARGS_((ClientData))) NULL);
	} else {
	    Tcl_CreateObjCommand(interp, cmdPtr->name, cmdPtr->objProc,
		    clientData, NULL);
	}
	if (isSafe) {
	    if (!(cmdPtr->flags & ISSAFE)) {
		Tcl_HideCommand(interp, cmdPtr->name, cmdPtr->name);
	    }
	}
    }

    TkCreateMenuCmd(interp);

    /*
     * Set variables for the intepreter.
     */
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
	     * Invalidate all objects referring to windows
	     * with the same main window
	     */
	    winPtr->mainPtr->deletionEpoch++;
	}
	winPtr->mainPtr->refCount--;
	if (winPtr->mainPtr->refCount == 0) {
	    register TkCmd *cmdPtr;

	    /*
	     * We just deleted the last window in the application.  Delete
	     * the TkMainInfo structure too and replace all of Tk's commands
	     * with dummy commands that return errors.	Also delete the
	     * "send" command to unregister the interpreter.
	     *







|







1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
	     * Invalidate all objects referring to windows
	     * with the same main window
	     */
	    winPtr->mainPtr->deletionEpoch++;
	}
	winPtr->mainPtr->refCount--;
	if (winPtr->mainPtr->refCount == 0) {
	    register CONST TkCmd *cmdPtr;

	    /*
	     * We just deleted the last window in the application.  Delete
	     * the TkMainInfo structure too and replace all of Tk's commands
	     * with dummy commands that return errors.	Also delete the
	     * "send" command to unregister the interpreter.
	     *

Changes to unix/Makefile.in.

628
629
630
631
632
633
634


635




636

637
638
639
640
641
642
643
	    fi
	@if test "x$(TK_SHARED_BUILD)" = "x1"; then \
	    echo "Creating package index $(PKG_INDEX)"; \
	    rm -f $(PKG_INDEX); \
	    (\
	    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]";\

	    ) > $(PKG_INDEX); \
	    fi
	@echo "Installing $(LIB_FILE) to $(LIB_INSTALL_DIR)/"
	@@INSTALL_LIB@
	@chmod 555 $(LIB_INSTALL_DIR)/$(LIB_FILE)
	@if test "$(TK_BUILD_EXP_FILE)" != ""; then \
	    echo "Installing $(TK_EXP_FILE) to $(LIB_INSTALL_DIR)/"; \







>
>
|
>
>
>
>
|
>







628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
	    fi
	@if test "x$(TK_SHARED_BUILD)" = "x1"; then \
	    echo "Creating package index $(PKG_INDEX)"; \
	    rm -f $(PKG_INDEX); \
	    (\
	    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 "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)/"
	@@INSTALL_LIB@
	@chmod 555 $(LIB_INSTALL_DIR)/$(LIB_FILE)
	@if test "$(TK_BUILD_EXP_FILE)" != ""; then \
	    echo "Installing $(TK_EXP_FILE) to $(LIB_INSTALL_DIR)/"; \