Closed Bug 21747 Opened 25 years ago Closed 17 years ago

Implement backend for cmd_copyImageContents

Categories

(Core :: Widget: Gtk, defect)

x86
Linux
defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla1.9beta3

People

(Reporter: elig, Assigned: ventnor.bugzilla)

References

Details

(Keywords: platform-parity, Whiteboard: [Hixie-P0] [geekweb-P4])

Attachments

(1 file, 3 obsolete files)

* TITLE/SUMMARY
[4.x] Seamonkey lacks Copy Image functionality

* STEPS TO REPRODUCE
0) Launch Apprunner
1) View a page with an image, such as the http://slip/projects/marvin/copy-paste/
copy-img test case
2) Context-click on the image

* RESULT
 - What happened

The context menu lacks a "Copy Image" or "Copy this Image" menu item. (There is a
disabled "Copy" menu item, however.)

 - What was expected

Image copying functionality, as has been present in Navigator since 1995 (for Mac
OS, at least).

* REGRESSION

 - Occurs On
        Mac OS Apprunner (8.24.99 AM optimized build)

 - Doesn't Occur On
        Netscape Navigator 1.12 (1995 release for Mac OS)
        Netscape Communicator 4.7 (all platforms)
        Internet Explorer 4.01 (Mac OS)


* CONFIGURATIONS TESTED

- [Mac] Beige Power Mac G3 (266 MHz PowerPC 750), 96 MB RAM (VM on; 1 MB of VM
used), 1024x768 (Thousands of Colors), Mac OS 8.6

- [Win32] Vectra VL (233 MHz P2), 96 MB RAM, 800x600 (True Color), NT 4.0 SP5.

- [Linux] Vectra VL (266 MHz P2), 96 MB RAM. Red Hat Linux 6.0 (GNOME).
QA Contact: paulmac → elig
[qa assigning to self.]
Status: NEW → ASSIGNED
OS: Mac System 8.5 → All
Summary: [4.x] Seamonkey lacks Copy Image functionality → Seamonkey lacks Copy Image functionality
Target Milestone: M15
Marking this M15 at Pinkerton's suggestion.  The clipboard doesn't currently
support images, and it's not clear what out plans are for this feature.  (I'd
like to see us support image copy, too, and have no objection to implementing
the editor end of it ... please talk the Powers That Be into agreeing that it's
needed.)

I'm also removing the [4.x] from the summary since that makes it look like it's
a 4.x bug, and changing platform/OS to All.
Depends on: 9669
[Noted dependency on 9669.]
[per suggestion from Akkana, pinged jar to find out if he'd know who the "Powers
that Be" would comprise.]
I'm not sure who the "powers that be" are... but I decided to add Chris Saito to
the cc list.  I would also expect that this bug (for better or worse) should
land over in Pinkerton's pile, but I'm not going to move it (presuming that
folks had a reason for akkana to be holding it).
If this is indeed a regression from 4.x, we need to be sure this issue is
highlighted to Netscape marketing for their signoff relative to a Netscape
product, before we abandon it to the hope that non-Netscape activity would
supply the functionality.
i think the ability to do this on win32 might already be there (i think i saw
that rod had already written the code). sdagley has a bug/feature to do this on
MacOS. Dunno what we want to do about linux (ask pav).

akkana has this bug probably because of the xp stuff that would have to be done
to allow this...there is more than just support from the clipboard.
Target Milestone: M15 → M18
moving this one out to m18 -- we need to figure out the specs on this before we
go any further
Since the bug to implement the underlying architecture has been latered, would it 
be worth doing likewise with this bug?

Yep, unfortunately we can't add this in the front end if it isn't going to be
implemented in the backend.  Thanks for the alert, Eli.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → LATER
Sure.

Correspondingly, Simon has snatched 9669 from the brink of death and re-opened
it, so, I'll do likewise with this bug. (Okay, other than the part about
reassigning it to Simon. ;)
Status: RESOLVED → REOPENED
Resolution: LATER → ---
Status: REOPENED → ASSIGNED
Currently (2000-041908 M16 linux) - ANY image that is clicked on is copied to
clipboard. Works like a dream - pasting them too, but i don't really need all
that copying going on. I hope this copy-feature will be moved to context menu
instead?
Sounds like another bug: clicking on an image blows away my clipboard.  Already
filed?
Strange you should mention it - yes, actually it is: bug 36809
9669 has been futured again (surprise, surprise!) so I'll do likewise with this
dependant bug.  Sorry, all.
Target Milestone: M18 → Future
adding help wanted keyword
Keywords: helpwanted
Blocks: 36866
Anthony is taking over Output.  Not clear what XPToolkit folks want to do about
image copies.
Assignee: akkana → anthonyd
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
*** Bug 60834 has been marked as a duplicate of this bug. ***
QA Contact: elig → sairuh
*** Bug 56341 has been marked as a duplicate of this bug. ***
[Copying stuff from bug 56341]

Comments from pinkerton@netscape.com:

Support for image copy is about as follows:
- get dcone to provide necessary api's on nsIImage (1 day)
- get editor team to hook up image copy to clipboard api's (2 days)
  -- probably just give the clipboard the nsIImage
- write clipboard code to go between nsIImage and native image data (2 days per
platform)
Assignee: anthonyd → pinkerton
Status: ASSIGNED → NEW
Keywords: helpwantedembed
Priority: P3 → P1
Target Milestone: Future → mozilla0.8
nav triage team:

Not important for beta1, marking nsbeta1-
Keywords: nsbeta1-
This is a required embedding feature, and is already targetted for the next 
milestone, so all the nsbeta keyword stuff should be moot, and I'm removing it. 
Is there any Apps-specific work implied by this bug? If so, perhaps bug 56341 
should be reopened, and the differences clarified.  Also, if this work really 
depends on bug 9669, that will need be retargetted, and possibly reassigned. cc 
pchen,sfraser
Keywords: nsbeta1-
Changing qa contact as i am resposible for this area now
QA Contact: sairuh → tpreston
there is gecko work that needs to be done here, once it is hooked up in the 
toolkit, which is why i was leaving the two bugs separated (one was owned by 
the ender team).

whatever.
Status: NEW → ASSIGNED
i've landed this for win32. mac and linux still need work here.
just landed image->PICT code on macos. only unix is left, and for someone to
call them. pushing to pavlov for implementation on unix, anthonyd and I will
file other fe-specific bugs when the presShell functionality comes online.

removing 36866 as a dependency, since there's nothing about clipboard support in
that bug (only the menu text, which isn't my department).
Assignee: pinkerton → pavlov
No longer blocks: 36866
Status: ASSIGNED → NEW
OS: All → Linux
Hardware: All → PC
Summary: Seamonkey lacks Copy Image functionality → Linux lacks Copy Image functionality
future. no linux apps care about this what-so-ever
Target Milestone: mozilla0.8 → Future
Huh?  Gimp does this, so why should Linux be the only platform where we don't
support it? reassigning to dr, leaving future for now, as I hear there are no
plans to use this in the editor.  Would be good to estimate how much toolkit
work is involved.
Assignee: pavlov → dr
trudelle: i don't know about pavlov's assessment... with respect to time
involved, it'd be 2-3 days to write the conversion code from our image data to
x's (and for all i know, tor may have written this code already), and minimal
work to hook up to the clipboard after that.

if mac and win32 can do it, unix ought to also... ->1.0.
Status: NEW → ASSIGNED
Component: XP Apps → XP Miscellany
Priority: P1 → P3
QA Contact: tpreston → jrgm
Summary: Linux lacks Copy Image functionality → Unix lacks Copy Image functionality
Target Milestone: Future → mozilla1.0
gimp doesn't do it.  gimp only supports copying inside itself.
Blocks: 64833
An important distinction.  I think this should work on Linux, but I don't think
we can afford to be the first to do it.  adding helpwanted keyword.
Keywords: helpwanted
Blocks: 70229
just curious, how does this block embedding?
It was required for Win32 embedding, but has morphed to Linux-only and shouldn't 
block any known clients now.
In that case, removing embed keyword and detaching from the tracking bug. Unless
I'm mistaken, this shouldn't be on Jud's radar.
No longer blocks: 70229
Keywords: embed
*** Bug 71922 has been marked as a duplicate of this bug. ***
This is not just in Unix, Windows on build 2001031008 doesn't have this ability 
either. Pinkerton said he landed this for Windows, so I'm assuming the front-
end hasn't been done yet.
right, win32 and mac backends are in, but anthonyd has the bug for the UI. this 
bug is for the linux backend.
No longer blocks: 64833
Patch I'm working on in bug 64313 has a nice place,
PresShell::DoCopyImageContents, to work from, which is called on
cmd_copyImageContents.

Unix image-copying backend still needs implementation, and all backends need to
be hooked up to this new method.
Depends on: 64313
Summary: Unix lacks Copy Image functionality → Implement backend for cmd_copyImageContents
Target Milestone: mozilla1.0 → mozilla0.9.1
Severity: normal → major
Keywords: helpwanted
Priority: P3 → P2
Priority: P2 → P3
->future, per trudelle
Target Milestone: mozilla0.9.1 → Future
[spam] dr@netscape.com's bugs subject to redistribution by chofmann. R!
Assignee: dr → chofmann
Status: ASSIGNED → NEW
Priority: P3 → --
Target Milestone: Future → ---
[Tested using the "official" win32 mozilla 0.9.5 (build 2001101117) on Windows 2000]

* Shouldn't platform/OS be marked to All (I still don't see any way to copy
images in Win32 for example, I can see a disabled 'copy' command in the popup
tough) ?
* Is there any bug for the frontend -> popup on images showing 'Copy image (to
clipboard)', maybe also in "Edit" when only the image is showed (when 'show
image' is chosen). At this moment the only thing it does is copying the image
location like "[http://www.mozilla.org/images/mozilla-banner.gif]", and even
this option is available only if the image is double-clicked.
* Why is this bug not marked as '4xp' ?
* Since it is really a major bug (several people i know don't like/use
mozilla/ns6 for this mean reason - "I can't copy an image to the clipboard") can
we have at least a target milestone? 
This should probably belong somewhere with trudelle's team.
Assignee: chofmann → trudelle
Component: XP Miscellany → XP Apps
QA Contact: jrgm → sairuh
Not sure how critical this is for MachV, but if it is trivial, maybe someone can
find time.  cc tpringle for input.
QA Contact: sairuh → tpreston
Hmm.  Frankly what is more critical (not sure if it is related work) is the set
image as wallpaper option.  Press and user feedback indicate that this is
important functionality to people.
I think that is completely unrelated.  This feature is described in the original
report above.
->bryner
Assignee: trudelle → bryner
Todd: Is there a bug on the wallpaper? If not, create one and assign it to me. I
will fix it. Otherwise, do you know the bug #?
Brian, I think there is another bug filed on the set as wallpaper option, but
I'm not sure what the number is.  Joe Hewitt might know - ccing him.
This is pretty darn easy to do on Windows, but other platforms would be
difficult I presume.  The BITMAP data and header structs can be retrieved pretty
easily, as you can see in the patch for Set As Wallpaper (bug 41526).  Copying
them into the clipboard should be a snap on windows, where the BITMAP structures
are natively supported.
*** Bug 127201 has been marked as a duplicate of this bug. ***
I just received bug 110153 to supply UI for this feature.
But we don't need any new UI, right?
Using "copy" on an image should put both the current clipboard flavors as well as 
actual bits (CF_BITMAP in windows). This is how it works in Netscape 4.x
"Copy" on an image is still not there in the new context menus (build
2002040403, win32). Copy is neither enabled in the Edit menu when choosing "View
Image".
Isn't that "UI" ?
*** Bug 130938 has been marked as a duplicate of this bug. ***
No longer blocks: 135300
Whiteboard: [Hixie-P0]
Images also do not high-light / which means they can't be selected to be copied 
or printed.
They don't highlight; that doesn't mean they can't be selected. They in fact are
selected, you just can't see that they are.
That's a defect in itself, selections should be clearly visible.
... And it's a separate defect, namely bug 14835. Marking as dependent, since an
image shouldn't look selected if selecting it doesn't do anything.
Blocks: 14835
*** Bug 130708 has been marked as a duplicate of this bug. ***
*** Bug 164788 has been marked as a duplicate of this bug. ***
I think the people at mozilla should wontfix this if there not going to fix it
rather than just leaving it 
Whiteboard: [Hixie-P0] → [Hixie-P0] [geekweb-P4]
This will be fixed, _eventually_... All the quicker if someone offers a patch. :-)
The UI for this feature is bug 135300, "context menus: add Copy Image per ui 
spec".  Hixie, did you mean to remove the dependency link between this bug and 
135300?  Because this bug is linux-only and backends already exist for other 
platforms?
oops.
Blocks: 135300
*** Bug 195572 has been marked as a duplicate of this bug. ***
*** Bug 206076 has been marked as a duplicate of this bug. ***
Blocks: 210043
Yes I think that "Copy Image" is a very useful feature that lacks in Mozilla 1.4
. I think it would be great if there were "Copy Image" and "Copy Image Location"
(in order to have a short context menu, why not doing a submenu called "Menu"
and when you move the mouse over it, it appears two items at the right of Menu
with the two items mentioned above ?), even if I don't use Copy Image Location.
In Opera (7.11), there are the two options in the context menu.
A big context menu is somehow not very annoying.
Isn't this fixed as indicated in bug 64313?
Nope, still needs fixing.
*** Bug 216857 has been marked as a duplicate of this bug. ***
http://gratisdei.com/FB.htm
seems to have the copy image function
Since they write "Activates the inherent ability ..." this sounds like they just
enable the function. But this should not work on Linux, since there is no such
function (and that's what this bug is about).
I assume by Linux, you mean Gtk and qt, for as far as I know, neither Linux nor
X have a clipboard. Would this also apply to all *nixes running Gtk or qt?
Brian: You are right, that Linux has no clipboard. 

But X has one and Mozilla is using it already for copying text. The X clipboard
is capable of other content types then just text. Clients even can negotiate the
content type of the copied data.

For more information on this see http://www.jwz.org/doc/x-cut-and-paste.html and
http://tronche.com/gui/x/icccm/sec-2.html
*** Bug 219258 has been marked as a duplicate of this bug. ***
*** Bug 221119 has been marked as a duplicate of this bug. ***
*** Bug 223170 has been marked as a duplicate of this bug. ***
*** Bug 229660 has been marked as a duplicate of this bug. ***
Blocks: 234716
*** Bug 239742 has been marked as a duplicate of this bug. ***
*** Bug 242214 has been marked as a duplicate of this bug. ***
Product: Core → Mozilla Application Suite
Assignee: bryner → blizzard
Component: XP Apps → Widget: Gtk
Product: Mozilla Application Suite → Core
QA Contact: tpreston → ian
Am I correct in presuming this bug is the reason why, running Xubuntu 6.06 Dapper, I can't copy an image in Firefox 1.5.0.5 and paste it directly into the Gimp 2.2.11 or Krita 1.5?  (I've tried highlighting an image to copy it, and pasting it, but no dice.)

This is about *half* of my dissatisfaction with copy-paste in Linux, the other half being the lack of an Irfanview alternative that can *receive* pasted images.

And this bug hasn't been touched in TWO YEARS? D:

I have a sinking feeling that this isn't gonna be fixed until at least 3.0, if ever D:
MechCommanderRei (comment 80) wrote:
>Am I correct in presuming this bug is the reason why, running Xubuntu 6.06
>Dapper, I can't copy an image in Firefox 1.5.0.5 and paste it directly into the
>Gimp 2.2.11 or Krita 1.5?

Yes, you are correct. I'm not a Linux person but I have poked in the source code.  I'd guess that the relevant file is:
  http://lxr.mozilla.org/mozilla1.8/source/widget/src/gtk2/nsClipboard.cpp

In particular, the code for nsClipboard::GetData() and nsClipboard::SetData doesn't handle nsIImages (look for kUnicodeMime).  Probably some other code will need to be fixed too (such as nsClipboard::HasDataMatchingFlavors()).

Someone working on fixing Linux to handle images would need to do something similar to the code in widget/src/mac or widget/src/windows.

Then again, before I wrote a bunch of code, I'd ask vlad or pavlov if/when the move to Cairo will affect this (I recall seeing some Cairo #ifdefs in the Mac clipboard code but that was probably in the 3.0 / trunk version of these files).
How can I add priority to this bug? I have to do it so often, copy an image somewhere and paste it in an email. 
Now I have to resort to cumbersome saving it to a file from GIMP and then inserting an image in Thunderbird.
Running Ubuntu feisty fawn.
I have the Ubuntu Gutsy.

This bug for something that I consider really important has not been fixed since 8 YEARS AGO. I really vote to give it a serious priority.
Yes please add the "save image as" and "copy image" options to the right click context menu in the Linux version of firefox.  It's silly cos it's available on the Windows version.  I currently have to use Konqueror to copy or save any image from a web page.  This is in my opinion A PRIORITY. 
Jon, the SAVE IMAGE AS is already in my Firefox 2.0, but the COPY IMAGE still missing. The Mozilla SeaMonkey web browser already has this context menu. Why not to port that source part into Firefox ??

I've also realized that the seaMonkey COPY IMAGE works pasting to OpenOffice Writer but not to GIMP for example.

it may help (for developing pourposes) use the ubuntu applet named GLIPPER which shows the clipboard value.
By the way Konqueror's COPY IMAGE works great for pasting into GIMP and OPENOFFICE WRITER.

There is a CopyImage extension for Firefox < 1.9 here.

http://www.projectit.com/freestuff.html

Maybe this code can be ported to work with 2.0
Any updates on this? Seeing how old this bug file is I'm guessing not... I think it's pretty silly as well to have to use Konqueror or Opera to copy and paste images from clipboard.
Taking, I have a working patch. I've only been familiar with our clipboard code for a day, but I've managed to cook something up.
Assignee: blizzard → ventnor.bugzilla
Attached patch Patch (obsolete) — Splinter Review
This works, but I'm sure Roc can tell me ways to make this code better.
Attachment #291585 - Flags: superreview?(roc)
Attachment #291585 - Flags: review?(roc)
Keywords: pp
Attached patch Patch 2 (obsolete) — Splinter Review
More mime types and safer code.
Attachment #291585 - Attachment is obsolete: true
Attachment #291597 - Flags: superreview?(roc)
Attachment #291597 - Flags: review?(roc)
Attachment #291585 - Flags: superreview?(roc)
Attachment #291585 - Flags: review?(roc)
Attached patch Patch 2.1 (obsolete) — Splinter Review
Yet another oversight on my part. Sigh, I really need to start proofreading my code.
Attachment #291597 - Attachment is obsolete: true
Attachment #291600 - Flags: superreview?(roc)
Attachment #291600 - Flags: review?(roc)
Attachment #291597 - Flags: superreview?(roc)
Attachment #291597 - Flags: review?(roc)
+                GdkPixbuf* pixbuf = nsImageToPixbuf::ImageToPixbuf(image);

You need to check for failure here, right?

+                GtkClipboard *aClipboard = gtk_clipboard_get(GetSelectionAtom(aWhichClipboard));

maybe here too?

Does copy and paste of images within Gecko work? E.g. if I copy an image and paste into an HTML editor (e.g. GMail composer)?
Attached patch Patch 3Splinter Review
(In reply to comment #92)
> +                GdkPixbuf* pixbuf = nsImageToPixbuf::ImageToPixbuf(image);
> 
> You need to check for failure here, right?

Yeah, I should.

> +                GtkClipboard *aClipboard =
> gtk_clipboard_get(GetSelectionAtom(aWhichClipboard));
> 
> maybe here too?

No, because GetSelectionAtom can only return one of two clipboards (either Primary or Clipboard), both of which always exist on Linux. We don't do failure checks in any other place where this function is called.

> Does copy and paste of images within Gecko work? E.g. if I copy an image and
> paste into an HTML editor (e.g. GMail composer)?

I've figured it out now and yes, this patch supports pasting of images. Of course its not that useful for now with pasting images into editor being borked, but its not that much extra code anyway. I've verified that pasting actually works on the clipboard side because I pasted the url from the HTML code generated in editor into my URL bar and lo and behold was the copied image.
Attachment #291600 - Attachment is obsolete: true
Attachment #291805 - Flags: superreview?(roc)
Attachment #291805 - Flags: review?(roc)
Attachment #291600 - Flags: superreview?(roc)
Attachment #291600 - Flags: review?(roc)
Attachment #291805 - Flags: superreview?(roc)
Attachment #291805 - Flags: superreview+
Attachment #291805 - Flags: review?(roc)
Attachment #291805 - Flags: review+
Comment on attachment 291805 [details] [diff] [review]
Patch 3

This is the oldest open GTK bug ever, and something that even I have lamented going without ever since switching to Linux. We really should take this for Firefox 3 since its quite unfair that users of other platforms have enjoyed this functionality in Gecko for a long time now ;-)

The fact that this patch is under 10KB for the enormous benefit it provides should be something to consider.
Attachment #291805 - Flags: approval1.9?
Note that this will also fix Firefox bug 234716. Killing two bugs with one patch ftw!
Status: NEW → ASSIGNED
QA Contact: ian → gtk
Comment on attachment 291805 [details] [diff] [review]
Patch 3

a=drivers for when trunk opens after Fx3 Beta 2 freeze
Attachment #291805 - Flags: approvalM10-
Attachment #291805 - Flags: approval1.9?
Attachment #291805 - Flags: approval1.9+
Keywords: checkin-needed
Checking in browser/base/Makefile.in;
/cvsroot/mozilla/browser/base/Makefile.in,v  <--  Makefile.in
new revision: 1.21; previous revision: 1.20
done
Checking in widget/src/gtk2/nsClipboard.cpp;
/cvsroot/mozilla/widget/src/gtk2/nsClipboard.cpp,v  <--  nsClipboard.cpp
new revision: 1.30; previous revision: 1.29
done
Status: ASSIGNED → RESOLVED
Closed: 24 years ago17 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9 M11
FYI, "Copy Image" worked for me using this morning's nightly trunk build (Gecko/2007121108) on a Fedora 6 system.  I was able to paste the image into gimp.

It is great that this has been fixed.  We can now support copying page images to the clipboard on Linux in our Page Saver Pro extension as well.
It looks like this bumped the minimal GTK2 version we rely on to 2.6.  Unfortunately, configure still checks for version 1.8.0.  The check in configure needs to be updated, or the use of gtk_clipboard_set_image needs to be conditioned on the gtk version...
Depends on: 518249
What about the possibility to paste image data into the composer in bugzilla?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: