Bug 434619 - copy paste broken
Summary: copy paste broken
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Usability (other bugs)
Version First Reported In: 4.4.3-beta2
Platform: macOS (DMG) macOS
: NOR wishlist
Target Milestone: ---
Assignee: vanyossi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-19 11:39 UTC by Manga Tengu
Modified: 2021-04-01 20:18 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Manga Tengu 2021-03-19 11:39:55 UTC
SUMMARY
Whatever I copy, when I paste in krita (via cmd V or cmd shift N) I only get a gigantic image icon (jpg in my case)

STEPS TO REPRODUCE
1. copy an image in the finder
2. paste in krita or cmd + shift + N

OBSERVED RESULT
an image icon instead of content

EXPECTED RESULT
nicely pasted images

macOS: 11.2.3 (20D91)
15' 2018 MacBook pro
Comment 1 Halla Rempt 2021-03-19 11:45:45 UTC
Um... Is this supposed to work at all? Selecting copy in the file manager doesn't put the image on the clipboard, but the file name, as far as I can tell.
Comment 2 Manga Tengu 2021-03-19 12:05:41 UTC
up until now it worked well. 
btw if that can help, I could even copy paste between photoshop and krita.
Comment 3 Halla Rempt 2021-03-19 12:33:55 UTC
Hm, it works with older versions of macOS, but not with Big Sur. Only if I move the file into the Documents folder can I paste it -- and then I get the icon, not the file contents. Maybe we need extra permissions to read that. Drag and drop still works.
Comment 4 Manga Tengu 2021-03-19 14:02:38 UTC
yes drag & drop works but with the following issue: https://bugs.kde.org/show_bug.cgi?id=434618
Comment 5 vanyossi 2021-03-19 18:59:18 UTC
This has never worked, there is no code in krita for it. (at least not as old as I could look). KisClipboardUtil.cpp manages the clipboard pasting. And the supported mimetypes does not include text/uri-list.

Below are the mimetypes reported from clipboard when copying from Finder

"text/uri-list"
"text-plain"
"application/x-qt-image"

When the image is not generated from clipboard we fallback to the default "QApplication::clipboard()->image() contents which are the mimetype icons.

Clipboard expects image data to return, in case of a text/uri-list mimetype the most we can do whitout refactoring is to take the first element in the list and load the image from file. ??

BTW: Copying and pasting between programs works perfectly fine.

1. From finder open document in "Preview"
2. Cmd + C
3. Paste in krita (or open from clipboard)

can we change the title and move this to a wish maybe?
Comment 6 Manga Tengu 2021-03-19 19:08:11 UTC
True I have mixed memories. The thing I'm used to doing is right-click copy layer and then Cmd + shift + N to get a new perfectly sized image...

I feel like this is an expected behavior. I mean I guess most people would expect it to act this way?
Comment 7 Halla Rempt 2021-03-19 19:30:41 UTC
I got confused because I was pasting into a too small file, but I don't think so -- you're copying a file, not an image.
Comment 8 Manga Tengu 2021-03-19 19:40:46 UTC
It works like that in other programs and I find it feels natural. I guess I'm the only one here.
Comment 9 Bug Janitor Service 2021-03-25 02:51:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/766
Comment 10 vanyossi 2021-03-25 02:58:01 UTC
Decided to hack a little code to see how it behaves. (MR above)

Copying from dolphin or Finder works correctly, however I did not tested all paste contexts, only "create from clipboard" and "paste into canvas" as those are the ones I modified.

What I've seen is that the KisClipBoardUtil is not used to parse in all clipboard contexts but only one case. I had to add it to kis_image_from_clipboard to load dimensions correctly.

While not confirmed, im assigning the report to me, and changing it to a whish.
Comment 11 vanyossi 2021-04-01 20:18:10 UTC
Bug is fixed now, MR https://invent.kde.org/graphics/krita/-/merge_requests/766 is merged