diff options
author | stanton <stanton> | 1998-09-30 02:15:12 (GMT) |
---|---|---|
committer | stanton <stanton> | 1998-09-30 02:15:12 (GMT) |
commit | 3c1a537631e7e5fdc7c237b92a582824afea1fda (patch) | |
tree | 1da3d93d793cd6abb62cd2204f5e4f73406f2752 /win | |
parent | c16d45ef706cbb616125e57ec8a1f809bae3c9df (diff) | |
download | tk-3c1a537631e7e5fdc7c237b92a582824afea1fda.zip tk-3c1a537631e7e5fdc7c237b92a582824afea1fda.tar.gz tk-3c1a537631e7e5fdc7c237b92a582824afea1fda.tar.bz2 |
Merged 8.0.3 changes into 8.1
Diffstat (limited to 'win')
-rw-r--r-- | win/README | 27 | ||||
-rw-r--r-- | win/makefile.bc | 5 | ||||
-rw-r--r-- | win/makefile.vc | 131 | ||||
-rw-r--r-- | win/mkd.bat | 20 | ||||
-rw-r--r-- | win/rc/tk.rc | 2 | ||||
-rw-r--r-- | win/rc/wish.rc | 2 | ||||
-rw-r--r-- | win/rmd.bat | 20 | ||||
-rw-r--r-- | win/tkWin.h | 10 | ||||
-rw-r--r-- | win/tkWin32Dll.c | 2 | ||||
-rw-r--r-- | win/tkWin3d.c | 2 | ||||
-rw-r--r-- | win/tkWinButton.c | 2 | ||||
-rw-r--r-- | win/tkWinClipboard.c | 2 | ||||
-rw-r--r-- | win/tkWinColor.c | 2 | ||||
-rw-r--r-- | win/tkWinConfig.c | 2 | ||||
-rw-r--r-- | win/tkWinCursor.c | 2 | ||||
-rw-r--r-- | win/tkWinDefault.h | 2 | ||||
-rw-r--r-- | win/tkWinDialog.c | 2 | ||||
-rw-r--r-- | win/tkWinDraw.c | 2 | ||||
-rw-r--r-- | win/tkWinEmbed.c | 2 | ||||
-rw-r--r-- | win/tkWinFont.c | 26 | ||||
-rw-r--r-- | win/tkWinImage.c | 2 | ||||
-rw-r--r-- | win/tkWinInit.c | 2 | ||||
-rw-r--r-- | win/tkWinInt.h | 2 | ||||
-rw-r--r-- | win/tkWinKey.c | 12 | ||||
-rw-r--r-- | win/tkWinMenu.c | 306 | ||||
-rw-r--r-- | win/tkWinPixmap.c | 2 | ||||
-rw-r--r-- | win/tkWinPointer.c | 11 | ||||
-rw-r--r-- | win/tkWinPort.h | 2 | ||||
-rw-r--r-- | win/tkWinRegion.c | 2 | ||||
-rw-r--r-- | win/tkWinScrlbr.c | 2 | ||||
-rw-r--r-- | win/tkWinSend.c | 2 | ||||
-rw-r--r-- | win/tkWinTest.c | 2 | ||||
-rw-r--r-- | win/tkWinWindow.c | 8 | ||||
-rw-r--r-- | win/tkWinWm.c | 106 | ||||
-rw-r--r-- | win/tkWinX.c | 21 | ||||
-rw-r--r-- | win/winMain.c | 6 |
36 files changed, 508 insertions, 245 deletions
@@ -1,10 +1,10 @@ Tk 8.1a2 for Windows by Scott Stanton -Sun Microsystems Laboratories -scott.stanton@eng.sun.com +Scriptics Corporation +scott.stanton@scriptics.com -SCCS: @(#) README 1.22 98/02/18 18:03:07 +RCS: @(#) $Id: README,v 1.1.4.2 1998/09/30 02:19:25 stanton Exp $ 1. Introduction --------------- @@ -22,7 +22,7 @@ common source release. The binary distribution is a self-extracting archive with a built-in installation script. Look for the binary release in the same location as the source release -(ftp.smli.com:/pub/tcl or any of the mirror sites). For most users, +(ftp.scriptics.com:/pub/tcl/tcl8_1 or any of the mirror sites). For most users, the binary release will be much easier to install and use. You only need the source release if you plan to modify the core of Tcl, or if you need to compile with a different compiler. With the addition of @@ -42,7 +42,8 @@ In order to compile Tk for Windows, you need the following items: Borland C++ 4.5 or later (32-bit compiler) or Visual C++ 2.x or later - + +In practice, 8.1 was built with Visual C++ 5.0 In the "win" subdirectory of the source release, you will find two files called "makefile.bc" and "makefile.vc". These are the makefiles @@ -61,12 +62,7 @@ find them. Tk looks in one of two places for the library files: 2) In the lib\tk8.1 directory under the Tcl installation directory as specified in the registry: - For Windows NT & 95: - HKEY_LOCAL_MACHINE\SOFTWARE\Sun\Tcl\8.1 - Value Name is "Root" - - For Win32s: - HKEY_CLASSES_ROOT\SOFTWARE\Sun\Tcl\8.1\ + HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.0\ 2) Relative to the directory containing the current .exe. Tk will look for a directory "..\lib\tk8.1" relative to the @@ -107,13 +103,14 @@ Windows beta version of Tk: - Tk_dialog appears in the upper left corner. This is a symptom of a larger problem with "wm geometry" when applied to unmapped or iconified windows. -- Grabs do not affect native menus or the title bar. - PPM images are using the wrong translation mode for writing to files, resulting in CR/LF terminated PPM files. - Tk crashes if the display depth changes while it is running. Tk also doesn't consistently track changes in the system colors. If you have comments or bug reports for the Windows version of Tk, -please direct them to the comp.lang.tcl newsgroup or the wintcl -mailing list (see http://sunscript.sun.com/win/wintcl-list.html for -more information). +please direct them to: + +<bugs@scriptics.com> + +or post them to the newsgroup comp.lang.tcl. diff --git a/win/makefile.bc b/win/makefile.bc index f2bd900..8c59bb1 100644 --- a/win/makefile.bc +++ b/win/makefile.bc @@ -5,7 +5,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# SCCS: @(#) makefile.bc 1.75 98/02/18 18:32:57 +# RCS: @(#) $Id: makefile.bc,v 1.1.4.2 1998/09/30 02:19:26 stanton Exp $ # @@ -80,11 +80,9 @@ LNLIBS_dll = $(TCLLIBDIR)\$(TCLLIB) import32 cw32mti .path.obj=$(TMPDIR) WISHOBJS = \ - $(TMPDIR)\tkConsole.obj \ $(TMPDIR)\winMain.obj TKTESTOBJS = \ - $(TMPDIR)\tkConsole.obj \ $(TMPDIR)\tkTest.obj \ $(TMPDIR)\tkSquare.obj \ $(TMPDIR)\testMain.obj @@ -97,6 +95,7 @@ XLIBOBJS = \ $(TMPDIR)\xutil.obj TKOBJS = \ + $(TMPDIR)\tkConsole.obj \ $(TMPDIR)\tkUnixMenubu.obj \ $(TMPDIR)\tkUnixScale.obj \ $(XLIBOBJS) \ diff --git a/win/makefile.vc b/win/makefile.vc index d1b2a34..4dc4594 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -4,7 +4,7 @@ # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Copyright (c) 1995-1997 Sun Microsystems, Inc. -# SCCS: @(#) makefile.vc 1.67 98/02/18 18:32:52 +# RCS: @(#) $Id: makefile.vc,v 1.1.4.2 1998/09/30 02:19:26 stanton Exp $ # Does not depend on the presence of any environment variables in # order to compile tcl; all needed information is derived from @@ -25,16 +25,16 @@ # TCLDIR = location of top of Tcl source heirarchy # -ROOT = .. -TMPDIR = . -TOOLS32 = c:\msdev -TCLDIR = ..\..\tcl8.1a2 +ROOT = .. +TOOLS32 = c:\progra~1\devstudio\vc +TOOLS32_rc = c:\progra~1\devstudio\sharedide +TCLDIR = ..\..\tcl8.1a2 # Set this to the appropriate value of /MACHINE: for your platform MACHINE = IX86 -# Comment the following line to compile with symbols -NODEBUG=1 +# Set NODEBUG to 0 to compile with symbols +NODEBUG = 1 # uncomment the following two lines to compile with TCL_MEM_DEBUG #DEBUGDEFINES =-DTCL_MEM_DEBUG @@ -43,28 +43,41 @@ NODEBUG=1 # Do not modify below this line ###################################################################### -VERSION = 81 +TCLNAMEPREFIX = tcl +TKNAMEPREFIX = tk +WISHNAMEPREFIX = wish +VERSION = 80 -TCLDLL = tcl$(VERSION).dll -TCLLIB = tcl$(VERSION).lib -TCLPLUGINDLL = tcl$(VERSION)p.dll -TCLPLUGINLIB = tcl$(VERSION)p.lib -TKDLL = tk$(VERSION).dll -TKLIB = tk$(VERSION).lib -TKPLUGINDLL = tk$(VERSION)p.dll -TKPLUGINLIB = tk$(VERSION)p.lib - -WISH = wish$(VERSION).exe -WISHP = wishp$(VERSION).exe -TKTEST = tktest.exe -DUMPEXTS = $(TMPDIR)\dumpexts.exe +BINROOT = . +!IF "$(NODEBUG)" == "1" +TMPDIRNAME = Release +DBGX = +!ELSE +TMPDIRNAME = Debug +DBGX = d +!ENDIF +TMPDIR = $(BINROOT)\$(TMPDIRNAME) +OUTDIRNAME = $(TMPDIRNAME) +OUTDIR = $(TMPDIR) + +TCLLIB = $(TCLNAMEPREFIX)$(VERSION)$(DBGX).lib +TCLPLUGINLIB = $(TCLNAMEPREFIX)$(VERSION)p.lib +TKDLLNAME = $(TKNAMEPREFIX)$(VERSION)$(DBGX).dll +TKDLL = $(OUTDIR)\$(TKDLLNAME) +TKLIB = $(OUTDIR)\$(TKNAMEPREFIX)$(VERSION)$(DBGX).lib +TKPLUGINDLLNAME = $(TKNAMEPREFIX)$(VERSION)p$(DBG).dll +TKPLUGINDLL = $(OUTDIR)\$(TKPLUGINDLLNAME) +TKPLUGINLIB = $(OUTDIR)\$(TKNAMEPREFIX)$(VERSION)p$(DBGX).lib + +WISH = $(OUTDIR)\$(WISHNAMEPREFIX)$(VERSION)$(DBGX).exe +WISHP = $(OUTDIR)\$(WISHNAMEPREFIX)p$(VERSION)$(DBGX).exe +TKTEST = $(OUTDIR)\$(TKNAMEPREFIX)test.exe +DUMPEXTS = $(TMPDIR)\dumpexts.exe WISHOBJS = \ - $(TMPDIR)\tkConsole.obj \ $(TMPDIR)\winMain.obj TKTESTOBJS = \ - $(TMPDIR)\tkConsole.obj \ $(TMPDIR)\tkTest.obj \ $(TMPDIR)\tkSquare.obj \ $(TMPDIR)\testMain.obj @@ -77,6 +90,7 @@ XLIBOBJS = \ $(TMPDIR)\xutil.obj TKOBJS = \ + $(TMPDIR)\tkConsole.obj \ $(TMPDIR)\tkUnixMenubu.obj \ $(TMPDIR)\tkUnixScale.obj \ $(XLIBOBJS) \ @@ -176,14 +190,14 @@ TKOBJS = \ cc32 = $(TOOLS32)\bin\cl.exe link32 = $(TOOLS32)\bin\link.exe -rc32 = $(TOOLS32)\bin\rc.exe +rc32 = $(TOOLS32_rc)\bin\rc.exe include32 = -I$(TOOLS32)\include WINDIR = $(ROOT)\win GENERICDIR = $(ROOT)\generic XLIBDIR = $(ROOT)\xlib BITMAPDIR = $(ROOT)\bitmaps -TCLLIBDIR = $(TCLDIR)\win +TCLLIBDIR = $(TCLDIR)\win\$(OUTDIRNAME) RCDIR = $(WINDIR)\rc TK_INCLUDES = -I$(WINDIR) -I$(GENERICDIR) -I$(BITMAPDIR) -I$(XLIBDIR) \ @@ -197,7 +211,7 @@ TK_CFLAGS = $(cdebug) $(cflags) $(cvarsdll) $(include32) \ # Link flags ###################################################################### -!IFDEF NODEBUG +!IF "$(NODEBUG)" == "1" ldebug = /RELEASE !ELSE ldebug = -debug:full -debugtype:cv @@ -236,14 +250,19 @@ guilibsdll = $(libcdll) $(winlibs) # Compile flags ###################################################################### -!IFDEF NODEBUG +!IF "$(NODEBUG)" == "1" +!IF "$(MACHINE)" == "ALPHA" +# MSVC on Alpha doesn't understand -Ot +cdebug = -O2i -Gs -GD +!ELSE cdebug = -Oti -Gs -GD +!ENDIF !ELSE cdebug = -Z7 -Od -WX !ENDIF # declarations common to all compiler options -ccommon = -c -W3 -nologo -YX +ccommon = -c -W3 -nologo -Fp$(TMPDIR)\ -YX !IF "$(MACHINE)" == "IX86" cflags = $(ccommon) -D_X86_=1 @@ -265,21 +284,31 @@ cvars = -DWIN32 -D_WIN32 cvarsmt = $(cvars) -D_MT cvarsdll = $(cvarsmt) -D_DLL +!IF "$(NODEBUG)" == "1" +cvarsdll = $(cvars) -MD +!ELSE +cvarsdll = $(cvars) -MDd +!ENDIF + CON_CFLAGS = $(cdebug) $(cflags) $(cvars) $(include32) -DCONSOLE ###################################################################### # Project specific targets ###################################################################### -all: $(WISH) -test: $(TKTEST) -plugin: $(TKPLUGINDLL) $(WISHP) +all: setup $(WISH) +test: setup $(TKTEST) +plugin: setup $(TKPLUGINDLL) $(WISHP) + +setup: + @mkd $(TMPDIR) + @mkd $(OUTDIR) $(TKLIB): $(TKDLL) $(TKDLL): $(TKOBJS) $(TMPDIR)\tk.res $(TMPDIR)\tk.def set LIB=$(TOOLS32)\lib - $(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\tk.def \ + $(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\tk.def \ -out:$@ $(TMPDIR)\tk.res $(TCLLIBDIR)\$(TCLLIB) \ $(guilibsdll) @<< $(TKOBJS) @@ -312,12 +341,12 @@ $(TKTEST): $(TKTESTOBJS) $(TKLIB) $(TMPDIR)\wish.res $(guilibsdll) $(TCLLIBDIR)\$(TCLLIB) $(TKLIB) $(TKTESTOBJS) $(TMPDIR)\tk.def: $(DUMPEXTS) $(TKOBJS) - $(DUMPEXTS) -o $@ $(TKDLL) @<< + $(DUMPEXTS) -o $@ $(TKDLLNAME) @<< $(TKOBJS) << $(TMPDIR)\plugin.def: $(DUMPEXTS) $(TKOBJS) - $(DUMPEXTS) -o $@ $(TKPLUGINDLL) @<< + $(DUMPEXTS) -o $@ $(TKPLUGINDLLNAME) @<< $(TKOBJS) << @@ -332,35 +361,49 @@ $(DUMPEXTS): $(TCLDIR)\win\winDumpExts.c # $(TMPDIR)\testMain.obj: $(ROOT)\win\winMain.c - $(cc32) $(TK_CFLAGS) -DTK_TEST -Fo$@ $? + $(cc32) $(TK_CFLAGS) -DSTATIC_BUILD -DTK_TEST -Fo$@ $? + +$(TMPDIR)\tkTest.obj: $(ROOT)\generic\tkTest.c + $(cc32) $(TK_CFLAGS) -DSTATIC_BUILD -Fo$@ $? + +$(TMPDIR)\tkSquare.obj: $(ROOT)\generic\tkSquare.c + $(cc32) $(TK_CFLAGS) -Fo$@ $? + +$(TMPDIR)\winMain.obj: $(ROOT)\win\winMain.c + $(cc32) $(TK_CFLAGS) -DSTATIC_BUILD -Fo$@ $? # # Implicit rules # {$(XLIBDIR)}.c{$(TMPDIR)}.obj: - $(cc32) $(TK_CFLAGS) -Fo$(TMPDIR)\ $< + $(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -Fo$(TMPDIR)\ $< {$(GENERICDIR)}.c{$(TMPDIR)}.obj: - $(cc32) $(TK_CFLAGS) -Fo$(TMPDIR)\ $< + $(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -Fo$(TMPDIR)\ $< {$(WINDIR)}.c{$(TMPDIR)}.obj: - $(cc32) $(TK_CFLAGS) -Fo$(TMPDIR)\ $< + $(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -Fo$(TMPDIR)\ $< {$(ROOT)\unix}.c{$(TMPDIR)}.obj: - $(cc32) $(TK_CFLAGS) -Fo$(TMPDIR)\ $< + $(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -Fo$(TMPDIR)\ $< {$(RCDIR)}.rc{$(TMPDIR)}.res: $(rc32) -fo $@ -r -i $(GENERICDIR) $< clean: - -@del *.exp - -@del *.lib - -@del *.dll - -@del *.exe - -@del $(TMPDIR)\*.obj + -@del $(OUTDIR)\*.exp + -@del $(OUTDIR)\*.lib + -@del $(OUTDIR)\*.dll + -@del $(OUTDIR)\*.exe + -@del $(OUTDIR)\*.pdb + -@del $(TMPDIR)\*.pch + -@del $(TMPDIR)\*.obj -@del $(TMPDIR)\*.res -@del $(TMPDIR)\*.def + -@del $(TMPDIR)\*.exe + -@rmd $(OUTDIR) + -@rmd $(TMPDIR) # dependencies diff --git a/win/mkd.bat b/win/mkd.bat new file mode 100644 index 0000000..1d1365c --- /dev/null +++ b/win/mkd.bat @@ -0,0 +1,20 @@ +@echo off
+rem RCS: @(#) $Id: mkd.bat,v 1.1.4.1 1998/09/30 02:19:26 stanton Exp $ +
+if exist %1 goto end
+
+if %OS% == Windows_NT goto winnt
+
+echo Add support for Win 95 please
+goto end
+
+goto success
+
+:winnt
+md %1
+if errorlevel 1 goto end
+
+:success
+echo created directory %1
+
+:end
diff --git a/win/rc/tk.rc b/win/rc/tk.rc index b357dd9..db90945 100644 --- a/win/rc/tk.rc +++ b/win/rc/tk.rc @@ -1,4 +1,4 @@ -// SCCS: @(#) tk.rc 1.23 97/07/24 13:55:02 +// RCS: @(#) $Id: tk.rc,v 1.1.4.2 1998/09/30 02:19:42 stanton Exp $ // // Version // diff --git a/win/rc/wish.rc b/win/rc/wish.rc index 76cf124..fbddde1 100644 --- a/win/rc/wish.rc +++ b/win/rc/wish.rc @@ -1,4 +1,4 @@ -// SCCS: @(#) wish.rc 1.15 96/09/17 13:24:11 +// RCS: @(#) $Id: wish.rc,v 1.1.4.1 1998/09/30 02:19:42 stanton Exp $ // // Version // diff --git a/win/rmd.bat b/win/rmd.bat new file mode 100644 index 0000000..6490f83 --- /dev/null +++ b/win/rmd.bat @@ -0,0 +1,20 @@ +@echo off
+rem RCS: @(#) $Id: rmd.bat,v 1.1.4.1 1998/09/30 02:19:27 stanton Exp $ +
+if not exist %1 goto end
+
+if %OS% == Windows_NT goto winnt
+
+echo Add support for Win 95 please
+goto end
+
+goto success
+
+:winnt
+rmdir %1 /s /q
+if errorlevel 1 goto end
+
+:success
+echo deleted directory %1
+
+:end
diff --git a/win/tkWin.h b/win/tkWin.h index 2b10c46..a746fe8 100644 --- a/win/tkWin.h +++ b/win/tkWin.h @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWin.h 1.10 97/08/29 15:21:40 + * RCS: @(#) $Id: tkWin.h,v 1.1.4.2 1998/09/30 02:19:27 stanton Exp $ */ #ifndef _TKWIN @@ -23,6 +23,11 @@ #include <windows.h> #undef WIN32_LEAN_AND_MEAN +#ifdef BUILD_tk +# undef TCL_STORAGE_CLASS +# define TCL_STORAGE_CLASS DLLEXPORT +#endif + /* * The following messages are use to communicate between a Tk toplevel * and its container window. @@ -56,4 +61,7 @@ EXTERN int Tk_TranslateWinEvent _ANSI_ARGS_((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result)); +# undef TCL_STORAGE_CLASS +# define TCL_STORAGE_CLASS DLLIMPORT + #endif /* _TKWIN */ diff --git a/win/tkWin32Dll.c b/win/tkWin32Dll.c index 6f69a29..48e111e 100644 --- a/win/tkWin32Dll.c +++ b/win/tkWin32Dll.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWin32Dll.c 1.14 97/08/06 18:22:18 + * RCS: @(#) $Id: tkWin32Dll.c,v 1.1.4.2 1998/09/30 02:19:27 stanton Exp $ */ #include "tkWinInt.h" diff --git a/win/tkWin3d.c b/win/tkWin3d.c index 16e7c0e..17a015c 100644 --- a/win/tkWin3d.c +++ b/win/tkWin3d.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWin3d.c 1.7 97/08/22 12:13:12 + * RCS: @(#) $Id: tkWin3d.c,v 1.1.4.2 1998/09/30 02:19:28 stanton Exp $ */ #include "tkWinInt.h" diff --git a/win/tkWinButton.c b/win/tkWinButton.c index 1aaa029..78e998f 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinButton.c 1.14 98/01/09 09:46:46 + * RCS: @(#) $Id: tkWinButton.c,v 1.1.4.2 1998/09/30 02:19:28 stanton Exp $ */ #define OEMRESOURCE diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c index 5d630d9..87a4d34 100644 --- a/win/tkWinClipboard.c +++ b/win/tkWinClipboard.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinClipboard.c 1.9 97/11/07 21:25:49 + * RCS: @(#) $Id: tkWinClipboard.c,v 1.1.4.2 1998/09/30 02:19:29 stanton Exp $ */ #include "tkWinInt.h" diff --git a/win/tkWinColor.c b/win/tkWinColor.c index db38a7d..096d585 100644 --- a/win/tkWinColor.c +++ b/win/tkWinColor.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinColor.c 1.21 97/10/29 10:37:34 + * RCS: @(#) $Id: tkWinColor.c,v 1.1.4.2 1998/09/30 02:19:29 stanton Exp $ */ #include "tkWinInt.h" diff --git a/win/tkWinConfig.c b/win/tkWinConfig.c index feb77bd..3223d81 100644 --- a/win/tkWinConfig.c +++ b/win/tkWinConfig.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinConfig.c 1.4 98/01/21 00:23:32 + * RCS: @(#) $Id: tkWinConfig.c,v 1.1.2.2 1998/09/30 02:19:30 stanton Exp $ */ #include "tk.h" diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c index 85010e6..bbc18e4 100644 --- a/win/tkWinCursor.c +++ b/win/tkWinCursor.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinCursor.c 1.11 97/11/12 17:50:45 + * RCS: @(#) $Id: tkWinCursor.c,v 1.1.4.2 1998/09/30 02:19:30 stanton Exp $ */ #include "tkWinInt.h" diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h index ecd00d2..9a6264b 100644 --- a/win/tkWinDefault.h +++ b/win/tkWinDefault.h @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinDefault.h 1.35 98/01/09 09:46:28 + * RCS: @(#) $Id: tkWinDefault.h,v 1.1.4.2 1998/09/30 02:19:30 stanton Exp $ */ #ifndef _TKWINDEFAULT diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 11f2056..8e7573a 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinDialog.c 1.11 97/10/29 10:41:59 + * RCS: @(#) $Id: tkWinDialog.c,v 1.1.4.2 1998/09/30 02:19:31 stanton Exp $ * */ diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c index e972365..72f258e 100644 --- a/win/tkWinDraw.c +++ b/win/tkWinDraw.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinDraw.c 1.30 97/03/21 11:20:05 + * RCS: @(#) $Id: tkWinDraw.c,v 1.1.4.1 1998/09/30 02:19:31 stanton Exp $ */ #include "tkWinInt.h" diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c index 1e66219..9594768 100644 --- a/win/tkWinEmbed.c +++ b/win/tkWinEmbed.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinEmbed.c 1.21 97/11/07 21:59:08; + * RCS: @(#) $Id: tkWinEmbed.c,v 1.1.4.2 1998/09/30 02:19:32 stanton Exp $ */ #include "tkWinInt.h" diff --git a/win/tkWinFont.c b/win/tkWinFont.c index d8e1647..f53351e 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinFont.c 1.29 98/02/04 15:55:35 + * RCS: @(#) $Id: tkWinFont.c,v 1.1.4.2 1998/09/30 02:19:33 stanton Exp $ */ #include "tkWinInt.h" @@ -55,7 +55,7 @@ typedef struct FontFamily { /* The procedure to use to draw text after * it has been converted from UTF-8 to the * encoding of this font. */ - BOOL (WINAPI *getTextExtentPointProc)(HDC, TCHAR *, int, LPSIZE); + BOOL (WINAPI *getTextExtentPoint32Proc)(HDC, TCHAR *, int, LPSIZE); /* The procedure to use to measure text after * it has been converted from UTF-8 to the * encoding of this font. */ @@ -652,7 +652,7 @@ Tk_MeasureChars( familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source, &runString); - (*familyPtr->getTextExtentPointProc)(hdc, + (*familyPtr->getTextExtentPoint32Proc)(hdc, Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont, &size); @@ -668,7 +668,8 @@ Tk_MeasureChars( familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source, &runString); - (*familyPtr->getTextExtentPointProc)(hdc, Tcl_DStringValue(&runString), + (*familyPtr->getTextExtentPoint32Proc)(hdc, + Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont, &size); curX += size.cx; @@ -689,7 +690,10 @@ Tk_MeasureChars( * every character individually. There is a function call that * can measure multiple characters at once and return the * offset of each of them, but it only works on NT, even though - * the documentation claims it works for 95. + * the documentation claims it works for 95. + * TODO: verify that GetTextExtentExPoint is still broken in '95, and + * possibly use it for NT anyway since it should be much faster and + * more accurate. */ next = source + Tcl_UtfToUniChar(source, &ch); @@ -711,7 +715,7 @@ Tk_MeasureChars( familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternal(NULL, familyPtr->encoding, p, next - p, 0, NULL, buf, sizeof(buf), &srcRead, &dstWrote, NULL); - (*familyPtr->getTextExtentPointProc)(hdc, buf, + (*familyPtr->getTextExtentPoint32Proc)(hdc, buf, dstWrote >> familyPtr->isWideFont, &size); newX += size.cx; } @@ -953,7 +957,7 @@ MultiFontTextOut( (*familyPtr->textOutProc)(hdc, x, y, Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont); - (*familyPtr->getTextExtentPointProc)(hdc, + (*familyPtr->getTextExtentPoint32Proc)(hdc, Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont, &size); @@ -1283,14 +1287,14 @@ AllocFontFamily( encoding = Tcl_GetEncoding(NULL, "unicode"); familyPtr->textOutProc = (BOOL (WINAPI *)(HDC, int, int, TCHAR *, int)) TextOutW; - familyPtr->getTextExtentPointProc = - (BOOL (WINAPI *)(HDC, TCHAR *, int, LPSIZE)) GetTextExtentPointW; + familyPtr->getTextExtentPoint32Proc = + (BOOL (WINAPI *)(HDC, TCHAR *, int, LPSIZE)) GetTextExtentPoint32W; familyPtr->isWideFont = 1; } else { familyPtr->textOutProc = (BOOL (WINAPI *)(HDC, int, int, TCHAR *, int)) TextOutA; - familyPtr->getTextExtentPointProc = - (BOOL (WINAPI *)(HDC, TCHAR *, int, LPSIZE)) GetTextExtentPointA; + familyPtr->getTextExtentPoint32Proc = + (BOOL (WINAPI *)(HDC, TCHAR *, int, LPSIZE)) GetTextExtentPoint32A; familyPtr->isWideFont = 0; } diff --git a/win/tkWinImage.c b/win/tkWinImage.c index 388a58a..5b5db88 100644 --- a/win/tkWinImage.c +++ b/win/tkWinImage.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinImage.c 1.13 97/07/07 11:19:45 + * RCS: @(#) $Id: tkWinImage.c,v 1.1.4.1 1998/09/30 02:19:33 stanton Exp $ */ #include "tkWinInt.h" diff --git a/win/tkWinInit.c b/win/tkWinInit.c index b311bae..c4879a9 100644 --- a/win/tkWinInit.c +++ b/win/tkWinInit.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinInit.c 1.30 97/11/07 21:25:45 + * RCS: @(#) $Id: tkWinInit.c,v 1.1.4.2 1998/09/30 02:19:34 stanton Exp $ */ #include "tkWinInt.h" diff --git a/win/tkWinInt.h b/win/tkWinInt.h index 8198b6b..48e0828 100644 --- a/win/tkWinInt.h +++ b/win/tkWinInt.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinInt.h 1.36 97/10/02 17:30:22 + * RCS: @(#) $Id: tkWinInt.h,v 1.1.4.2 1998/09/30 02:19:34 stanton Exp $ */ #ifndef _TKWININT diff --git a/win/tkWinKey.c b/win/tkWinKey.c index bc74c43..c864bcb 100644 --- a/win/tkWinKey.c +++ b/win/tkWinKey.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinKey.c 1.11 98/01/13 20:26:49 + * RCS: @(#) $Id: tkWinKey.c,v 1.1.4.2 1998/09/30 02:19:35 stanton Exp $ */ #include "tkWinInt.h" @@ -72,6 +72,16 @@ static Keys keymap[] = { VK_F24, XK_F24, VK_NUMLOCK, XK_Num_Lock, VK_SCROLL, XK_Scroll_Lock, + + /* + * The following support the new keys in the Microsoft keyboard. + * Win_L and Win_R have the windows logo. App has the menu. + */ + + VK_LWIN, XK_Win_L, + VK_RWIN, XK_Win_R, + VK_APPS, XK_App, + 0, NoSymbol }; diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 44f53fc..47915ae 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -1,14 +1,14 @@ /* * tkWinMenu.c -- * - * This module implements the Windows-platform specific features of menus. + * This module implements the Windows platform-specific features of menus. * * Copyright (c) 1996-1998 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinMenu.c 1.110 98/01/26 19:43:53 + * RCS: @(#) $Id: tkWinMenu.c,v 1.1.4.2 1998/09/30 02:19:35 stanton Exp $ */ #define OEMRESOURCE @@ -323,35 +323,51 @@ TkpDestroyMenu(menuPtr) Tcl_CancelIdleCall(ReconfigureWindowsMenu, (ClientData) menuPtr); } - if (NULL != winMenuHdl) { - if (menuPtr->menuFlags & MENU_SYSTEM_MENU) { - TkMenuEntry *searchEntryPtr; - Tcl_HashTable *tablePtr = TkGetMenuHashTable(menuPtr->interp); - char *menuName = Tcl_GetHashKey(tablePtr, - menuPtr->menuRefPtr->hashEntryPtr); - - for (searchEntryPtr = menuPtr->menuRefPtr->parentEntryPtr; - searchEntryPtr != NULL; - searchEntryPtr = searchEntryPtr->nextCascadePtr) { - searchName = Tcl_GetStringFromObj(searchEntryPtr->namePtr, - NULL); - if (strcmp(searchName, - menuName) == 0) { - Tk_Window parentTopLevelPtr = searchEntryPtr - ->menuPtr->parentTopLevelPtr; - - if (parentTopLevelPtr != NULL) { - GetSystemMenu(TkWinGetWrapperWindow(parentTopLevelPtr), - TRUE); - } - break; + if (winMenuHdl == NULL) { + return; + } + + if (menuPtr->menuFlags & MENU_SYSTEM_MENU) { + TkMenuEntry *searchEntryPtr; + Tcl_HashTable *tablePtr = TkGetMenuHashTable(menuPtr->interp); + char *menuName = Tcl_GetHashKey(tablePtr, + menuPtr->menuRefPtr->hashEntryPtr); + + /* + * Search for the menu in the menubar, if it is present, get the + * wrapper window associated with the toplevel and reset its + * system menu to the default menu. + */ + + for (searchEntryPtr = menuPtr->menuRefPtr->parentEntryPtr; + searchEntryPtr != NULL; + searchEntryPtr = searchEntryPtr->nextCascadePtr) { + searchName = Tcl_GetStringFromObj(searchEntryPtr->namePtr, NULL); + if (strcmp(searchName, menuName) == 0) { + Tk_Window parentTopLevelPtr = searchEntryPtr + ->menuPtr->parentTopLevelPtr; + + if (parentTopLevelPtr != NULL) { + GetSystemMenu(TkWinGetWrapperWindow(parentTopLevelPtr), + TRUE); } + break; } - } else { - DestroyMenu(winMenuHdl); } - menuPtr->platformData = NULL; + } else { + Tcl_HashEntry *hashEntryPtr; + + /* + * Remove the menu from the menu hash table, then destroy the handle. + */ + + hashEntryPtr = Tcl_FindHashEntry(&winMenuTable, (char *) winMenuHdl); + if (hashEntryPtr != NULL) { + Tcl_DeleteHashEntry(hashEntryPtr); + } + DestroyMenu(winMenuHdl); } + menuPtr->platformData = NULL; } /* @@ -538,7 +554,7 @@ ReconfigureWindowsMenu( if ((menuPtr->menuType == MENUBAR) && (menuPtr->parentTopLevelPtr != NULL)) { width = Tk_Width(menuPtr->parentTopLevelPtr); - height = Tk_Width(menuPtr->parentTopLevelPtr); + height = Tk_Height(menuPtr->parentTopLevelPtr); } base = (menuPtr->menuFlags & MENU_SYSTEM_MENU) ? 7 : 0; @@ -599,58 +615,55 @@ ReconfigureWindowsMenu( } itemID = (int) mePtr->platformEntryData; - if (mePtr->type == CASCADE_ENTRY) { - if ((mePtr->childMenuRefPtr != NULL) - && (mePtr->childMenuRefPtr->menuPtr != NULL)) { - HMENU childMenuHdl = - (HMENU) mePtr->childMenuRefPtr->menuPtr - ->platformData; - if (childMenuHdl != NULL) { - itemID = (UINT) childMenuHdl; - flags |= MF_POPUP; - } - if ((menuPtr->menuType == MENUBAR) - && !(mePtr->childMenuRefPtr->menuPtr->menuFlags - & MENU_SYSTEM_MENU)) { - TkMenuReferences *menuRefPtr; - TkMenu *systemMenuPtr = mePtr->childMenuRefPtr - ->menuPtr; - char *systemMenuName = ckalloc(strlen( - Tk_PathName(menuPtr->masterMenuPtr->tkwin)) - + strlen(".system") + 1); - menuRefPtr = TkFindMenuReferences(menuPtr->interp, - systemMenuName); - if ((menuRefPtr != NULL) - && (menuRefPtr->menuPtr != NULL) - && (menuPtr->parentTopLevelPtr != NULL) - && (systemMenuPtr->masterMenuPtr - == menuRefPtr->menuPtr)) { - HMENU systemMenuHdl = - (HMENU) systemMenuPtr->platformData; - HWND wrapper = TkWinGetWrapperWindow(menuPtr - ->parentTopLevelPtr); - if (wrapper != NULL) { - DestroyMenu(systemMenuHdl); - systemMenuHdl = GetSystemMenu( - wrapper, FALSE); - systemMenuPtr->menuFlags |= MENU_SYSTEM_MENU; - systemMenuPtr->platformData = - (TkMenuPlatformData) systemMenuHdl; - if (!(systemMenuPtr->menuFlags - & MENU_RECONFIGURE_PENDING)) { - systemMenuPtr->menuFlags - |= MENU_RECONFIGURE_PENDING; - Tcl_DoWhenIdle(ReconfigureWindowsMenu, - (ClientData) systemMenuPtr); - } + if ((mePtr->type == CASCADE_ENTRY) + && (mePtr->childMenuRefPtr != NULL) + && (mePtr->childMenuRefPtr->menuPtr != NULL)) { + HMENU childMenuHdl = (HMENU) mePtr->childMenuRefPtr->menuPtr + ->platformData; + if (childMenuHdl != NULL) { + itemID = (UINT) childMenuHdl; + flags |= MF_POPUP; + } + if ((menuPtr->menuType == MENUBAR) + && !(mePtr->childMenuRefPtr->menuPtr->menuFlags + & MENU_SYSTEM_MENU)) { + TkMenuReferences *menuRefPtr; + TkMenu *systemMenuPtr = mePtr->childMenuRefPtr + ->menuPtr; + char *systemMenuName = ckalloc(strlen( + Tk_PathName(menuPtr->masterMenuPtr->tkwin)) + + strlen(".system") + 1); + menuRefPtr = TkFindMenuReferences(menuPtr->interp, + systemMenuName); + if ((menuRefPtr != NULL) + && (menuRefPtr->menuPtr != NULL) + && (menuPtr->parentTopLevelPtr != NULL) + && (systemMenuPtr->masterMenuPtr + == menuRefPtr->menuPtr)) { + HMENU systemMenuHdl = + (HMENU) systemMenuPtr->platformData; + HWND wrapper = TkWinGetWrapperWindow(menuPtr + ->parentTopLevelPtr); + if (wrapper != NULL) { + DestroyMenu(systemMenuHdl); + systemMenuHdl = GetSystemMenu(wrapper, FALSE); + systemMenuPtr->menuFlags |= MENU_SYSTEM_MENU; + systemMenuPtr->platformData = + (TkMenuPlatformData) systemMenuHdl; + if (!(systemMenuPtr->menuFlags + & MENU_RECONFIGURE_PENDING)) { + systemMenuPtr->menuFlags + |= MENU_RECONFIGURE_PENDING; + Tcl_DoWhenIdle(ReconfigureWindowsMenu, + (ClientData) systemMenuPtr); } } - ckfree(systemMenuName); - } - if (mePtr->childMenuRefPtr->menuPtr->menuFlags - & MENU_SYSTEM_MENU) { - systemMenu++; } + ckfree(systemMenuName); + } + if (mePtr->childMenuRefPtr->menuPtr->menuFlags + & MENU_SYSTEM_MENU) { + systemMenu++; } } } @@ -894,7 +907,18 @@ TkWinHandleMenuEvent(phwnd, pMessage, pwParam, plParam, plResult) ReconfigureWindowsMenu((ClientData) menuPtr); } if (!inPostMenu) { - TkPreprocessMenu(menuPtr); + Tcl_Interp *interp; + int code; + + interp = menuPtr->interp; + Tcl_Preserve((ClientData)interp); + code = TkPreprocessMenu(menuPtr); + if ((code != TCL_OK) && (code != TCL_CONTINUE) + && (code != TCL_BREAK)) { + Tcl_AddErrorInfo(interp, "\n (menu preprocess)"); + Tcl_BackgroundError(interp); + } + Tcl_Release((ClientData)interp); } TkActivateMenuEntry(menuPtr, -1); *plResult = 0; @@ -907,64 +931,68 @@ TkWinHandleMenuEvent(phwnd, pMessage, pwParam, plParam, plResult) case WM_SYSCOMMAND: case WM_COMMAND: { TkMenuInit(); - if (HIWORD(*pwParam) == 0) { - hashEntryPtr = Tcl_FindHashEntry(&commandTable, - (char *)LOWORD(*pwParam)); - if (hashEntryPtr != NULL) { - mePtr = (TkMenuEntry *) Tcl_GetHashValue(hashEntryPtr); - if (mePtr != NULL) { - TkMenuReferences *menuRefPtr; - TkMenuEntry *parentEntryPtr; - int code; - - /* - * We have to set the parent of this menu to be active - * if this is a submenu so that tearoffs will get the - * correct title. - */ - - menuPtr = mePtr->menuPtr; - menuRefPtr = TkFindMenuReferences(menuPtr->interp, - Tk_PathName(menuPtr->tkwin)); - if ((menuRefPtr != NULL) - && (menuRefPtr->parentEntryPtr != NULL)) { - char *name; - int state; - - for (parentEntryPtr = menuRefPtr->parentEntryPtr; - ; - parentEntryPtr = - parentEntryPtr->nextCascadePtr) { - name = Tcl_GetStringFromObj( - parentEntryPtr->namePtr, NULL); - if (strcmp(name, Tk_PathName(menuPtr->tkwin)) - == 0) { - break; - } - } - Tcl_GetIndexFromObj(NULL, parentEntryPtr->menuPtr - ->entries[parentEntryPtr->index] - ->statePtr, tkMenuStateStrings, NULL, - 0, &state); - if (state != ENTRY_DISABLED) { - TkActivateMenuEntry(parentEntryPtr->menuPtr, - parentEntryPtr->index); - } - } - - code = TkInvokeMenu(mePtr->menuPtr->interp, - menuPtr, mePtr->index); - if (code != TCL_OK && code != TCL_CONTINUE - && code != TCL_BREAK) { - Tcl_AddErrorInfo(mePtr->menuPtr->interp, - "\n (menu invoke)"); - Tcl_BackgroundError(mePtr->menuPtr->interp); - } + if (HIWORD(*pwParam) != 0) { + break; + } + hashEntryPtr = Tcl_FindHashEntry(&commandTable, + (char *)LOWORD(*pwParam)); + if (hashEntryPtr == NULL) { + break; + } + mePtr = (TkMenuEntry *) Tcl_GetHashValue(hashEntryPtr); + if (mePtr != NULL) { + TkMenuReferences *menuRefPtr; + TkMenuEntry *parentEntryPtr; + Tcl_Interp *interp; + int code; + + /* + * We have to set the parent of this menu to be active + * if this is a submenu so that tearoffs will get the + * correct title. + */ + + menuPtr = mePtr->menuPtr; + menuRefPtr = TkFindMenuReferences(menuPtr->interp, + Tk_PathName(menuPtr->tkwin)); + if ((menuRefPtr != NULL) + && (menuRefPtr->parentEntryPtr != NULL)) { + char *name; + int state; + + for (parentEntryPtr = menuRefPtr->parentEntryPtr; + ; + parentEntryPtr = + parentEntryPtr->nextCascadePtr) { + name = Tcl_GetStringFromObj( + parentEntryPtr->namePtr, NULL); + if (strcmp(name, Tk_PathName(menuPtr->tkwin)) + == 0) { + break; + } } - *plResult = 0; - returnResult = 1; + Tcl_GetIndexFromObj(NULL, parentEntryPtr->menuPtr + ->entries[parentEntryPtr->index] + ->statePtr, tkMenuStateStrings, NULL, + 0, &state); + if (state != ENTRY_DISABLED) { + TkActivateMenuEntry(parentEntryPtr->menuPtr, + parentEntryPtr->index); + } + } + + interp = menuPtr->interp; + Tcl_Preserve((ClientData)interp); + code = TkInvokeMenu(interp, menuPtr, mePtr->index); + if (code != TCL_OK && code != TCL_CONTINUE + && code != TCL_BREAK) { + Tcl_AddErrorInfo(interp, "\n (menu invoke)"); + Tcl_BackgroundError(interp); } + Tcl_Release((ClientData)interp); } + *plResult = 0; + returnResult = 1; break; } @@ -992,10 +1020,10 @@ TkWinHandleMenuEvent(phwnd, pMessage, pwParam, plParam, plResult) == CharUpper((LPTSTR) (unsigned char) label[underline]))) { *plResult = (2 << 16) | i; + returnResult = 1; break; } } - returnResult = 1; } break; } @@ -1764,6 +1792,7 @@ MenuKeyBindProc(clientData, interp, eventPtr, tkwin, keySym) UINT scanCode; UINT virtualKey; TkWindow *winPtr = (TkWindow *)tkwin; + int i; if (eventPtr->type == KeyPress) { switch (keySym) { @@ -1791,6 +1820,15 @@ MenuKeyBindProc(clientData, interp, eventPtr, tkwin, keySym) CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYDOWN, virtualKey, ((scanCode << 16) | (1 << 29))); + if (eventPtr->xkey.nchars > 0) { + for (i = 0; i < eventPtr->xkey.nchars; i++) { + CallWindowProc(DefWindowProc, + Tk_GetHWND(Tk_WindowId(tkwin)), + WM_SYSCHAR, + eventPtr->xkey.trans_chars[i], + ((scanCode << 16) | (1 << 29))); + } + } } } } else if (eventPtr->type == KeyRelease) { diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c index 1ca2d7e..7ee6952 100644 --- a/win/tkWinPixmap.c +++ b/win/tkWinPixmap.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinPixmap.c 1.18 97/08/06 15:36:23 + * RCS: @(#) $Id: tkWinPixmap.c,v 1.1.4.1 1998/09/30 02:19:36 stanton Exp $ */ #include "tkWinInt.h" diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c index 96661ae..7820084 100644 --- a/win/tkWinPointer.c +++ b/win/tkWinPointer.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinPointer.c 1.28 97/10/31 08:40:07 + * RCS: @(#) $Id: tkWinPointer.c,v 1.1.4.1 1998/09/30 02:19:36 stanton Exp $ */ #include "tkWinInt.h" @@ -409,6 +409,15 @@ TkpChangeFocus(winPtr, force) if (winPtr->window == None) { panic("ChangeXFocus got null X window"); } + + /* + * Change the foreground window so the focus window is raised to the top of + * the system stacking order and gets the keyboard focus. + */ + + if (force) { + SetForegroundWindow(Tk_GetHWND(winPtr->window)); + } XSetInputFocus(dispPtr->display, winPtr->window, RevertToParent, CurrentTime); diff --git a/win/tkWinPort.h b/win/tkWinPort.h index c2e9658..333f7ed 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinPort.h 1.27 98/02/10 10:35:52 + * RCS: @(#) $Id: tkWinPort.h,v 1.1.4.2 1998/09/30 02:19:37 stanton Exp $ */ #ifndef _WINPORT diff --git a/win/tkWinRegion.c b/win/tkWinRegion.c index 3303022..2d10481 100644 --- a/win/tkWinRegion.c +++ b/win/tkWinRegion.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinRegion.c 1.7 96/05/03 11:05:54 + * RCS: @(#) $Id: tkWinRegion.c,v 1.1.4.1 1998/09/30 02:19:37 stanton Exp $ */ #include "tkWinInt.h" diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index 613469f..28314c9 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinScrlbr.c 1.20 97/11/07 21:25:53 + * RCS: @(#) $Id: tkWinScrlbr.c,v 1.1.4.2 1998/09/30 02:19:37 stanton Exp $ */ #include "tkWinInt.h" diff --git a/win/tkWinSend.c b/win/tkWinSend.c index 120ccf9..1f82b93 100644 --- a/win/tkWinSend.c +++ b/win/tkWinSend.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinSend.c 1.15 98/02/19 17:04:54 + * RCS: @(#) $Id: tkWinSend.c,v 1.1.4.2 1998/09/30 02:19:38 stanton Exp $ */ #include "tkWinInt.h" diff --git a/win/tkWinTest.c b/win/tkWinTest.c index 3ca00d4..4af98dc 100644 --- a/win/tkWinTest.c +++ b/win/tkWinTest.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinTest.c 1.4 97/11/07 21:26:18 + * RCS: @(#) $Id: tkWinTest.c,v 1.1.2.2 1998/09/30 02:19:38 stanton Exp $ */ #include "tkWinInt.h" diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index ab723c4..3ddc67b 100644 --- a/win/tkWinWindow.c +++ b/win/tkWinWindow.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinWindow.c 1.25 97/12/08 15:16:32 + * RCS: @(#) $Id: tkWinWindow.c,v 1.1.4.2 1998/09/30 02:19:39 stanton Exp $ */ #include "tkWinInt.h" @@ -261,9 +261,9 @@ TkpMakeWindow(winPtr, parent) * stacking order. */ - hwnd = CreateWindow(TK_WIN_CHILD_CLASS_NAME, NULL, style, - Tk_X(winPtr), Tk_Y(winPtr), Tk_Width(winPtr), Tk_Height(winPtr), - parentWin, NULL, Tk_GetHINSTANCE(), NULL); + hwnd = CreateWindowEx(WS_EX_NOPARENTNOTIFY, TK_WIN_CHILD_CLASS_NAME, NULL, + style, Tk_X(winPtr), Tk_Y(winPtr), Tk_Width(winPtr), + Tk_Height(winPtr), parentWin, NULL, Tk_GetHINSTANCE(), NULL); SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); return Tk_AttachHWND((Tk_Window)winPtr, hwnd); diff --git a/win/tkWinWm.c b/win/tkWinWm.c index c81e137..4d0d887 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -11,12 +11,23 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinWm.c 1.68 97/11/07 21:25:21 + * RCS: @(#) $Id: tkWinWm.c,v 1.1.4.2 1998/09/30 02:19:39 stanton Exp $ */ #include "tkWinInt.h" /* + * Event structure for synthetic activation events. These events are + * placed on the event queue whenever a toplevel gets a WM_MOUSEACTIVATE + * message. + */ + +typedef struct ActivateEvent { + Tcl_Event ev; + TkWindow *winPtr; +} ActivateEvent; + +/* * A data structure of the following type holds information for * each window manager protocol (such as WM_DELETE_WINDOW) for * which a handler (i.e. a Tcl command) has been defined for a @@ -211,7 +222,8 @@ typedef struct TkWmInfo { #define WM_TRANSIENT_STYLE \ (WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_CLIPSIBLINGS|CS_DBLCLKS) -#define EX_TRANSIENT_STYLE (WS_EX_TOOLWINDOW | WS_EX_DLGMODALFRAME) +#define EX_TRANSIENT_STYLE \ + (WS_EX_TOOLWINDOW|WS_EX_DLGMODALFRAME) /* * This module keeps a list of all top-level windows. @@ -282,6 +294,8 @@ static int firstWindow = 1; * Forward declarations for procedures defined in this file: */ +static int ActivateWindow _ANSI_ARGS_((Tcl_Event *evPtr, + int flags)); static void ConfigureEvent _ANSI_ARGS_((TkWindow *winPtr, XConfigureEvent *eventPtr)); static void ConfigureTopLevel _ANSI_ARGS_((WINDOWPOS *pos)); @@ -731,6 +745,13 @@ UpdateWrapper(winPtr) if (oldWrapper && (oldWrapper != wmPtr->wrapper) && (oldWrapper != GetDesktopWindow())) { SetWindowLong(oldWrapper, GWL_USERDATA, (LONG) NULL); + + /* + * Remove the menubar before destroying the window so the menubar + * isn't destroyed. + */ + + SetMenu(oldWrapper, NULL); DestroyWindow(oldWrapper); } wmPtr->flags &= ~WM_NEVER_MAPPED; @@ -1361,6 +1382,9 @@ Tk_WmCmd(clientData, interp, argc, argv) argv[0], " frame window\"", (char *) NULL); return TCL_ERROR; } + if (Tk_WindowId((Tk_Window) winPtr) == None) { + Tk_MakeWindowExist((Tk_Window) winPtr); + } hwnd = wmPtr->wrapper; if (hwnd == NULL) { hwnd = Tk_GetHWND(Tk_WindowId((Tk_Window) winPtr)); @@ -3991,6 +4015,44 @@ WmProc(hwnd, message, wParam, lParam) result = 0; goto done; + case WM_NCHITTEST: { + winPtr = GetTopLevel(hwnd); + if (winPtr && (TkGrabState(winPtr) == TK_GRAB_EXCLUDED)) { + /* + * This window is outside the grab heirarchy, so don't let any + * of the normal non-client processing occur. Note that this + * implementation is not strictly correct because the grab + * might change between now and when the event would have been + * processed by Tk, but it's close enough. + */ + + result = HTCLIENT; + goto done; + } + break; + } + + case WM_MOUSEACTIVATE: { + ActivateEvent *eventPtr; + winPtr = GetTopLevel((HWND) wParam); + + /* + * Don't activate the window yet since there may be grabs + * that should take precedence. Instead we need to queue + * an event so we can check the grab state right before we + * handle the mouse event. + */ + + if (winPtr) { + eventPtr = (ActivateEvent *)ckalloc(sizeof(ActivateEvent)); + eventPtr->ev.proc = ActivateWindow; + eventPtr->winPtr = winPtr; + Tcl_QueueEvent((Tcl_Event*)eventPtr, TCL_QUEUE_TAIL); + } + result = MA_NOACTIVATE; + goto done; + } + default: break; } @@ -4145,3 +4207,43 @@ TkpGetWrapperWindow( } return winPtr; } + +/* + *---------------------------------------------------------------------- + * + * ActivateWindow -- + * + * This function is called when an ActivateEvent is processed. + * + * Results: + * Returns 1 to indicate that the event was handled, else 0. + * + * Side effects: + * May activate the toplevel window associated with the event. + * + *---------------------------------------------------------------------- + */ + +static int +ActivateWindow( + Tcl_Event *evPtr, /* Pointer to ActivateEvent. */ + int flags) /* Notifier event mask. */ +{ + TkWindow *winPtr; + + if (! (flags & TCL_WINDOW_EVENTS)) { + return 0; + } + + winPtr = ((ActivateEvent *) evPtr)->winPtr; + + /* + * Ensure that the window is not excluded by a grab. + */ + + if (winPtr && (TkGrabState(winPtr) != TK_GRAB_EXCLUDED)) { + SetFocus(Tk_GetHWND(winPtr->window)); + } + + return 1; +} diff --git a/win/tkWinX.c b/win/tkWinX.c index 579eaf7..3ef489b 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkWinX.c 1.55 98/01/21 00:23:17 + * RCS: @(#) $Id: tkWinX.c,v 1.1.4.2 1998/09/30 02:19:40 stanton Exp $ */ #include "tkWinInt.h" @@ -592,6 +592,11 @@ Tk_TranslateWinEvent(hwnd, message, wParam, lParam, resultPtr) case WM_KEYUP: GenerateXEvent(hwnd, message, wParam, lParam); return 1; + case WM_MENUCHAR: + GenerateXEvent(hwnd, message, wParam, lParam); + /* MNC_CLOSE is the only one that looks right. This is a hack. */ + *resultPtr = MAKELONG (0, MNC_CLOSE); + return 1; } return 0; } @@ -935,10 +940,20 @@ GetTranslatedKey(xkey) while ((xkey->nbytes < XMaxTransChars) && PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { - if (msg.message == WM_CHAR) { + if ((msg.message == WM_CHAR) || (msg.message == WM_SYSCHAR)) { + xkey->trans_chars[xkey->nchars] = (char) msg.wParam; + xkey->nchars++; GetMessage(&msg, NULL, 0, 0); - if (msg.lParam & 0x20000000) { + /* + * If this is a normal character message, we may need to strip + * off the Alt modifier (e.g. Alt-digits). Note that we don't + * want to do this for system messages, because those were + * presumably generated as an Alt-char sequence (e.g. accelerator + * keys). + */ + + if ((msg.message == WM_CHAR) && (msg.lParam & 0x20000000)) { xkey->state = 0; } buf[xkey->nbytes] = (char) msg.wParam; diff --git a/win/winMain.c b/win/winMain.c index 691aa91..22b7bbc 100644 --- a/win/winMain.c +++ b/win/winMain.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) winMain.c 1.37 98/01/20 22:47:06 + * RCS: @(#) $Id: winMain.c,v 1.1.4.2 1998/09/30 02:19:41 stanton Exp $ */ #include <tk.h> @@ -200,9 +200,7 @@ WishPanic TCL_VARARGS_DEF(char *,arg1) MessageBox(NULL, buf, "Fatal Error in Wish", MB_ICONSTOP | MB_OK | MB_TASKMODAL | MB_SETFOREGROUND); #ifdef _MSC_VER - _asm { - int 3 - } + DebugBreak(); #endif ExitProcess(1); } |