Tk Source Code

View Ticket
Login
Ticket UUID: 3607248
Title: Patch for Aqua keyboard/mouse bindings
Type: Bug Version: current: 8.6.0
Submitter: kjnash Created on: 2013-03-07 21:34:17
Subsystem: 01. Bindings Assigned To: aku
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2020-04-20 21:14:23
Resolution: Fixed Closed By: chrstphrchvz
    Closed on: 2020-04-20 21:14:23
Description:
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.
User Comments: chrstphrchvz added on 2020-04-20 21:14:23:

Closing: this patch was merged long ago in [1f184c7377] (2013-08-25).


kjnash added on 2013-03-15 20:31:48:
Yes, a backport to 8.5 is inappropriate: these are bugs in code that is new in 8.6.

wordtech added on 2013-03-15 09:05:02:
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 added on 2013-03-11 10:25:29:
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.

nijtmans added on 2013-03-08 20:25:17:
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 added on 2013-03-08 09:52:19:
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.

nijtmans added on 2013-03-08 05:05:03:
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 added on 2013-03-08 04:34:18:

File Added - 461344: patch-against-0deef053f6-for-aqua-bindings.patch

Attachments: