Tk Source Code

View Ticket
Login
Ticket UUID: 317643cfbf377b28d10410c5390e3d89a984eb28
Title: macOS misses some double-click events
Type: Bug Version: 8.6.9
Submitter: anonymous Created on: 2019-07-22 06:12:32
Subsystem: 69. Events Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2019-10-21 00:26:29
Resolution: Fixed Closed By: marc_culler
    Closed on: 2019-10-21 00:26:29
Description:
When the demo file "dirViewer.tcl" from tablelist is run on Aqua 8.6.9, it is not possible to open a folder by double click or to open the right-click menu. This works under 8.6.8 as expected and on Linux. On closer inspection, dirViewer.tcl achieves this by binding to the body tag of tablelist:

bind $bodyTag <Double-1>   [list putContentsOfSelFolder $tbl]

The tablelist widget is .tf.tbl, bodytag resolves to body.tf.tbl. This is added as a bindtag by tablelist upon creation to all children of the body:

(tablelist6.6) 58 % bindtags .tf.tbl.body
.tf.tbl.body body.tf.tbl TablelistBody . TablelistKeyNav all
(tablelist6.6) 63 % bindtags .tf.tbl.body.img_k0,0
.tf.tbl.body.img_k0,0 body.tf.tbl TablelistBody . all

Can this be caused by the Cocoa rework in 8.6.9 as opposed to 8.6.8?
User Comments: marc_culler (claiming to be Marc Culler) added on 2019-10-21 00:26:29:
Now that TIP #532 has been merged into core-8-6-branch the Tablelist demo
appears to work fine.  Double-clicking on a directory opens it and
control-click opens a pop-up menu from which one can select "Contents"
to see what is in the directory.

So I am closing this ticket with resolution "Fixed".

chrstphrchvz added on 2019-07-24 03:33:37:

Cc'ing myself since this is a Mac issue I might want to test (so far I have not tried to observe the issue or understand it exactly).


marc_culler (claiming to be Marc Culler) added on 2019-07-23 21:44:12:
Looking more carefully at tkBind.c I see that there were two typos, and the
effect of the two together was to increase the size of the ring-buffer for
all platforms, including macOS.  So this explains why the bind tests all pass
on macOS.

marc_culler (claiming to be Marc Culler) added on 2019-07-23 15:09:38:

I have learned several things about this.

* I see no evidence whatsoever that this has anything to do with bindtags.

* The symptoms do indicate that some double-click events are being missed. (Hence the change in the title).
This is something that we know something about. First of all, it is well known that the ring-buffer used in generic/tkBind.c is very buggy and in fact TIP #532, which has been approved, addresses this issue by, among other things, removing the ring buffer altogether. Second, we have already seen that the changes which fix the problem that all windows were black when Tk was built on Mojave also increased the load on the ring buffer. An attempt was made to partially address this by increasing the size of the ring buffer on macOS.

* When I looked back at the code I found that the attempt to increase the size of the ring buffer was completely ineffective due to a spectacularly egregious typo. The size of the ring was increased for NON-macosx systems, and not changed for macOS!!! I will correct this, but I have already tested that it does not solve this problem of missed double-clicks in the tableList demo.

* Merging the tip of core-8-6-branch with the implementation of TIP #532, i.e. with the bug6e8afe516d branch, does make the tableList demo respond to double-clicks as expected.


anonymous (claiming to be auriocus) added on 2019-07-23 08:11:29:
I bisected the bug using git bisect, and it pointed me to three commits, one good, one buggy, and one crashing:

Buggy: 
commit a84c4c2e4c34b0204d6652a3e217f52fb8dfd5e7 (HEAD)
Author: culler <[email protected]>
Date:   Sat Nov 3 21:48:37 2018 +0000

    On 10.13 we must now process idle events in drawRect, as in 10.14, but we also
    must lock focus inside the s[NSView setFrame] method.
    
    FossilOrigin-Name: c2a1f5a779880f64792a434b6a2926a2e251c43f0a988db61ac3df9eda0eec78

Working:
commit 2edb63e4a5e914fce6633f26d3b9e9402ce1a05f (HEAD, tag: rc3)
Merge: eed857393 bcc1d3490
Author: dgp <[email protected]>
Date:   Mon Nov 5 12:47:53 2018 +0000

    merge 8.6
    
    FossilOrigin-Name: 149b44e93dc4007a1ec6ec7d2e160a0a0c642f429a0b21e2cda092bb4d224649


The commit in between crashes (4298a893da24fe1092fcab9324f125beda830149, Fossil: 0bf25c9f6c4ebabef81254a5ab2b5f28d17cd7d9a015d106b954cc12c90ba15e) with segfault.

The diff between the good and the bad version is still extensive, I attach it here for reference. I'm on OSX 10.13.6 and compiled Tk with no compatibility options using Apple LLVM version 10.0.0 (clang-1000.11.45.5). It would be good to check if this is different on 10.14.

anonymous (claiming to be auriocus) added on 2019-07-23 05:45:27:
The problem persists in core-8-6-10-rc. It is mysterious, though, because I couldn't reproduce it in a short script. Attached are two scripts which show the problem. The one calls the demo of tablelist, doubleclicking on a directory should open the directory, which does not happen beyond 8.6.9. 
The test script prints "Clicked" when you double click on the item, which does work in all versions. Both versions work on Linux.

marc_culler (claiming to be Marc Culler) added on 2019-07-22 23:09:10:
Can you test this against core-8-6-10-rc?  Who knows? Maybe the problem has already been fixed.

Attachments: