diff options
author | marc_culler <marc.culler@gmail.com> | 2020-10-25 00:01:47 (GMT) |
---|---|---|
committer | marc_culler <marc.culler@gmail.com> | 2020-10-25 00:01:47 (GMT) |
commit | 38f8f81b3b2a5ed3db23fc8fa7edb35c52a9eac5 (patch) | |
tree | 4f7557ef9cbb7be44521902c3178eb9a9d9893b7 /macosx/tkMacOSXDialog.c | |
parent | 4d8498f181894261f21358d49ab8ba2dfe3b021a (diff) | |
download | tk-38f8f81b3b2a5ed3db23fc8fa7edb35c52a9eac5.zip tk-38f8f81b3b2a5ed3db23fc8fa7edb35c52a9eac5.tar.gz tk-38f8f81b3b2a5ed3db23fc8fa7edb35c52a9eac5.tar.bz2 |
Back out change to tkMacOSXDialog.c from commit b53baf71. The preferred API works in Catalina and Big Sur but fails in earlier OS versions.
Diffstat (limited to 'macosx/tkMacOSXDialog.c')
-rw-r--r-- | macosx/tkMacOSXDialog.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index ba6fabd..42cb4a5 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -346,25 +346,23 @@ static NSInteger showOpenSavePanel( NSWindow *parent, FilePanelCallbackInfo *callbackInfo) { - __block NSInteger modalReturnCode = modalOther; + NSInteger modalReturnCode; if (parent && ![parent attachedSheet]) { [panel beginSheetModalForWindow:parent - completionHandler:^(NSModalResponse result) { - [NSApp tkFilePanelDidEnd:panel - returnCode:result - contextInfo:callbackInfo ]; - modalReturnCode = result; + completionHandler:^(NSModalResponse returnCode) { + [NSApp tkFilePanelDidEnd:panel + returnCode:returnCode + contextInfo:callbackInfo ]; }]; + + modalReturnCode = callbackInfo->cmdObj ? modalOther : + [panel runModal]; } else { - [panel beginWithCompletionHandler:^(NSModalResponse result) { - [NSApp tkFilePanelDidEnd:panel - returnCode:result - contextInfo:callbackInfo ]; - modalReturnCode = result; - }]; + modalReturnCode = [panel runModal]; + [NSApp tkFilePanelDidEnd:panel returnCode:modalReturnCode + contextInfo:callbackInfo]; } - [panel runModal]; return modalReturnCode; } |