[PATCH] macdrv: Don't update clipboard if its content didn't change

Piotr Caban piotr at codeweavers.com
Fri May 26 01:23:45 CDT 2017


> I'll have to run some tests again to see exactly which operations do and don't increment the change count.  I'll let you know what I find.
> 
> It may be that your patch is better for the vast majority of the cases such that we should commit it.  We'll just accept incorrect behavior for the (hopefully) rare aberrant uses of the API that I'm concerned about.  Or maybe we can take a belt-and-suspenders approach and check both the change count and the list of types.

I’ve done some initial testing:

	[myPasteboard clearContents];
clearContent increments the changeCount.

	[myPasteboard setString:@"test" forType:NSStringPboardType];
        NSLog(@"changeCount %ld", [myPasteboard changeCount]);
        [NSThread sleepForTimeInterval:2];
        [myPasteboard setString:@"test2" forType:NSStringPboardType];
        NSLog(@“changeCount %ld", [myPasteboard changeCount]);
In this case changeCount doesn’t change no matter if other applications read the pasteboard data between setString calls.

	[myPasteboard addTypes:[NSArray arrayWithObject:NSRTFPboardType] owner:nil];
        NSLog(@“addTypes changeCount %ld”, [myPasteboard changeCount]);
        [myPasteboard setString:rtf forType:NSRTFPboardType];
        NSLog(@"new data type changeCount %ld", [myPasteboard changeCount]);
Adding new clipboard format doesn’t change changeCount. Setting value for newly added format also doesn’t change it.

	[myPasteboard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, NSURLPboardType, nil] owner:nil];
declareTypes changes changeCount value.

Thank you,
Piotr






More information about the wine-devel mailing list