Tk Source Code

Check-in [0eec907f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:merge 8.6
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | rc0 | core-8-6-7-rc
Files: files | file ages | folders
SHA1: 0eec907f4e04a890aa762bfccc8df45e05549b2e
User & Date: dgp 2017-07-28 18:38:15
Context
2017-08-01
20:09
update changes check-in: f134cd04 user: dgp tags: core-8-6-7-rc
2017-07-28
18:38
merge 8.6 check-in: 0eec907f user: dgp tags: rc0, core-8-6-7-rc
2017-07-03
05:50
Fix last crashing bug for save dialogs on macOS check-in: 0456a159 user: kevin_walzer tags: core-8-6-branch
2017-06-22
14:27
merge 8.6 check-in: 8b2acfe3 user: dgp tags: core-8-6-7-rc
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkText.c.

1487
1488
1489
1490
1491
1492
1493

1494
1495
1496
1497
1498
1499
1500
			indexToPtr, objc, objv, 0);

		if (result == TCL_OK) {
		    /*
		     * Move the insertion position to the correct place.
		     */


		    TkTextIndexForwChars(NULL, indexFromPtr,
			    deleteInsertOffset, &index, COUNT_INDICES);
		    TkBTreeUnlinkSegment(textPtr->insertMarkPtr,
			    textPtr->insertMarkPtr->body.mark.linePtr);
		    TkBTreeLinkSegment(textPtr->insertMarkPtr, &index);
		}
	    } else {







>







1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
			indexToPtr, objc, objv, 0);

		if (result == TCL_OK) {
		    /*
		     * Move the insertion position to the correct place.
		     */

                    indexFromPtr = TkTextGetIndexFromObj(interp, textPtr, objv[2]);
		    TkTextIndexForwChars(NULL, indexFromPtr,
			    deleteInsertOffset, &index, COUNT_INDICES);
		    TkBTreeUnlinkSegment(textPtr->insertMarkPtr,
			    textPtr->insertMarkPtr->body.mark.linePtr);
		    TkBTreeLinkSegment(textPtr->insertMarkPtr, &index);
		}
	    } else {

Changes to macosx/tkMacOSXDialog.c.

534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
	    }
	    break;
	case OPEN_INITFILE:
	    str = Tcl_GetStringFromObj(objv[i + 1], &len);
	    if (len) {
		filename = [[[NSString alloc] initWithUTF8String:str]
			autorelease];
		[openpanel setNameFieldStringValue:filename];
	    }
	    break;
	case OPEN_MESSAGE:
	    message = [[NSString alloc] initWithUTF8String:
		    Tcl_GetString(objv[i + 1])];
	    break;
	case OPEN_MULTIPLE:







|







534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
	    }
	    break;
	case OPEN_INITFILE:
	    str = Tcl_GetStringFromObj(objv[i + 1], &len);
	    if (len) {
		filename = [[[NSString alloc] initWithUTF8String:str]
			autorelease];
	       	[openpanel setNameFieldStringValue:filename];
	    }
	    break;
	case OPEN_MESSAGE:
	    message = [[NSString alloc] initWithUTF8String:
		    Tcl_GetString(objv[i + 1])];
	    break;
	case OPEN_MULTIPLE:
658
659
660
661
662
663
664


665



666
667
668
669
670
671
672
673
674
675
676
677
678
679
680


681




682
683
684
685
686
687
688
	       didEndSelector:
		   @selector(tkFilePanelDidEnd:returnCode:contextInfo:)
	       contextInfo:callbackInfo];
#else
	if (directory) {
	    [openpanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]];
	}


	[openpanel setNameFieldStringValue:filename];



	[openpanel beginSheetModalForWindow:parent
	       completionHandler:^(NSInteger returnCode)
	       { [NSApp tkFilePanelDidEnd:openpanel
		       returnCode:returnCode
		       contextInfo:callbackInfo ]; } ];
#endif
	modalReturnCode = cmdObj ? modalOther : [NSApp runModalForWindow:openpanel];
    } else {
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
	modalReturnCode = [openpanel runModalForDirectory:directory
				 file:filename];
#else
	if (directory) {
	    [openpanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]];
	}


	[openpanel setNameFieldStringValue:filename];




	modalReturnCode = [openpanel runModal];
#endif
	[NSApp tkFilePanelDidEnd:openpanel returnCode:modalReturnCode
		contextInfo:callbackInfo];
    }
    result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR;
    if (parentIsKey) {







>
>

>
>
>















>
>
|
>
>
>
>







658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
	       didEndSelector:
		   @selector(tkFilePanelDidEnd:returnCode:contextInfo:)
	       contextInfo:callbackInfo];
#else
	if (directory) {
	    [openpanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]];
	}
	/*check for file name, otherwise set to empty string; crashes with uncaught exception if set to nil*/
	if (filename) {
	[openpanel setNameFieldStringValue:filename];
	} else {
	    [openpanel setNameFieldStringValue:@""];
	}
	[openpanel beginSheetModalForWindow:parent
	       completionHandler:^(NSInteger returnCode)
	       { [NSApp tkFilePanelDidEnd:openpanel
		       returnCode:returnCode
		       contextInfo:callbackInfo ]; } ];
#endif
	modalReturnCode = cmdObj ? modalOther : [NSApp runModalForWindow:openpanel];
    } else {
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
	modalReturnCode = [openpanel runModalForDirectory:directory
				 file:filename];
#else
	if (directory) {
	    [openpanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]];
	}
	/*check for file name, otherwise set to empty string; crashes with uncaught exception if set to nil*/
	if (filename) {
	    [openpanel setNameFieldStringValue:filename];
	} else {
	    [openpanel setNameFieldStringValue:@""];
	}

	modalReturnCode = [openpanel runModal];
#endif
	[NSApp tkFilePanelDidEnd:openpanel returnCode:modalReturnCode
		contextInfo:callbackInfo];
    }
    result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR;
    if (parentIsKey) {
894
895
896
897
898
899
900


901



902
903
904
905
906
907
908
909
910
911
912
913
914
915


916



917
918
919
920
921
922
923
	       didEndSelector:
		   @selector(tkFilePanelDidEnd:returnCode:contextInfo:)
	       contextInfo:callbackInfo];
#else
	if (directory) {
	    [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]];
	}


	[savepanel setNameFieldStringValue:filename];



	[savepanel beginSheetModalForWindow:parent
	       completionHandler:^(NSInteger returnCode)
	       { [NSApp tkFilePanelDidEnd:savepanel
		       returnCode:returnCode
		       contextInfo:callbackInfo ]; } ];
#endif
	modalReturnCode = cmdObj ? modalOther : [NSApp runModalForWindow:savepanel];
    } else {
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
	modalReturnCode = [savepanel runModalForDirectory:directory file:filename];
#else
	if (directory) {
	    [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]];
	}


	[savepanel setNameFieldStringValue:filename];



	modalReturnCode = [savepanel runModal];
	#if 0
	NSLog(@"modal: %li", modalReturnCode);
	#endif
#endif
	[NSApp tkFilePanelDidEnd:savepanel returnCode:modalReturnCode
		contextInfo:callbackInfo];







>
>
|
>
>
>














>
>
|
>
>
>







905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
	       didEndSelector:
		   @selector(tkFilePanelDidEnd:returnCode:contextInfo:)
	       contextInfo:callbackInfo];
#else
	if (directory) {
	    [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]];
	}
	   /*check for file name, otherwise set to empty string; crashes with uncaught exception if set to nil*/
	if (filename) {
	    [savepanel setNameFieldStringValue:filename];
	} else {
	    [savepanel setNameFieldStringValue:@""];
	}
	[savepanel beginSheetModalForWindow:parent
	       completionHandler:^(NSInteger returnCode)
	       { [NSApp tkFilePanelDidEnd:savepanel
		       returnCode:returnCode
		       contextInfo:callbackInfo ]; } ];
#endif
	modalReturnCode = cmdObj ? modalOther : [NSApp runModalForWindow:savepanel];
    } else {
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
	modalReturnCode = [savepanel runModalForDirectory:directory file:filename];
#else
	if (directory) {
	    [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]];
	}
	 /*check for file name, otherwise set to empty string; crashes with uncaught exception if set to nil*/
	if (filename) {
	    [savepanel setNameFieldStringValue:filename];
	} else {
	    [savepanel setNameFieldStringValue:@""];
	}
	modalReturnCode = [savepanel runModal];
	#if 0
	NSLog(@"modal: %li", modalReturnCode);
	#endif
#endif
	[NSApp tkFilePanelDidEnd:savepanel returnCode:modalReturnCode
		contextInfo:callbackInfo];
1043
1044
1045
1046
1047
1048
1049




1050
1051
1052
1053
1054
1055
1056
	    cmdObj = Tcl_DuplicateObj(cmdObj);
	}
	Tcl_IncrRefCount(cmdObj);
    }
    callbackInfo->cmdObj = cmdObj;
    callbackInfo->interp = interp;
    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:nil
		modalForWindow:parent







>
>
>
>







1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
	    cmdObj = Tcl_DuplicateObj(cmdObj);
	}
	Tcl_IncrRefCount(cmdObj);
    }
    callbackInfo->cmdObj = cmdObj;
    callbackInfo->interp = interp;
    callbackInfo->multiple = 0;
    /*check for directory value, set to root if not specified; otherwise crashes with exception because of nil string parameter*/
    if (!directory) {
	directory = @"/";
    }
    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:nil
		modalForWindow:parent

Changes to tests/text.test.

1570
1571
1572
1573
1574
1575
1576










1577
1578
1579
1580
1581
1582
1583
    destroy .t
} -result {foo 0 1}
test text-8.26 {TextWidgetCmd procedure, "replace" option crash} -setup {
    text .tt
} -body {
    .tt insert 0.0 foo\n
    .tt replace end-1l end bar










} -cleanup {
    destroy .tt
} -result {}


test text-9.1 {TextWidgetCmd procedure, "get" option} -setup {
    text .t







>
>
>
>
>
>
>
>
>
>







1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
    destroy .t
} -result {foo 0 1}
test text-8.26 {TextWidgetCmd procedure, "replace" option crash} -setup {
    text .tt
} -body {
    .tt insert 0.0 foo\n
    .tt replace end-1l end bar
} -cleanup {
    destroy .tt
} -result {}
test text-8.27 {TextWidgetCmd procedure, "replace" option crash} -setup {
    text .tt
} -body {
    .tt insert 0.0 \na
    for {set i 0} {$i < 2} {incr i} {
        .tt replace 2.0 3.0 b
    }
} -cleanup {
    destroy .tt
} -result {}


test text-9.1 {TextWidgetCmd procedure, "get" option} -setup {
    text .t

Changes to win/ttkWinMonitor.c.

118
119
120
121
122
123
124
125

126
127



128
129
130
131
132
133
134
135
136
137

    case WM_SYSCOLORCHANGE:
	RegisterSystemColors(interp);
	break;

    case WM_THEMECHANGED:
	/*
	 * Reset the application theme to 'xpnative' if present,

	 * which will in turn fall back to 'winnative' if XP theming
	 * is disabled.



	 */

	theme = Ttk_GetTheme(interp, "xpnative");
	if (theme) {
	    Ttk_UseTheme(interp, theme);
	    /* @@@ What to do about errors here? */
	}
	break;
    }
    return DefWindowProc(hwnd, msg, wp, lp);







|
>
|
<
>
>
>


|







118
119
120
121
122
123
124
125
126
127

128
129
130
131
132
133
134
135
136
137
138
139
140

    case WM_SYSCOLORCHANGE:
	RegisterSystemColors(interp);
	break;

    case WM_THEMECHANGED:
	/*
         * Reset the application theme.
         * On windows, it is possible to sign in as a second user, change
         * the theme to 'winnative' (by setting the ui to 'best performance'),

         * which is a machine-wide change, and then sign back on to the original user.
         * Ttk_UseTheme needs to be executed again in order to process the fallback
         * from vista/xpnative to winnative.
	 */

	theme = Ttk_GetCurrentTheme(interp);
	if (theme) {
	    Ttk_UseTheme(interp, theme);
	    /* @@@ What to do about errors here? */
	}
	break;
    }
    return DefWindowProc(hwnd, msg, wp, lp);