| Ticket UUID: | cde766f911df2c0281f60a8283dcf8cb60ed328 | |||
| Title: | macOS11 Aqua: issue with update | |||
| Type: | Bug | Version: | 8.7a4 | |
| Submitter: | nab | Created on: | 2021-03-10 13:18:24 | |
| Subsystem: | 66. Aqua Window Operations | Assigned To: | marc_culler | |
| Priority: | 5 Medium | Severity: | Important | |
| Status: | Closed | Last Modified: | 2021-05-01 17:20:45 | |
| Resolution: | Fixed | Closed By: | fvogel | |
| Closed on: | 2021-05-01 17:20:45 | |||
| Description: |
Hi, please consider the attached script (you'll need to have TableList and Scrollutil package from Csaba web site: https://www.nemethi.de/) on my computer running macOS11.2.3 and using Tk trunk and Tcl core-8-branch there's 2 noticeable issues: -when holding Shift and scrolling horizontaly with two fingers on the trackpad, the x scrollbar does not reflect the mouvement. -when pushing addRows2TblList button, the vertical scrollbar does not update unless I move the mouse over the tableList widget. does mac users observe the same behaviour or the script behave correctly? (Csaba have reported that the script is working correctly for him...) many thanks for any help. ++ nicolas | |||
| User Comments: |
fvogel added on 2021-05-01 17:20:45:
Marc did that change, thanks. See [4651327e]. textWind-17.10 passes again. fvogel added on 2021-04-29 20:48:40: I could now check, and here are the results. textWind-17.10, as it is now in branch CALayer-86:
When replacing the last "update idletasks" of this test by an "update" the test passes on both Windows and macOS. Any veto before doing that change? fvogel added on 2021-04-28 21:17:08: I cannot check on the mac if removing 'idletasks' will make textWind-17.10 fail or not (the mac test setup I have usually acces to does not seem to work right now). Could you try perhaps? Depending on the result, we could resort to proc updateText as in textDisp.test. Regarding the rest of your questions I don't know. Best I can say is that the existing tests give hints about what is expected. Agreed, documentation could be more complete and accurate. marc_culler (claiming to be Marc Culler) added on 2021-04-28 19:40:57: We can do that. Of course, as we know, when you do that to make the test pass in Windows it often makes the test fail in macOS. But we can certainly try it and see what happens. I did see the documentation. I just could not understand it. For example, if "the association between the old pathname and the text" is removed then does the pathname still refer to the old widget? Does the widget still appear in the Text widget? At the same position? Or does the text to the right of the widget's index move to the left, filling its space? Are we supposed to be able to deduce from that sentence what happens when you run that command? (I can't.) fvogel added on 2021-04-28 19:09:11: The expected result is the correct result and wWindows is not getting it. But the test pass when I replace the last 'update idletasks' of the test by a simple 'update'. We can sure do this, right? > One thing that is very unclear in the manual is what the effect of > <widget> configure <index> -window {} is supposed to be. I believe this is documented: -window pathName Specifies the name of a window to display in the annotation. Note that if a pathName has been set, then later configuring a window to the empty string will not delete the widget corresponding to the old pathName. Rather it will remove the association between the old pathName and the text widget. [...] marc_culler (claiming to be Marc Culler) added on 2021-04-28 18:19:28: Hi François, textWind-17.10 is the test that we discussed privately. As I
said, the previous version of this test appeared to be checking that the
window configure command was reporting the wrong answer before calling
update and then reporting the right answer after calling update. That
would seem to have more to do with timing and with details of the update
command than with configuring peer widgets.
When I rewrote the test I added those comments explaining why I thought
that the expected answers should be expected. Do you think I got that
wrong? Do you think that the answer that Windows is getting is correct?
Can you explain that?
I tried reading the manual to figure out what the expected behavior should
be. One thing I learned there is that peer text widgets should not share
embedded windows. That seems to be on thing that is being tested here. But
why should the blue 25x20 window which was embedded in .tt.t have disappeared
from the peer widget, as Windows seems to be claiming.
One thing that is very unclear in the manual is what the effect of
<widget> configure <index> -window {}
is supposed to be. That seems to be at the core of this.
fvogel added on 2021-04-28 17:48:55: This failure can also be seen in GitHub Actions. fvogel added on 2021-04-28 17:34:23: textWind-17.10 now fails on Windows, suspecting [35bd8248]...
==== textWind-17.10 peer widget window configuration FAILED
==== Contents of test case:
set res {}
pack [text .t]
.t delete 1.0 end
.t insert 1.0 "Some sample text"
toplevel .tt
pack [.t peer create .tt.t]
update idletasks
.t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue]
update idletasks
# There should be a window in the main widget but not in the peer.
lappend res [.t window configure 1.2 -window]
lappend res [.tt.t window configure 1.2 -window]
.tt.t window create 1.2 -window [frame .tt.t.f -width 25 -height 20 -bg blue]
update idletasks
.t window configure 1.2 -create {destroy %W.f ; frame %W.f -width 50 -height 7 -bg red}
update idletasks
# The main widget should not have changed.
lappend res [.t window configure 1.2 -window]
.t window configure 1.2 -window {}
.tt.t window configure 1.2 -window {}
update idletasks
# Nothing should have changed.
lappend res [.t window configure 1.2 -window]
lappend res [.tt.t window configure 1.2 -window]
---- Result was:
{-window {} {} {} .t.f} {-window {} {} {} {}} {-window {} {} {} .t.f} {-window {} {} {} .t.f} {-window {} {} {} {}}
---- Result should have been (exact matching):
{-window {} {} {} .t.f} {-window {} {} {} {}} {-window {} {} {} .t.f} {-window {} {} {} .t.f} {-window {} {} {} .tt.t.f}
==== textWind-17.10 FAILED
nab added on 2021-04-21 14:42:52: it works with mac_styles_87 too. thanks ++ nab added on 2021-04-21 13:11:42: in order to be sure, can you please merge to mac_styles_87? thanks, ++ marc_culler (claiming to be Marc Culler) added on 2021-04-21 12:18:17: Thanks, Nicolas. I will close this ticket now. nab added on 2021-04-21 08:47:57: Hi Marc, I've tried your fix on macOS11.2.3 and it scrolls very smoothly :) many thanks for your work on it and well done for your new technical idea! from my point of view this issue is fixed. ++ marc_culler (claiming to be Marc Culler) added on 2021-04-20 21:47:47: I think this problem is now fixed in the bug-cde766f911 branch. It is sort of technical and not so easy to explain. But maybe we can start by testing that branch and see if people agree that it is fixed, or at least better. marc_culler (claiming to be Marc Culler) added on 2021-04-19 21:31:25: I agree with the comment about TkpRedrawWidget and setTkDirtyRect and I made that change to improve clarity. But it has nothing to do with this problem. The only call to TkpRedrawWidget is in tkTextDisp.c. But there is no problem with scrolling text widgets, and the problem occurs with treeview widgets when there is no text widget involved. marc_culler (claiming to be Marc Culler) added on 2021-04-19 19:31:52: I looked into this problem but, I am sorry to say, doing so did not bring me any closer to a solution. The scrollbar thumb is drawn with low-level Core Graphics functions. The function that does the drawing is called SolidFillRoundedRectangle. The name suggests what it does -- it draws a filled rounded rectangle using basic Core Graphics calls. I added print statements in that function. This is what I found: * The low level graphics calls are happening when they should, but the calls fail to have any effect on the screen. * The drawing fails to have any effect even when SolidFillRoundedRectangle is being called from within drawRect. * The drawing fails to have any effect even when there is no clipping being done. I disabled all calls to CGContextEOClip to test this. Lots of other artifacts appear without any clipping, but the scrollbar thumb still fails to be drawn. * The problem appears to only occur on Big Sur and only with the Treeview widget. Scrollbars on other widgets are drawn normally. This is very mysterious. I wish it could be fixed by simply making the severity of the bug report higher, but so far I have no idea about what the cause of the problem might be. Since it works fine on other versions of the OS I think it is unlikely that there is a fundamental problem with the logic of the graphics implementation. There must be something special about the treeview widget that somehow triggers this, since it does not seem to happen with other widgets. That fact is the only clue that I have about where to look for the cause. nab added on 2021-04-09 16:26:56: ok, thank you Marc for the explanation. ++ marc_culler (claiming to be Marc Culler) added on 2021-04-09 16:19:18: No that is not the issue. ScrollRect is called to redraw a text widget when it is scrolled. It has nothing to do with redrawing scroll bars or handling scroll events. Without that function it would not be possible to scroll a text widget at all without completely rewriting the scrolling code. While it is deprecated in new systems it still exists and has no replacement. ScrollRect uses the graphics card to shift the middle part of the view so that only the exposed part at the top or bottom has to be redrawn. Without it, the only option would be to redraw all visible text for each scroll. That would surely make the text widget much slower. So we are not going to touch that until Apple actually removes it, and we are hoping that they will provide a replacement before they remove it. What Apple wants is for NSScrollView to be used instead of calling scrollRect. But changing NSView to NSScrollView would require rewriting a huge amount of the Tk code. That is not a project that I am willing to take on. nab added on 2021-04-09 15:08:22: each time I compile Tk I got this warning:
tkMacOSXDraw.c
/Users/nico/lib/framework/customTk/unix/../macosx/tkMacOSXDraw.c:1177:13: warning: 'scrollRect:by:' is deprecated: first deprecated in macOS 10.14 - Use
NSScrollView to achieve scrolling views. [-Wdeprecated-declarations]
[view scrollRect:scrollSrc by:NSMakeSize(dx, -dy)];
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSView.h:213:1: note:
'scrollRect:by:' has been explicitly marked deprecated here
- (void)scrollRect:(NSRect)rect by:(NSSize)delta API_DEPRECATED("Use NSScrollView to achieve scrolling views.", macos(10.0,10.14));
can it be a reason of this issue?
++
nab added on 2021-04-04 06:34:31: Hi Christopher, yes I've tried and it's not better. ++ chrstphrchvz added on 2021-04-04 03:01:04: Nicolas, could you please try the change I suggested to tkMacOSXWm.c and see if it helps? nab added on 2021-04-03 15:18:11: I'm agree with Csaba... I've tried new Tcl code from "Clean up the notifier code", but still the same issue on BigSur nemethi (claiming to be Csaba Nemethi) added on 2021-04-03 14:37:38: Changed the type from "Support" to "Bug" and the severity from "Minor" to "Important". nemethi (claiming to be Csaba Nemethi) added on 2021-03-30 18:45:29: The issue reported by Nicolas is a serious one. As seen from the attached script scrolltest.tcl, which is free from any external packages, Tk on Big Sur suffers from update problems regarding the scrollbars. Being that most newer Macs now run Big Sur, it would be fine to see some efforts aiming at fixing this really annoying bug. chrstphrchvz added on 2021-03-21 02:26:08: I wonder if it would be a good idea to remove the setTkDirtyRect: setter (leaving only addTkDirtyRect: and clearTkDirtyRect for updating). chrstphrchvz added on 2021-03-19 15:33:55: I noticed that sometime between addTkDirtyRect: last being called (e.g. from TkMacOSXSetupDrawingContex()) and setNeedsDisplayInRect: being called, TKContentView's tkDirtyRect was changing. By using explicit (instead of synthesized) accessors for tkDirtyRect with debugging output, I found that tkDirtyRect is completely overwritten by TkpRedrawWidget() (which is being called from GenerateWidgetViewSyncEvent()). It seems the code should instead be as follows (it at least resolves the issues I observe on macOS 10.13):
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -6309,7 +6309,6 @@ TkpRedrawWidget(Tk_Window tkwin) {
[view bounds].size.height - tkBounds.bottom,
tkBounds.right - tkBounds.left,
tkBounds.bottom - tkBounds.top);
- [view setTkNeedsDisplay:YES];
- [view setTkDirtyRect:bounds];
+ [view addTkDirtyRect:bounds];
}
}
Maybe this is the source of some other outstanding redrawing issues. nab added on 2021-03-19 10:34:00: using mac_styles_87 branch on my 2020 15-inch MacBook Pro running macOS11.2.3, I do observe redrawing issues (using a real mouse). -using Shift+MouseWheel, the horizontal scrollbar is only updated when I move the mouse pointer over the scrollbar. The ttk::treeview itself is scrolling fine. -using MouseWheel (vertical scrolling), ttk::treeview itself is scrolling fine, but vertical scrollbar does not scroll at all unless I move the mouse pointer over it. using gesture, scrollbars AND ttk::treeview are scrolling, but behaviour is weird... very sensible... ++ chrstphrchvz added on 2021-03-19 10:01:01: Using core-8-6-branch on my 2010 13-inch MacBook Pro, under both macOS 10.13 and 10.15, I do not observe any redrawing issues with the scrolltest.tcl (Treeview-based) example so far. But because the issues I observed in the scrollUtilXX.tcl example resemble previous Aqua redrawing issues ([06d8246ba] etc., which the idle_curiosity branch attempted to address), I am not yet inclined to believe the cause is definitely somewhere in tablelist or scrollutil. nemethi (claiming to be Csaba Nemethi) added on 2021-03-18 14:42:45: In order to exclude the possibility that the reported behavior might be caused by Tablelist and/or Scrollutil, I am attaching the script scrolltest.tcl, which doesn't use any external packages. For me, the script works as expected on macOS 10.15.6 (Catalina), but on macOS 11.2.3 (Big Sur) its behavior is even worse than that of the script attached by Nicolas. I made the tests on both OS versions with Tk 8.6.11 and 8.7a4 (freshly built from trunk). (Now I have access to Big Sur myself.) chrstphrchvz added on 2021-03-18 08:15:05: Using core-8-6-branch on my 2010 13-inch MacBook Pro (which cannot redraw the table very quickly, only about 3 times per second):
nemethi (claiming to be Csaba Nemethi) added on 2021-03-11 20:04:13: The script works for me as expected on Linux, Windows, and Mac running Catalina. I have tested it with Tk 8.6.9, 8.6.10, 8.6.11, and 8.7a4 (built from trunk). The behavior described by Nicolas seems to be Big Sur specific (I don't have Big Sur on my 11 years old Mac). | |||
Attachments:
- scrolltest.tcl [download] added by nemethi on 2021-03-18 14:45:32. [details]
- scrollUtilXX.tcl [download] added by nab on 2021-03-10 13:18:39. [details]
