View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0034840||Lazarus||LCL||public||2019-01-09 11:37||2019-06-16 11:59|
|Reporter||David||Assigned To||Juha Manninen|
|Product Version||2.0RC3||Product Build|
|Target Version||Fixed in Version|
|Summary||0034840: Unable to paste images when copied from another app|
|Description||If an image is copied into the clipboard from another application, an app compiled with 20RC3 is unable to paste it into a TPicture. The reason appears to be that the 20RC3 app believes, incorrectly that there is no FormatIDs present in the clipboard.|
This problem is not present in Lazarus 1.8.4 and does not show up in any release on Windows (not checked Mac yet).
|Steps To Reproduce||Using the attached demo, build using 20RC3, you will be able to copy the Leopard image to the clipboard and then paste same image into TImage on the right. Press info button and see the apps view of FormatIDs available.|
Now, copy an image form some other app, perhaps a webbrowser, right click, copy image. Return to the compiled app, you will be unable to paste it using Paste button, the Info button shows no FormatIDs available.
|Additional Information||Problem confirmed by WP and confirmed OK on Windows by Bart, thanks !|
|Tags||No tags attached.|
|Fixed in Revision||r60131|
project1.zip (107,554 bytes)
This issue was discussed here:
Lazarus Release Candidate 3 for 2.0
As discussed in the forum, this code fragment:
memo1.append('pasted as FormatID ' + inttostr(clipboard.FindPictureFormatID));
Referring to discussion on forum, I pointed out that the problem still existed if the line -
is replaced by -
But that matters not, pasting, or attempting to paste is nothing to do with the problem. The problem is apparent long before pasting happens. An application queries the clipboard to see if it has content suitable for pasting. In Fixes_2_0 at present, the clipboard says it has no content if all it has is a picture.
Click the button labelled 'Info' to make such a request. If the image was copied into the clipboard from another app (ie clipboard cannot get to it via cache) you will see no formats listed.
I can (very easily) upload another demo with the alternative pasting model but, as I said, it really has nothing to do with the problem.
OK, problem seems to relate to changes made to /lcl/interfaces/gtk2/gtk2proc.inc
function RequestSelectionData(ClipboardWidget: PGtkWidget;
ClipboardType: TClipboardType; FormatID: PtrUInt): TGtkSelectionData;
about line number 7541 in 1.8.4 we have -
if gtk_selection_convert(ClipboardWidget, ClipboardTypeAtoms[ClipboardType], FormatID, TimeID)<>GdkFalse
if not WaitForClipboardAnswer(c) then exit;
in Fixes_2_0 we have, at line number 7546
if gtk_selection_convert(ClipboardWidget,Atom,FormatID,TimeID) <> GdkFalse then
if gtk_clipboard_wait_is_text_available(gtk_clipboard_get(Atom)) then
I note the new code appears to depend on gtk_clipboard_wait_is_text_available() and the problem shows up when there is no text, only an image in the clipboard. Perhaps this function is unsuited to the application ?
Anyway, its clearly a deliberate change, something that needs be referred to whoever made the change. A patch from me reverting to old mode would clearly be unwelcome.
ImagePaste.zip (107,262 bytes)
Noting that the problem does not show up on the Mac, not surprising given my theory that its caused by gtk_clipboard_wait_is_text_available() !
I have uploaded a new test project in case anyone is still going on about the pasting code. Sigh.
I don't know much about the gtk but maybe the line should of been like this
If gtk_clipBoard_wait_text_available(gtk_clipBoard_get(ClipboardTypeAtoms[ClipBoardType])) Then....
or the "Atom" resolved prior to ?
personally using a function with "TEXT" in it tells me that is all it's looking for but maybe that isn't the case here.
||Revision 58969 breaks it.|
> or the "Atom" resolved prior to ?
jamie, just look at the source and you know the answer.
> personally using a function with "TEXT" in it tells me that
> is all it's looking for but maybe that isn't the case here.
Apparently yes. How to fix it?
||I think I figured it out myself. Please test with r60131.|
Just tested on Linux, both text and images reporting correctly and pasting fine.
This is all in Linux only code so no point in testing Windows/Mac ?
|2019-01-09 11:37||David||New Issue|
|2019-01-09 11:37||David||File Added: project1.zip|
|2019-01-09 17:33||Valdir Marcos||Note Added: 0113289|
|2019-01-09 23:11||Bart Broersma||Note Added: 0113295|
|2019-01-15 07:51||David||Note Added: 0113421|
|2019-01-15 07:53||David||Note Added: 0113422|
|2019-01-15 07:57||David||Note Edited: 0113422||View Revisions|
|2019-01-20 12:54||David||File Added: ImagePaste.zip|
|2019-01-20 12:56||David||Note Added: 0113519|
|2019-01-20 15:47||jamie philbrook||Note Added: 0113526|
|2019-01-20 22:21||Bart Broersma||LazTarget||=> -|
|2019-01-20 22:21||Bart Broersma||Status||new => acknowledged|
|2019-01-20 22:22||Bart Broersma||Status||acknowledged => confirmed|
|2019-01-20 22:28||Bart Broersma||Assigned To||=> Juha Manninen|
|2019-01-20 22:28||Bart Broersma||Status||confirmed => assigned|
|2019-01-20 22:29||Bart Broersma||Note Added: 0113533|
|2019-01-20 22:31||Bart Broersma||Relationship added||related to 0018295|
|2019-01-21 00:11||Juha Manninen||Note Added: 0113538|
|2019-01-21 13:08||Juha Manninen||Fixed in Revision||=> r60131|
|2019-01-21 13:08||Juha Manninen||Note Added: 0113546|
|2019-01-21 13:08||Juha Manninen||Status||assigned => resolved|
|2019-01-21 13:08||Juha Manninen||Resolution||open => fixed|
|2019-01-23 08:55||David||Note Added: 0113591|
|2019-06-16 11:59||David||Status||resolved => closed|
|2019-06-16 11:59||David||Note Added: 0116750|