fb-mac-messenger icon indicating copy to clipboard operation
fb-mac-messenger copied to clipboard

Remove images paste logic

Open partykamdev opened this issue 9 years ago • 4 comments

Right now, copying file in Finder and pasting it in Messenger doesn't paste the file as attachment(in case for example .zip or .doc file), neither as an image (in case of png/jpg), but it pastes that file osx system icon. Also, pasting file from such an app as Snappy doesn't work (Messenger just does nothing. I have checked code, and there was some problem with generating fake drag&drop by MMFakeDragInfo). I have tested possible scenarios, and have found that all current logic isn't necessary, as pasting works perfectly well without it. This bug occurred on macOS Sierra, as well as OSX El Capitan.

Tested solution on macOS Sierra, and all paste file types work well. Correct me if I didn't take into account some other paste-scenario and that pull request will break it.

partykamdev avatar Oct 12 '16 23:10 partykamdev

Pasting files works for me, but pasting screenshots that were taken to the clipboard (⌃⌘⇧4) no longer works.

Useful to note that without these changes, the first time a clipboard screenshot is pasted, nothing happens, but the second time it actually pastes. With these changes, nothing happens at all.

So it seems like the actual paste operation is ok (no need to fake drag and drop instead), but we do still need special handling for whatever datatype a clipboard screenshot is.

greg avatar Dec 23 '16 15:12 greg

@greg

Pasting files works for me, but pasting screenshots that were taken to the clipboard (⌃⌘⇧4) no longer works.

Works fine for me. Sometimes I just need to paste twice..

emilstahl avatar Feb 06 '17 14:02 emilstahl

Correct, but it's not "sometimes", it's every time the content of your clipboard changes -- if you read the paste method, you'll see that it writes the image data to a temp file and replaces the clipboard, but doesn't actually paste (or attempts to and it doesn't work).

greg avatar Feb 06 '17 14:02 greg

I want to merge this, not for the original state reason (that it's useless) but because the code is of poor quality and too hacky for my taste.

However, some things I'd like understand before merging:

  1. Why is do we still need and implementation of - (IBAction)paste:(id)sender that just calls [[NSApplication sharedApplication] sendAction:@selector(paste:) to:nil from:self] ?

  2. This diff doesn't remove MMFakeDragInfo which seems to be used for clipboard stuff. Where else in the code is MMFakeDragInfo used and is there a reason those other uses shouldn't be updated as well?

rsms avatar Feb 18 '17 02:02 rsms