[PATCH] macdrv: Don't update clipboard if its content didn't change
Ken Thomases
ken at codeweavers.com
Thu May 25 13:46:51 CDT 2017
On May 25, 2017, at 1:22 PM, Piotr Caban <piotr at codeweavers.com> wrote:
>
> Signed-off-by: Piotr Caban <piotr at 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
More information about the wine-devel
mailing list