Imported Tk 8.6.9

This commit is contained in:
Steve Dower
2018-12-11 10:05:28 -08:00
parent 753ac6b037
commit 5ba5cbc9af
184 changed files with 6223 additions and 1994 deletions

View File

@@ -112,14 +112,23 @@ enum {
*
* TkMacOSXFlushWindows --
*
* This routine flushes all the visible windows of the application. It is
* called by XSync().
* This routine is a stub called by XSync, which is called during the Tk
* update command. The language specification does not require that the
* update command be synchronous but many of the tests assume that is the
* case. It is not naturally the case on macOS since many idle tasks are
* run inside of the drawRect method of a window's contentView, and that
* method will not be called until after this function returns. To make
* the tests work, we attempt to force this to be synchronous by waiting
* until drawRect has been called for each window. The mechanism we use
* for this is to have drawRect post an ApplicationDefined NSEvent on the
* AppKit event queue when it finishes drawing, and wait for it here.
*
* Results:
* None.
*
* Side effects:
* Flushes all visible Cocoa windows
* Calls the drawRect method of the contentView of each visible
* window.
*
*----------------------------------------------------------------------
*/
@@ -128,11 +137,14 @@ MODULE_SCOPE void
TkMacOSXFlushWindows(void)
{
NSArray *macWindows = [NSApp orderedWindows];
if ([NSApp simulateDrawing]) {
[NSApp setSimulateDrawing:NO];
return;
}
for (NSWindow *w in macWindows) {
if (TkMacOSXGetXWindow(w)) {
[w flushWindow];
}
if (TkMacOSXGetXWindow(w)) {
[w displayIfNeeded];
}
}
}