Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clipboard access functions don't return #f as documented #328

Open
kengruven opened this issue Jun 15, 2024 · 1 comment
Open

Clipboard access functions don't return #f as documented #328

kengruven opened this issue Jun 15, 2024 · 1 comment

Comments

@kengruven
Copy link
Contributor

The function get-clipboard-data says:

Gets the current clipboard contents in a specific format, returning #f if the clipboard does not contain data in the requested format.

In practice, on Linux, I can't get it to return #f:

> (require racket/gui)
> (send the-clipboard set-clipboard-string "hello, world" (current-seconds))
> (send the-clipboard get-clipboard-data "image/jpeg" (current-seconds))
#""

I've confirmed that after calling set-clipboard-string, the only types on the clipboard are "COMPOUND_TEXT", "STRING", "TEXT", "text/plain", "text/plain;charset=utf-8", and "UTF8_STRING". I don't know what comparison algorithm it's using for comparing formats, but by any reasonable measure, there's no JPEG image here.

@kengruven
Copy link
Contributor Author

The win32/clipboard.rkt and cocoa/clipboard.rkt implementations of get-data both have an overall (and ...), which makes sense for returning a false value. (I have not tested if they ever actually return #f.) The gtk/clipboard.rkt get-data, in contrast, calls gtk_clipboard_request_contents but doesn't seem to check the result anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant