Import Tk 8.6.11

This commit is contained in:
Steve Dower
2021-03-30 00:54:10 +01:00
parent 42c69189d9
commit 070b8750b0
403 changed files with 21608 additions and 16269 deletions

View File

@@ -35,7 +35,9 @@ static Tk_Window clipboardOwner = NULL;
targetPtr->type == dispPtr->utf8Atom) {
for (TkClipboardBuffer *cbPtr = targetPtr->firstBufferPtr;
cbPtr; cbPtr = cbPtr->nextPtr) {
NSString *s = TclUniToNSString(cbPtr->buffer, cbPtr->length);
NSString *s = [[TKNSString alloc]
initWithTclUtfBytes:cbPtr->buffer
length:cbPtr->length];
[string appendString:s];
[s release];
}
@@ -135,26 +137,19 @@ TkSelGetSelection(
string = [pb stringForType:type];
}
if (string) {
/*
* Encode the string using the encoding which is used in Tcl
* when TCL_UTF_MAX = 3. This replaces each UTF-16 surrogate with
* a 3-byte sequence generated using the UTF-8 algorithm. (Even
* though UTF-8 does not allow encoding surrogates, the algorithm
* does produce a 3-byte sequence.)
*/
char *bytes = NSStringToTclUni(string, NULL);
result = proc(clientData, interp, bytes);
if (bytes) {
ckfree(bytes);
if (target == dispPtr->utf8Atom) {
result = proc(clientData, interp, string.UTF8String);
} else if (target == XA_STRING) {
const char *latin1 = [string
cStringUsingEncoding:NSISOLatin1StringEncoding];
result = proc(clientData, interp, latin1);
}
}
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s selection doesn't exist or form \"%s\" not defined",
Tk_GetAtomName(tkwin, selection),
Tk_GetAtomName(tkwin, target)));
"%s selection doesn't exist or form \"%s\" not defined",
Tk_GetAtomName(tkwin, selection),
Tk_GetAtomName(tkwin, target)));
Tcl_SetErrorCode(interp, "TK", "SELECTION", "EXISTS", NULL);
}
return result;
@@ -182,7 +177,7 @@ XSetSelectionOwner(
Display *display, /* X Display. */
Atom selection, /* What selection to own. */
Window owner, /* Window to be the owner. */
Time time) /* The current time? */
TCL_UNUSED(Time)) /* The current time? */
{
TkDisplay *dispPtr = TkGetDisplayList();
@@ -242,8 +237,8 @@ TkMacOSXSelDeadWindow(
void
TkSelUpdateClipboard(
TkWindow *winPtr, /* Window associated with clipboard. */
TkClipboardTarget *targetPtr)
TCL_UNUSED(TkWindow *), /* Window associated with clipboard. */
TCL_UNUSED(TkClipboardTarget *))
/* Info about the content. */
{
NSPasteboard *pb = [NSPasteboard generalPasteboard];
@@ -271,7 +266,7 @@ TkSelUpdateClipboard(
void
TkSelEventProc(
Tk_Window tkwin, /* Window for which event was targeted. */
register XEvent *eventPtr) /* X event: either SelectionClear,
XEvent *eventPtr) /* X event: either SelectionClear,
* SelectionRequest, or SelectionNotify. */
{
if (eventPtr->type == SelectionClear) {
@@ -299,7 +294,7 @@ TkSelEventProc(
void
TkSelPropProc(
register XEvent *eventPtr) /* X PropertyChange event. */
TCL_UNUSED(XEvent *)) /* X PropertyChange event. */
{
}