-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.tcltk
208 lines (163 loc) · 5.68 KB
/
README.tcltk
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
Building TCL 8.5.0
------------------
Building the Tcl and Tk libraries version 8.5.0 works in the same way
as described below for 8.4. However the Tk library patch is no longer
required (since it's now possible to catch shutdown messages by means
of the wm protocol command.) The message box patch is currently also
not used.
To cross-compile the libraries for Windows on a Linux host, proceed
as follows:
- cd into the "win" sub-directory
- extend your PATH so that "windres" is found, if necessary
- set environment variable CC so that the mingw32 gcc compiler is
used instead of gcc (e.g. setenv CC i586-mingw32msvc-gcc)
- run the configure script with parameter --host=linux
and optionally --prefix=/tmp/tcl-win32
- in the generated makefiles, edit the rule for ".rc.$(RES):" to
add the path to the mingw32 include directory (else compilation
of the "rc" files will fail)
- finally, to get the nxtvepg logo in the Windows task bar, all ico
files must be overwritten with the content of nxtvepg.ico (nxtvepg
tries to override the logo at run-time, but that doesn't work)
- patch tk8.5.6/win/tkWinWm.c to include the below extension
- make
- make install may fail due to trying to run ./tclsh.exe: edit the
makefile and modify the two install rules to use the host "tclsh"
instead
Patch for power event handling:
-------------------------------
File tk8.5.6/win/tkWinWm.c:
//...
#include <pbt.h> //TZO++
//...
static LRESULT CALLBACK
WmProc(
//...
case WM_QUERYENDSESSION: {
//...
case WM_POWERBROADCAST: {
XEvent event;
/*
* XXX TZO extension for nxtvepg:
* Synthesize wm protocol messages on Windows suspend and resume
*/
if ((wParam == PBT_APMQUERYSUSPEND)||
(wParam == PBT_APMQUERYSTANDBY)) {
winPtr = GetTopLevel(hwnd);
event.xclient.message_type =
Tk_InternAtom((Tk_Window) winPtr, "WM_PROTOCOLS");
event.xclient.data.l[0] =
Tk_InternAtom((Tk_Window) winPtr, "WM_APM_QUERY_SUSPEND");
TkWmProtocolEventProc(winPtr, &event);
} else if ((wParam == PBT_APMSUSPEND)||
(wParam == PBT_APMSTANDBY)) {
winPtr = GetTopLevel(hwnd);
event.xclient.message_type =
Tk_InternAtom((Tk_Window) winPtr, "WM_PROTOCOLS");
event.xclient.data.l[0] =
Tk_InternAtom((Tk_Window) winPtr, "WM_APM_SUSPEND");
TkWmProtocolEventProc(winPtr, &event);
}
else if ((wParam == PBT_APMRESUMESUSPEND)||
(wParam == PBT_APMRESUMESTANDBY)) {
winPtr = GetTopLevel(hwnd);
event.xclient.message_type =
Tk_InternAtom((Tk_Window) winPtr, "WM_PROTOCOLS");
event.xclient.data.l[0] =
Tk_InternAtom((Tk_Window) winPtr, "WM_APM_RESUME");
TkWmProtocolEventProc(winPtr, &event);
}
break;
}
//...
Building TCL 8.4.x
------------------
This describes how to compile Tcl/Tk version 8.4b1 and later for gcc/mingw32
(i.e. on Windows in the GNU/Cygwin environment) and which patches
have been made against the original Tk 8.4b1 library.
[note: working directory: /cygdrive/e/tcl]
TCL Build
---------
cd tcl8.4b1/win
Edit configure script:
CFLAGS=-mno-cygwin
sh configure
Edit generated Makefile:
prefix=/d/gnu/tcl84
exec_prefix=${prefix}
make install
TK build
--------
cd tk8.4b1/win
Edit configure script:
CFLAGS=-mno-cygwin
sh configure
Edit generated Makefile:
prefix=/d/gnu/tcl84
exec_prefix=${prefix}
libdir=${prefix}/lib
replace win/rc/tk.ico with nxtvepg.ico
windres -o tk.res.o rc/tk.rc --include ../generic --include ../../tcl8.4b1/generic --include rc
windres -o wish.res.o rc/tk.rc --include ../generic --include ../../tcl8.4b1/generic --include rc
patch tk_messageBox:
diff -r tk8.4b1-orig/generic/tkWindow.c tk8.4b1/generic/tkWindow.c
125c125
< #ifdef __WIN32__
---
> #ifdef USE_WIN32_MSGBOX /*__WIN32__ // disabled by TZ (again) 2002-04-30 */
patch shutdown message:
diff -r tk8.4b1-orig/generic/tk.decls tk8.4b1/generic/tk.decls
1278a1279,1282
> declare 6 win {
> void Tk_RegisterMainDestructionHandler ( ClientData clientData )
> }
>
diff -r tk8.4b1-orig/generic/tkPlatDecls.h tk8.4b1/generic/tkPlatDecls.h
49a50,52
> /* 6 */
> EXTERN void Tk_RegisterMainDestructionHandler _ANSI_ARGS_((
> Tcl_CloseProc * handler ));
96a100
> void (*tk_RegisterMainDestructionHandler) _ANSI_ARGS_((Tcl_CloseProc * handler)); /* 6 */
150a155,158
> #endif
> #ifndef Tk_RegisterMainDestructionHandler
> #define Tk_RegisterMainDestructionHandler \
> (tkPlatStubsPtr->tk_RegisterMainDestructionHandler) /* 6 */
diff -r tk8.4b1-orig/generic/tkStubInit.c tk8.4b1/generic/tkStubInit.c
628a629
> Tk_RegisterMainDestructionHandler, /* 6 */
diff -r tk8.4b1-orig/win/tkWinX.c tk8.4b1/win/tkWinX.c
116a117,134
> * Tk_RegisterMainDestructionHandler
> *
> * Patched in by tzo: set a handler for shutdown messages
> *
> *----------------------------------------------------------------------
> */
> static Tcl_CloseProc * tkMainDestructionHandler = NULL;
>
> void
> Tk_RegisterMainDestructionHandler( Tcl_CloseProc * handler )
> {
> tkMainDestructionHandler = handler;
> }
>
>
> /*
> *----------------------------------------------------------------------
> *
650a669,677
>
> /* TZ++ Jul/2002: this is a hack to catch shutdown messages */
> case WM_QUERYENDSESSION:
> case WM_ENDSESSION:
> if (tkMainDestructionHandler != NULL)
> {
> tkMainDestructionHandler(NULL);
> }
> /*fall-through*/
make install
note: after adding the shutdown patch the include files
must be installed again, or the new function is missing
which can lead to strange linker errors.