Menu

#3073 Patch for Aqua keyboard/mouse bindings

current: 8.6.0
open
5
2013-03-11
2013-03-07
kjnash
No

The patch fixes these three bugs:

1. Removal of duplicate <<ContextMenu>> binding for misconfigured X servers.

2. Correction of typo - "Control" had been used in place of "Command" in a few places.

3. Allowance for the perversity of Mac keyboard bindings:

(a) The following events fire in response to the obvious keystrokes:

<Control-Key-f>
<Lock-Control-Key-F>
<Shift-Control-Key-F>
<Shift-Lock-Control-Key-F>

<Command-Key-f>
<Lock-Command-Key-F>
<Shift-Command-Key-f>
<Shift-Lock-Command-Key-f>

(b) Commands can be bound to the following distinct events, but they never fire:

<Control-Key-F>
<Lock-Control-Key-f>
<Shift-Control-Key-f>
<Shift-Lock-Control-Key-f>

<Command-Key-F>
<Lock-Command-Key-f>
<Shift-Command-Key-F>
<Shift-Lock-Command-Key-F>

The relevant bindings in tk.tcl have been corrected. Some other bindings have been changed, although this is not strictly necessary: some bindings without "Shift" are sufficiently general to capture the intended event, but by adding "Shift" the intention of the command is clearer.

Discussion

  • kjnash

    kjnash - 2013-03-07

    patch file generated by "fossil diff"

     
  • Jan Nijtmans

    Jan Nijtmans - 2013-03-07

    Patch proposal committed to branch "bug-3607248". The
    Control->Command changes look good to me, the
    other changes I cannot really judge.

    Someone else who can confirm that this is a correct change?

     
  • kjnash

    kjnash - 2013-03-08

    If you have a recent enough Mac to run the 8.6.0 Cocoa version of Tk, you can test the changes by creating a text widget with "text $t -undo 1", pasting some text into the widget, and then trying out the bindings with and without "Caps Lock".

    When testing the patch, note also bug report 3607250 which reports a separate issue with Undo/Redo.

     
  • Jan Nijtmans

    Jan Nijtmans - 2013-03-08
    • assigned_to: hobbs --> wordtech
    • milestone: 4024690 --> 3997841
     
  • Jan Nijtmans

    Jan Nijtmans - 2013-03-08

    The bindings mentioned in 1) and 2) didn't change in Tk 8.6. Have they always been wrong?
    Are there still Mac's with misconfigured X servers around? If so, should this be
    changed for 8.5 as well?

    Kevin, I think you are the best person to answer this.

    Regarding 3), I have simply no idea.

     
  • kjnash

    kjnash - 2013-03-11

    I think these bindings did change in 8.6. The virtual event <<ContextMenu>> is new, and is not yet widely used.

    Re item 3, I think the bugs are in events/bindings that have recently (8.6) been adapted to use the "Lock" modifier, so these bugs have not been around for long.

    Re item 1, for Darwin/X11, the trunk code binds <<ContextMenu>> to both <Button-2> and <Button-3>, and also binds <<PasteSelection>> to <ButtonRelease-2>. Mouse buttons on Aqua are (left to right) 1,3,2 but on Darwin/X11 they have the conventional order 1,2,3.

    Not only is the <<ContextMenu>> virtual event new, the X11 version of Tk is much less widely used on the Mac than the Aqua version, and Mac users do not necessarily use a 3-button PC mouse - so this code is probably not very widely tested!

    I have tested the patch with a 3-button USB mouse on Mountain Lion 10.8.2 with XQuartz 2.7.4, and also on Tiger 10.4.11 with "Apple X11 1.1 - XFree86 4.4.0"; it also works when the X server is on a remote non-Mac machine.

     
  • kjnash

    kjnash - 2013-03-11
    • milestone: 3997841 --> current: 8.6.0
     
  • Kevin Walzer

    Kevin Walzer - 2013-03-15

    Based on limited testing, the changes appear to cause no harm under Tk-Cocoa 8.6 trunk: for instance, Command-V (paste) fires with or without the caps lock key on. (Hope I'm understanding this correctly, based on the OP's suggestion for testing on Cocoa.) I have no objection to committing this, although I must say that the bindings are not something I work with much. If some of these bindings are new to 8.6, then it might make more sense not to backport to 8.5. I have no way to test these using X11 as I do not use X in a production setting.

     
  • kjnash

    kjnash - 2013-03-15

    Yes, a backport to 8.5 is inappropriate: these are bugs in code that is new in 8.6.