|
2026-10-22
| ||
| 17:19 | • Ticket [883155fb98] tkDisplayIfNeeded is unnecessary status still Closed wit... artifact: 2f67d7bceb user: serhiy.storchaka | |
|
2026-10-15
| ||
| 11:29 | • Closed ticket [883155fb98]. artifact: 48fca559b8 user: serhiy.storchaka | |
|
2015-05-15
| ||
| 13:27 | • Pending ticket [883155fb98]. artifact: 4c51ff87af user: dkf | |
|
2015-05-11
| ||
| 17:10 | • Ticket [883155fb98]: 4 changes artifact: 3b1550d5cd user: dgp | |
|
2014-10-31
| ||
| 00:50 | • Ticket [883155fb98]: 3 changes artifact: 0a716e3abd user: anonymous | |
|
2014-10-30
| ||
| 13:27 | • Ticket [883155fb98]: 3 changes artifact: 907e726f3a user: dgp | |
|
2014-01-21
| ||
| 10:05 | • Add attachment tkMacOSXNotify.c.patch to ticket [883155fb98a9d7a4|88315... artifact: f9748325cb user: anonymous | |
| 10:05 | • Add attachment tkMacOSXWm.c.patch to ticket [883155fb98a9d7a4|883155fb9... artifact: 2b7659fc83 user: anonymous | |
| 10:04 | • New ticket [883155fb98] tkDisplayIfNeeded is unnecessary. artifact: 658a9961ac user: anonymous | |
tkDisplayIfNeeded is unnecessary
Closed / Invalid883155fb98a9d7a426f24cac27c71a9b353a3f7fCreated 13 years agoUpdated 41 days ago
Descriptionplain2014-01-21 10:04:29
In the nextEventMatchingMask method in macosx/tkMacOSXNotify.c, the tkDisplayIfNeeded method is applied to all windows each time there is an event by calling [NSApp makeWindowsPerform:@selector(tkDisplayIfNeeded) inOrder:NO].
The tkDisplayIfNeeded method is the following:
@implementation NSWindow(TKNotify)
- (id) tkDisplayIfNeeded
{
if (![self isAutodisplay]) {
[self displayIfNeeded];
}
return nil;
}
@end
In the code creating the window (TkMacOSXMakeRealWindowExist in tkMacOSXWm.c), we call [window setAutodisplay:NO], so [self isAutodisplay] is false, and tkDisplayIfNeeded calls [self displayIfNeeded]. Thus, in each window auto-displaying is switched off, but then on each pass through the event loop we ask the window to display itself if needed anyway.
This suggests that this piece of code may not be needed, and moreover the Cocoa documentation seems to discourage the use of [NSWindow displayIfNeeded]. According to the discussion on the MacTcl mailing list starting on January 18, 2014, the [window setAutodisplay:NO] line is needed to address some issues with drawing Tk windows under Cocoa, though the details are no longer readily available.
The attached patch removed the [window setAutodisplay:NO] line from tkMacOSXWm.c (by default, windows do auto-display), and removes the tkDisplayIfNeeded code. This seems to work perfectly fine; after applying this patch, the Tk test suite actually reports one test failure less. However, if it turns out that removing [window setAutodisplay:NO] causes some issues with Cocoa to reappear, then it provides us a chance to investigate the bug in detail and find an appropriate solution for it (preferably without having to tinker with the innards of the event loop).
While this patch helps to keep the Tcl/Tk code clean, it is particularly relevant for people who are running Tcl/Tk using an external event loop (using the notifier approach, as explained at http://www.tcl.tk/man/tcl8.5/TclLib/Notifier.htm; see the mailing list for details).
dgp Ticket [883155fb98]: 3 changes
[History diff]2014-10-30 13:27:32
anonymousplain2014-10-31 00:50:18
I submitted this patch back in January, but since then I have been looking at the Tcl/Tk event loop code in much more detail, and it's clear to me that much more extensive changes are needed to solve the event loop issues. I would suggest to close this ticket for now, and wait for a comprehensive solution of the event loop (which may take a few more months).
dgpplain2015-05-11 17:10:14
This might be out of date now, but the code is still in tkMacOSXNotify.c.
dkfhtml2015-05-15 13:27:16
Belongs in Tk.
serhiy.storchakawiki2026-10-15 11:29:04
Closing: this belongs to the Tk tracker.
serhiy.storchaka Ticket [883155fb98]: 3 changes
[History diff]2026-10-22 17:19:26
Log in (anonymous is fine) to add a comment.