On May 25, 2017, at 1:22 PM, Piotr Caban <piotr(a)codeweavers.com> wrote:
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> --- dlls/winemac.drv/clipboard.c | 34 ++++++++++------------------------ dlls/winemac.drv/cocoa_clipboard.m | 18 ++++++++++++++++++ dlls/winemac.drv/macdrv_cocoa.h | 1 + 3 files changed, 29 insertions(+), 24 deletions(-)
+int macdrv_has_pasteboard_changed(void) +{ + __block int new_change_count; + int ret; + + OnMainThread(^{ + NSPasteboard* pb = [NSPasteboard generalPasteboard]; + new_change_count = [pb changeCount]; + }); + + ret = (change_count != new_change_count); + change_count = new_change_count; + return ret; +}
Unfortunately, -[NSPasteboard changeCount] isn't incremented for all changes to the pasteboard. For example, if the owner replaces the data for an existing type, it doesn't change. I'd have to check again, but I think it doesn't even change if the owner adds a new data type. I think it only changes when the pasteboard is cleared and rebuilt by -clearContents or -declareTypes:owner:. -Ken