Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-124214

QClipboard::ownsClipboard() always false on macOS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.7
    • GUI: Other
    • None
    • macOS

    Description

      Calling QClipboard::ownsClipboard() on macOS always returns false, making it impossible/difficult to determine if the clipboard is ours or not. This is crucial for us at TigerVNC, as we need to know which direction to synchronise the clipboard.

      The documentation states "Windows and macOS does not have the concept of ownership; the clipboard is a fully global resource so all applications are notified of changes.", but I don't think this is correct.

      From Apple's documentation:

      https://developer.apple.com/documentation/appkit/nspasteboard/1533544-changecount

      The change count is also returned from clearContents and declareTypes:owner:. You can therefore record the value of changeCount at the time that you take ownership of the pasteboard and compare it with a later value to determine whether you still have ownership.

      Qt also seems to use PasteboardSynchronize, which seems to be able to return the flag kPasteboardClientIsOwner. So perhaps even a second method to track ownership.

      (ownsClipboard() also seems to work fine on Windows, so I don't think that part of the documentation is correct either).

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            cendossm Pierre Ossman (Cendio AB)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes