summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2016-01-11 00:24:47 (GMT)
committerKevin Walzer <kw@codebykevin.com>2016-01-11 00:24:47 (GMT)
commite4b0148eca30063133d3e7e725f04bcf46a3cc9a (patch)
treeb0e8ea632e28d90766c9540f0686d9f6375fde1e
parent2940f5b23c3b77c0bd31a2bc13756519a64fe8c8 (diff)
downloadtk-e4b0148eca30063133d3e7e725f04bcf46a3cc9a.zip
tk-e4b0148eca30063133d3e7e725f04bcf46a3cc9a.tar.gz
tk-e4b0148eca30063133d3e7e725f04bcf46a3cc9a.tar.bz2
Fix for 63c3542c06, messageboxes in Tk-Cocoa; thanks to Marc Culler for patch
-rw-r--r--macosx/tkMacOSXDialog.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index a3510f8..3523bc4 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -1016,7 +1016,8 @@ Tk_MessageBoxObjCmd(
NSArray *buttons;
NSAlert *alert = [NSAlert new];
NSInteger modalReturnCode = 1;
-
+ BOOL parentIsKey = NO;
+
iconIndex = ICON_INFO;
typeIndex = TYPE_OK;
for (i = 1; i < objc; i += 2) {
@@ -1142,6 +1143,7 @@ Tk_MessageBoxObjCmd(
callbackInfo->typeIndex = typeIndex;
parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window);
if (haveParentOption && parent && ![parent attachedSheet]) {
+ parentIsKey = [parent isKeyWindow];
#if MAC_OS_X_VERSION_MIN_REQUIRED > 1090
[alert beginSheetModalForWindow:parent
completionHandler:^(NSModalResponse returnCode)
@@ -1164,6 +1166,9 @@ Tk_MessageBoxObjCmd(
result = (modalReturnCode >= NSAlertFirstButtonReturn) ? TCL_OK : TCL_ERROR;
end:
[alert release];
+ if (parentIsKey) {
+ [parent makeKeyWindow];
+ }
return result;
}