Capturing Command-Q in Darwin tclkits

2 views
Skip to first unread message

irrational

unread,
Apr 20, 2009, 3:28:01 AM4/20/09
to starkit
I have an application that wants to do some cleaning-up and query user
about unsaved changes before quitting.
Here is a little test.tcl for doing this
--------------------------
# test.tcl
package require Tk
proc my_exit {} {
puts {Drive safely}
exit
}
button .q -text Quit -command my_exit
pack .q
bind . <Control-q> my_exit
bind . <Command-q> my_exit
--------------------------
You see my safe exit procedure should run on clicking the Quit button,
or typing Control-Q, or Command-Q.
On a Mac, running

wish test.tcl

all quit routes behave as intended. Using tclkits, the button and
Control-Q work as expected. However, running

tclkit-darwin-univ-aqua test.tcl

a Command-Q exits the tclkit without going through my_exit, and
running

tclkit-darwin-univ test.tcl

a Command-Q brings up a dialog as to whether I want to exit X11.

Why does this happen, and how do I get the behaviour I want?
(Actually I'd be happy with a "how" answer without the "why")

K
Reply all
Reply to author
Forward
0 new messages