Tk Source Code

Check-in Differences
Login

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

Difference From 902c9d170a386c95 To 3dd96e7babd82262

2018-08-18
21:22
merge core-8-6-branch check-in: f9947b8d user: culler tags: bug-b947864419, bug-b947864419-redux
21:15
Fix bug [c2c5bdb4aa]: segfault when opening colorpicker check-in: 6f994d29 user: culler tags: core-8-6-branch
21:08
Fix bug [c2c5bdb4aa]: add test for NULL pointer Closed-Leaf check-in: 66456ff1 user: culler tags: bug-c2c5bdb4aa
2018-08-15
19:51
Reverted a pointless change in tkCheckPasteboard. check-in: 3dd96e7b user: culler tags: bug-b947864419, bug-b947864419-redux
19:17
Fix bug [b947864419]: Also account for changes to the clipboard made by other apps check-in: c554e32b user: culler tags: bug-b947864419, bug-b947864419-redux
16:22
Fix [98dce84781]: yesno messageBoxes on macOS return wrong values check-in: b2160d49 user: fvogel tags: trunk
16:21
Fix [98dce84781]: yesno messageBoxes on macOS return wrong values check-in: 902c9d17 user: fvogel tags: core-8-6-branch
16:20
Fix [98dce84781] by partial revert of previous commit. check-in: ccf173b5 user: fvogel tags: bug-66db98f30d, bug-98dce84781
15:54
Revert [b4c5f163] since it breaks paste function with text from another application, see [568827f41c] check-in: 6557e972 user: fvogel tags: core-8-6-branch

Changes to macosx/tkMacOSXClipboard.c.

69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
    if (clipboardOwner && [[NSPasteboard generalPasteboard] changeCount] !=
	    changeCount) {
	TkDisplay *dispPtr = TkGetDisplayList();

	if (dispPtr) {
	    XEvent event;

	    event.xany.type = SelectionClear;
	    event.xany.serial = NextRequest(Tk_Display(clipboardOwner));
	    event.xany.send_event = False;
	    event.xany.window = Tk_WindowId(clipboardOwner);
	    event.xany.display = Tk_Display(clipboardOwner);
	    event.xselectionclear.selection = dispPtr->clipboardAtom;
	    Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);







<







69
70
71
72
73
74
75

76
77
78
79
80
81
82
{
    if (clipboardOwner && [[NSPasteboard generalPasteboard] changeCount] !=
	    changeCount) {
	TkDisplay *dispPtr = TkGetDisplayList();

	if (dispPtr) {
	    XEvent event;

	    event.xany.type = SelectionClear;
	    event.xany.serial = NextRequest(Tk_Display(clipboardOwner));
	    event.xany.send_event = False;
	    event.xany.window = Tk_WindowId(clipboardOwner);
	    event.xany.display = Tk_Display(clipboardOwner);
	    event.xselectionclear.selection = dispPtr->clipboardAtom;
	    Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
121
122
123
124
125
126
127


128
129
130
131
132
133
134
135
136
    Tk_GetSelProc *proc,	/* Procedure to call to process the selection,
				 * once it has been retrieved. */
    ClientData clientData)	/* Arbitrary value to pass to proc. */
{
    int result = TCL_ERROR;
    TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;



    if (dispPtr && selection == dispPtr->clipboardAtom && (target == XA_STRING
	    || target == dispPtr->utf8Atom)) {
	NSString *string = nil;
	NSPasteboard *pb = [NSPasteboard generalPasteboard];
	NSString *type = [pb availableTypeFromArray:[NSArray arrayWithObject:
		NSStringPboardType]];

	if (type) {
	    string = [pb stringForType:type];







>
>
|
|







120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
    Tk_GetSelProc *proc,	/* Procedure to call to process the selection,
				 * once it has been retrieved. */
    ClientData clientData)	/* Arbitrary value to pass to proc. */
{
    int result = TCL_ERROR;
    TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;

    int haveExternalClip = ([[NSPasteboard generalPasteboard] changeCount] != changeCount);
    if (dispPtr && (haveExternalClip || dispPtr->clipboardActive)
	        && selection == dispPtr->clipboardAtom
	        && (target == XA_STRING || target == dispPtr->utf8Atom)) {
	NSString *string = nil;
	NSPasteboard *pb = [NSPasteboard generalPasteboard];
	NSString *type = [pb availableTypeFromArray:[NSArray arrayWithObject:
		NSStringPboardType]];

	if (type) {
	    string = [pb stringForType:type];
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
{
    TkDisplay *dispPtr = TkGetDisplayList();

    if (dispPtr && selection == dispPtr->clipboardAtom) {
	clipboardOwner = owner ? Tk_IdToWindow(display, owner) : NULL;
	if (!dispPtr->clipboardActive) {
	    NSPasteboard *pb = [NSPasteboard generalPasteboard];

	    changeCount = [pb declareTypes:[NSArray array] owner:NSApp];
	}
    }
    return Success;
}

/*







<







173
174
175
176
177
178
179

180
181
182
183
184
185
186
{
    TkDisplay *dispPtr = TkGetDisplayList();

    if (dispPtr && selection == dispPtr->clipboardAtom) {
	clipboardOwner = owner ? Tk_IdToWindow(display, owner) : NULL;
	if (!dispPtr->clipboardActive) {
	    NSPasteboard *pb = [NSPasteboard generalPasteboard];

	    changeCount = [pb declareTypes:[NSArray array] owner:NSApp];
	}
    }
    return Success;
}

/*

Changes to macosx/tkMacOSXDialog.c.

113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
static const char *const alertIconStrings[] = {
    "error", "info", "question", "warning", NULL
};
enum alertIconOptions {
    ICON_ERROR, ICON_INFO, ICON_QUESTION, ICON_WARNING
};
static const char *const alertButtonStrings[] = {
    "abort", "retry", "ignore", "ok", "cancel", "yes", "no", NULL
};

static const NSString *const alertButtonNames[][3] = {
    [TYPE_ABORTRETRYIGNORE] =   {@"Abort", @"Retry", @"Ignore"},
    [TYPE_OK] =			{@"OK"},
    [TYPE_OKCANCEL] =		{@"OK", @"Cancel"},
    [TYPE_RETRYCANCEL] =	{@"Retry", @"Cancel"},







|







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
static const char *const alertIconStrings[] = {
    "error", "info", "question", "warning", NULL
};
enum alertIconOptions {
    ICON_ERROR, ICON_INFO, ICON_QUESTION, ICON_WARNING
};
static const char *const alertButtonStrings[] = {
    "abort", "retry", "ignore", "ok", "cancel", "no", "yes", NULL
};

static const NSString *const alertButtonNames[][3] = {
    [TYPE_ABORTRETRYIGNORE] =   {@"Abort", @"Retry", @"Ignore"},
    [TYPE_OK] =			{@"OK"},
    [TYPE_OKCANCEL] =		{@"OK", @"Cancel"},
    [TYPE_RETRYCANCEL] =	{@"Retry", @"Cancel"},