Tk Source Code

Changes On Branch bug-9ba9729ef1
Login

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

Changes In Branch bug-9ba9729ef1 Excluding Merge-Ins

This is equivalent to a diff from 031211db to f12f630b

2025-08-18
22:37
Fix [9ba9729ef1]: Limitation of [send] on macOS is not reflected in documentation and tests check-in: 6a6e9a5b user: erikleunissen tags: simplify_test_file_init_for_singleproc_1
22:14
Fix [9ba9729ef1]: Limitation of [send] on macOS is not reflected in documentation and tests Leaf check-in: 718af4f8 user: erikleunissen tags: trunk, main
22:10
Remove Github CI scheduling intructions Closed-Leaf check-in: f12f630b user: erikleunissen tags: bug-9ba9729ef1
2025-08-17
16:42
send.n: don't make claims about behaviour that might be unintended check-in: db0cf509 user: erikleunissen tags: bug-9ba9729ef1
2025-08-16
22:24
Merge 9.0 check-in: e0a88b0c user: jan.nijtmans tags: trunk, main
20:05
Let tests be run at Github CI for this branch check-in: dd5d0ddc user: erikleunissen tags: bug-9ba9729ef1
07:43
Ticket [9ba9729ef1]: text complements for man winfo and man send check-in: 731a5957 user: erikleunissen tags: bug-9ba9729ef1
2025-08-15
22:25
Merge 9.0 check-in: 031211db user: jan.nijtmans tags: trunk, main
22:23
Merge 8.6 check-in: d266a4ff user: jan.nijtmans tags: core-9-0-branch
2025-08-13
14:04
Merge 9.0 check-in: 6242b4c1 user: jan.nijtmans tags: trunk, main

Changes to doc/send.n.
86
87
88
89
90
91
92





93
94
95
96
97
98
99
is enabled (i.e. only certain hosts can establish connections) and (b) the
list of enabled hosts is empty.
This means that applications cannot connect to your server unless
they use some other form of authorization
such as that provide by \fBxauth\fR.
Under Windows, \fBsend\fR is currently disabled.  Most of the
functionality is provided by the \fBdde\fR command instead.





.SH EXAMPLE
.PP
This script fragment can be used to make an application that only runs
once on a particular display.
.CS
if {[tk appname FoobarApp] ne "FoobarApp"} {
    \fBsend\fR -async FoobarApp RemoteStart $argv







>
>
>
>
>







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
is enabled (i.e. only certain hosts can establish connections) and (b) the
list of enabled hosts is empty.
This means that applications cannot connect to your server unless
they use some other form of authorization
such as that provide by \fBxauth\fR.
Under Windows, \fBsend\fR is currently disabled.  Most of the
functionality is provided by the \fBdde\fR command instead.
.SH LIMITATIONS
.PP
Under macOS/aqua, the send command works only with interpreters that exist in
the same process (these are returned by "winfo interps"). Invocations that
target an interpreter that exists in another process don't accomplish anything.
.SH EXAMPLE
.PP
This script fragment can be used to make an application that only runs
once on a particular display.
.CS
if {[tk appname FoobarApp] ne "FoobarApp"} {
    \fBsend\fR -async FoobarApp RemoteStart $argv
Changes to tests/send.test.
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
} {1 {target application died or uses a Tk version before 4.0}}
test send-5.4 {ValidateName procedure} {secureserver testsend} {
    tk appname test
    testsend prop root InterpRegistry "$commId Bogus\n$commId test\n"
    winfo interps
} {test}

if {[testConstraint nonPortable] && [testConstraint xhost]} {
    winfo interps
    tk appname tktest
    update
    childTkProcess create
    set x [split [exec xhost] \n]
    foreach i [lrange $x 1 end]  {
	exec xhost - $i
    }
}

test send-6.1 {ServerSecure procedure} {nonPortable secureserver} {
    set a 44
    list [childTkProcess eval [list send [tk appname] set a 55]] $a
} {55 55}
test send-6.2 {ServerSecure procedure} {nonPortable secureserver xhost} {
    set a 22
    exec xhost [exec hostname]
    list [catch {childTkProcess eval [list send [tk appname] set a 33]} msg] $a $msg
} {0 22 {X server insecure (must use xauth-style authorization); command ignored}}
test send-6.3 {ServerSecure procedure} {nonPortable secureserver xhost} {
    set a abc
    exec xhost - [exec hostname]
    list [childTkProcess eval [list send [tk appname] set a new]] $a
} {new new}
childTkProcess exit

test send-7.1 {Tk_SetAppName procedure} {secureserver testsend} {







|










|



|




|







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
} {1 {target application died or uses a Tk version before 4.0}}
test send-5.4 {ValidateName procedure} {secureserver testsend} {
    tk appname test
    testsend prop root InterpRegistry "$commId Bogus\n$commId test\n"
    winfo interps
} {test}

if {[testConstraint nonPortable] && [testConstraint xhost] && [testConstraint notAqua]} {
    winfo interps
    tk appname tktest
    update
    childTkProcess create
    set x [split [exec xhost] \n]
    foreach i [lrange $x 1 end]  {
	exec xhost - $i
    }
}

test send-6.1 {ServerSecure procedure} {nonPortable secureserver notAqua} {
    set a 44
    list [childTkProcess eval [list send [tk appname] set a 55]] $a
} {55 55}
test send-6.2 {ServerSecure procedure} {nonPortable secureserver xhost notAqua} {
    set a 22
    exec xhost [exec hostname]
    list [catch {childTkProcess eval [list send [tk appname] set a 33]} msg] $a $msg
} {0 22 {X server insecure (must use xauth-style authorization); command ignored}}
test send-6.3 {ServerSecure procedure} {nonPortable secureserver xhost notAqua} {
    set a abc
    exec xhost - [exec hostname]
    list [childTkProcess eval [list send [tk appname] set a new]] $a
} {new new}
childTkProcess exit

test send-7.1 {Tk_SetAppName procedure} {secureserver testsend} {
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
    send -async $app [list send [tk appname] set a 77]
    set result $a
    after 200 set x 40
    tkwait variable x
    childTkProcess exit
    lappend result $a
} {66 77}
test send-8.2 {Tk_SendCmd procedure, options} {secureserver altDisplay} {
    childTkProcess create -display $env(TK_ALT_DISPLAY)
    tk appname xyzgorp
    set a homeDisplay
    set result [childTkProcess eval "
    toplevel .t -screen [winfo screen .]
    wm geometry .t +0+0
    set a altDisplay







|







190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
    send -async $app [list send [tk appname] set a 77]
    set result $a
    after 200 set x 40
    tkwait variable x
    childTkProcess exit
    lappend result $a
} {66 77}
test send-8.2 {Tk_SendCmd procedure, options} {secureserver altDisplay notAqua} {
    childTkProcess create -display $env(TK_ALT_DISPLAY)
    tk appname xyzgorp
    set a homeDisplay
    set result [childTkProcess eval "
    toplevel .t -screen [winfo screen .]
    wm geometry .t +0+0
    set a altDisplay
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
    winfo interps
    tk appname tktest
    set result
} {1 {no application named "bogus"}}

catch {interp delete t_s_1}

test send-8.17 {Tk_SendCmd procedure, deferring events} {secureserver nonPortable} {
    # Non-portable because some window managers ignore "raise"
    # requests so can't guarantee that new app's window won't
    # obscure .f, thereby masking the Expose event.

    childTkProcess create
    set app [childTkProcess eval {tk appname}]
    raise .		; # Don't want new app obscuring .f
    catch {destroy .f}
    frame .f
    place .f -x 0 -y 0
    bind .f <Expose> {set a exposed}
    set a {no event yet}
    set result ""
    lappend result [send $app send [list [tk appname]] set a]
    lappend result $a
    update
    childTkProcess exit
    lappend result $a
} {{no event yet} {no event yet} exposed}
test send-8.18 {Tk_SendCmd procedure, error in remote app} {secureserver} {
    childTkProcess create
    set app [childTkProcess eval {tk appname}]
    set result [string tolower [list [catch {send $app open bad_name} msg] \
	    $msg $errorInfo $errorCode]]
    childTkProcess exit
    set result
} {1 {couldn't open "bad_name": no such file or directory} {couldn't open "bad_name": no such file or directory
    while executing
"open bad_name"
    invoked from within
"send $app open bad_name"} {posix enoent {no such file or directory}}}
test send-8.19 {Tk_SendCmd, using modal timeouts} {secureserver} {
    childTkProcess create
    set app [childTkProcess eval {tk appname}]
    set x no
    set result ""
    after 0 {set x yes}
    lappend result [send $app {concat x y z}]
    lappend result $x







|



















|











|







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
    winfo interps
    tk appname tktest
    set result
} {1 {no application named "bogus"}}

catch {interp delete t_s_1}

test send-8.17 {Tk_SendCmd procedure, deferring events} {secureserver nonPortable notAqua} {
    # Non-portable because some window managers ignore "raise"
    # requests so can't guarantee that new app's window won't
    # obscure .f, thereby masking the Expose event.

    childTkProcess create
    set app [childTkProcess eval {tk appname}]
    raise .		; # Don't want new app obscuring .f
    catch {destroy .f}
    frame .f
    place .f -x 0 -y 0
    bind .f <Expose> {set a exposed}
    set a {no event yet}
    set result ""
    lappend result [send $app send [list [tk appname]] set a]
    lappend result $a
    update
    childTkProcess exit
    lappend result $a
} {{no event yet} {no event yet} exposed}
test send-8.18 {Tk_SendCmd procedure, error in remote app} {secureserver notAqua} {
    childTkProcess create
    set app [childTkProcess eval {tk appname}]
    set result [string tolower [list [catch {send $app open bad_name} msg] \
	    $msg $errorInfo $errorCode]]
    childTkProcess exit
    set result
} {1 {couldn't open "bad_name": no such file or directory} {couldn't open "bad_name": no such file or directory
    while executing
"open bad_name"
    invoked from within
"send $app open bad_name"} {posix enoent {no such file or directory}}}
test send-8.19 {Tk_SendCmd, using modal timeouts} {secureserver notAqua} {
    childTkProcess create
    set app [childTkProcess eval {tk appname}]
    set x no
    set result ""
    after 0 {set x yes}
    lappend result [send $app {concat x y z}]
    lappend result $x
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
test send-10.17 {SendEventProc procedure, errorCode and errorInfo} {secureserver testsend} {
    testsend prop comm Comm \
	    "r\n-i test1\n-e test2\n-c 4\n-s [testsend serial]\n"
    set errorCode oldErrorCode
    set errorInfo oldErrorInfo
    list [catch {send dummy foo} msg] $msg $errorInfo $errorCode
} {4 {} oldErrorInfo oldErrorCode}
test send-10.18 {SendEventProc procedure, send kills application} {secureserver testsend} {
    childTkProcess create
    childTkProcess eval {tk appname t_s_3}
    set x [list [catch {send t_s_3 destroy .} msg] $msg]
    childTkProcess exit
    set x
} {0 {}}
test send-10.19 {SendEventProc procedure, send exits} {secureserver testsend} {
    childTkProcess create
    childTkProcess eval {tk appname t_s_3}
    set x [list [catch {send t_s_3 exit} msg] $msg]
    childTkProcess exit
    set x
} {1 {target application died}}








|






|







479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
test send-10.17 {SendEventProc procedure, errorCode and errorInfo} {secureserver testsend} {
    testsend prop comm Comm \
	    "r\n-i test1\n-e test2\n-c 4\n-s [testsend serial]\n"
    set errorCode oldErrorCode
    set errorInfo oldErrorInfo
    list [catch {send dummy foo} msg] $msg $errorInfo $errorCode
} {4 {} oldErrorInfo oldErrorCode}
test send-10.18 {SendEventProc procedure, send kills application} {secureserver testsend notAqua} {
    childTkProcess create
    childTkProcess eval {tk appname t_s_3}
    set x [list [catch {send t_s_3 destroy .} msg] $msg]
    childTkProcess exit
    set x
} {0 {}}
test send-10.19 {SendEventProc procedure, send exits} {secureserver testsend notAqua} {
    childTkProcess create
    childTkProcess eval {tk appname t_s_3}
    set x [list [catch {send t_s_3 exit} msg] $msg]
    childTkProcess exit
    set x
} {1 {target application died}}

552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
    rename send {}
    set result {}
    lappend result [winfo interps] [info commands send]
    tk appname foo
    lappend result [winfo interps] [info commands send]
} {{} {} foo send}

test send-14.1 {SendRestrictProc procedure, sends crossing from different displays} {secureserver altDisplay} {
    childTkProcess create -display $env(TK_ALT_DISPLAY)
    set result [childTkProcess eval "
    toplevel .t -screen [winfo screen .]
    wm geometry .t +0+0
    tk appname xyzgorp1
    set x child
    "]







|







552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
    rename send {}
    set result {}
    lappend result [winfo interps] [info commands send]
    tk appname foo
    lappend result [winfo interps] [info commands send]
} {{} {} foo send}

test send-14.1 {SendRestrictProc procedure, sends crossing from different displays} {secureserver altDisplay notAqua} {
    childTkProcess create -display $env(TK_ALT_DISPLAY)
    set result [childTkProcess eval "
    toplevel .t -screen [winfo screen .]
    wm geometry .t +0+0
    tk appname xyzgorp1
    set x child
    "]