Imported Tk 8.6.9
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include "tkMacOSXPrivate.h"
|
||||
#include "tkMacOSXConstants.h"
|
||||
#include "tkSelect.h"
|
||||
|
||||
static NSInteger changeCount = -1;
|
||||
@@ -70,10 +71,8 @@ static Tk_Window clipboardOwner = NULL;
|
||||
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;
|
||||
@@ -125,8 +124,10 @@ TkSelGetSelection(
|
||||
int result = TCL_ERROR;
|
||||
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
|
||||
|
||||
if (dispPtr && selection == dispPtr->clipboardAtom && (target == XA_STRING
|
||||
|| target == dispPtr->utf8Atom)) {
|
||||
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:
|
||||
@@ -176,7 +177,6 @@ XSetSelectionOwner(
|
||||
clipboardOwner = owner ? Tk_IdToWindow(display, owner) : NULL;
|
||||
if (!dispPtr->clipboardActive) {
|
||||
NSPasteboard *pb = [NSPasteboard generalPasteboard];
|
||||
|
||||
changeCount = [pb declareTypes:[NSArray array] owner:NSApp];
|
||||
}
|
||||
}
|
||||
@@ -289,28 +289,6 @@ TkSelPropProc(
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TkSuspendClipboard --
|
||||
*
|
||||
* Handle clipboard conversion as required by the suppend event.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* The local scrap is moved to the global scrap.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
TkSuspendClipboard(void)
|
||||
{
|
||||
changeCount = [[NSPasteboard generalPasteboard] changeCount];
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: objc
|
||||
|
||||
Reference in New Issue
Block a user