diff options
Diffstat (limited to 'macosx/tkMacOSXClipboard.c')
-rw-r--r-- | macosx/tkMacOSXClipboard.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c index 07a8419..efd3c69 100644 --- a/macosx/tkMacOSXClipboard.c +++ b/macosx/tkMacOSXClipboard.c @@ -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]; } } @@ -290,28 +290,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 * c-basic-offset: 4 |