Skip to content

Conversation

@VZout
Copy link

@VZout VZout commented Aug 24, 2023

Instead of storing as png on linux and tiff on macos, it feels nicer to just store it as png everywhere.

(haven't tested it yet, but macos docs say this is possible)

default = ["image-data"]
image-data = ["core-graphics", "image", "winapi/minwindef", "winapi/wingdi", "winapi/winnt"]
wayland-data-control = ["wl-clipboard-rs"]
image-data = ["dep:core-graphics", "dep:image", "winapi/minwindef", "winapi/wingdi", "winapi/winnt"]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the feature flags in the docs a bit more readable as right now it shows image, core-graphics and wl-clipboard-rs as "features" but they are just optional dependencies

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, this requires a bump to Rust 1.60 to support:

The dep: syntax is only available starting with Rust 1.60. Previous versions can only use the implicit feature name.

arboard doesn't currently have an MSRV, and 1.60 is over a year old at this point, so I don't think its a big deal. Its also easy enough to rollback if it causes someone problems. I'm mentioning it just in case though.

@complexspaces
Copy link
Member

Thanks for the PR. I think this change makes sense as long as it doesn't break copying compatibility in any noticeable way. Could I ask you to try some testing by copying images from various apps/websites to see if there's a difference in what NSPasteboard can convert into a .png vs a .tiff?

Copy link
Member

@complexspaces complexspaces left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding my comment about compatibility testing, I got a little bit ahead of myself since I didn't look at the code first. Sorry. Feel free to play around on my other PR though where you could fit PNG reading in though.

default = ["image-data"]
image-data = ["core-graphics", "image", "winapi/minwindef", "winapi/wingdi", "winapi/winnt"]
wayland-data-control = ["wl-clipboard-rs"]
image-data = ["dep:core-graphics", "dep:image", "winapi/minwindef", "winapi/wingdi", "winapi/winnt"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, this requires a bump to Rust 1.60 to support:

The dep: syntax is only available starting with Rust 1.60. Previous versions can only use the implicit feature name.

arboard doesn't currently have an MSRV, and 1.60 is over a year old at this point, so I don't think its a big deal. Its also easy enough to rollback if it causes someone problems. I'm mentioning it just in case though.

};

let tiff: &NSArray<NSObject> = unsafe { msg_send![obj, TIFFRepresentation] };
let png: &NSArray<NSObject> = unsafe { msg_send![obj, PNGRepresentation] };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe NSImage supports this representation (and is causing a test failure), unlike UIImage which does.

One alternative may be to wait for #106 to merge which switches to a different method of getting images from the clipboard. That way does support PNG like you'd want.

@complexspaces complexspaces added enhancement New feature or request waiting on author Further information is requested O-Apple Work related to the macOS or iOS clipboard labels Jun 18, 2025
@complexspaces
Copy link
Member

Closing in favor of #164 or future PRs doing similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request O-Apple Work related to the macOS or iOS clipboard waiting on author Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants