summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-01-23 21:29:18 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-01-23 21:29:18 (GMT)
commitf97f966abdb154039f603a3cb313d31e022a9a89 (patch)
tree486650609c5ff5ec94246172cfe3c76f065aa1d0 /macosx
parentff8b5479baab369fa6163bf42b9928dcb482261f (diff)
parent3000865931e61dd77e966d0af27b4c86dcdbfaad (diff)
downloadtk-f97f966abdb154039f603a3cb313d31e022a9a89.zip
tk-f97f966abdb154039f603a3cb313d31e022a9a89.tar.gz
tk-f97f966abdb154039f603a3cb313d31e022a9a89.tar.bz2
merge 8.5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXDialog.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 0f7ef3a..84fef94 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -190,6 +190,7 @@ static NSURL *getFileURL(NSString *directory, NSString *filename) {
Tcl_Obj **objv, **tmpv;
int objc, result = Tcl_ListObjGetElements(callbackInfo->interp,
callbackInfo->cmdObj, &objc, &objv);
+
if (result == TCL_OK && objc) {
tmpv = (Tcl_Obj **) ckalloc(sizeof(Tcl_Obj *) * (objc + 2));
memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc);
@@ -212,18 +213,22 @@ static NSURL *getFileURL(NSString *directory, NSString *filename) {
ckfree((char *)callbackInfo);
}
}
-- (void)tkAlertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode
- contextInfo:(void *)contextInfo {
+
+- (void) tkAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) returnCode
+ contextInfo: (void *) contextInfo
+{
AlertCallbackInfo *callbackInfo = contextInfo;
if (returnCode >= NSAlertFirstButtonReturn) {
Tcl_Obj *resultObj = Tcl_NewStringObj(alertButtonStrings[
alertNativeButtonIndexAndTypeToButtonIndex[callbackInfo->
typeIndex][returnCode - NSAlertFirstButtonReturn]], -1);
+
if (callbackInfo->cmdObj) {
Tcl_Obj **objv, **tmpv;
int objc, result = Tcl_ListObjGetElements(callbackInfo->interp,
callbackInfo->cmdObj, &objc, &objv);
+
if (result == TCL_OK && objc) {
tmpv = (Tcl_Obj **) ckalloc(sizeof(Tcl_Obj *) * (objc + 2));
memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc);
@@ -395,9 +400,7 @@ Tk_GetOpenFileObjCmd(
NSMutableArray *fileTypes = nil;
NSOpenPanel *panel = [NSOpenPanel openPanel];
NSInteger modalReturnCode = modalError;
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
BOOL parentIsKey = NO;
-#endif
TkInitFileFilters(&fl);
for (i = 1; i < objc; i += 2) {
@@ -513,10 +516,10 @@ Tk_GetOpenFileObjCmd(
callbackInfo->multiple = multiple;
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
- parentIsKey = [parent isKeyWindow];
types:fileTypes
modalForWindow:parent
modalDelegate:NSApp
@@ -545,12 +548,12 @@ Tk_GetOpenFileObjCmd(
contextInfo:callbackInfo];
}
result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR;
- if (typeVariablePtr && result == TCL_OK) {
- /*
- * The -typevariable option is not really supported.
if (parentIsKey) {
[parent makeKeyWindow];
}
+ if (typeVariablePtr && result == TCL_OK) {
+ /*
+ * The -typevariable option is not really supported.
*/
Tcl_SetVar2(interp, Tcl_GetString(typeVariablePtr), NULL,
@@ -604,7 +607,6 @@ Tk_GetSaveFileObjCmd(
TkInitFileFilters(&fl);
for (i = 1; i < objc; i += 2) {
- parentIsKey = NO;
if (Tcl_GetIndexFromObjStruct(interp, objv[i], saveOptionStrings,
sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) {
goto end;
@@ -718,10 +720,10 @@ Tk_GetSaveFileObjCmd(
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
- parentIsKey = [parent isKeyWindow];
modalForWindow:parent
modalDelegate:NSApp
didEndSelector:
@@ -1177,7 +1179,7 @@ Tk_MessageBoxObjCmd(
contextInfo:callbackInfo];
}
result = (modalReturnCode >= NSAlertFirstButtonReturn) ? TCL_OK : TCL_ERROR;
- end:
+ end:
[alert release];
if (parentIsKey) {
[parent makeKeyWindow];