summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2016-01-11 00:45:56 (GMT)
committerKevin Walzer <kw@codebykevin.com>2016-01-11 00:45:56 (GMT)
commit44cda04c842ee384d0e830bbb247787ee0819fee (patch)
tree5bcc798b855bfbc801129ff991235d95ecf0584f /macosx
parent651d6089bd63522c1a689dabead4ed1c6c4a5f17 (diff)
downloadtk-44cda04c842ee384d0e830bbb247787ee0819fee.zip
tk-44cda04c842ee384d0e830bbb247787ee0819fee.tar.gz
tk-44cda04c842ee384d0e830bbb247787ee0819fee.tar.bz2
Additional tweaks for dialog
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXDialog.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 4ceb010..6af6b33 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -398,6 +398,7 @@ Tk_GetOpenFileObjCmd(
TkInitFileFilters(&fl);
for (i = 1; i < objc; i += 2) {
+ BOOL parentIsKey = NO;
if (Tcl_GetIndexFromObjStruct(interp, objv[i], openOptionStrings,
sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) {
goto end;
@@ -513,6 +514,7 @@ Tk_GetOpenFileObjCmd(
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
[panel beginSheetForDirectory:directory
file:filename
+ parentIsKey = [parent isKeyWindow];
types:fileTypes
modalForWindow:parent
modalDelegate:NSApp
@@ -544,6 +546,9 @@ Tk_GetOpenFileObjCmd(
if (typeVariablePtr && result == TCL_OK) {
/*
* The -typevariable option is not really supported.
+ if (parentIsKey) {
+ [parent makeKeyWindow];
+ }
*/
Tcl_SetVar2(interp, Tcl_GetString(typeVariablePtr), NULL,
@@ -596,6 +601,7 @@ Tk_GetSaveFileObjCmd(
TkInitFileFilters(&fl);
for (i = 1; i < objc; i += 2) {
+ BOOL parentIsKey = NO;
if (Tcl_GetIndexFromObjStruct(interp, objv[i], saveOptionStrings,
sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) {
goto end;
@@ -712,6 +718,7 @@ Tk_GetSaveFileObjCmd(
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
[panel beginSheetForDirectory:directory
file:filename
+ parentIsKey = [parent isKeyWindow];
modalForWindow:parent
modalDelegate:NSApp
didEndSelector:
@@ -737,7 +744,9 @@ Tk_GetSaveFileObjCmd(
contextInfo:callbackInfo];
}
result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR;
-
+ if (parentIsKey) {
+ [parent makeKeyWindow];
+ }
end:
TkFreeFileFilters(&fl);
return result;
@@ -780,6 +789,7 @@ Tk_ChooseDirectoryObjCmd(
NSWindow *parent;
NSOpenPanel *panel = [NSOpenPanel openPanel];
NSInteger modalReturnCode = modalError;
+ BOOL parentIsKey = NO;
for (i = 1; i < objc; i += 2) {
if (Tcl_GetIndexFromObjStruct(interp, objv[i], chooseOptionStrings,
@@ -847,6 +857,7 @@ Tk_ChooseDirectoryObjCmd(
callbackInfo->multiple = 0;
parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window);
if (haveParentOption && parent && ![parent attachedSheet]) {
+ parentIsKey = [parent isKeyWindow];
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
[panel beginSheetForDirectory:directory
file:filename
@@ -874,7 +885,9 @@ Tk_ChooseDirectoryObjCmd(
contextInfo:callbackInfo];
}
result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR;
-
+ if (parentIsKey) {
+ [parent makeKeyWindow];
+ }
end:
return result;
}