Tk Source Code

Check-in [599ec1e5]
Login

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

Overview
Comment:More complete purge of things only present for supporting long-dead Mac 9 systems.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-4-branch
Files: files | file ages | folders
SHA1: 599ec1e501bf3a502d1b6b513a7c0f76e4398429
User & Date: dgp 2012-11-15 19:31:20
Context
2012-12-03
01:23
[Bug 3588824]: bug in image index handling for weird image names check-in: 407486bb user: fvogel tags: core-8-4-branch
2012-12-02
22:27
merge-mark check-in: 82edd3d8 user: jan.nijtmans tags: core-8-5-branch
2012-11-22
21:12
[Bug 3588824]: bug in image index handling for weird image names check-in: 7bb1876e user: fvogel tags: bug-3588824
2012-11-19
16:54
merge 8.4 check-in: 0096c844 user: dgp tags: core-8-4-20-rc
2012-11-15
19:31
More complete purge of things only present for supporting long-dead Mac 9 systems. check-in: 599ec1e5 user: dgp tags: core-8-4-branch
08:29
Remove all the long dead mac entries in tk*.decls files

re-generate all tk*Decls.h files.

check-in: 4b7cb51b user: jan.nijtmans tags: core-8-4-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to doc/chooseDirectory.n.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
possible as command line arguments:
.TP
\fB\-initialdir\fR \fIdirname\fR
Specifies that the directories in \fIdirectory\fR should be displayed
when the dialog pops up. If this parameter is not specified, then
the directories in the current working directory are displayed. If the
parameter specifies a relative path, the return value will convert the
relative path to an absolute path.  This option may not always work on
the Macintosh.  This is not a bug. Rather, the \fIGeneral Controls\fR
control panel on the Mac allows the end user to override the
application default directory.
.TP
\fB\-parent\fR \fIwindow\fR
Makes \fIwindow\fR the logical parent of the dialog. The dialog
is displayed on top of its parent window.
.TP
\fB\-title\fR \fItitleString\fR
Specifies a string to display as the title of the dialog box. If this







|
<
<
<







20
21
22
23
24
25
26
27



28
29
30
31
32
33
34
possible as command line arguments:
.TP
\fB\-initialdir\fR \fIdirname\fR
Specifies that the directories in \fIdirectory\fR should be displayed
when the dialog pops up. If this parameter is not specified, then
the directories in the current working directory are displayed. If the
parameter specifies a relative path, the return value will convert the
relative path to an absolute path.



.TP
\fB\-parent\fR \fIwindow\fR
Makes \fIwindow\fR the logical parent of the dialog. The dialog
is displayed on top of its parent window.
.TP
\fB\-title\fR \fItitleString\fR
Specifies a string to display as the title of the dialog box. If this

Changes to doc/console.n.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
.PP
The console window is a replacement for a real console to allow input
and output on the standard I/O channels on platforms that do not have
a real console.  It is implemented as a separate interpreter with the
Tk toolkit loaded, and control over this interpreter is given through
the \fBconsole\fR command.  The behaviour of the console window is
defined mainly through the contents of the \fIconsole.tcl\fR file in
the Tk library (or the \fIConsole\fR resource on Macintosh systems.)
.PP
.TP
\fBconsole eval \fIscript\fR
Evaluate the \fIscript\fR argument as a Tcl script in the console
interpreter.  The normal interpreter is accessed through the
\fBconsoleinterp\fR command in the console interpreter.
.TP







|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
.PP
The console window is a replacement for a real console to allow input
and output on the standard I/O channels on platforms that do not have
a real console.  It is implemented as a separate interpreter with the
Tk toolkit loaded, and control over this interpreter is given through
the \fBconsole\fR command.  The behaviour of the console window is
defined mainly through the contents of the \fIconsole.tcl\fR file in
the Tk library.
.PP
.TP
\fBconsole eval \fIscript\fR
Evaluate the \fIscript\fR argument as a Tcl script in the console
interpreter.  The normal interpreter is accessed through the
\fBconsoleinterp\fR command in the console interpreter.
.TP

Changes to doc/getOpenFile.n.

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
The following \fIoption\-value\fR pairs are possible as command line
arguments to these two commands:
.TP
\fB\-defaultextension\fR \fIextension\fR
Specifies a string that will be appended to the filename if the user
enters a filename without an extension. The default value is the empty
string, which means no extension will be appended to the filename in
any case. This option is ignored on the Macintosh platform, which
does not require extensions to filenames,
.VS 8.4
and the UNIX implementation guesses reasonable values for this from
the \fB\-filetypes\fR option when this is not supplied.
.VE 8.4
.TP
\fB\-filetypes\fR \fIfilePatternList\fR







|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
The following \fIoption\-value\fR pairs are possible as command line
arguments to these two commands:
.TP
\fB\-defaultextension\fR \fIextension\fR
Specifies a string that will be appended to the filename if the user
enters a filename without an extension. The default value is the empty
string, which means no extension will be appended to the filename in
any case. This option is ignored on Mac OS X, which
does not require extensions to filenames,
.VS 8.4
and the UNIX implementation guesses reasonable values for this from
the \fB\-filetypes\fR option when this is not supplied.
.VE 8.4
.TP
\fB\-filetypes\fR \fIfilePatternList\fR
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
discussion on the contents of \fIfilePatternList\fR.
.TP
\fB\-initialdir\fR \fIdirectory\fR
Specifies that the files in \fIdirectory\fR should be displayed
when the dialog pops up. If this parameter is not specified, then
the files in the current working directory are displayed. If the
parameter specifies a relative path, the return value will convert the
relative path to an absolute path.  This option may not always work on
the Macintosh.  This is not a bug. Rather, the \fIGeneral Controls\fR
control panel on the Mac allows the end user to override the
application default directory.
.TP
\fB\-initialfile\fR \fIfilename\fR
Specifies a filename to be displayed in the dialog when it pops up.  This
option is ignored on the Macintosh platform.
.TP
\fB\-multiple\fR \fIboolean\fR
Allows the user to choose multiple files from the Open dialog.
On the Macintosh, this is only available when Navigation Services are
installed.
.TP
\fB\-message\fR \fIstring\fR
Specifies a message to include in the client area of the dialog.
This is only available on the Macintosh, and only when Navigation
Services are installed.
.TP
\fB\-parent\fR \fIwindow\fR
Makes \fIwindow\fR the logical parent of the file dialog. The file
dialog is displayed on top of its parent window.
.TP
\fB\-title\fR \fItitleString\fR
Specifies a string to display as the title of the dialog box. If this







|
<
<
<


|
<



<
<



|
<







57
58
59
60
61
62
63
64



65
66
67

68
69
70


71
72
73
74

75
76
77
78
79
80
81
discussion on the contents of \fIfilePatternList\fR.
.TP
\fB\-initialdir\fR \fIdirectory\fR
Specifies that the files in \fIdirectory\fR should be displayed
when the dialog pops up. If this parameter is not specified, then
the files in the current working directory are displayed. If the
parameter specifies a relative path, the return value will convert the
relative path to an absolute path.



.TP
\fB\-initialfile\fR \fIfilename\fR
Specifies a filename to be displayed in the dialog when it pops up.

.TP
\fB\-multiple\fR \fIboolean\fR
Allows the user to choose multiple files from the Open dialog.


.TP
\fB\-message\fR \fIstring\fR
Specifies a message to include in the client area of the dialog.
This is only available on the Mac OS X.

.TP
\fB\-parent\fR \fIwindow\fR
Makes \fIwindow\fR the logical parent of the file dialog. The file
dialog is displayed on top of its parent window.
.TP
\fB\-title\fR \fItitleString\fR
Specifies a string to display as the title of the dialog box. If this

Changes to generic/default.h.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

#if defined(__WIN32__) || defined(_WIN32) || \
    defined(__MINGW32__)
#   include "tkWinDefault.h"
#else
#   if defined(MAC_OSX_TK)
#	include "tkMacOSXDefault.h"
#   elif defined(MAC_TCL)
#	include "tkMacDefault.h"
#   else
#	include "tkUnixDefault.h"
#   endif
#endif

#endif /* _DEFAULT */







<
<






16
17
18
19
20
21
22


23
24
25
26
27
28

#if defined(__WIN32__) || defined(_WIN32) || \
    defined(__MINGW32__)
#   include "tkWinDefault.h"
#else
#   if defined(MAC_OSX_TK)
#	include "tkMacOSXDefault.h"


#   else
#	include "tkUnixDefault.h"
#   endif
#endif

#endif /* _DEFAULT */

Changes to generic/tk.h.

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#define TK_RELEASE_SERIAL  19

#define TK_VERSION	"8.4"
#define TK_PATCH_LEVEL	"8.4.19"

/* 
 * A special definition used to allow this header file to be included
 * from windows or mac resource files so that they can obtain version
 * information.  RC_INVOKED is defined by default by the windows RC tool
 * and manually set for macintosh.
 *
 * Resource compilers don't like all the C stuff, like typedefs and
 * procedure declarations, that occur below, so block them out.
 */
    
#ifndef RC_INVOKED
    
#ifndef _XLIB_H
#   if defined (MAC_TCL)
#	include <Xlib.h>
#	include <X.h>
#   elif defined(MAC_OSX_TK)
#	include <X11/Xlib.h>
#	include <X11/X.h>
#   else
#	include <X11/Xlib.h>
#   endif
#endif
#ifdef __STDC__







|
|
<








|
<
<
<







56
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
72
73



74
75
76
77
78
79
80
#define TK_RELEASE_SERIAL  19

#define TK_VERSION	"8.4"
#define TK_PATCH_LEVEL	"8.4.19"

/* 
 * A special definition used to allow this header file to be included
 * from windows resource files so that they can obtain version
 * information.  RC_INVOKED is defined by default by the windows RC tool.

 *
 * Resource compilers don't like all the C stuff, like typedefs and
 * procedure declarations, that occur below, so block them out.
 */
    
#ifndef RC_INVOKED
    
#ifndef _XLIB_H
#   if defined(MAC_OSX_TK)



#	include <X11/Xlib.h>
#	include <X11/X.h>
#   else
#	include <X11/Xlib.h>
#   endif
#endif
#ifdef __STDC__

Changes to generic/tkBind.c.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "tkPort.h"
#include "tkInt.h"

#ifdef __WIN32__
#include "tkWinInt.h"
#endif

#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)) /* UNIX */
#include "tkUnixInt.h"
#endif


/*
 * File structure:
 *







|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "tkPort.h"
#include "tkInt.h"

#ifdef __WIN32__
#include "tkWinInt.h"
#endif

#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* UNIX */
#include "tkUnixInt.h"
#endif


/*
 * File structure:
 *

Changes to generic/tkCmds.c.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 */

#include "tkPort.h"
#include "tkInt.h"

#if defined(WIN32)
#include "tkWinInt.h"
#elif defined(MAC_TCL)
#include "tkMacInt.h"
#elif defined(MAC_OSX_TK) 
#include "tkMacOSXInt.h"
#else
#include "tkUnixInt.h"
#endif

/*







<
<







13
14
15
16
17
18
19


20
21
22
23
24
25
26
 */

#include "tkPort.h"
#include "tkInt.h"

#if defined(WIN32)
#include "tkWinInt.h"


#elif defined(MAC_OSX_TK) 
#include "tkMacOSXInt.h"
#else
#include "tkUnixInt.h"
#endif

/*
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
	    
	    if (objc != 2) {
	        Tcl_WrongNumArgs(interp, 2, objv, NULL);
		return TCL_ERROR;
	    }
#if defined(WIN32)
	    windowingsystem = "win32";
#elif defined(MAC_TCL)
	    windowingsystem = "classic";
#elif defined(MAC_OSX_TK)
	    windowingsystem = "aqua";
#else
	    windowingsystem = "x11";
#endif
	    Tcl_SetStringObj(Tcl_GetObjResult(interp), windowingsystem, -1);
	    break;







<
<







831
832
833
834
835
836
837


838
839
840
841
842
843
844
	    
	    if (objc != 2) {
	        Tcl_WrongNumArgs(interp, 2, objv, NULL);
		return TCL_ERROR;
	    }
#if defined(WIN32)
	    windowingsystem = "win32";


#elif defined(MAC_OSX_TK)
	    windowingsystem = "aqua";
#else
	    windowingsystem = "x11";
#endif
	    Tcl_SetStringObj(Tcl_GetObjResult(interp), windowingsystem, -1);
	    break;

Changes to generic/tkConsole.c.

346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
    Tcl_Channel chan;
    ConsoleInfo *info;
    Tk_Window mainWindow;
    Tcl_Command token;
    int result = TCL_OK;
    int haveConsoleChannel = 1;

#ifdef MAC_TCL
    static CONST char *initCmd = "if {[catch {source $tk_library:console.tcl}]} {source -rsrc console}";
#else
    static CONST char *initCmd = "source $tk_library/console.tcl";
#endif

    /* Init an interp with Tcl and Tk */
    Tcl_Interp *consoleInterp = Tcl_CreateInterp();
    if (Tcl_Init(consoleInterp) != TCL_OK) {
      goto error;
    }
    if (Tk_Init(consoleInterp) != TCL_OK) {







<
<
<

<







346
347
348
349
350
351
352



353

354
355
356
357
358
359
360
    Tcl_Channel chan;
    ConsoleInfo *info;
    Tk_Window mainWindow;
    Tcl_Command token;
    int result = TCL_OK;
    int haveConsoleChannel = 1;




    static CONST char *initCmd = "source $tk_library/console.tcl";


    /* Init an interp with Tcl and Tk */
    Tcl_Interp *consoleInterp = Tcl_CreateInterp();
    if (Tcl_Init(consoleInterp) != TCL_OK) {
      goto error;
    }
    if (Tk_Init(consoleInterp) != TCL_OK) {

Changes to generic/tkFileFilter.h.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#ifndef _TK_FILE_FILTER
#define _TK_FILE_FILTER

#ifdef MAC_TCL
#include <StandardFile.h>
#else
#define OSType long
#endif

#ifdef BUILD_tk
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLEXPORT
#endif

typedef struct GlobPattern {







<
<
<

<







9
10
11
12
13
14
15



16

17
18
19
20
21
22
23
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#ifndef _TK_FILE_FILTER
#define _TK_FILE_FILTER




#define OSType long


#ifdef BUILD_tk
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLEXPORT
#endif

typedef struct GlobPattern {

Changes to generic/tkGrab.c.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include "tkPort.h"
#include "tkInt.h"

#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
#include "tkUnixInt.h"
#endif

/*
 * The grab state machine has four states: ungrabbed, button pressed,
 * grabbed, and button pressed while grabbed.  In addition, there are
 * three pieces of grab state information: the current grab window,







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include "tkPort.h"
#include "tkInt.h"

#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
#include "tkUnixInt.h"
#endif

/*
 * The grab state machine has four states: ungrabbed, button pressed,
 * grabbed, and button pressed while grabbed.  In addition, there are
 * three pieces of grab state information: the current grab window,

Changes to generic/tkImgPhoto.c.

2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
     * XGetImage with a zero size, which it does not like. [Bug 979239]
     */

    if (width < 1 || height < 1) {
	return;
    }

    if (
#if defined(MAC_TCL)
	/*
	 * The retrieval of bgImg is currently not functional on OS9
	 * so skip attempts to alpha blend.
	 */
	0 &&
#endif
	(instancePtr->masterPtr->flags & COMPLEX_ALPHA)
	    && visInfo.depth >= 15
	    && (visInfo.class == DirectColor || visInfo.class == TrueColor)) {
	Tk_ErrorHandler handler;
	XImage *bgImg = NULL;

	/*
	 * Create an error handler to suppress the case where the input was







<
<
<
<
<
<
<
<
|







2766
2767
2768
2769
2770
2771
2772








2773
2774
2775
2776
2777
2778
2779
2780
     * XGetImage with a zero size, which it does not like. [Bug 979239]
     */

    if (width < 1 || height < 1) {
	return;
    }









    if ((instancePtr->masterPtr->flags & COMPLEX_ALPHA)
	    && visInfo.depth >= 15
	    && (visInfo.class == DirectColor || visInfo.class == TrueColor)) {
	Tk_ErrorHandler handler;
	XImage *bgImg = NULL;

	/*
	 * Create an error handler to suppress the case where the input was

Changes to generic/tkIntXlibDecls.h.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

/*
 * WARNING: This file is automatically generated by the tools/genStubs.tcl
 * script.  Any modifications to the function declarations below should be made
 * in the generic/tkInt.decls script.
 */

#ifdef MAC_TCL
#include "Xutil.h"
#else
#include "X11/Xutil.h"
#endif

#ifdef BUILD_tk
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLEXPORT
#endif

typedef int (*XAfterFunction) (	    /* WARNING, this type not in Xlib spec */







<
<
<

<







15
16
17
18
19
20
21



22

23
24
25
26
27
28
29

/*
 * WARNING: This file is automatically generated by the tools/genStubs.tcl
 * script.  Any modifications to the function declarations below should be made
 * in the generic/tkInt.decls script.
 */




#include "X11/Xutil.h"


#ifdef BUILD_tk
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLEXPORT
#endif

typedef int (*XAfterFunction) (	    /* WARNING, this type not in Xlib spec */

Changes to generic/tkMain.c.

92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

	return 1;
    } else {
	return 0;
    }
}
#else
#if !defined(MAC_TCL)
extern int		isatty _ANSI_ARGS_((int fd));
#else
#include <unistd.h>
#endif
extern char *		strrchr _ANSI_ARGS_((CONST char *string, int c));
#endif

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








<

<
<
<







92
93
94
95
96
97
98

99



100
101
102
103
104
105
106

	return 1;
    } else {
	return 0;
    }
}
#else

extern int		isatty _ANSI_ARGS_((int fd));



extern char *		strrchr _ANSI_ARGS_((CONST char *string, int c));
#endif

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

189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
    Tcl_Preserve((ClientData) interp);

#if defined(__WIN32__) && !defined(STATIC_BUILD)
    if (!tclStubsPtr->reserved9) {
	/* Only initialize console when not running under cygwin */
	Tk_InitConsoleChannels(interp);
    }
#elif  defined(__WIN32__) || defined(MAC_TCL)
    Tk_InitConsoleChannels(interp);
#endif

#ifdef MAC_OSX_TK
    if (TclGetStartupScriptFileName() == NULL) {
        TkMacOSXDefaultStartupScript();
    }







|







185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
    Tcl_Preserve((ClientData) interp);

#if defined(__WIN32__) && !defined(STATIC_BUILD)
    if (!tclStubsPtr->reserved9) {
	/* Only initialize console when not running under cygwin */
	Tk_InitConsoleChannels(interp);
    }
#elif  defined(__WIN32__)
    Tk_InitConsoleChannels(interp);
#endif

#ifdef MAC_OSX_TK
    if (TclGetStartupScriptFileName() == NULL) {
        TkMacOSXDefaultStartupScript();
    }

Changes to generic/tkMenu.c.

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 *
 * In order to make the bindings for cascade menus work properly under Unix,
 * the cascade menus' pathnames must be proper children of the menu that
 * they are cascade from. So if there is a menu .m, and it has two
 * cascades labelled "File" and "Edit", the cascade menus might have
 * the pathnames .m.file and .m.edit. Another constraint is that the menus
 * used for menubars must be children of the toplevel widget that they
 * are attached to. And on the Macintosh, the platform specific menu handle
 * for cascades attached to a menu bar must have a title that matches the
 * label for the cascade menu.
 *
 * To handle all of the constraints, Tk menubars and tearoff menus are
 * implemented using menu clones. Menu clones are full menus in their own
 * right; they have a Tk window and pathname associated with them; they have
 * a TkMenu structure and array of entries. However, they are linked with the
 * original menu that they were cloned from. The reflect the attributes of
 * the original, or "master", menu. So if an item is added to a menu, and







|
<
<







28
29
30
31
32
33
34
35


36
37
38
39
40
41
42
 *
 * In order to make the bindings for cascade menus work properly under Unix,
 * the cascade menus' pathnames must be proper children of the menu that
 * they are cascade from. So if there is a menu .m, and it has two
 * cascades labelled "File" and "Edit", the cascade menus might have
 * the pathnames .m.file and .m.edit. Another constraint is that the menus
 * used for menubars must be children of the toplevel widget that they
 * are attached to. 


 *
 * To handle all of the constraints, Tk menubars and tearoff menus are
 * implemented using menu clones. Menu clones are full menus in their own
 * right; they have a Tk window and pathname associated with them; they have
 * a TkMenu structure and array of entries. However, they are linked with the
 * original menu that they were cloned from. The reflect the attributes of
 * the original, or "master", menu. So if an item is added to a menu, and

Changes to generic/tkPointer.c.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

#include "tkInt.h"

#ifdef __WIN32__
#include "tkWinInt.h"
#endif

#if defined(MAC_TCL)
#include "tkMacInt.h"
#define Cursor XCursor
#endif

#if defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
#define Cursor XCursor
#endif

/*
 * Mask that selects any of the state bits corresponding to buttons,







<
<
<
<
<







14
15
16
17
18
19
20





21
22
23
24
25
26
27

#include "tkInt.h"

#ifdef __WIN32__
#include "tkWinInt.h"
#endif






#if defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
#define Cursor XCursor
#endif

/*
 * Mask that selects any of the state bits corresponding to buttons,

Changes to generic/tkPort.h.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef _TCL
#include "tcl.h"
#endif

#if defined(__WIN32__) || defined(_WIN32)
#   include "tkWinPort.h"
#else
#   if defined(MAC_TCL)
#	include "tkMacPort.h"
#   elif defined(MAC_OSX_TK)
#	include "tkMacOSXPort.h"
#   else
#	include "tkUnixPort.h"
#   endif
#endif

#endif /* _TKPORT */







|
<
<







20
21
22
23
24
25
26
27


28
29
30
31
32
33
34
#ifndef _TCL
#include "tcl.h"
#endif

#if defined(__WIN32__) || defined(_WIN32)
#   include "tkWinPort.h"
#else
#   if defined(MAC_OSX_TK)


#	include "tkMacOSXPort.h"
#   else
#	include "tkUnixPort.h"
#   endif
#endif

#endif /* _TKPORT */

Changes to generic/tkSelect.c.

1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
     * Using UTF8_STRING instead of the XA_UTF8_STRING macro allows us
     * to support older X servers that didn't have UTF8_STRING yet.
     * This is necessary on Unix systems.
     * For more information, see:
     *    http://www.cl.cam.ac.uk/~mgk25/unicode.html#x11
     */

#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
    dispPtr->utf8Atom		= Tk_InternAtom(tkwin, "UTF8_STRING");
#else
    dispPtr->utf8Atom		= (Atom) NULL;
#endif
}

/*







|







1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
     * Using UTF8_STRING instead of the XA_UTF8_STRING macro allows us
     * to support older X servers that didn't have UTF8_STRING yet.
     * This is necessary on Unix systems.
     * For more information, see:
     *    http://www.cl.cam.ac.uk/~mgk25/unicode.html#x11
     */

#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
    dispPtr->utf8Atom		= Tk_InternAtom(tkwin, "UTF8_STRING");
#else
    dispPtr->utf8Atom		= (Atom) NULL;
#endif
}

/*

Changes to generic/tkStubInit.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include "tkInt.h"
#include "tkPort.h"

#if !(defined(__WIN32__) && defined(MAC_TCL) || defined(MAC_OSX_TK))
/* UNIX */
#define UNIX_TK
#endif

#ifdef __WIN32__
#include "tkWinInt.h"
#endif
#if defined(MAC_TCL)
/* set this locally .. we could have used _TKMACINT */
#define MAC_TK
#include "tkMacInt.h"
#endif

#if defined(MAC_OSX_TK)
/* set this locally .. we could have used _TKMACINT */
#include "tkMacOSXInt.h"
#endif

#include "tkDecls.h"







|







<
<
<
<
<







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22





23
24
25
26
27
28
29
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include "tkInt.h"
#include "tkPort.h"

#if !(defined(__WIN32__) && defined(MAC_OSX_TK))
/* UNIX */
#define UNIX_TK
#endif

#ifdef __WIN32__
#include "tkWinInt.h"
#endif






#if defined(MAC_OSX_TK)
/* set this locally .. we could have used _TKMACINT */
#include "tkMacOSXInt.h"
#endif

#include "tkDecls.h"
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#	define TkWinGetPlatformId 0
#	define TkWinSetHINSTANCE 0
#	define TkWinGetPlatformTheme 0
#	define TkWinChildProc 0

#	define TkBindDeadWindow 0 /* On purpose not in Cygwin's stub table */

#   elif !defined(MAC_TCL) && !defined(MAC_OSX_TK) /* UNIX */

#	undef TkClipBox
#	undef TkCreateRegion
#	undef TkDestroyRegion
#	undef TkIntersectRegion
#	undef TkRectInRegion
#	undef TkSetRegion







|







232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
#	define TkWinGetPlatformId 0
#	define TkWinSetHINSTANCE 0
#	define TkWinGetPlatformTheme 0
#	define TkWinChildProc 0

#	define TkBindDeadWindow 0 /* On purpose not in Cygwin's stub table */

#   elif !defined(MAC_OSX_TK) /* UNIX */

#	undef TkClipBox
#	undef TkCreateRegion
#	undef TkDestroyRegion
#	undef TkIntersectRegion
#	undef TkRectInRegion
#	undef TkSetRegion

Changes to generic/tkStubLib.c.

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "tkPort.h"
#include "tkInt.h"

#ifdef __WIN32__
#include "tkWinInt.h"
#endif

#ifdef MAC_TCL
#include "tkMacInt.h"
#endif

#ifdef MAC_OSX_TK
#include "tkMacOSXInt.h"
#endif

#include "tkDecls.h"
#include "tkIntDecls.h"
#include "tkPlatDecls.h"







<
<
<
<







32
33
34
35
36
37
38




39
40
41
42
43
44
45
#include "tkPort.h"
#include "tkInt.h"

#ifdef __WIN32__
#include "tkWinInt.h"
#endif





#ifdef MAC_OSX_TK
#include "tkMacOSXInt.h"
#endif

#include "tkDecls.h"
#include "tkIntDecls.h"
#include "tkPlatDecls.h"

Changes to generic/tkTest.c.

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

#ifdef __WIN32__
#include "tkWinInt.h"
#endif

#if defined(MAC_TCL) || defined(MAC_OSX_TK)
#include "tkScrollbar.h"
#endif

#ifdef __UNIX__
#include "tkUnixInt.h"
#endif








|







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

#ifdef __WIN32__
#include "tkWinInt.h"
#endif

#if defined(MAC_OSX_TK)
#include "tkScrollbar.h"
#endif

#ifdef __UNIX__
#include "tkUnixInt.h"
#endif

173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
static int		TestdeleteappsCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
static int		TestfontObjCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int objc,
			    Tcl_Obj *CONST objv[]));
static int		TestmakeexistCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
static int		TestmenubarCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
#endif
#if defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)
static int		TestmetricsCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
#endif
static int		TestobjconfigObjCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int objc,
			    Tcl_Obj * CONST objv[]));
static int	CustomOptionSet _ANSI_ARGS_((ClientData clientData,
			Tcl_Interp *interp, Tk_Window tkwin,
			Tcl_Obj **value, char *recordPtr, int internalOffset,
			char *saveInternalPtr, int flags));
static Tcl_Obj *CustomOptionGet _ANSI_ARGS_((ClientData clientData,
			Tk_Window tkwin, char *recordPtr, int internalOffset));
static void	CustomOptionRestore _ANSI_ARGS_((ClientData clientData,
			Tk_Window tkwin, char *internalPtr,
			char *saveInternalPtr));
static void	CustomOptionFree _ANSI_ARGS_((ClientData clientData,
			Tk_Window tkwin, char *internalPtr));
static int		TestpropCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
static int		TestsendCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
#endif
static int		TesttextCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
static int		TestwrapperCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
#endif
static void		TrivialCmdDeletedProc _ANSI_ARGS_((
			    ClientData clientData));
static int		TrivialConfigObjCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int objc,
			    Tcl_Obj * CONST objv[]));
static void		TrivialEventProc _ANSI_ARGS_((ClientData clientData,
			    XEvent *eventPtr));

/*
 * External (platform specific) initialization routine:
 */

extern int		TkplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp));

#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
#define TkplatformtestInit(x) TCL_OK
#endif

/*
 *----------------------------------------------------------------------
 *
 * Tktest_Init --







|



|



















|





|

















|







173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
static int		TestdeleteappsCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
static int		TestfontObjCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int objc,
			    Tcl_Obj *CONST objv[]));
static int		TestmakeexistCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
static int		TestmenubarCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
#endif
#if defined(__WIN32__) || defined(MAC_OSX_TK)
static int		TestmetricsCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
#endif
static int		TestobjconfigObjCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int objc,
			    Tcl_Obj * CONST objv[]));
static int	CustomOptionSet _ANSI_ARGS_((ClientData clientData,
			Tcl_Interp *interp, Tk_Window tkwin,
			Tcl_Obj **value, char *recordPtr, int internalOffset,
			char *saveInternalPtr, int flags));
static Tcl_Obj *CustomOptionGet _ANSI_ARGS_((ClientData clientData,
			Tk_Window tkwin, char *recordPtr, int internalOffset));
static void	CustomOptionRestore _ANSI_ARGS_((ClientData clientData,
			Tk_Window tkwin, char *internalPtr,
			char *saveInternalPtr));
static void	CustomOptionFree _ANSI_ARGS_((ClientData clientData,
			Tk_Window tkwin, char *internalPtr));
static int		TestpropCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
static int		TestsendCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
#endif
static int		TesttextCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
static int		TestwrapperCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int argc, CONST char **argv));
#endif
static void		TrivialCmdDeletedProc _ANSI_ARGS_((
			    ClientData clientData));
static int		TrivialConfigObjCmd _ANSI_ARGS_((ClientData dummy,
			    Tcl_Interp *interp, int objc,
			    Tcl_Obj * CONST objv[]));
static void		TrivialEventProc _ANSI_ARGS_((ClientData clientData,
			    XEvent *eventPtr));

/*
 * External (platform specific) initialization routine:
 */

extern int		TkplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp));

#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
#define TkplatformtestInit(x) TCL_OK
#endif

/*
 *----------------------------------------------------------------------
 *
 * Tktest_Init --
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateObjCommand(interp, "testobjconfig", TestobjconfigObjCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateObjCommand(interp, "testfont", TestfontObjCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand(interp, "testmakeexist", TestmakeexistCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
    Tcl_CreateCommand(interp, "testmenubar", TestmenubarCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
#endif
#if defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)
    Tcl_CreateCommand(interp, "testmetrics", TestmetricsCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
#endif
    Tcl_CreateCommand(interp, "testprop", TestpropCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
    Tcl_CreateCommand(interp, "testsend", TestsendCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
#endif
    Tcl_CreateCommand(interp, "testtext", TesttextCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
    Tcl_CreateCommand(interp, "testwrapper", TestwrapperCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
#endif

    /*
     * Create test image type.
     */







|



|





|





|







279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateObjCommand(interp, "testobjconfig", TestobjconfigObjCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateObjCommand(interp, "testfont", TestfontObjCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand(interp, "testmakeexist", TestmakeexistCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
    Tcl_CreateCommand(interp, "testmenubar", TestmenubarCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
#endif
#if defined(__WIN32__) || defined(MAC_OSX_TK)
    Tcl_CreateCommand(interp, "testmetrics", TestmetricsCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
#endif
    Tcl_CreateCommand(interp, "testprop", TestpropCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
    Tcl_CreateCommand(interp, "testsend", TestsendCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
#endif
    Tcl_CreateCommand(interp, "testtext", TesttextCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
    Tcl_CreateCommand(interp, "testwrapper", TestwrapperCmd,
	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
#endif

    /*
     * Create test image type.
     */
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
 * Side effects:
 *	Changes menubar related stuff.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
static int
TestmenubarCmd(clientData, interp, argc, argv)
    ClientData clientData;		/* Main window for application. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    CONST char **argv;			/* Argument strings. */
{







|







1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
 * Side effects:
 *	Changes menubar related stuff.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
static int
TestmenubarCmd(clientData, interp, argc, argv)
    ClientData clientData;		/* Main window for application. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    CONST char **argv;			/* Argument strings. */
{
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

#if defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)
static int
TestmetricsCmd(clientData, interp, argc, argv)
    ClientData clientData;		/* Main window for application. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    CONST char **argv;			/* Argument strings. */
{







|







2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

#if defined(__WIN32__) || defined(MAC_OSX_TK)
static int
TestmetricsCmd(clientData, interp, argc, argv)
    ClientData clientData;		/* Main window for application. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    CONST char **argv;			/* Argument strings. */
{
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
 * Side effects:
 *	Depends on option;  see below.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
static int
TestsendCmd(clientData, interp, argc, argv)
    ClientData clientData;		/* Main window for application. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    CONST char **argv;			/* Argument strings. */
{







|







2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
 * Side effects:
 *	Depends on option;  see below.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
static int
TestsendCmd(clientData, interp, argc, argv)
    ClientData clientData;		/* Main window for application. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    CONST char **argv;			/* Argument strings. */
{
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
    TkTextPrintIndex(&index, buf);
    sprintf(buf + strlen(buf), " %d", index.byteIndex);
    Tcl_AppendResult(interp, buf, NULL);

    return TCL_OK;
}

#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
/*
 *----------------------------------------------------------------------
 *
 * TestwrapperCmd --
 *
 *	This procedure implements the "testwrapper" command.  It 
 *	provides a way from Tcl to determine the extra window Tk adds







|







2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
    TkTextPrintIndex(&index, buf);
    sprintf(buf + strlen(buf), " %d", index.byteIndex);
    Tcl_AppendResult(interp, buf, NULL);

    return TCL_OK;
}

#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
/*
 *----------------------------------------------------------------------
 *
 * TestwrapperCmd --
 *
 *	This procedure implements the "testwrapper" command.  It 
 *	provides a way from Tcl to determine the extra window Tk adds

Changes to generic/tkText.c.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 */

#include "default.h"
#include "tkPort.h"
#include "tkInt.h"
#include "tkUndo.h"

#if defined(MAC_TCL) || defined(MAC_OSX_TK)
#define Style TkStyle
#define DInfo TkDInfo
#endif

#include "tkText.h"

/*







|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 */

#include "default.h"
#include "tkPort.h"
#include "tkInt.h"
#include "tkUndo.h"

#if defined(MAC_OSX_TK)
#define Style TkStyle
#define DInfo TkDInfo
#endif

#include "tkText.h"

/*

Changes to generic/tkWindow.c.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 */

#include "tkPort.h"
#include "tkInt.h"

#ifdef __WIN32__
#include "tkWinInt.h"
#elif !(defined(MAC_TCL) ||  defined(MAC_OSX_TK))
#include "tkUnixInt.h"
#endif

#include "tclInt.h" /* for Tcl_CreateNamespace() */

/*
 * Type used to keep track of Window objects that were







|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 */

#include "tkPort.h"
#include "tkInt.h"

#ifdef __WIN32__
#include "tkWinInt.h"
#elif !(defined(MAC_OSX_TK))
#include "tkUnixInt.h"
#endif

#include "tclInt.h" /* for Tcl_CreateNamespace() */

/*
 * Type used to keep track of Window objects that were
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
    {"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",  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",   Tk_MessageBoxObjCmd,	PASSMAINWINDOW},







|







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
    {"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_OSX_TK)
    {"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",   Tk_MessageBoxObjCmd,	PASSMAINWINDOW},
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
    {"text",		(Tcl_ObjCmdProc *) Tk_TextCmd,		NOOBJPROC|PASSMAINWINDOW|ISSAFE},
    {"toplevel",	Tk_ToplevelObjCmd,	0},

    /*
     * Misc.
     */

#if defined(MAC_TCL) || defined(MAC_OSX_TK)
    {"::tk::unsupported::MacWindowStyle",
	    		TkUnsupported1ObjCmd,			PASSMAINWINDOW|ISSAFE},
#endif
    {NULL, NULL, 0}
};

/*







|







171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
    {"text",		(Tcl_ObjCmdProc *) Tk_TextCmd,		NOOBJPROC|PASSMAINWINDOW|ISSAFE},
    {"toplevel",	Tk_ToplevelObjCmd,	0},

    /*
     * Misc.
     */

#if defined(MAC_OSX_TK)
    {"::tk::unsupported::MacWindowStyle",
	    		TkUnsupported1ObjCmd,			PASSMAINWINDOW|ISSAFE},
#endif
    {NULL, NULL, 0}
};

/*
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471

    if (winPtr->flags & TK_WIN_MANAGED) {
	TkWmDeadWindow(winPtr);
    } else if (winPtr->flags & TK_WM_COLORMAP_WINDOW) {
	TkWmRemoveFromColormapWindows(winPtr);
    }
    if (winPtr->window != None) {
#if defined(MAC_TCL) || defined(MAC_OSX_TK) || defined(__WIN32__)
	XDestroyWindow(winPtr->display, winPtr->window);
#else
	if ((winPtr->flags & TK_TOP_HIERARCHY)
		|| !(winPtr->flags & TK_DONT_DESTROY_WINDOW)) {
	    /*
	     * The parent has already been destroyed and this isn't
	     * a top-level window, so this window will be destroyed







|







1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471

    if (winPtr->flags & TK_WIN_MANAGED) {
	TkWmDeadWindow(winPtr);
    } else if (winPtr->flags & TK_WM_COLORMAP_WINDOW) {
	TkWmRemoveFromColormapWindows(winPtr);
    }
    if (winPtr->window != None) {
#if defined(MAC_OSX_TK) || defined(__WIN32__)
	XDestroyWindow(winPtr->display, winPtr->window);
#else
	if ((winPtr->flags & TK_TOP_HIERARCHY)
		|| !(winPtr->flags & TK_DONT_DESTROY_WINDOW)) {
	    /*
	     * The parent has already been destroyed and this isn't
	     * a top-level window, so this window will be destroyed
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
	    ckfree((char *) winPtr->mainPtr);

            /*
             * If no other applications are using the display, close the
             * display now and relinquish its data structures.
             */

#if !defined(WIN32) && !defined(MAC_TCL) && defined(NOT_YET)
            if (dispPtr->refCount <= 0) {
                /*
                 * I have disabled this code because on Windows there are
                 * still order dependencies in close-down. All displays
                 * and resources will get closed down properly anyway at
                 * exit, through the exit handler. -- jyl
                 */







|







1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
	    ckfree((char *) winPtr->mainPtr);

            /*
             * If no other applications are using the display, close the
             * display now and relinquish its data structures.
             */

#if !defined(WIN32) && defined(NOT_YET)
            if (dispPtr->refCount <= 0) {
                /*
                 * I have disabled this code because on Windows there are
                 * still order dependencies in close-down. All displays
                 * and resources will get closed down properly anyway at
                 * exit, through the exit handler. -- jyl
                 */
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
void
Tk_DefineCursor(tkwin, cursor)
    Tk_Window tkwin;		/* Window to manipulate. */
    Tk_Cursor cursor;		/* Cursor to use for window (may be None). */
{
    register TkWindow *winPtr = (TkWindow *) tkwin;

#if defined(MAC_TCL) || defined(MAC_OSX_TK)
    winPtr->atts.cursor = (XCursor) cursor;
#else
    winPtr->atts.cursor = (Cursor) cursor;
#endif

    if (winPtr->window != None) {
	XDefineCursor(winPtr->display, winPtr->window, winPtr->atts.cursor);







|







2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
void
Tk_DefineCursor(tkwin, cursor)
    Tk_Window tkwin;		/* Window to manipulate. */
    Tk_Cursor cursor;		/* Cursor to use for window (may be None). */
{
    register TkWindow *winPtr = (TkWindow *) tkwin;

#if defined(MAC_OSX_TK)
    winPtr->atts.cursor = (XCursor) cursor;
#else
    winPtr->atts.cursor = (Cursor) cursor;
#endif

    if (winPtr->window != None) {
	XDefineCursor(winPtr->display, winPtr->window, winPtr->atts.cursor);

Changes to library/bgerror.tcl.

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
    set ret [catch {::tkerror $err} msg];
    if {$ret != 1} {return -code $ret $msg}

    # Ok the application's tkerror either failed or was not found
    # we use the default dialog then :
    set windowingsystem [tk windowingsystem]

    if {($windowingsystem eq "classic")
             || ($windowingsystem eq "aqua")} {
	set ok		[mc Ok]
	set messageFont	system
	set textRelief	flat
	set textHilight	0
    } else {
	set ok		[mc OK]
	set messageFont	{Times -18}







<
|







90
91
92
93
94
95
96

97
98
99
100
101
102
103
104
    set ret [catch {::tkerror $err} msg];
    if {$ret != 1} {return -code $ret $msg}

    # Ok the application's tkerror either failed or was not found
    # we use the default dialog then :
    set windowingsystem [tk windowingsystem]


    if {$windowingsystem eq "aqua"} {
	set ok		[mc Ok]
	set messageFont	system
	set textRelief	flat
	set textHilight	0
    } else {
	set ok		[mc OK]
	set messageFont	{Times -18}
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
    destroy .bgerrorDialog
    toplevel .bgerrorDialog -class ErrorDialog
    wm withdraw .bgerrorDialog
    wm title .bgerrorDialog $title
    wm iconname .bgerrorDialog ErrorDialog
    wm protocol .bgerrorDialog WM_DELETE_WINDOW { }

    if {($windowingsystem eq "classic")
            || ($windowingsystem eq "aqua")} {
	::tk::unsupported::MacWindowStyle style .bgerrorDialog moveableAlert {}
    } elseif {$windowingsystem eq "x11"} {
	wm attributes .bgerrorDialog -type dialog
    }

    frame .bgerrorDialog.bot
    frame .bgerrorDialog.top







<
|







138
139
140
141
142
143
144

145
146
147
148
149
150
151
152
    destroy .bgerrorDialog
    toplevel .bgerrorDialog -class ErrorDialog
    wm withdraw .bgerrorDialog
    wm title .bgerrorDialog $title
    wm iconname .bgerrorDialog ErrorDialog
    wm protocol .bgerrorDialog WM_DELETE_WINDOW { }


    if {$windowingsystem eq "aqua"} {
	::tk::unsupported::MacWindowStyle style .bgerrorDialog moveableAlert {}
    } elseif {$windowingsystem eq "x11"} {
	wm attributes .bgerrorDialog -type dialog
    }

    frame .bgerrorDialog.bot
    frame .bgerrorDialog.top
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
    # Max-width of message is the width of the screen...
    set wrapwidth [winfo screenwidth .bgerrorDialog]
    # ...minus the width of the icon, padding and a fudge factor for
    # the window manager decorations and aesthetics.
    set wrapwidth [expr {$wrapwidth-60-[winfo pixels .bgerrorDialog 9m]}]
    label .bgerrorDialog.msg -justify left -text $text -font $messageFont \
	    -wraplength $wrapwidth
    if {($windowingsystem eq "classic")
            || ($windowingsystem eq "aqua")} {
	# On the Macintosh, use the stop bitmap
	label .bgerrorDialog.bitmap -bitmap stop
    } else {
	# On other platforms, make the error icon
	canvas .bgerrorDialog.bitmap -width 32 -height 32 -highlightthickness 0
	.bgerrorDialog.bitmap create oval 0 0 31 31 -fill red -outline black
	.bgerrorDialog.bitmap create line 9 9 23 23 -fill white -width 4
	.bgerrorDialog.bitmap create line 9 23 23 9 -fill white -width 4
    }
    grid .bgerrorDialog.bitmap .bgerrorDialog.msg \
	    -in .bgerrorDialog.top	\
	    -row 0			\
	    -padx 3m			\
	    -pady 3m
    grid configure	 .bgerrorDialog.msg -sticky nsw -padx {0 3m}
    grid rowconfigure	 .bgerrorDialog.top 1 -weight 1







<
<
<
<
<
<




<







184
185
186
187
188
189
190






191
192
193
194

195
196
197
198
199
200
201
    # Max-width of message is the width of the screen...
    set wrapwidth [winfo screenwidth .bgerrorDialog]
    # ...minus the width of the icon, padding and a fudge factor for
    # the window manager decorations and aesthetics.
    set wrapwidth [expr {$wrapwidth-60-[winfo pixels .bgerrorDialog 9m]}]
    label .bgerrorDialog.msg -justify left -text $text -font $messageFont \
	    -wraplength $wrapwidth






	canvas .bgerrorDialog.bitmap -width 32 -height 32 -highlightthickness 0
	.bgerrorDialog.bitmap create oval 0 0 31 31 -fill red -outline black
	.bgerrorDialog.bitmap create line 9 9 23 23 -fill white -width 4
	.bgerrorDialog.bitmap create line 9 23 23 9 -fill white -width 4

    grid .bgerrorDialog.bitmap .bgerrorDialog.msg \
	    -in .bgerrorDialog.top	\
	    -row 0			\
	    -padx 3m			\
	    -pady 3m
    grid configure	 .bgerrorDialog.msg -sticky nsw -padx {0 3m}
    grid rowconfigure	 .bgerrorDialog.top 1 -weight 1
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
		-in .bgerrorDialog.bot	\
		-column $i		\
		-row 0			\
		-sticky ew		\
		-padx 10
	grid columnconfigure .bgerrorDialog.bot $i -weight 1
	# We boost the size of some Mac buttons for l&f
	if {($windowingsystem eq "classic")
	    || ($windowingsystem eq "aqua")} {
	    if {($name eq "ok") || ($name eq "dismiss")} {
		grid columnconfigure .bgerrorDialog.bot $i -minsize 90
	    }
	    grid configure .bgerrorDialog.$name -pady 7
	}
	incr i
    }







<
|







213
214
215
216
217
218
219

220
221
222
223
224
225
226
227
		-in .bgerrorDialog.bot	\
		-column $i		\
		-row 0			\
		-sticky ew		\
		-padx 10
	grid columnconfigure .bgerrorDialog.bot $i -weight 1
	# We boost the size of some Mac buttons for l&f

	if {$windowingsystem eq "aqua"} {
	    if {($name eq "ok") || ($name eq "dismiss")} {
		grid columnconfigure .bgerrorDialog.bot $i -minsize 90
	    }
	    grid configure .bgerrorDialog.$name -pady 7
	}
	incr i
    }

Changes to library/button.tcl.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#

#-------------------------------------------------------------------------
# The code below creates the default class bindings for buttons.
#-------------------------------------------------------------------------

if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
    bind Radiobutton <Enter> {
	tk::ButtonEnter %W
    }
    bind Radiobutton <1> {
	tk::ButtonDown %W
    }
    bind Radiobutton <ButtonRelease-1> {







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#

#-------------------------------------------------------------------------
# The code below creates the default class bindings for buttons.
#-------------------------------------------------------------------------

if {[tk windowingsystem] eq "aqua"} {
    bind Radiobutton <Enter> {
	tk::ButtonEnter %W
    }
    bind Radiobutton <1> {
	tk::ButtonDown %W
    }
    bind Radiobutton <ButtonRelease-1> {
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
	    }
	}
    }
}

}

if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {

####################
# Mac implementation
####################

# ::tk::ButtonEnter --
# The procedure below is invoked when the mouse pointer enters a







|







438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
	    }
	}
    }
}

}

if {[tk windowingsystem] eq "aqua"} {

####################
# Mac implementation
####################

# ::tk::ButtonEnter --
# The procedure below is invoked when the mouse pointer enters a

Changes to library/console.tcl.

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
proc ::tk::ConsoleInit {} {
    global tcl_platform

    if {![consoleinterp eval {set tcl_interactive}]} {
	wm withdraw .
    }

    if {$tcl_platform(platform) eq "macintosh"
	    || [tk windowingsystem] eq "aqua"} {
	set mod "Cmd"
    } else {
	set mod "Ctrl"
    }

    if {[catch {menu .menubar} err]} { bgerror "INIT: $err" }
    .menubar add cascade -label File -menu .menubar.file -underline 0
    .menubar add cascade -label Edit -menu .menubar.edit -underline 0

    menu .menubar.file -tearoff 0
    .menubar.file add command -label [mc "Source..."] \
	    -underline 0 -command tk::ConsoleSource
    .menubar.file add command -label [mc "Hide Console"] \
	    -underline 0 -command {wm withdraw .}
    .menubar.file add command -label [mc "Clear Console"] \
	    -underline 0 -command {.console delete 1.0 "promptEnd linestart"}
   if {$tcl_platform(platform) eq "macintosh"
	    || [tk windowingsystem] eq "aqua"} {
	.menubar.file add command -label [mc "Quit"] \
		-command exit -accel Cmd-Q
    } else {
	.menubar.file add command -label [mc "Exit"] \
		-underline 1 -command exit
    }








<
|
















<
|







44
45
46
47
48
49
50

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

68
69
70
71
72
73
74
75
proc ::tk::ConsoleInit {} {
    global tcl_platform

    if {![consoleinterp eval {set tcl_interactive}]} {
	wm withdraw .
    }


    if {[tk windowingsystem] eq "aqua"} {
	set mod "Cmd"
    } else {
	set mod "Ctrl"
    }

    if {[catch {menu .menubar} err]} { bgerror "INIT: $err" }
    .menubar add cascade -label File -menu .menubar.file -underline 0
    .menubar add cascade -label Edit -menu .menubar.edit -underline 0

    menu .menubar.file -tearoff 0
    .menubar.file add command -label [mc "Source..."] \
	    -underline 0 -command tk::ConsoleSource
    .menubar.file add command -label [mc "Hide Console"] \
	    -underline 0 -command {wm withdraw .}
    .menubar.file add command -label [mc "Clear Console"] \
	    -underline 0 -command {.console delete 1.0 "promptEnd linestart"}

   if {[tk windowingsystem] eq "aqua"} {
	.menubar.file add command -label [mc "Quit"] \
		-command exit -accel Cmd-Q
    } else {
	.menubar.file add command -label [mc "Exit"] \
		-underline 1 -command exit
    }

99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
    . configure -menu .menubar

    set con [text .console  -yscrollcommand [list .sb set] -setgrid true]
    scrollbar .sb -command [list $con yview]
    pack .sb -side right -fill both
    pack $con -fill both -expand 1 -side left
    switch -exact $tcl_platform(platform) {
	"macintosh" {
	    $con configure -font {Monaco 10 normal} -highlightthickness 0
	}
	"windows" {
	    $con configure -font systemfixed
	}
	"unix" {
	    if {[tk windowingsystem] eq "aqua"} {
		$con configure -font {Monaco 10 normal} -highlightthickness 0
	    }







<
<
<







97
98
99
100
101
102
103



104
105
106
107
108
109
110
    . configure -menu .menubar

    set con [text .console  -yscrollcommand [list .sb set] -setgrid true]
    scrollbar .sb -command [list $con yview]
    pack .sb -side right -fill both
    pack $con -fill both -expand 1 -side left
    switch -exact $tcl_platform(platform) {



	"windows" {
	    $con configure -font systemfixed
	}
	"unix" {
	    if {[tk windowingsystem] eq "aqua"} {
		$con configure -font {Monaco 10 normal} -highlightthickness 0
	    }
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
	catch {tk::ConsoleInsert %W [::tk::GetSelection %W PRIMARY]}
    }
    bind Console <KeyPress> {
	tk::ConsoleInsert %W %A
    }
    bind Console <F9> {
	eval destroy [winfo child .]
	if {$tcl_platform(platform) eq "macintosh"} {
	    if {[catch {source [file join $tk_library console.tcl]}]} {source -rsrc console}
	} else {
	    source [file join $tk_library console.tcl]
	}
    }
    if {$::tcl_platform(platform) eq "macintosh" || [tk windowingsystem] eq "aqua"} {
	    bind Console <Command-q> {
		exit
	    }
    }
    bind Console <<Cut>> {
        # Same as the copy event
 	if {![catch {set data [%W get sel.first sel.last]}]} {







<
<
<
|
|
<
|







458
459
460
461
462
463
464



465
466

467
468
469
470
471
472
473
474
	catch {tk::ConsoleInsert %W [::tk::GetSelection %W PRIMARY]}
    }
    bind Console <KeyPress> {
	tk::ConsoleInsert %W %A
    }
    bind Console <F9> {
	eval destroy [winfo child .]



	source [file join $tk_library console.tcl]
    }

    if {[tk windowingsystem] eq "aqua"} {
	    bind Console <Command-q> {
		exit
	    }
    }
    bind Console <<Cut>> {
        # Same as the copy event
 	if {![catch {set data [%W get sel.first sel.last]}]} {

Changes to library/dialog.tcl.

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
    } elseif {"" eq $default} {
	set default -1
    } else {
	set default [lsearch -exact $args $default]
    }

    set windowingsystem [tk windowingsystem]
    if {$tcl_platform(platform) eq "macintosh" || $windowingsystem eq "aqua"} {
	option add *Dialog*background systemDialogBackgroundActive widgetDefault
	option add *Dialog*Button.highlightBackground \
		systemDialogBackgroundActive widgetDefault
    }

    # 1. Create the top-level window and divide it into top
    # and bottom parts.







|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
    } elseif {"" eq $default} {
	set default -1
    } else {
	set default [lsearch -exact $args $default]
    }

    set windowingsystem [tk windowingsystem]
    if {$windowingsystem eq "aqua"} {
	option add *Dialog*background systemDialogBackgroundActive widgetDefault
	option add *Dialog*Button.highlightBackground \
		systemDialogBackgroundActive widgetDefault
    }

    # 1. Create the top-level window and divide it into top
    # and bottom parts.
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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
    # window, this can hang the entire application.  Therefore we only make
    # the dialog transient if the parent is viewable.
    #
    if {[winfo viewable [winfo toplevel [winfo parent $w]]] } {
	wm transient $w [winfo toplevel [winfo parent $w]]
    }

    if {$tcl_platform(platform) eq "macintosh" || $windowingsystem eq "aqua"} {
	::tk::unsupported::MacWindowStyle style $w moveableModal {}
    } elseif {$windowingsystem eq "x11"} {
	wm attributes $w -type dialog
    }

    frame $w.bot
    frame $w.top
    if {$windowingsystem eq "x11"} {
	$w.bot configure -relief raised -bd 1
	$w.top configure -relief raised -bd 1
    }
    pack $w.bot -side bottom -fill both
    pack $w.top -side top -fill both -expand 1

    # 2. Fill the top part with bitmap and message (use the option
    # database for -wraplength and -font so that they can be
    # overridden by the caller).

    option add *Dialog.msg.wrapLength 3i widgetDefault
    if {$tcl_platform(platform) eq "macintosh" || $windowingsystem eq "aqua"} {
	option add *Dialog.msg.font system widgetDefault
    } else {
	option add *Dialog.msg.font {Times 12} widgetDefault
    }

    label $w.msg -justify left -text $text
    pack $w.msg -in $w.top -side right -expand 1 -fill both -padx 3m -pady 3m
    if {$bitmap ne ""} {
	if {($tcl_platform(platform) eq "macintosh"
	     || $windowingsystem eq "aqua") && ($bitmap eq "error")} {
	    set bitmap "stop"
	}
	label $w.bitmap -bitmap $bitmap
	pack $w.bitmap -in $w.top -side left -padx 3m -pady 3m
    }

    # 3. Create a row of buttons at the bottom of the dialog.

    set i 0
    foreach but $args {
	button $w.button$i -text $but -command [list set ::tk::Priv(button) $i]
	if {$i == $default} {
	    $w.button$i configure -default active
	} else {
	    $w.button$i configure -default normal
	}
	grid $w.button$i -in $w.bot -column $i -row 0 -sticky ew \
		-padx 10 -pady 4
	grid columnconfigure $w.bot $i
	# We boost the size of some Mac buttons for l&f
	if {$tcl_platform(platform) eq "macintosh" || $windowingsystem eq "aqua"} {
	    set tmp [string tolower $but]
	    if {$tmp eq "ok" || $tmp eq "cancel"} {
		grid columnconfigure $w.bot $i -minsize 90
	    }
	    grid configure $w.button$i -pady 7
	}
	incr i







|



















|








<
|




















|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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
    # window, this can hang the entire application.  Therefore we only make
    # the dialog transient if the parent is viewable.
    #
    if {[winfo viewable [winfo toplevel [winfo parent $w]]] } {
	wm transient $w [winfo toplevel [winfo parent $w]]
    }

    if {$windowingsystem eq "aqua"} {
	::tk::unsupported::MacWindowStyle style $w moveableModal {}
    } elseif {$windowingsystem eq "x11"} {
	wm attributes $w -type dialog
    }

    frame $w.bot
    frame $w.top
    if {$windowingsystem eq "x11"} {
	$w.bot configure -relief raised -bd 1
	$w.top configure -relief raised -bd 1
    }
    pack $w.bot -side bottom -fill both
    pack $w.top -side top -fill both -expand 1

    # 2. Fill the top part with bitmap and message (use the option
    # database for -wraplength and -font so that they can be
    # overridden by the caller).

    option add *Dialog.msg.wrapLength 3i widgetDefault
    if {$windowingsystem eq "aqua"} {
	option add *Dialog.msg.font system widgetDefault
    } else {
	option add *Dialog.msg.font {Times 12} widgetDefault
    }

    label $w.msg -justify left -text $text
    pack $w.msg -in $w.top -side right -expand 1 -fill both -padx 3m -pady 3m
    if {$bitmap ne ""} {

	if {$windowingsystem eq "aqua" && $bitmap eq "error"} {
	    set bitmap "stop"
	}
	label $w.bitmap -bitmap $bitmap
	pack $w.bitmap -in $w.top -side left -padx 3m -pady 3m
    }

    # 3. Create a row of buttons at the bottom of the dialog.

    set i 0
    foreach but $args {
	button $w.button$i -text $but -command [list set ::tk::Priv(button) $i]
	if {$i == $default} {
	    $w.button$i configure -default active
	} else {
	    $w.button$i configure -default normal
	}
	grid $w.button$i -in $w.bot -column $i -row 0 -sticky ew \
		-padx 10 -pady 4
	grid columnconfigure $w.bot $i
	# We boost the size of some Mac buttons for l&f
	if {$windowingsystem eq "aqua"} {
	    set tmp [string tolower $but]
	    if {$tmp eq "ok" || $tmp eq "cancel"} {
		grid columnconfigure $w.bot $i -minsize 90
	    }
	    grid configure $w.button$i -pady 7
	}
	incr i

Changes to library/entry.tcl.

199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
bind Entry <Alt-KeyPress> {# nothing}
bind Entry <Meta-KeyPress> {# nothing}
bind Entry <Control-KeyPress> {# nothing}
bind Entry <Escape> {# nothing}
bind Entry <Return> {# nothing}
bind Entry <KP_Enter> {# nothing}
bind Entry <Tab> {# nothing}
if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
	bind Entry <Command-KeyPress> {# nothing}
}

# On Windows, paste is done using Shift-Insert.  Shift-Insert already
# generates the <<Paste>> event, so we don't need to do anything here.
if {[tk windowingsystem] ne "win32"} {
    bind Entry <Insert> {







|







199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
bind Entry <Alt-KeyPress> {# nothing}
bind Entry <Meta-KeyPress> {# nothing}
bind Entry <Control-KeyPress> {# nothing}
bind Entry <Escape> {# nothing}
bind Entry <Return> {# nothing}
bind Entry <KP_Enter> {# nothing}
bind Entry <Tab> {# nothing}
if {[tk windowingsystem] eq "aqua"} {
	bind Entry <Command-KeyPress> {# nothing}
}

# On Windows, paste is done using Shift-Insert.  Shift-Insert already
# generates the <<Paste>> event, so we don't need to do anything here.
if {[tk windowingsystem] ne "win32"} {
    bind Entry <Insert> {

Changes to library/listbox.tcl.

172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
bind Listbox <B2-Motion> {
    %W scan dragto %x %y
}

# The MouseWheel will typically only fire on Windows and Mac OS X.
# However, someone could use the "event generate" command to produce
# one on other platforms.
if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
    bind Listbox <MouseWheel> {
        %W yview scroll [expr {- (%D)}] units
    }
    bind Listbox <Option-MouseWheel> {
        %W yview scroll [expr {-10 * (%D)}] units
    }
    bind Listbox <Shift-MouseWheel> {







|







172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
bind Listbox <B2-Motion> {
    %W scan dragto %x %y
}

# The MouseWheel will typically only fire on Windows and Mac OS X.
# However, someone could use the "event generate" command to produce
# one on other platforms.
if {[tk windowingsystem] eq "aqua"} {
    bind Listbox <MouseWheel> {
        %W yview scroll [expr {- (%D)}] units
    }
    bind Listbox <Option-MouseWheel> {
        %W yview scroll [expr {-10 * (%D)}] units
    }
    bind Listbox <Shift-MouseWheel> {

Changes to library/msgbox.tcl.

152
153
154
155
156
157
158
159
160
161
162
163
164
165
166

    tclParseConfigSpec $w $specs "" $args

    if {[lsearch -exact {info warning error question} $data(-icon)] == -1} {
	error "bad -icon value \"$data(-icon)\": must be error, info, question, or warning"
    }
    set windowingsystem [tk windowingsystem]
    if {$windowingsystem eq "classic" || $windowingsystem eq "aqua"} {
	switch -- $data(-icon) {
	    "error"     {set data(-icon) "stop"}
	    "warning"   {set data(-icon) "caution"}
	    "info"      {set data(-icon) "note"}
	}
	option add *Dialog*background systemDialogBackgroundActive widgetDefault
	option add *Dialog*Button.highlightBackground \







|







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166

    tclParseConfigSpec $w $specs "" $args

    if {[lsearch -exact {info warning error question} $data(-icon)] == -1} {
	error "bad -icon value \"$data(-icon)\": must be error, info, question, or warning"
    }
    set windowingsystem [tk windowingsystem]
    if {$windowingsystem eq "aqua"} {
	switch -- $data(-icon) {
	    "error"     {set data(-icon) "stop"}
	    "warning"   {set data(-icon) "caution"}
	    "info"      {set data(-icon) "note"}
	}
	option add *Dialog*background systemDialogBackgroundActive widgetDefault
	option add *Dialog*Button.highlightBackground \
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
    # "grab"bed windows.  So only make the message box transient if the parent
    # is viewable.
    #
    if {[winfo viewable [winfo toplevel $data(-parent)]] } {
	wm transient $w $data(-parent)
    }

    if {$windowingsystem eq "classic" || $windowingsystem eq "aqua"} {
	::tk::unsupported::MacWindowStyle style $w moveableModal {}
    } elseif {$windowingsystem eq "x11"} {
        wm attributes $w -type dialog
    }

    frame $w.bot -background $bg
    pack $w.bot -side bottom -fill both
    frame $w.top -background $bg
    pack $w.top -side top -fill both -expand 1
    if {$windowingsystem ne "classic" && $windowingsystem ne "aqua"} {
	$w.bot configure -relief raised -bd 1
	$w.top configure -relief raised -bd 1
    }

    # 4. Fill the top part with bitmap and message (use the option
    # database for -wraplength and -font so that they can be
    # overridden by the caller).

    option add *Dialog.msg.wrapLength 3i widgetDefault
    if {$windowingsystem eq "classic" || $windowingsystem eq "aqua"} {
	option add *Dialog.msg.font system widgetDefault
    } else {
	option add *Dialog.msg.font {Times 14} widgetDefault
    }

    label $w.msg -anchor nw -justify left -text $data(-message) \
	    -background $bg
    if {$data(-icon) ne ""} {
	if {($windowingsystem eq "classic" || $windowingsystem eq "aqua")
		|| ([winfo depth $w] < 4) || $tk_strictMotif} {
	    label $w.bitmap -bitmap $data(-icon) -background $bg
	} else {
	    canvas $w.bitmap -width 32 -height 32 -highlightthickness 0 \
		    -background $bg
	    switch $data(-icon) {
		error {







|









|









|








|







259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
    # "grab"bed windows.  So only make the message box transient if the parent
    # is viewable.
    #
    if {[winfo viewable [winfo toplevel $data(-parent)]] } {
	wm transient $w $data(-parent)
    }

    if {$windowingsystem eq "aqua"} {
	::tk::unsupported::MacWindowStyle style $w moveableModal {}
    } elseif {$windowingsystem eq "x11"} {
        wm attributes $w -type dialog
    }

    frame $w.bot -background $bg
    pack $w.bot -side bottom -fill both
    frame $w.top -background $bg
    pack $w.top -side top -fill both -expand 1
    if {$windowingsystem ne "aqua"} {
	$w.bot configure -relief raised -bd 1
	$w.top configure -relief raised -bd 1
    }

    # 4. Fill the top part with bitmap and message (use the option
    # database for -wraplength and -font so that they can be
    # overridden by the caller).

    option add *Dialog.msg.wrapLength 3i widgetDefault
    if {$windowingsystem eq "aqua"} {
	option add *Dialog.msg.font system widgetDefault
    } else {
	option add *Dialog.msg.font {Times 14} widgetDefault
    }

    label $w.msg -anchor nw -justify left -text $data(-message) \
	    -background $bg
    if {$data(-icon) ne ""} {
	if {($windowingsystem eq "aqua")
		|| ([winfo depth $w] < 4) || $tk_strictMotif} {
	    label $w.bitmap -bitmap $data(-icon) -background $bg
	} else {
	    canvas $w.bitmap -width 32 -height 32 -highlightthickness 0 \
		    -background $bg
	    switch $data(-icon) {
		error {
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
	    $w.$name configure -default active
	} else {
	    $w.$name configure -default normal
	}
	grid $w.$name -in $w.bot -row 0 -column $i -padx 3m -pady 2m -sticky ew
	grid columnconfigure $w.bot $i -uniform buttons
	# We boost the size of some Mac buttons for l&f
	if {$windowingsystem eq "classic" || $windowingsystem eq "aqua"} {
	    set tmp [string tolower $name]
	    if {$tmp eq "ok" || $tmp eq "cancel" || $tmp eq "yes" ||
		    $tmp eq "no" || $tmp eq "abort" || $tmp eq "retry" ||
		    $tmp eq "ignore"} {
		grid columnconfigure $w.bot $i -minsize 90
	    }
	    grid configure $w.$name -pady 7







|







354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
	    $w.$name configure -default active
	} else {
	    $w.$name configure -default normal
	}
	grid $w.$name -in $w.bot -row 0 -column $i -padx 3m -pady 2m -sticky ew
	grid columnconfigure $w.bot $i -uniform buttons
	# We boost the size of some Mac buttons for l&f
	if {$windowingsystem eq "aqua"} {
	    set tmp [string tolower $name]
	    if {$tmp eq "ok" || $tmp eq "cancel" || $tmp eq "yes" ||
		    $tmp eq "no" || $tmp eq "abort" || $tmp eq "retry" ||
		    $tmp eq "ignore"} {
		grid columnconfigure $w.bot $i -minsize 90
	    }
	    grid configure $w.$name -pady 7

Changes to library/scrlbar.tcl.

124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
bind Scrollbar <Home> {
    tk::ScrollToPos %W 0
}
bind Scrollbar <End> {
    tk::ScrollToPos %W 1
}
}
if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
    bind Scrollbar <MouseWheel> {
        tk::ScrollByUnits %W v [expr {- (%D)}]
    }
    bind Scrollbar <Option-MouseWheel> {
        tk::ScrollByUnits %W v [expr {-10 * (%D)}]
    }
    bind Scrollbar <Shift-MouseWheel> {







|







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
bind Scrollbar <Home> {
    tk::ScrollToPos %W 0
}
bind Scrollbar <End> {
    tk::ScrollToPos %W 1
}
}
if {[tk windowingsystem] eq "aqua"} {
    bind Scrollbar <MouseWheel> {
        tk::ScrollByUnits %W v [expr {- (%D)}]
    }
    bind Scrollbar <Option-MouseWheel> {
        tk::ScrollByUnits %W v [expr {-10 * (%D)}]
    }
    bind Scrollbar <Shift-MouseWheel> {

Changes to library/spinbox.tcl.

207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
bind Spinbox <Meta-KeyPress> {# nothing}
bind Spinbox <Control-KeyPress> {# nothing}
bind Spinbox <Escape> {# nothing}
bind Spinbox <Return> {# nothing}
bind Spinbox <KP_Enter> {# nothing}
bind Spinbox <Tab> {# nothing}

if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
	bind Spinbox <Command-KeyPress> {# nothing}
}

# On Windows, paste is done using Shift-Insert.  Shift-Insert already
# generates the <<Paste>> event, so we don't need to do anything here.
if {[tk windowingsystem] ne "win32"} {
    bind Spinbox <Insert> {







|







207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
bind Spinbox <Meta-KeyPress> {# nothing}
bind Spinbox <Control-KeyPress> {# nothing}
bind Spinbox <Escape> {# nothing}
bind Spinbox <Return> {# nothing}
bind Spinbox <KP_Enter> {# nothing}
bind Spinbox <Tab> {# nothing}

if {[tk windowingsystem] eq "aqua"} {
	bind Spinbox <Command-KeyPress> {# nothing}
}

# On Windows, paste is done using Shift-Insert.  Shift-Insert already
# generates the <<Paste>> event, so we don't need to do anything here.
if {[tk windowingsystem] ne "win32"} {
    bind Spinbox <Insert> {

Changes to library/text.tcl.

271
272
273
274
275
276
277
278
279
280
281
282
283
284
285

bind Text <Alt-KeyPress> {# nothing }
bind Text <Meta-KeyPress> {# nothing}
bind Text <Control-KeyPress> {# nothing}
bind Text <Escape> {# nothing}
bind Text <KP_Enter> {# nothing}

if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
    bind Text <Command-KeyPress> {# nothing}
}

# Additional emacs-like bindings:

bind Text <Control-a> {
    if {!$tk_strictMotif} {







|







271
272
273
274
275
276
277
278
279
280
281
282
283
284
285

bind Text <Alt-KeyPress> {# nothing }
bind Text <Meta-KeyPress> {# nothing}
bind Text <Control-KeyPress> {# nothing}
bind Text <Escape> {# nothing}
bind Text <KP_Enter> {# nothing}

if {[tk windowingsystem] eq "aqua"} {
    bind Text <Command-KeyPress> {# nothing}
}

# Additional emacs-like bindings:

bind Text <Control-a> {
    if {!$tk_strictMotif} {
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
    if {!$tk_strictMotif} {
	%W delete [tk::TextPrevPos %W insert tcl_startOfPreviousWord] insert
    }
}

# Macintosh only bindings:

if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
bind Text <FocusIn> {
    %W configure -selectbackground systemHighlight -selectforeground systemHighlightText
}
bind Text <FocusOut> {
    %W configure -selectbackground systemHighlightSecondary -selectforeground systemHighlightText
}
bind Text <Option-Left> {







|







387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
    if {!$tk_strictMotif} {
	%W delete [tk::TextPrevPos %W insert tcl_startOfPreviousWord] insert
    }
}

# Macintosh only bindings:

if {[tk windowingsystem] eq "aqua"} {
bind Text <FocusIn> {
    %W configure -selectbackground systemHighlight -selectforeground systemHighlightText
}
bind Text <FocusOut> {
    %W configure -selectbackground systemHighlightSecondary -selectforeground systemHighlightText
}
bind Text <Option-Left> {
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
}
set ::tk::Priv(prevPos) {}

# The MouseWheel will typically only fire on Windows and MacOS X.
# However, someone could use the "event generate" command to produce
# one on other platforms.

if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
    bind Text <MouseWheel> {
        %W yview scroll [expr {- (%D)}] units
    }
    bind Text <Option-MouseWheel> {
        %W yview scroll [expr {-10 * (%D)}] units
    }
    bind Text <Shift-MouseWheel> {







|







448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
}
set ::tk::Priv(prevPos) {}

# The MouseWheel will typically only fire on Windows and MacOS X.
# However, someone could use the "event generate" command to produce
# one on other platforms.

if {[tk windowingsystem] eq "aqua"} {
    bind Text <MouseWheel> {
        %W yview scroll [expr {- (%D)}] units
    }
    bind Text <Option-MouseWheel> {
        %W yview scroll [expr {-10 * (%D)}] units
    }
    bind Text <Shift-MouseWheel> {

Changes to library/tk.tcl.

113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
	    set x [expr {[winfo vrootx $w]+[winfo vrootwidth $w]-[winfo reqwidth $w]}]
	}
	if {$y < [winfo vrooty $w]} {
	    set y [winfo vrooty $w]
	} elseif {$y > ([winfo vrooty $w]+[winfo vrootheight $w]-[winfo reqheight $w])} {
	    set y [expr {[winfo vrooty $w]+[winfo vrootheight $w]-[winfo reqheight $w]}]
	}
	if {$windowingsystem eq "classic" || $windowingsystem eq "aqua"} {
	    # Avoid the native menu bar which sits on top of everything.
	    if {$y < 22} { set y 22 }
	}
    }
    wm maxsize $w [winfo vrootwidth $w] [winfo vrootheight $w]
    wm geometry $w +$x+$y
    wm deiconify $w







|







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
	    set x [expr {[winfo vrootx $w]+[winfo vrootwidth $w]-[winfo reqwidth $w]}]
	}
	if {$y < [winfo vrooty $w]} {
	    set y [winfo vrooty $w]
	} elseif {$y > ([winfo vrooty $w]+[winfo vrootheight $w]-[winfo reqheight $w])} {
	    set y [expr {[winfo vrooty $w]+[winfo vrootheight $w]-[winfo reqheight $w]}]
	}
	if {$windowingsystem eq "aqua"} {
	    # Avoid the native menu bar which sits on top of everything.
	    if {$y < 22} { set y 22 }
	}
    }
    wm maxsize $w [winfo vrootwidth $w] [winfo vrootheight $w]
    wm geometry $w +$x+$y
    wm deiconify $w
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
	event add <<Copy>> <Command-Key-c> <Key-F3>
	event add <<Paste>> <Command-Key-v> <Key-F4>
	event add <<PasteSelection>> <ButtonRelease-2>
	event add <<Clear>> <Clear>
  	event add <<Undo>> <Command-Key-z>
	event add <<Redo>> <Command-Key-y>
    }
    "classic" {
	event add <<Cut>> <Control-Key-x> <Key-F2> 
	event add <<Copy>> <Control-Key-c> <Key-F3>
	event add <<Paste>> <Control-Key-v> <Key-F4>
	event add <<PasteSelection>> <ButtonRelease-2>
	event add <<Clear>> <Clear>
	event add <<Undo>> <Control-Key-z> <Key-F1>
	event add <<Redo>> <Control-Key-Z>
    }
}
# ----------------------------------------------------------------------
# Read in files that define all of the class bindings.
# ----------------------------------------------------------------------

if {$::tk_library ne ""} {
    if {[tk windowingsystem] eq "classic"} {
	proc ::tk::SourceLibFile {file} {
	    if {[catch {
		namespace eval :: \
			[list source [file join $::tk_library $file.tcl]]
	    }]} {
		namespace eval :: [list source -rsrc $file]
	    }
	}
    } else {
	proc ::tk::SourceLibFile {file} {
	    namespace eval :: [list source [file join $::tk_library $file.tcl]]
	}	
    }
    namespace eval ::tk {
	SourceLibFile button
	SourceLibFile entry
	SourceLibFile listbox
	SourceLibFile menu
	SourceLibFile panedwindow
	SourceLibFile scale







<
<
<
<
<
<
<
<
<






<
<
<
<
<
<
<
<
<
<



<







386
387
388
389
390
391
392









393
394
395
396
397
398










399
400
401

402
403
404
405
406
407
408
	event add <<Copy>> <Command-Key-c> <Key-F3>
	event add <<Paste>> <Command-Key-v> <Key-F4>
	event add <<PasteSelection>> <ButtonRelease-2>
	event add <<Clear>> <Clear>
  	event add <<Undo>> <Command-Key-z>
	event add <<Redo>> <Command-Key-y>
    }









}
# ----------------------------------------------------------------------
# Read in files that define all of the class bindings.
# ----------------------------------------------------------------------

if {$::tk_library ne ""} {










	proc ::tk::SourceLibFile {file} {
	    namespace eval :: [list source [file join $::tk_library $file.tcl]]
	}	

    namespace eval ::tk {
	SourceLibFile button
	SourceLibFile entry
	SourceLibFile listbox
	SourceLibFile menu
	SourceLibFile panedwindow
	SourceLibFile scale

Changes to tests/clrpick.test.

168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
    tk_chooseColor -title "Press Ok $verylongstring" -initialcolor $color \
	    -parent $parent
} "$color"

set color #808040
test clrpick-2.2 {tk_chooseColor command} \
	{nonUnixUserInteraction colorsLeftover} {
    if {$tcl_platform(platform) == "macintosh"} {
	set colors "32768 32768 16384"
    } else {
	set colors "128 128 64"
    }
    ToChooseColorByKey $parent 128 128 64
    tk_chooseColor -parent $parent -title "choose $colors"
} "$color"

test clrpick-2.3 {tk_chooseColor command} \
	{nonUnixUserInteraction colorsLeftover} {
    ToPressButton $parent ok







<
<
<
|
<







168
169
170
171
172
173
174



175

176
177
178
179
180
181
182
    tk_chooseColor -title "Press Ok $verylongstring" -initialcolor $color \
	    -parent $parent
} "$color"

set color #808040
test clrpick-2.2 {tk_chooseColor command} \
	{nonUnixUserInteraction colorsLeftover} {



    set colors "128 128 64"

    ToChooseColorByKey $parent 128 128 64
    tk_chooseColor -parent $parent -title "choose $colors"
} "$color"

test clrpick-2.3 {tk_chooseColor command} \
	{nonUnixUserInteraction colorsLeftover} {
    ToPressButton $parent ok

Changes to tests/font.test.

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
}

setup

case $tcl_platform(platform) {
    unix	{set fixed "fixed"}
    windows	{set fixed "courier 12"}
    macintosh	{set fixed "monaco 9"}
}
set times [font actual {times 0} -family]

test font-1.1 {TkFontPkgInit} {
    catch {interp delete foo}
    interp create foo
    foo eval {







<







48
49
50
51
52
53
54

55
56
57
58
59
60
61
}

setup

case $tcl_platform(platform) {
    unix	{set fixed "fixed"}
    windows	{set fixed "courier 12"}

}
set times [font actual {times 0} -family]

test font-1.1 {TkFontPkgInit} {
    catch {interp delete foo}
    interp create foo
    foo eval {

Deleted tests/macMenu.test.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
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
928
929
930
931
932
933
934
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
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
# This file is a Tcl script to test menus in Tk.  It is
# organized in the standard fashion for Tcl tests. This
# file tests the Macintosh-specific features of the menu
# system.
#
# Copyright (c) 1995-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.

package require tcltest 2.1
namespace import -force tcltest::configure
namespace import -force tcltest::testsDirectory
configure -testdir [file join [pwd] [file dirname [info script]]]
configure -loadfile [file join [testsDirectory] constraints.tcl]
tcltest::loadTestedCommands

test macMenu-1.0 {TkMacUseMenuID} {macOnly} {
    # Can't really test TkMacUseMenuID; it's only called on startup.
} {}

test macMenu-2.1 {GetNewID} {macOnly} {
    catch {destroy .m1}
    list [catch {menu .m1} msg] $msg [destroy .m1]
} {0 .m1 {}}
test macMenu-2.2 {GetNewID - cascade menu} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m2
    list [catch {menu .m2} msg] $msg [destroy .m1] [destroy .m2]
} {0 .m2 {} {}}
test macMenu-2.3 {GetNewID - running out of ids} {macOnly} {
    deleteWindows
    menu .menu
    for {set i 0} {$i < 230} {incr i} {
    	menu .m$i
    	.menu add cascade -label ".m$i" -menu .m$i
    }
    menu .breaker
    list [catch {.menu add cascade -menu .breaker} msg] $msg [deleteWindows]
} {1 {No more menus can be allocated.} {}}

test macMenu-3.1 {FreeID} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {destroy .m1} msg] $msg
} {0 {}}

# No way to test running out of ids in TkpNewPlatformMenu
test macMenu-4.1 {TkpNewMenu} {macOnly} {
    catch {destroy .m1}
    list [catch {menu .m1} msg] $msg [catch {destroy .m1} msg2] $msg2
} {0 .m1 0 {}}
test macMenu-4.2 {TkpNewMenu - checking for help menu when one is there} {macOnly} {
    catch {destroy .m1}
    catch {destroy .m2}
    menu .m1
    menu .m1.help -tearoff 0
    .m1.help add command -label Test
    . configure -menu .m1
    raise .
    update
    list [catch {menu .m2} msg] $msg [destroy .m1] [destroy .m2] [. configure -menu ""]
} {0 .m2 {} {} {}}
test macMenu-4.3 {TkpNewMenu - menubar set but different interp} {macOnly} {
    catch {interp delete testinterp}
    catch {destroy .m1}
    interp create testinterp
    load {} Tk testinterp
    interp eval testinterp {raise .}
    interp eval testinterp {menu .m1}
    interp eval testinterp {. configure -menu .m1}
    interp eval testinterp {update}
    list [catch {menu .m1} msg] $msg [destroy .m1] [interp delete testinterp]
} {0 .m1 {} {}}
test macMenu-4.4 {TkpNewMenu - menubar set but new menu has different parent} {macOnly} {
    catch {destroy .m1}
    catch {destroy .m2}
    menu .m1 -tearoff 0
    .m1 add cascade -menu .m1.help
    menu .m2
    .m2 add cascade -menu .m2.help
    . configure -menu .m1
    raise .
    update
    list [catch {menu .m2.help} msg] $msg [. configure -menu ""] [destroy .m1] [destroy .m2]
} {0 .m2.help {} {} {}}
test macMenu-4.5 {TkpNewMenu - menubar set, same parent, not .help} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    .m1 add cascade -menu .m1.help
    . configure -menu .m1
    raise .
    update
    list [catch {menu .m1.foo} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 .m1.foo {} {}}
test macMenu-4.6 {TkpNewMenu - creating the help menu} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    .m1 add cascade -menu .m1.help
    . configure -menu .m1
    raise .
    update
    list [catch {menu .m1.help} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 .m1.help {} {}}

test macMenu-5.1 {TkpDestroyMenu} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {destroy .m1} msg] $msg
} {0 {}}
test macMenu-5.2 {TkpDestroyMenu - help menu} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    .m1 add cascade -menu .m1.help
    . configure -menu .m1
    menu .m1.help
    raise .
    update
    list [catch {destroy .m1.help} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-5.3 {TkpDestroyMenu - idle handler pending} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label test
    list [catch {destroy .m1} msg] $msg
} {0 {}}
test macMenu-5.4 {TkpDestroyMenu - idle handler not pending} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label test
    update idletasks
    list [catch {destroy .m1} msg] $msg
} {0 {}}

test macMenu-6.1 {SetMenuCascade} {macOnly} {
    catch {destroy .m1}
    catch {destroy .m2}
    menu .m1
    menu .m2
    list [catch {.m2 add cascade -menu .m1} msg] $msg [destroy .m1 .m2]
} {0 {} {}}
test macMenu-6.2 {SetMenuCascade - running out of ids} {macOnly} {
    deleteWindows
    menu .menu
    for {set i 0} {$i < 230} {incr i} {
    	menu .m$i
    	.menu add cascade -label ".m$i" -menu .m$i
    }
    menu .breaker
    list [catch {.menu add cascade -menu .breaker} msg] $msg [deleteWindows]
} {1 {No more menus can be allocated.} {}}

test macMenu-7.1 {TkpDestroyMenuEntry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label "test"
    list [catch {.m1 delete 1} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-7.2 {TkpDestroyMenuEntry - help menu} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m1.help
    menu .m1.help -tearoff 0
    .m1.help add command -label "test"
    . configure -menu .m1
    raise .
    update
    list [catch {.m1.help delete test} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}

test macMenu-8.1 {GetEntryText} {macOnly} {
    catch {destroy .m1}
    list [catch {menu .m1} msg] $msg [destroy .m1]
} {0 .m1 {}}
test macMenu-8.2 {GetEntryText} {macOnly testImageType} {
    catch {destroy .m1}
    catch {image delete image1}
    menu .m1
    image create test image1
    list [catch {.m1 add command -image image1} msg] $msg [destroy .m1] [image delete image1]
} {0 {} {} {}}
test macMenu-8.3 {GetEntryText} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -bitmap questhead} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-8.4 {GetEntryText} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-8.5 {GetEntryText} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label "foo"
    list [catch {.m1 add command -label "foo"} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-8.6 {GetEntryText} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -label "This is a very long string. 9012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890"} \
    	    msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-8.7 {GetEntryText - elipses character} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -label "foo..."} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-8.8 {GetEntryText - false elipses character} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -label "foo."} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-8.9 {GetEntryText - false elipses character} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -label "foo.."} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-8.10 {GetEntryText - false elipses character} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -label "foo.b"} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-8.11 {GetEntryText - false elipses character} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -label "foo..b"} msg] $msg [destroy .m1]
} {0 {} {}}


# test macMenu-9.1 - assumes some fonts
test macMenu-9.1 {FindMarkCharacter} {macOnly} {
    catch {destroy .m1}
    menu .m1 -font "Helvetica 12" -tearoff 0
    .m1 add checkbutton -label test
    .m1 invoke test
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
# All standard fonts have "�" defined. We can't test further.

test macMenu-10.1 {SetMenuIndicator - cascade entry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add cascade -label foo} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-10.2 {SetMenuIndicator - not radio or checkbutton} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -label foo} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-10.3 {SetMenuIndicator - indiatorOn false} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add checkbutton -label foo -indicatoron 0} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-10.4 {SetMenuIndicator - entry not selected} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add checkbutton -label foo} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-10.5 {SetMenuIndicator - checkbutton} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add checkbutton -label foo
    list [catch {.m1 invoke foo} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-10.6 {SetMenuIndicator - radio button} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add radiobutton -label foo
    list [catch {.m1 invoke foo} msg] $msg [destroy .m1]
} {0 {} {}}

test macMenu-11.1 {SetMenuTitle} {macOnly} {
    catch {destroy .m1}
    catch {destroy .container}
    menu .container
    menu .m1
#previous title is .m1
    .container add cascade -label "File" -menu .m1
    list [catch {. configure -menu .container} msg] $msg [. configure -menu ""] [destroy .container .m1]
} {0 {} {} {}}
test macMenu-11.2 {SetMenuTitle} {macOnly} {
    menu .container
    menu .m1
    . configure -menu ""
#previous title is .m1
    .container add cascade -label "F" -menu .m1
    list [catch {. configure -menu .container} msg] $msg [. configure -menu ""] [destroy .container .m1]
} {0 {} {} {}}

test macMenu-12.1 {TkpConfigureMenuEntry} {macOnly} {
    catch {destroy .m1}
    . configure -menu ""
    menu .m1
    .m1 add cascade -menu .m3
    list [catch {.m1 entryconfigure 1 -menu .m2} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-12.2 {TkpConfigureMenuEntry} {macOnly} {
    catch {destroy .m1}
    catch {destroy .m2}
    . configure -menu ""
    menu .m1
    .m1 add cascade -menu .m3
    menu .m2
    list [catch {.m1 entryconfigure 1 -menu .m2} msg] $msg [destroy .m1 .m2]
} {0 {} {}}
test macMenu-12.3 {TkpConfigureMenuEntry - running out of ids} {macOnly} {
    deleteWindows
    menu .menu
    for {set i 0} {$i < 230} {incr i} {
    	menu .m$i
    	.menu add cascade -label ".m$i" -menu .m$i
    }
    menu .breaker
    list [catch {.menu add cascade -menu .breaker} msg] $msg [deleteWindows]
} {1 {No more menus can be allocated.} {}}
test macMenu-12.4 {TkpConfigureMenuEntry - Control} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -accel "Control+S"} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-12.5 {TkpConfigureMenuEntry - Ctrl} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -accel "Ctrl+S"} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-12.6 {TkpConfigureMenuEntry - Shift} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -accel "Shift+S"} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-12.7 {TkpConfigureMenuEntry - Option} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -accel "Opt+S"} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-12.8 {TkpConfigureMenuEntry - Command} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -accel "Command+S"} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-12.9 {TkpConfigureMenuEntry - Cmd} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -accel "Cmd+S"} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-12.10 {TkpConfigureMenuEntry - Alt} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -accel "Alt+S"} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-12.11 {TkpConfigureMenuEntry - Meta} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -accel "Meta+S"} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-12.12 {TkpConfigureMenuEntry - Two modifiers} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -accel "Cmd+Shift+S"} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-12.13 {TkpConfigureMenuEntry - dash instead of plus} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -accel "Command-S"} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-12.14 {TkpConfigureMenuEntry - idler pending} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    .m1 add command -label test
    list [catch {.m1 entryconfigure test -label test2} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-12.15 {TkpConfigureMenuEntry - idler not pending} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    .m1 add command -label test
    update idletasks
    list [catch {.m1 entryconfigure test -label test2} msg] $msg [destroy .m1]
} {0 {} {}}

test macMenu-13.1 {ReconfigureIndividualMenu - getting rid of zero items} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    .m1 add command -label test
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.2 {ReconfigureIndividualMenu - getting rid of one item} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    .m1 add command -label test
    update idletasks
    .m1 delete test
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.3 {ReconfigureIndividualMenu - getting rid of more than one} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    .m1 add command -label test
    .m1 add command -label test2
    update idletasks
    .m1 entryconfigure test2 -label "test two"
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.4 {ReconfigureIndividualMenu - separator} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add separator
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.5 {ReconfigureIndividualMenu - disabled} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command
    .m1 entryconfigure 1 -state disabled
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.6 {ReconfigureIndividualMenu - active} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command
    .m1 entryconfigure 1 -state active
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.7 {ReconfigureIndividualMenu - checkbutton not checked} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add checkbutton -label test
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.8 {ReconfigureIndividualMenu - checkbutton - indicator off} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add checkbutton -label test -indicatoron 0
    .m1 invoke test
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.9 {ReconfigureIndividualMenu - checkbutton on} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add checkbutton -label test
    .m1 invoke test
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.10 {ReconfigureIndividualMenu - radiobutton not checked} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add radiobutton -label test
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.11 {ReconfigureIndividualMenu - radiobutton - indicator off} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add radiobutton -label test -indicatoron 0
    .m1 invoke test
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.12 {ReconfigureIndividualMenu - radiobutton on} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add radiobutton -label test
    .m1 invoke test
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.13 {ReconfigureIndividualMenu} {macOnly} {
    catch {destroy .m1}
    . configure -menu ""
    menu .m1
    .m1 add cascade -menu .m3
    .m1 entryconfigure 1 -menu .m2
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.14 {ReconfigureIndividualMenu} {macOnly} {
    catch {destroy .m1}
    catch {destroy .m2}
    . configure -menu ""
    menu .m1
    .m1 add cascade -menu .m3
    menu .m2
    .m1 entryconfigure 1 -menu .m2
    list [catch {update idletasks} msg] $msg [destroy .m1 .m2]
} {0 {} {}}
test macMenu-13.15 {ReconfigureIndividualMenu - accelerator} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -accel "Command-S"
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.16 {ReconfigureIndividualMenu - parent is disabled} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -label .m1.edit -label "Edit" -state disabled
    menu .m1.edit
    .m1.edit add command -label foo
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-13.17 {ReconfigureIndividualMenu - disabling parent} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -label .m1.edit -label Edit
    menu .m1.edit
    .m1.edit add command -label foo
    .m1 entryconfigure Edit -state disabled
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}

test macMenu-14.1 {ReconfigureMacintoshMenu - normal menu} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    .m1 add command -label test
    list [catch {update idletasks} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-14.2 {ReconfigureMacintoshMenu - apple menu} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m1.apple
    menu .m1.apple -tearoff 0
    .m1.apple add command -label test
    . configure -menu .m1
    raise .
    list [catch {update idletasks} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-14.3 {ReconfigureMacintoshMenu - help menu} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m1.help
    menu .m1.help -tearoff 0
    .m1.help add command -label test
    . configure -menu .m1
    raise .
    list [catch {update idletasks} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-14.4 {ReconfigureMacintoshMenu - menubar} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m1.file -label "foo"
    menu .m1.file
    . configure -menu .m1
    raise .
    .m1 entryconfigure foo -label "File"
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}

test macMenu-15.1 {CompleteIdlers - no idle pending} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label test
    update idletasks
    list [catch {.m1 post 40 40} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-15.2 {CompleteIdlers - idle pending} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label test
    list [catch {.m1 post 40 40} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-15.3 {CompleteIdlers - recursive} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m1.m2 -label test
    menu .m1.m2
    .m1.m2 add command -label test
    list [catch {.m1 post 40 40} msg] $msg [destroy .m1]
} {0 {} {}}

#Don't know how to generate nested post menus
test macMenu-16.1 {TkpPostMenu} {macOnly} {
    catch {destroy .m1}
    menu .m1 -postcommand "destroy .m1"
    list [catch {.m1 post 40 40} msg] $msg
} {0 {}}
test macMenu-16.2 {TkpPostMenu} {macOnly} {
    catch {destroy .m1}
    menu .m1 -postcommand "blork"
    list [catch {.m1 post 40 40} msg] $msg [destroy .m1]
} {1 {invalid command name "blork"} {}}
# We need to write the interactive test for menu posting.

test macMenu-17.1 {TkpMenuNewEntry - no idle pending} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [catch {.m1 add command -label test} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-17.2 {TkpMenuNewEntry - idle pending} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label test
    list [catch {.m1 add command -label test2} msg] $msg [destroy .m1]
} {0 {} {}}

test macMenu-18.1 {DrawMenuBarWhenIdle} {macOnly} {
    catch {destroy .m1}
    . configure -menu ""
    menu .m1
    . configure -menu .m1
    list [catch {update idletasks} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-18.2 {DrawMenuBarWhenIdle - clearing old apple menu out} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m1.apple
    menu .m1.apple
    .m1.apple add command -label test
    . configure -menu .m1
    raise .
    update
    . configure -menu ""
    raise .
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-18.3 {DrawMenuBarWhenIdle - clearing out old help menu} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m1.help
    menu .m1.help
    .m1.help add command -label test
    . configure -menu .m1
    raise .
    update
    . configure -menu ""
    raise .
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-18.4 {DrawMenuBarWhenIdle - menu not there} {macOnly} {
    catch {destroy .m1}
    . configure -menu .m1
    raise .
    list [catch {update} msg] $msg [. configure -menu ""]
} {0 {} {}}
test macMenu-18.5 {DrawMenuBarWhenIdle - menu there} {macOnly} {
    catch {destroy .m1}
    menu .m1
    . configure -menu .m1
    raise .
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-18.6 {DrawMenuBarWhenIdle - no apple menu} {macOnly} {
    catch {destroy .m1}
    menu .m1
    . configure -menu .m1
    raise .
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-18.7 {DrawMenuBarWhenIdle - apple menu references but not there} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m1.apple
    . configure -menu .m1
    raise .
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-18.8 {DrawMenuBarWhenIdle - apple menu there} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m1.apple
    menu .m1.apple
    .m1.apple add command -label test
    . configure -menu .m1
    raise .
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-18.9 {DrawMenuBarWhenIdle - apple menu there; no idle handler} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m1.apple
    menu .m1.apple
    .m1.apple add command -label test
    . configure -menu .m1
    raise .
    update idletasks
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-18.10 {DrawMenuBarWhenIdle - no help menu} {macOnly} {
    catch {destroy .m1}
    menu .m1
    . configure -menu .m1
    raise .
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-18.11 {DrawMenuBarWhenIdle - help menu referenced but not there} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m1.help
    . configure -menu .m1
    raise .
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-18.12 {DrawMenuBarWhenIdle - help menu there} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m1.help
    menu .m1.help
    .m1.help add command -label test
    . configure -menu .m1
    raise .
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-18.13 {DrawMenuBarWhenIdle - help menu there - no idlers} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m1.help
    menu .m1.help
    .m1.help add command -label test
    . configure -menu .m1
    raise .
    update idletasks
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
# Can't generate no menubar clone
test macMenu-18.14 {DrawMenuBarWhenIdle - apple and help menus in tearoff menubar} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -menu .m1.apple
    .m1 add cascade -menu .m1.help
    menu .m1.apple
    menu .m1.help
    . configure -menu .m1
    raise .
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-18.15 {DrawMenuBarWhenIdle - apple and help menus in non-tearoff menubar} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    .m1 add cascade -menu .m1.apple
    .m1 add cascade -menu .m1.help
    menu .m1.apple
    menu .m1.help
    . configure -menu .m1
    raise .
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-18.16 {DrawMenuBarWhenIdle - no apple menu} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    . configure -menu .m1
    raise .
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-18.17 {DrawMenuBarWhenIdle - apple menu} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    . configure -menu .m1
    .m1 add cascade -menu .m1.apple
    menu .m1.apple
    .m1.apple add cascade -label test -menu .m1.apple.test
    menu .m1.apple.test
    raise .
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-18.18 {DrawMenuBarWhenIdle - big for loop} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    menu .m1.apple -tearoff 0
    menu .m1.help -tearoff 0
    menu .m1.foo -tearoff 0
    .m1 add cascade -menu .m1.apple
    .m1 add cascade -menu .m1.help
    .m1 add cascade -label Foo -menu .m1.foo
    . configure -menu .m1
    raise .
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-18.19 {DrawMenuBarWhenIdle = disabled menu} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    menu .m1.edit -tearoff 0
    .m1 add cascade -menu .m1.edit -label Edit
    . configure -menu .m1
    raise .
    .m1 entryconfigure Edit -state disabled
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}

test macMenu-19.1 {RecursivelyInsertMenu} {macOnly} {
    catch {destroy .m1}
    catch {destroy .m2}
    catch {destroy .main}
    catch {destroy .t2}
    toplevel .t2 -menu .main
    wm geometry .t2 +0+0
    menu .main
    .main add cascade -menu .m1 -label ".m1"
    menu .m1
    .m1 add command -label "Test 2"
    .m1 add cascade -label ".m2" -menu .m2
    menu .m2
    .m2 add command -label "Test 3"
    list [catch {raise .t2} msg] $msg [destroy .t2 .main .m1 .m2]
} {0 {} {}}
test macMenu-19.2 {RecursivelyInsertMenu} {macOnly} {
    catch {destroy .m1}
    catch {destroy .m2}
    catch {destroy .main}
    catch {destroy .t2}
    toplevel .t2 -menu .main
    wm geometry .t2 +0+0
    menu .main
    .main add cascade -menu .m1 -label ".m1"
    menu .m1
    .m1 add command -label "Test 2"
    .m1 add cascade -label ".m2" -menu .m2
    menu .m2
    .m2 add command -label "Test 3"
    list [catch {raise .t2} msg] $msg [destroy .t2 .main .m1 .m2]
} {0 {} {}}

test macMenu-20.1 {SetDefaultMenuBar} {macOnly} {
    . configure -menu ""
    raise .
    list [catch {update} msg] $msg
} {0 {}}

test macMenu-21.1 {TkpSetMainMenubar - not front window} {macOnly} {
    catch {destroy .m1}
    catch {destroy .t2}
    toplevel .t2
    wm geometry .t2 +50+50
    menu .m1
    raise .
    update
    list [catch {.t2 configure -menu .m1} msg] $msg [destroy .t2] [destroy .m1]
} {0 {} {} {}}
test macMenu-21.2 {TkpSetMainMenubar - menu null} {macOnly} {
    . configure -menu ""
    raise .
    list [catch {update} msg] $msg
} {0 {}}
test macMenu-21.3 {TkpSetMainMenubar - different interps} {macOnly} {
    catch {destroy .m1}
    catch {interp delete testinterp}
    interp create testinterp
    load {} Tk testinterp
    menu .m1
    . configure -menu .m1
    raise .
    update
    interp eval testinterp {menu .m1}
    interp eval testinterp {. configure -menu .m1}
    interp eval testinterp {raise .}
    list [catch {interp eval testinterp {update}} msg] $msg [interp delete testinterp] [. configure -menu ""] [destroy .m1]
} {0 {} {} {} {}}
test macMenu-21.4 {TkpSetMainMenubar - different windows} {macOnly} {
    catch {destroy .m1}
    catch {destroy .t2}
    menu .m1
    . configure -menu .m1
    toplevel .t2
    wm geometry .t2 +50+50
    .t2 configure -menu .m1
    raise .
    update
    raise .t2
    list [catch {update} msg] $msg [destroy .t2] [. configure -menu ""] [destroy .m1]
} {0 {} {} {} {}}
test macMenu-21.5 {TkpSetMainMenubar - old menu was null} {macOnly} {
    catch {destroy .m1}
    . configure -menu ""
    update
    menu .m1
    . configure -menu .m1
    raise .
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}
test macMenu-21.6 {TkpSetMainMenubar - old menu different} {macOnly} {
    catch {destroy .m1}
    catch {destroy .m2}
    menu .m1
    menu .m2
    . configure -menu .m1
    raise .
    update
    . configure -menu .m2
    raise .
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] [destroy .m2]
} {0 {} {} {} {}}
test macMenu-21.7 {TkpSetMainMenubar - child window NULL - parent window now} {macOnly} {
    catch {destroy .m1}
    catch {destroy .t2}
    toplevel .t2 
    menu .m1
    .m1 add cascade -label Foo -menu .m1.foo
    menu .m1.foo
    .m1.foo add command -label foo
    . configure -menu .m1
    raise .t2
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] [destroy .t2]
} {0 {} {} {} {}}
test macMenu-21.8 {TkpSetMainMenubar - tearoff window} {macOnly} {
    catch {destroy .t2}
    toplevel .t2 -menu .t2.m1
    menu .t2.m1
    .t2.m1 add cascade -label File -menu .t2.m1.foo
    menu .t2.m1.foo
    .t2.m1.foo add command -label foo
    raise .t2
    tk::TearOffMenu .t2.m1.foo 100 100
    list [catch {update} msg] $msg [destroy .t2]
} {0 {} {}}

test macMenu-22.1 {TkSetWindowMenuBar} {macOnly} {
} {}

test macMenu-23.1 {TkMacDispatchMenuEvent} {macOnly} {
    # needs to be interactive.
} {}

test macMenu-24.1 {GetMenuIndicatorGeometry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add checkbutton -label foo
    .m1 invoke foo
    list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}

test macMenu-25.1 {GetMenuAccelGeometry - cascade entry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -label foo
    list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
test macMenu-25.2 {GetMenuAccelGeometry - no accel} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command
    list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
test macMenu-25.3 {GetMenuAccelGeometry - no special chars - arbitrary string} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -accel "Test"
    list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
test macMenu-25.4 {GetMenuAccelGeometry - Command} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -accel "Cmd+S"
    list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
test macMenu-25.5 {GetMenuAccelGeometry - Control} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -accel "Ctrl+S"
    list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
test macMenu-25.6 {GetMenuAccelGeometry - Shift} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -accel "Shift+S"
    list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
test macMenu-25.7 {GetMenuAccelGeometry - Option} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -accel "Opt+S"
    list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
test macMenu-25.8 {GetMenuAccelGeometry - Combination} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -accel "Cmd+Shift+S"
    list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
test macMenu-25.9 {GetMenuAccelGeometry - extra text} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -accel "Command+Delete"
    list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}
    
test macMenu-26.1 {GetTearoffEntryGeometry} {macOnly} {
    # can't call this on power mac.
} {}

test macMenu-27.1 {GetMenuSeparatorGeometry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add separator
    list [catch {tk::TearOffMenu .m1 40 40}] [destroy .m1]
} {0 {}}

test macMenu-28.1 {DrawMenuEntryIndicator - non-checkbutton} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-28.2 {DrawMenuEntryIndicator - indicator off} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add checkbutton -label foo -indicatoron 0
    .m1 invoke foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-28.3 {DrawMenuEntryIndicator - not selected} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add checkbutton -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-28.4 {DrawMenuEntryIndicator - checkbutton} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add checkbutton -label foo
    .m1 invoke foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-28.5 {DrawMenuEntryIndicator - radiobutton} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add radiobutton -label foo
    .m1 invoke foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}

# Cannot reproduce resources missing or color allocation failing easily.
test macMenu-29.1 {DrawSICN} {macOnly} {
   catch {destroy .m1}
   menu .m1
   .m1 add command -label foo -accel "Cmd+S"
   set tearoff [tk::TearOffMenu .m1 40 40]
   list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}

# Cannot reproduce resources missing
test macMenu-30.1 {DrawMenuEntryAccelerator - cascade entry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-30.2 {DrawMenuEntryAccelerator - no accel string} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-30.3 {DrawMenuEntryAccelerator - random accel string} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -accel foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-30.4 {DrawMenuEntryAccelerator - Command} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -accel "Cmd+S"
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-30.5 {DrawMenuEntryAccelerator - Option} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -accel "Opt+S"
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-30.6 {DrawMenuEntryAccelerator - Shift} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -accel "Shift+S"
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-30.7 {DrawMenuEntryAccelerator - Control} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -accel "Ctrl+S"
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}
test macMenu-30.8 {DrawMenuEntryAccelerator - combination} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -accel "Cmd+Shift+S"
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}

test macMenu-31.1 {DrawMenuSeparator} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add separator
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}

test macMenu-32.1 {TkpDrawMenuEntryLabel} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [catch {update} msg] $msg [destroy .m1]
} {0 {} {}}

test macMenu-33.1 {MenuDefProc - No way to test automatically.} {} {}
test macMenu-34.1 {TkMacHandleTearoffMenu - no way to test automatically} {} {}
test macMenu-35.1 {TkpInitializeMenuBindings - nothing to do} {} {}

test macMenu-36.1 {TkpComputeMenubarGeometry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -label foo
    . configure -menu .m1
    list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
} {0 {} {} {}}

test macMenu-37.1 {DrawTearoffEntry - can't do automatically} {} {}
test macMenu-38.1 {TkMacSetHelpMenuItemCount - called at boot time} {} {}
test macMenu-39.1 {TkMacMenuClick - can't do automatically} {} {}

test macMenu-40.1 {TkpDrawMenuEntry - gc for active and not strict motif} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    .m1 entryconfigure 1 -state active
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.2 {TkpDrawMenuEntry - gc for active menu item with its own gc} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -activeforeground red
    set tearoff [tk::TearOffMenu .m1 40 40]
    .m1 entryconfigure 1 -state active
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.3 {TkpDrawMenuEntry - gc for active and strict motif} {macOnly} {
    catch {destroy .m1}
    menu .m1
    set tk_strictMotif 1
    .m1 add command -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    .m1 entryconfigure 1 -state active
    list [update] [destroy .m1] [set tk_strictMotif 0]
} {{} {} 0}
test macMenu-40.4 {TkpDrawMenuEntry - gc for disabled with disabledfg and custom entry} {macOnly} {
    catch {destroy .m1}
    menu .m1 -disabledforeground blue
    .m1 add command -label foo -state disabled -background red
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.5 {TkpDrawMenuEntry - gc for disabled with disabledFg} {macOnly} {
    catch {destroy .m1}
    menu .m1 -disabledforeground blue
    .m1 add command -label foo -state disabled
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.6 {TkpDrawMenuEntry - gc for disabled - no disabledFg} {macOnly} {
    catch {destroy .m1}
    menu .m1 -disabledforeground ""
    .m1 add command -label foo -state disabled
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.7 {TkpDrawMenuEntry - gc for normal - custom entry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -foreground red
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.8 {TkpDrawMenuEntry - gc for normal} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.9 {TkpDrawMenuEntry - gc for indicator - custom entry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add checkbutton -label foo -selectcolor orange
    .m1 invoke 1
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.10 {TkpDrawMenuEntry - gc for indicator} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add checkbutton -label foo
    .m1 invoke 1
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.11 {TkpDrawMenuEntry - border - custom entry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -activebackground green
    set tearoff [tk::TearOffMenu .m1 40 40]
    .m1 entryconfigure 1 -state active
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.12 {TkpDrawMenuEntry - border} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    .m1 entryconfigure 1 -state active
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.13 {TkpDrawMenuEntry - active border - strict motif} {macOnly} {
    catch {destroy .m1}
    set tk_strictMotif 1
    menu .m1
    .m1 add command -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    .m1 entryconfigure 1 -state active
    list [update] [destroy .m1] [set tk_strictMotif 0]
} {{} {} 0}
test macMenu-40.14 {TkpDrawMenuEntry - active border - custom entry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -activeforeground yellow
    set tearoff [tk::TearOffMenu .m1 40 40]
    .m1 entryconfigure 1 -state active
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.15 {TkpDrawMenuEntry - active border} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    .m1 entryconfigure 1 -state active
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.16 {TkpDrawMenuEntry - font - custom entry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo -font "Helvectica 72"
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.17 {TkpDrawMenuEntry - font} {macOnly} {
    catch {destroy .m1}
    menu .m1 -font "Courier 72"
    .m1 add command -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.18 {TkpDrawMenuEntry - separator} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add separator
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.19 {TkpDrawMenuEntry - standard} {macOnly} {
    catch {destroy .mb}
    menu .m1
    .m1 add command -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.20 {TkpDrawMenuEntry - disabled cascade item} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add cascade -label File -menu .m1.file
    menu .m1.file
    .m1.file add command -label foo
    .m1 entryconfigure File -state disabled
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.21 {TkpDrawMenuEntry - indicator} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add checkbutton -label macMenu-40.20
    .m1 invoke 0
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}
test macMenu-40.22 {TkpDrawMenuEntry - indicator - hideMargin} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add checkbutton -label macMenu-40.21 -hidemargin 1
    .m1 invoke 0
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}

test macMenu-41.1 {TkpComputeStandardMenuGeometry - no entries} {macOnly} {
    catch {destroy .m1}
    menu .m1
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.2 {TkpComputeStandardMenuGeometry - one entry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label "one"
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.3 {TkpComputeStandardMenuGeometry - more than one entry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label "one"
    .m1 add command -label "two"
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.4 {TkpComputeStandardMenuGeometry - separator} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add separator
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.5 {TkpComputeStandardMenuGeometry - standard label geometry} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label "test"
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.6 {TkpComputeStandardMenuGeometry - different font for entry} {macOnly} {
    catch {destroy .m1}
    menu .m1 -font "Helvetica 12"
    .m1 add command -label "test" -font "Courier 12"
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.7 {TkpComputeStandardMenuGeometry - second entry larger} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label "test"
    .m1 add command -label "test test"
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.8 {TkpComputeStandardMenuGeometry - first entry larger} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label "test test"
    .m1 add command -label "test"
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.9 {TkpComputeStandardMenuGeometry - accelerator} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label "test" -accel "Ctrl+S"
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.10 {TkpComputeStandardMenuGeometry - second accel larger} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label "test" -accel "1"
    .m1 add command -label "test" -accel "1 1"
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.11 {TkpComputeStandardMenuGeometry - second accel smaller} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label "test" -accel "1 1"
    .m1 add command -label "test" -accel "1"
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.12 {TkpComputeStandardMenuGeometry - indicator} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add checkbutton -label test
    .m1 invoke 1
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.13 {TkpComputeStandardMenuGeometry - second indicator less or equal } {macOnly testImageType} {
    catch {destroy .m1}
    catch {image delete image1}
    image create test image1
    menu .m1
    .m1 add checkbutton -image image1
    .m1 invoke 1
    .m1 add checkbutton -label test
    .m1 invoke 2
    list [update idletasks] [destroy .m1] [image delete image1]
} {{} {} {}}
test macMenu-41.14 {TkpComputeStandardMenuGeometry - hidden margin} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add checkbutton -label macMenu-41.15 -hidemargin 1
    .m1 invoke macMenu-41.15
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.15 {TkpComputeStandardMenuGeometry - zero sized menus} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.16 {TkpComputeStandardMenuGeometry - first column bigger} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label one
    .m1 add command -label two
    .m1 add command -label three -columnbreak 1
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.17 {TkpComputeStandardMenuGeometry - second column bigger} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    .m1 add command -label one
    .m1 add command -label two -columnbreak 1
    .m1 add command -label three
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.18 {TkpComputeStandardMenuGeometry - three columns} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    .m1 add command -label one
    .m1 add command -label two -columnbreak 1
    .m1 add command -label three
    .m1 add command -label four
    .m1 add command -label five -columnbreak 1
    .m1 add command -label six
    list [update idletasks] [destroy .m1]    
} {{} {}}
test macMenu-41.19 {TkpComputeStandardMenuGeometry - entry without accel long} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    .m1 add command -label "This is a long item with no accel."
    .m1 add command -label foo -accel "Cmd+S"
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-41.20 {TkpComputeStandardMenuGeometry - entry with accel long} {macOnly} {
    catch {destroy .m1}
    menu .m1 -tearoff 0
    .m1 add command -label foo
    .m1 add command -label "This is a long label with an accel." -accel "Cmd+W"
    list [update idletasks] [destroy .m1]
} {{} {}}

test macMenu-42.1 {DrawMenuEntryLabel - setting indicatorSpace} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label "foo"
    set tearoff [tk::TearOffMenu .m1]
    list [update idletasks] [destroy .m1]    
} {{} {}}
test macMenu-42.2 {DrawMenuEntryLabel - drawing image} {macOnly testImageType} {
    catch {destroy .m1}
    catch {image delete image1}
    image create test image1
    menu .m1
    .m1 add command -image image1
    set tearoff [tk::TearOffMenu .m1]
    list [update idletasks] [destroy .m1] [image delete image1]
} {{} {} {}}
test macMenu-42.3 {DrawMenuEntryLabel - drawing select image} {macOnly testImageType} {
    catch {destroy .m1}
    catch {eval image delete [image names]}
    image create test image1
    image create test image2
    menu .m1
    .m1 add checkbutton -image image1 -selectimage image2
    .m1 invoke 1
    set tearoff [tk::TearOffMenu .m1]
    list [update idletasks] [destroy .m1] [eval image delete [image names]]
} {{} {} {}}
test macMenu-42.4 {DrawMenuEntryLabel - drawing a bitmap} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -bitmap questhead
    set tearoff [tk::TearOffMenu .m1]
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-42.5 {DrawMenuEntryLabel - drawing null label} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command
    set tearoff [tk::TearOffMenu .m1]
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-42.6 {DrawMenuEntryLabel - drawing real label} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label "This is a long label" -underline 3
    set tearoff [tk::TearOffMenu .m1]
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-42.7 {DrawMenuEntryLabel - drawing disabled label} {macOnly} {
	catch {destroy .m1}
	menu .m1 -disabledforeground ""
	.m1 add command -label "This is a long label" -state disabled
	set tearoff [tk::TearOffMenu .m1]
	list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-42.8 {DrawMenuEntryLabel - disabled images} {macOnly testImageType} {
	catch {destroy .m1}
	catch {image delete image1}
	image create test image1
	menu .m1
	.m1 add command -image image1 -state disabled
	set tearoff [tk::TearOffMenu .m1 100 100]
	list [update idletasks] [destroy .m1] [image delete image1]
} {{} {} {}}

test macMenu-43.1 {GetMenuLabelGeometry - image} {macOnly testImageType} {
    catch {destroy .m1}
    catch {image delete image1}
    menu .m1
    image create test image1
    .m1 add command -image image1
    list [update idletasks] [destroy .m1] [image delete image1]
} {{} {} {}}
test macMenu-43.2 {GetMenuLabelGeometry - bitmap} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -bitmap questhead
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-43.3 {GetMenuLabelGeometry - no text} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command
    list [update idletasks] [destroy .m1]
} {{} {}}
test macMenu-43.4 {GetMenuLabelGeometry - text} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label "This is a test."
    list [update idletasks] [destroy .m1]
} {{} {}}

test macMenu-44.1 {DrawMenuEntryBackground} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    list [update] [destroy .m1]
} {{} {}}
test macMenu-44.2 {DrawMenuEntryBackground} {macOnly} {
    catch {destroy .m1}
    menu .m1
    .m1 add command -label foo
    set tearoff [tk::TearOffMenu .m1 40 40]
    $tearoff activate 0
    list [update] [destroy .m1]
} {{} {}}

test macMenu-45.1 {TkpMenuInit - called at boot time} {macOnly} {
} {}

# cleanup
deleteWindows
::tcltest::cleanupTests
return
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted tests/macscrollbar.test.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# This file is a Tcl script to test out scrollbar widgets and
# the "scrollbar" command of Tk.  This file only tests Macintosh
# specific features.  It is organized in the standard fashion for 
# Tcl tests.
#
# Copyright (c) 1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.

package require tcltest 2.1
namespace import -force tcltest::configure
namespace import -force tcltest::testsDirectory
configure -testdir [file join [pwd] [file dirname [info script]]]
configure -loadfile [file join [testsDirectory] constraints.tcl]
tcltest::loadTestedCommands

update

# Tests for display and layout
wm geometry . 50x300
scrollbar .s
pack .s -fill y -expand 1
update
test macscroll-1.1 {TkpDisplayScrollbar procedure} {macOnly} {
    list [.s configure -width] [.s configure -bd]
} {{-width width Width 16 16} {-borderwidth borderWidth BorderWidth 0 0}}
test macscroll-1.2 {TkpDisplayScrollbar procedure} {macOnly} {
    # Exercise drawing 3D relief
    pack .s -fill y -expand 1 -anchor center
    .s configure -bd 4
    update
    focus .s
    update
} {}
test macscroll-1.3 {TkpDisplayScrollbar procedure} {macOnly} {
    pack .s -fill y -expand 1 -anchor e
    update
    set x [.s configure -width]
    pack .s -fill y -expand 1 -anchor w
    update
    list [.s configure -width] $x
} {{-width width Width 16 16} {-width width Width 16 16}}
test macscroll-1.4 {TkpDisplayScrollbar procedure} {macOnly} {
    wm geometry . 300x50
    .s configure -bd 0 -orient horizontal
    pack .s -fill x -expand 1 -anchor center
    update
    set x [.s configure -width]
    pack .s -fill x -expand 1 -anchor n
    update
    set y [.s configure -width]
    pack .s -fill x -expand 1 -anchor s
    update
    list [.s configure -width] $x $y
} {{-width width Width 16 16} {-width width Width 16 16} {-width width Width 16 16}}
test macscroll-1.5 {TkpDisplayScrollbar procedure} {macOnly} {
    wm geometry . 300x16
    .s configure -bd 0 -orient horizontal
    pack .s -fill x -expand 1 -anchor s
    update
    wm geometry . 300x15
    update
    wm geometry . 300x14
    update
} {}
test macscroll-1.6 {TkpDisplayScrollbar procedure} {macOnly} {
    # Check the drawing of the resize hack
    wm geometry . 20x300
    wm resizable . 1 1
    .s configure -bd 0 -orient vertical
    pack .s -fill y -expand 1 -anchor e
    update
    set x [.s identify 12 295]
    wm resizable . 0 0
    update
    set y [.s identify 12 295]
    wm resizable . 1 1
    pack .s -fill y -expand 1 -anchor center
    update
    list $x $y [.s identify 12 295]
} {{} arrow2 arrow2}
test macscroll-1.7 {TkpDisplayScrollbar procedure} {macOnly} {
    wm geometry . 300x300
    pack .s -fill y -expand 1 -anchor e
    catch {destroy .s2}
    scrollbar .s2 -orient horizontal
    place .s2 -x 0 -y 284 -width 300
} {}

deleteWindows
# cleanup
::tcltest::cleanupTests
return
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































Changes to tests/safe.test.

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

## it indicates that something went wrong sourcing tk.tcl.
## Ensure that any changes that occured to tk.tcl will work or
## are properly prevented in a safe interpreter.  -- hobbs

# The set of hidden commands is platform dependent:

if {"$tcl_platform(platform)" == "macintosh"} {
    set hidden_cmds {beep bell cd clipboard echo encoding exit fconfigure file glob grab load ls menu open pwd selection send socket source tk_chooseColor tk_chooseDirectory tk_getOpenFile tk_getSaveFile toplevel wm}
} elseif {"$tcl_platform(platform)" == "windows"} {
    set hidden_cmds {bell cd clipboard encoding exec exit fconfigure file glob grab load menu open pwd selection socket source tk_chooseColor tk_chooseDirectory tk_getOpenFile tk_getSaveFile tk_messageBox toplevel wm}
} else {
    set hidden_cmds {bell cd clipboard encoding exec exit fconfigure file glob grab load menu open pwd selection send socket source toplevel wm}
}

set saveAutoPath $::auto_path
set ::auto_path [list [info library] $::tk_library]







|
<
<







31
32
33
34
35
36
37
38


39
40
41
42
43
44
45

## it indicates that something went wrong sourcing tk.tcl.
## Ensure that any changes that occured to tk.tcl will work or
## are properly prevented in a safe interpreter.  -- hobbs

# The set of hidden commands is platform dependent:

if {"$tcl_platform(platform)" == "windows"} {


    set hidden_cmds {bell cd clipboard encoding exec exit fconfigure file glob grab load menu open pwd selection socket source tk_chooseColor tk_chooseDirectory tk_getOpenFile tk_getSaveFile tk_messageBox toplevel wm}
} else {
    set hidden_cmds {bell cd clipboard encoding exec exit fconfigure file glob grab load menu open pwd selection send socket source toplevel wm}
}

set saveAutoPath $::auto_path
set ::auto_path [list [info library] $::tk_library]

Changes to tests/text.test.

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
    list [catch {text .t2 -gorp nofun} msg] $msg [winfo exists .t2]
} {1 {unknown option "-gorp"} 0}
test text-2.4 {Tk_TextCmd procedure} {
    catch {destroy .t2}
    list [catch {text .t2 -bd 2 -fg red} msg] $msg \
	[lindex [.t2 config -bd] 4] [lindex [.t2 config -fg] 4]
} {0 .t2 2 red}
if {$tcl_platform(platform) == "macintosh"} {
    set relief solid
} elseif {$tcl_platform(platform) == "windows"} {
    set relief flat
} else {
    set relief raised
}
test text-2.5 {Tk_TextCmd procedure} {
    catch {destroy .t2}
    text .t2







|
<
<







126
127
128
129
130
131
132
133


134
135
136
137
138
139
140
    list [catch {text .t2 -gorp nofun} msg] $msg [winfo exists .t2]
} {1 {unknown option "-gorp"} 0}
test text-2.4 {Tk_TextCmd procedure} {
    catch {destroy .t2}
    list [catch {text .t2 -bd 2 -fg red} msg] $msg \
	[lindex [.t2 config -bd] 4] [lindex [.t2 config -fg] 4]
} {0 .t2 2 red}
if {$tcl_platform(platform) == "windows"} {


    set relief flat
} else {
    set relief raised
}
test text-2.5 {Tk_TextCmd procedure} {
    catch {destroy .t2}
    text .t2

Changes to tests/unixMenu.test.

1
2
3
4
5
6
7
8
9
10
11
# This file is a Tcl script to test menus in Tk.  It is
# organized in the standard fashion for Tcl tests. This
# file tests the Macintosh-specific features of the menu
# system.
#
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.

package require tcltest 2.1
namespace import -force tcltest::configure

|
<
<







1
2


3
4
5
6
7
8
9
# This file is a Tcl script to test menus in Tk.  It is
# organized in the standard fashion for Tcl tests.


#
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.

package require tcltest 2.1
namespace import -force tcltest::configure

Changes to tests/winMenu.test.

1
2
3
4
5
6
7
8
9
10
11
# This file is a Tcl script to test menus in Tk.  It is
# organized in the standard fashion for Tcl tests. This
# file tests the Macintosh-specific features of the menu
# system.
#
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.

package require tcltest 2.1
namespace import -force tcltest::configure

|
<
<







1
2


3
4
5
6
7
8
9
# This file is a Tcl script to test menus in Tk.  It is
# organized in the standard fashion for Tcl tests.


#
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.

package require tcltest 2.1
namespace import -force tcltest::configure

Changes to unix/Makefile.in.

1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
BUILD_HTML = \
	@if test -f "$(BUILD_TCLSH)"; then \
	$(SHELL_ENV) TCLSH="$(BUILD_TCLSH)"; else \
	TCLSH="$(TCL_EXE)"; fi ;\
	"$${TCLSH}" $(TOOL_DIR)/tcltk-man2html.tcl --htmldir="$(HTML_INSTALL_DIR)" \
		--srcdir=$(TOP_DIR)/.. $(BUILD_HTML_FLAGS)

#
# Target to create a Macintosh version of the distribution.  This will
# do a normal distribution and then massage the output to prepare it
# for moving to the Mac platform.  This requires a few scripts and
# programs found only in the Tcl greoup's tool workspace.
#

macdist: dist
	rm -f $(DISTDIR)/mac/tkMacProjects.sea.hqx
	$(TCL_EXE) $(TOOL_DIR)/man2html.tcl $(DISTDIR)/tmp ../.. tk$(VERSION)
	mv $(DISTDIR)/tmp/tk$(VERSION) $(DISTDIR)/html
	rm -rf $(DISTDIR)/doc
	rm -rf $(DISTDIR)/tmp
	$(TCL_EXE) $(TOOL_DIR)/cvtEOL.tcl $(DISTDIR)

#
# Targets to build Solaris package of the distribution for the current
# architecture.  To build stream packages for both sun4 and i86pc
# architectures: 
#
#   On the sun4 machine, execute the following:
#     make distclean; ./configure







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1494
1495
1496
1497
1498
1499
1500















1501
1502
1503
1504
1505
1506
1507
BUILD_HTML = \
	@if test -f "$(BUILD_TCLSH)"; then \
	$(SHELL_ENV) TCLSH="$(BUILD_TCLSH)"; else \
	TCLSH="$(TCL_EXE)"; fi ;\
	"$${TCLSH}" $(TOOL_DIR)/tcltk-man2html.tcl --htmldir="$(HTML_INSTALL_DIR)" \
		--srcdir=$(TOP_DIR)/.. $(BUILD_HTML_FLAGS)
















#
# Targets to build Solaris package of the distribution for the current
# architecture.  To build stream packages for both sun4 and i86pc
# architectures: 
#
#   On the sun4 machine, execute the following:
#     make distclean; ./configure

Changes to unix/README.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

The rest of this file contains instructions on how to do this.  The
release should compile and run either "out of the box" or with trivial
changes on any UNIX-like system that approximates POSIX, BSD, or System
V.  We know that it runs on workstations from Sun, H-P, DEC, IBM, and
SGI, as well as PCs running Linux, BSDI, and SCO UNIX.  To compile for
a PC running Windows, see the README file in the directory ../win.  To
compile for Mac OS X, see the README file in the directory ../macosx.  To
compile for a classic Macintosh, see the README file in the directory ../mac.

How To Compile And Install Tk:
------------------------------

(a) Make sure that the Tcl release is present in the directory
    ../../tcl<version> (or else use the "--with-tcl" switch described
    below).  This release of Tk will only work with the equivalently







|
<







14
15
16
17
18
19
20
21

22
23
24
25
26
27
28

The rest of this file contains instructions on how to do this.  The
release should compile and run either "out of the box" or with trivial
changes on any UNIX-like system that approximates POSIX, BSD, or System
V.  We know that it runs on workstations from Sun, H-P, DEC, IBM, and
SGI, as well as PCs running Linux, BSDI, and SCO UNIX.  To compile for
a PC running Windows, see the README file in the directory ../win.  To
compile for Mac OS X, see the README file in the directory ../macosx.


How To Compile And Install Tk:
------------------------------

(a) Make sure that the Tcl release is present in the directory
    ../../tcl<version> (or else use the "--with-tcl" switch described
    below).  This release of Tk will only work with the equivalently

Changes to unix/tkUnix3d.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include <tk3d.h>

#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
#include "tkUnixInt.h"
#endif

/*
 * This structure is used to keep track of the extra colors used
 * by Unix 3d borders.
 */







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include <tk3d.h>

#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
#include "tkUnixInt.h"
#endif

/*
 * This structure is used to keep track of the extra colors used
 * by Unix 3d borders.
 */

Changes to unix/tkUnixDraw.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include "tkPort.h"
#include "tkInt.h"

#if !defined(__WIN32__) && !defined(MAC_TCL)
#include "tkUnixInt.h"
#endif

/*
 * The following structure is used to pass information to
 * ScrollRestrictProc from TkScrollWindow.
 */







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include "tkPort.h"
#include "tkInt.h"

#if !defined(__WIN32__)
#include "tkUnixInt.h"
#endif

/*
 * The following structure is used to pass information to
 * ScrollRestrictProc from TkScrollWindow.
 */

Changes to xlib/X11/X.h.

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

******************************************************************/
#define X_PROTOCOL	11		/* current protocol version */
#define X_PROTOCOL_REVISION 0		/* current minor version */

#if defined(MAC_TCL) || defined(MAC_OSX_TK)
#   define Cursor XCursor
#   define Region XRegion
#endif

/* Resources */

#ifdef _WIN64







|







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

******************************************************************/
#define X_PROTOCOL	11		/* current protocol version */
#define X_PROTOCOL_REVISION 0		/* current minor version */

#if defined(MAC_OSX_TK)
#   define Cursor XCursor
#   define Region XRegion
#endif

/* Resources */

#ifdef _WIN64
665
666
667
668
669
670
671
672
673
674
675
676
677


/* Byte order  used in imageByteOrder and bitmapBitOrder */

#define LSBFirst		0
#define MSBFirst		1

#if defined(MAC_TCL) || defined(MAC_OSX_TK)
#   undef Cursor
#   undef Region
#endif

#endif /* X_H */







|





665
666
667
668
669
670
671
672
673
674
675
676
677


/* Byte order  used in imageByteOrder and bitmapBitOrder */

#define LSBFirst		0
#define MSBFirst		1

#if defined(MAC_OSX_TK)
#   undef Cursor
#   undef Region
#endif

#endif /* X_H */

Changes to xlib/X11/Xlib.h.

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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 *	Structures and symbols starting with "_" are private to the library.
 */
#ifndef _XLIB_H_
#define _XLIB_H_

#define XlibSpecificationRelease 5

#if !defined(MAC_TCL) && !defined(MAC_OSX_TK)
#   include <X11/X.h>
#endif
#ifdef MAC_TCL
#   include <X.h>
#   define Cursor XCursor
#   define Region XRegion
#endif
#ifdef MAC_OSX_TK
#   include <X11/X.h>
#   define Cursor XCursor
#   define Region XRegion
#endif

/* applications should not depend on these two headers being included! */
#ifdef MAC_TCL
#include <Xfuncproto.h>
#else
#include <X11/Xfuncproto.h>
#endif

#ifndef X_WCHAR
#ifdef X_NOT_STDC_ENV
#define X_WCHAR
#endif
#endif

#ifndef X_WCHAR
#include <stddef.h>
#else
/* replace this with #include or typedef appropriate for your system */
typedef unsigned long wchar_t;
#endif

typedef char *XPointer;

#define Bool int
#if defined(MAC_TCL) || defined(MAC_OSX_TK)
/* Use define rather than typedef, since may need to undefine this later */
#define Status int
#else
typedef int Status;
#endif
#define True 1
#define False 0







|


<
<
<
<
<







<
<
<

<

















|







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
61
62
63
64
65
 *	Structures and symbols starting with "_" are private to the library.
 */
#ifndef _XLIB_H_
#define _XLIB_H_

#define XlibSpecificationRelease 5

#if !defined(MAC_OSX_TK)
#   include <X11/X.h>
#endif





#ifdef MAC_OSX_TK
#   include <X11/X.h>
#   define Cursor XCursor
#   define Region XRegion
#endif

/* applications should not depend on these two headers being included! */



#include <X11/Xfuncproto.h>


#ifndef X_WCHAR
#ifdef X_NOT_STDC_ENV
#define X_WCHAR
#endif
#endif

#ifndef X_WCHAR
#include <stddef.h>
#else
/* replace this with #include or typedef appropriate for your system */
typedef unsigned long wchar_t;
#endif

typedef char *XPointer;

#define Bool int
#if defined(MAC_OSX_TK)
/* Use define rather than typedef, since may need to undefine this later */
#define Status int
#else
typedef int Status;
#endif
#define True 1
#define False 0
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214



#include "tkIntXlibDecls.h"

_XFUNCPROTOEND

#if defined(MAC_TCL) || defined(MAC_OSX_TK)
#   undef Cursor
#   undef Region
#endif

#endif /* _XLIB_H_ */







|





1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205



#include "tkIntXlibDecls.h"

_XFUNCPROTOEND

#if defined(MAC_OSX_TK)
#   undef Cursor
#   undef Region
#endif

#endif /* _XLIB_H_ */

Changes to xlib/X11/Xutil.h.

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
******************************************************************/

#ifndef _XUTIL_H_
#define _XUTIL_H_

/* You must include <X11/Xlib.h> before including this file */

#if defined(MAC_TCL) || defined(MAC_OSX_TK)
#   define Region XRegion
#endif

/* 
 * Bitmask returned by XParseGeometry().  Each bit tells if the corresponding
 * value (x, y, width, height) was found in the parsed string.
 */







|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
******************************************************************/

#ifndef _XUTIL_H_
#define _XUTIL_H_

/* You must include <X11/Xlib.h> before including this file */

#if defined(MAC_OSX_TK)
#   define Region XRegion
#endif

/* 
 * Bitmask returned by XParseGeometry().  Each bit tells if the corresponding
 * value (x, y, width, height) was found in the parsed string.
 */
844
845
846
847
848
849
850
851
852
853
854
855
    Region		/* srb */,
    Region		/* dr_return */
#endif
);

_XFUNCPROTOEND

#if defined(MAC_TCL) || defined(MAC_OSX_TK)
#   undef Region
#endif

#endif /* _XUTIL_H_ */







|




844
845
846
847
848
849
850
851
852
853
854
855
    Region		/* srb */,
    Region		/* dr_return */
#endif
);

_XFUNCPROTOEND

#if defined(MAC_OSX_TK)
#   undef Region
#endif

#endif /* _XUTIL_H_ */

Changes to xlib/X11/keysym.h.

28
29
30
31
32
33
34
35
36
37
38
39
#define XK_MISCELLANY
#define XK_LATIN1
#define XK_LATIN2
#define XK_LATIN3
#define XK_LATIN4
#define XK_GREEK

#ifdef MAC_TCL
#include <keysymdef.h>
#else
#include <X11/keysymdef.h>
#endif







<
<
<

<
28
29
30
31
32
33
34



35

#define XK_MISCELLANY
#define XK_LATIN1
#define XK_LATIN2
#define XK_LATIN3
#define XK_LATIN4
#define XK_GREEK




#include <X11/keysymdef.h>

Changes to xlib/xgc.c.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include <tkInt.h>

#if !defined(MAC_TCL) && !defined(MAC_OSX_TK)
#	include <X11/Xlib.h>
#endif
#ifdef MAC_TCL
#	include <Xlib.h>
#	include <X.h>
#	define Cursor XCursor
#	define Region XRegion
#endif
#ifdef MAC_OSX_TK
#	include <tkMacOSXInt.h>
#	include <X11/Xlib.h>
#	include <X11/X.h>
#	define Cursor XCursor
#	define Region XRegion
#endif







|


<
<
<
<
<
<







9
10
11
12
13
14
15
16
17
18






19
20
21
22
23
24
25
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include <tkInt.h>

#if !defined(MAC_OSX_TK)
#	include <X11/Xlib.h>
#endif






#ifdef MAC_OSX_TK
#	include <tkMacOSXInt.h>
#	include <X11/Xlib.h>
#	include <X11/X.h>
#	define Cursor XCursor
#	define Region XRegion
#endif
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
    int i;

    for (i=0; i<npoints; i++) {
	XDrawPoint(display, d, gc, points[i].x, points[i].y);
    }
}

#if !defined(MAC_TCL) && !defined(MAC_OSX_TK)
void
XDrawSegments(display, d, gc, segments, nsegments)
    Display* display;
    Drawable d;
    GC gc;
    XSegment* segments;
    int nsegments;







|







503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
    int i;

    for (i=0; i<npoints; i++) {
	XDrawPoint(display, d, gc, points[i].x, points[i].y);
    }
}

#if !defined(MAC_OSX_TK)
void
XDrawSegments(display, d, gc, segments, nsegments)
    Display* display;
    Drawable d;
    GC gc;
    XSegment* segments;
    int nsegments;

Changes to xlib/xutil.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include <stdlib.h>
#include <tk.h>

#ifdef MAC_TCL
#       include <Xutil.h>
#       include <Xatom.h>
#else
#       include <X11/Xutil.h>
#       include <X11/Xatom.h>
#endif

/*
 *----------------------------------------------------------------------
 *
 * XInternAtom --
 *
 *	This procedure simulates the XInternAtom function by calling







<
<
<
<
|
|
<







8
9
10
11
12
13
14




15
16

17
18
19
20
21
22
23
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include <stdlib.h>
#include <tk.h>





#include <X11/Xutil.h>
#include <X11/Xatom.h>


/*
 *----------------------------------------------------------------------
 *
 * XInternAtom --
 *
 *	This procedure simulates the XInternAtom function by calling