[PD-dev] no key commands in 0.37/MacOS X

Adam Lindsay atl at comp.lancs.ac.uk
Wed Sep 17 01:39:45 CEST 2003


[cc'd back to pd-dev list, cos others might find it interesting.]

Hans-Christoph Steiner said this at Tue, 16 Sep 2003 18:03:46 -0400:

>> Anyway, when did you switch to Tcl/Tk 8.4.4? which build did you get?
>> One of the raisons d'etre for my earlier distro was to have a small 
>> Tcl/
>> Tk that had an old (I picked it up on the net) patch that enabled the
>> short-cuts defined in the way Pd does it.
>>
>I just downgraded to Tcl/Tk 8.4.2 and that seems to have fixed it.  But 
>Miller's version is still using Ctrl instead of Cmd on MacOS X.  I was 

See, the version of Tcl/Tk on my machine (the one pkg'd with my
installer) takes advantage of the accel_munge tcl function (in pd.tk) and
modifies the menus to be command ("meta" in Tk parlance) instead of
control. Although the munge technically only is supposed to change the
appearance of menus, the Tcl/Tk patch takes that label and also respects
it as a shortcut.

So, effectively, on my machine (using my earlier Tcl/Tk from my distro),
both Cmd-1 and Ctrl-1 create an object. Weird, but not un-useful behaviour...

>going to try to extract a patch for that and send it to Miller so that 
>he would hopefully incorporate it into 0.37.  Do you happen to know 
>about the code that made that change?

As far as I see, Miller has included all the changes I made in pd.tk
(which is kind of pleasing :). The Tcl/Tk patch was different, and one of
the reasons for putting everything into one distro.

Here's the end of the thread (between Daniel Steffen and myself)
discussing this on the Mac Tcl/Tk list:

>I believe Daniel A. Steffen said this around Thu, 12 Dec 2002:
>
>>> with Command-key accelerators. That is, my application doesn't 
>>> recognise
>>> the command key in shortcuts.
>>
>>IIRC this is only the case if you don't add explicit bindings for the 
>>menu key shortcuts, the code looking for implicit bindings (i.e. those 
>>given by -accelerator) in the menus has been disabled by Vince because 
>>it was causing other problems. AFAIK relying on this is not 
>>cross-platform anyway, on other platforms you always needed to add 
>>explicit bindings, -accelerator is only for display purposes and 
>>doesn't create any bindings.
>
>Oh, huh. I guess the thing was that I used the -accelerator implicit
>bindings when experimenting on the MacOSX port of this application. They
>happened to work with the Tcl/Tk build I had installed, and judged that
>as the norm. That goes a long way towards explaining why (from my point
>of view) the accelerators for the other platforms were coded
>"redundantly" in this project.
>
>Now I know. Seems silly that the implicit -accelerator bindings aren't
>generally supported in Tk across platforms. *shrug*
>
>>> The odd thing is that the nice pre-cooked installers available at 
>>> sf.net
>>> *do* have the command-key accelerators enabled,
>>
>>those builds have the following patch applied reverting the change above
>>	http://rutherglen.ics.mq.edu.au/~steffen/tcltk/patches/tk.diff
>>because at present console.tcl is buggy and doesn't add explicit menu 
>>shortcut bindings on the mac which causes basic things like cmd-Q for 
>>quit not to work... console.tcl should be fixable easily by nobody has 
>>gotten around to it yet, see the list archives on what needs to be done.
>
>Okay, Thanks for the pointer to the patch. I'll build with that for now,
>but start on fixing the internals so as to use explicit bindings.

So. I haven't worked on explicit bindings yet, nor would I realistically
hope for Miller to incorporate such a patch in 0.37. 

But if I were to hazard a guess, the place to start to make the explicit
binding would be to change:
        bind $name.c <Control-Key> {pdtk_canvas_ctrlkey %W %K 0}
        bind $name.c <Control-Shift-Key> {pdtk_canvas_ctrlkey %W %K 1}
to:
        bind $name.c <Meta-Key> {pdtk_canvas_ctrlkey %W %K 0}
        bind $name.c <Meta-Shift-Key> {pdtk_canvas_ctrlkey %W %K 1}
(to be x-platform, I'd enclose this in the nearby ($pd_nt == 2) conditional.)

a very quick check on my machine suggested this was in the right
direction, but I can't be sure, as I do benefit from the above-discussed
implicit bindings. (and might run afoul of the above-mentioned
console.tcl problems listed above.) Let me know if they're a help on your
setup.

cheers,
adam
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Adam T. Lindsay                      atl at comp.lancs.ac.uk
 Computing Dept, Lancaster University   +44(0)1524/594.537
 Lancaster, LA1 4YR, UK             Fax:+44(0)1524/593.608
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-





More information about the Pd-dev mailing list