Skip to content

Quartz copy/paste bug?

5 messages · Demitri Muna, Simon Urbanek, Andrew Beckerman +1 more

#
Hello,

I have been encountering an intermittent (!) problem when copying  
from an R quartz window and pasting into another application. Often  
it works without a problem, but sometimes one of two things will happen:

- If the quartz window I am copying is active, the full (rounded)  
text field that displays the current working directory is  
superimposed on the pasted plot. It is in the lower left corner (not  
flush against the corner, but in that quadrant). Also, the text field  
in flipped both vertically and horizontally.

- If the quartz window being copied is not active, another image,  
again flipped as above, is overlaid onto my plot. This time, the  
region of the title bar that contains text is what is there, but not  
necessarily from the window I am copying from. For example, the  
active window in my case now is device 4 (title is "Quartz (4) -  
Inactive") and the text in the object in the pasted image is "Quartz  
(3) - Inactive", although device 3 is actually labelled "Quartz (3) -  
Active".

And actually, as I was creating plots to recreate this behaviour, I  
was able to get both images superimposed onto the same pasted image.  
I am attaching this image since it contains both overlays, but  
usually I get one or the other.

When I have seen this in the past and have needed to "clean up" the  
image, I copy and paste into Illustrator. There, it was a simple  
matter to remove the text fields by selecting the objects and just  
deleting them. This tells me that they are indeed composited onto my  
plot.

Finally, I just closed the original window I created the plot in,  
replotted, and the overlaid images went away. A second copy/paste,  
and it reappeared.

Anyway, has this been seen before? Is it a known bug, or is it just me?

Cheers,

Demitri

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedGraphic.pdf
Type: application/pdf
Size: 49394 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20060308/1216b51f/pastedGraphic-0001.pdf
#
Demitri,

I have encountered this bug occasionally, but very rarely. The  
problem is, I didn't figure a way to reproduce it consistently. I was  
fiddling around with Quartz locking etc., but without reproducible  
example, it's almost impossible to fix. If you or anyone else could  
come up with a way to reproduce this behavior consistently, it would  
be great. Please let me know if you have a way for this to appear  
more often - I'd appreciate that.

Thanks,
Simon
On Mar 8, 2006, at 12:58 PM, Demitri Muna wrote:

            
#
Dear all - I too have experienced this.  While I don't know what  
causes it, I do know that using dev.copy2eps() and then opening that  
file in preview (translates eps to pdf) never causes the trouble.

cheers
andrew
On 8 Mar 2006, at 19:54, Simon Urbanek wrote:

            
------------------------------------------------------------------------ 
---------
Dr. Andrew Beckerman
Department of Animal and Plant Sciences, University of Sheffield,
Alfred Denny Building, Western Bank, Sheffield S10 2TN, UK
ph +44 (0)114 222 0026; fx +44 (0)114 222 0002
http://www.beckslab.staff.shef.ac.uk/
------------------------------------------------------------------------ 
----------
1 day later
#
Yep, me too.  I see the problem when I do a print > save as pdf.   
Random bits of GUI elements, especially directory information, appear  
in the pdf images.  Good news is, I have workaround.  Try hiding all  
other windows (R > Hide Others) or closing all other windows.  Seems  
to help me.  Hope the developers sort this out soon.

- Jason
On Mar 9, 2006, at 3:54 AM, Andrew Beckerman wrote:

            
#
Hi Simon,
On 8 Mar 2006, at 19:54, Simon Urbanek wrote:

            
Unfortunately, I have not been able to reproduce the bug  
consistently. It "just happens". :)

I started to poke through the code, and wanted to get your thoughts  
on this. In the copy: method in RQuartz.m, I replaced the following  
code:

	[deviceView setPDFDrawing:YES];
	[deviceView lockFocus];
	[deviceView writePDFInsideRect:[deviceView bounds] toPasteboard:pb];
	[deviceView unlockFocus];
	[deviceView setPDFDrawing:NO];

with:

	[deviceView setPDFDrawing:YES];
	NSRect r = [deviceView bounds];
	NSData *data = [deviceView dataWithPDFInsideRect:r];
	[pb setData:data forType:NSPDFPboardType];
	[deviceView setPDFDrawing:NO];

A very simple (non-exhaustive!) test showed that this code will copy  
the pdf as expected. Behind the scenes, I don't know if this is any  
different from what you have, but I'll run with this change for a  
while to see if it happens again.

Cheers,

Demitri