diff options
author | marc_culler <marc.culler@gmail.com> | 2021-10-27 22:54:37 (GMT) |
---|---|---|
committer | marc_culler <marc.culler@gmail.com> | 2021-10-27 22:54:37 (GMT) |
commit | b073b90aa63190350a96903dcac16bbc701c4204 (patch) | |
tree | 81f16f611107cff839d1c662531131ba12b92e86 | |
parent | e8b212de5ca61695a8ce7172649b90d9eb80defa (diff) | |
download | tk-b073b90aa63190350a96903dcac16bbc701c4204.zip tk-b073b90aa63190350a96903dcac16bbc701c4204.tar.gz tk-b073b90aa63190350a96903dcac16bbc701c4204.tar.bz2 |
Catalina is a special case.
-rw-r--r-- | macosx/tkMacOSXDialog.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 09adaad..afb57fb 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -355,11 +355,20 @@ static NSInteger showOpenSavePanel( if (parent && ![parent attachedSheet]) { /* - * On most version of macOS the completion handler does not get - * run at all. So we ignore it. + * A completion handler is not needed except on macOS 10.15, where we + * have to start the sheet differently. */ - - [parent beginSheet: panel completionHandler:nil]; + + if (osVersion >= 101500 && osVersion < 110000 ) { + [panel beginSheetModalForWindow:parent + completionHandler:^(NSModalResponse returnCode) { + [NSApp tkFilePanelDidEnd:panel + returnCode:returnCode + contextInfo:callbackInfo ]; + }]; + } else { + [parent beginSheet: panel completionHandler:nil]; + } } /* @@ -372,9 +381,12 @@ static NSInteger showOpenSavePanel( } else { modalReturnCode = [NSApp runModalForWindow:panel]; } - [NSApp tkFilePanelDidEnd:panel - returnCode:modalReturnCode - contextInfo:callbackInfo ]; + + if (osVersion < 101500 || osVersion >= 110000 ) { + [NSApp tkFilePanelDidEnd:panel + returnCode:modalReturnCode + contextInfo:callbackInfo ]; + } return callbackInfo->cmdObj ? modalOther : modalReturnCode; } |