Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Installation, Compiling and Running of theide » Strange behavior of clipboard in TheIde 609-dev1 on Linux
Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5348] Fri, 15 September 2006 17:59 Go to next message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
The option paste incorrectly works if we have made the Copy outside TheIDE, for example in mozilla-firefox or gedit.
Clipboard conserves the previous content to a Copy outside TheIDE.
Nico
Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5359 is a reply to message #5348] Fri, 15 September 2006 21:38 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12118
Registered: November 2005
Ultimate Member
nicomesas wrote on Fri, 15 September 2006 11:59

The option paste incorrectly works if we have made the Copy outside TheIDE, for example in mozilla-firefox or gedit.
Clipboard conserves the previous content to a Copy outside TheIDE.
Nico


Have you checked my last reply here?

http://www.arilect.com/upp/forum/index.php?t=msg&goto=51 70&&srch=clipboard#msg_5170
Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5372 is a reply to message #5359] Sat, 16 September 2006 16:20 Go to previous messageGo to next message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
Yes, I read your message and in this version clipboard can be used without problems.

But I have been in some cases that have not worked to me correctly.

When there am been working more than one hour I have been that I have made copy in gedit or firefox and when doing paste in theide conserves what there was before in clipboard, as if they were not synchronous.

Now I test it now and all good works to me, but and before it happened to me yesterday repeatedly what I tell you.

Perhaps clipboard corrupts or passes something with the formats. It really does not have much sense, but that it happened to me yesterday during a good short while: it could not paste in theide code copied in a file opened with gedit. I had to open it with gedit to modify it and soon to return to theide; a little uncomfortable.

I will look for the problem and in what conditions happens.

Nico
Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5374 is a reply to message #5372] Sat, 16 September 2006 16:33 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12118
Registered: November 2005
Ultimate Member
Thanks!

I must say that there are still most likely holes in my understanding of X11 clipboard. It is pretty fragile thing.

Therefore community review of CtrlCore/X11Clip.cpp would be a great idea.

Mirek
Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5375 is a reply to message #5374] Sat, 16 September 2006 16:43 Go to previous messageGo to next message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
At least I will try it

Nico
Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5376 is a reply to message #5374] Sat, 16 September 2006 18:46 Go to previous messageGo to next message
guido is currently offline  guido
Messages: 169
Registered: April 2006
Experienced Member
Hi Mirek!

What do you have at hand for X11 documentation?
Maybe I can help you out with a few links to online manuals.

Guido
Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5377 is a reply to message #5376] Sat, 16 September 2006 18:54 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12118
Registered: November 2005
Ultimate Member
guido wrote on Sat, 16 September 2006 12:46

Hi Mirek!

What do you have at hand for X11 documentation?
Maybe I can help you out with a few links to online manuals.

Guido


I guess I have enough of reference docs (and there is some opensource to learn from), but I am afraid I might have oversimplified the whole situation once again (last time you have helped me, it was that "TARGETS" issue - now implemented). In other words, I am afraid that any instability is caused by some detail that is specific to current implementation.

Well, I suspect usage of "CurrrentTime" in some calls would demontrate exactly this way Smile

Mirek
Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5495 is a reply to message #5348] Wed, 27 September 2006 13:31 Go to previous messageGo to next message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
Today I have downloaded the 609-dev3, I compiled theIde and the clipboard problem persist.
Well, the problem is:

1) If I make Copy in a U++ App, the copied text does not paste in another application (for example gedit).
2) The same it happens the other way around. A text copied in gedit does not paste in a U++ app.
3) Nevertheless the text copied in U++app if one paste in that same app.
4) If I run a U++app and I don't do copy, then if I do Paste... Yes! app gets the Clipboard contents

I take all the morning watching how to solve this. I have watched in the source code of the GTK to see if it clarified my ideas. Also I have sailed by the QClipboard class of the QT and believe that I have sunk still more.
When I have downloaded the source of XFree86 to see some example, then my head explotes. Confused

Nevertheless I have removed something in clear. This reference has clarified enough to the subject http://standards.freedesktop.org/clipboards-spec/clipboards- latest.txt

Hey, I consider I am a good C++ programmer but this exceeds my capacity, so I have resorted to the true-very-old method of the test-error.

At end I believe to have found the one solution quite simple, although the reasoning to arrive at her is intuitive or rather magician. Razz

In the CtrlCore/X11lip.cpp file comment line 25.

void Ctrl::Xclipboard::Write(int fmt, const String& _data)
{
	LLOG("SetSelectionOwner " << XAtomName(fmt));
	data.GetAdd(fmt) = _data;
//	if(XGetSelectionOwner(Xdisplay, XAtom("CLIPBOARD") != win)) <--this line out
		XSetSelectionOwner(Xdisplay, XAtom("CLIPBOARD"), win, CurrentTime);
}


When doing this "I believe" that what happens is that updates (somehow) who made Copy for the last time in the system.

Also comment lines 65 and 66....
String Ctrl::Xclipboard::Read(int fmt)
{
//	if(data.GetCount())
//		return data.Get(fmt, Null);
	XConvertSelection(Xdisplay, XAtom("CLIPBOARD"), fmt, XAtom("CLIPDATA"), win, CurrentTime);
	XFlush(Xdisplay);
	XEvent event;


When doing this "I believe" that what happens is that makes the request standard to see who has the last copy in clipboard. Of this form its own internal buffer is only used in the Request function although is she herself that made Copy the last time.

And now it seems that everything works.

Nico
Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5497 is a reply to message #5495] Wed, 27 September 2006 13:43 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12118
Registered: November 2005
Ultimate Member
Thanks. Interesting. That thing in Read should be a "short circuit" when pasting in the same process (e.g. from TheIDE to the same TheIDE).

Anyway, "data" should be cleared elsewhere (line 140 X11Wnd.cpp) when other application takes over the focus.

Seems like this "clear elsewhere" does not work.

Could you please check what is going on there? E.g. put some LOGs there...

Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5498 is a reply to message #5497] Wed, 27 September 2006 13:57 Go to previous messageGo to next message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
No problem when I pasting to-from the same app.

I want to help, but I do not understand very well as the LOG system works. What I do it is to debbuging with breakpoints and it seems that the system is not stopped in lína 140 that you say to me.

Nico
Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5499 is a reply to message #5498] Wed, 27 September 2006 14:08 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12118
Registered: November 2005
Ultimate Member
nicomesas wrote on Wed, 27 September 2006 07:57

No problem when I pasting to-from the same app.



Yes, it was just optimization. It is a little but inelegant if all these data are about to go through X11 server back to the same application IMHO. X11 is quite slow pumping them, it could have visible impact.

Quote:


I want to help, but I do not understand very well as the LOG system works.



That is trivial - it just prints it to the .log file. For debugging GUI it is often much better than debugger / breakpoints. (You can gather a lot of data and then e.g. seek them using Find....).

Sometimes it is also more bullet proof - GDB has strange quirks and sometimes does not stop at the breakpoint.

So as the first thing, try to put LOG("Clearing clipboard") there, then copy text in another application (to move clipboard ownership) and see what happens...

See reference/Log.

Mirek
Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5500 is a reply to message #5499] Wed, 27 September 2006 14:26 Go to previous messageGo to next message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
luzr wrote on Wed, 27 September 2006 14:08

nicomesas wrote on Wed, 27 September 2006 07:57

No problem when I pasting to-from the same app.



Yes, it was just optimization. It is a little but inelegant if all these data are about to go through X11 server back to the same application IMHO. X11 is quite slow pumping them, it could have visible impact.



You are right, would be better to leave it as it were, although not very elegant

Now, I am using logs and already I have understand how the x11 clipboard works. He is almost "esoteric"! Shocked

It seems to me that line 140 is executed correctly!?. I will test more this evening, now I am going away to eat! Rolling Eyes

Nico
Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5501 is a reply to message #5500] Wed, 27 September 2006 14:54 Go to previous messageGo to next message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
I have not been able to wait for more and I have test it.

Then, if we did not comment line 26 of X11Clip.cpp is not called to xclipboard().Clear(); in line 140 of X11Wnd.cpp.

If we commented line 26 then everything it works correctly. Then I propose to eliminate or to comment that line in next releases:

void Ctrl::Xclipboard::Write(int fmt, const String& _data)
{
	LLOG("SetSelectionOwner " << XAtomName(fmt));
	data.GetAdd(fmt) = _data;
	//if(XGetSelectionOwner(Xdisplay, XAtom("CLIPBOARD") != win))
		XSetSelectionOwner(Xdisplay, XAtom("CLIPBOARD"), win, CurrentTime);
}



Now if that I am going away to eat Laughing

Nico
Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5519 is a reply to message #5501] Fri, 29 September 2006 15:06 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12118
Registered: November 2005
Ultimate Member
Commented out.

We will see how this works Smile

Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5574 is a reply to message #5519] Wed, 04 October 2006 11:48 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12118
Registered: November 2005
Ultimate Member
Well, another clipboard problem:

When I do screenshot and paste it to .iml, it works in about 10% of cases only.

Maybe you could "tune" the code once again Smile

Mirek
Re: Strange behavior of clipboard in TheIde 609-dev1 on Linux [message #5769 is a reply to message #5574] Sat, 14 October 2006 13:49 Go to previous message
mirek is currently offline  mirek
Messages: 12118
Registered: November 2005
Ultimate Member
luzr wrote on Wed, 04 October 2006 05:48

Well, another clipboard problem:

When I do screenshot and paste it to .iml, it works in about 10% of cases only.

Maybe you could "tune" the code once again Smile

Mirek



OK, now fixed. BTW, X11 clipboard is really the nest of race conditions...

Mirek
Previous Topic: Install U++ in Ubuntu-6.06.1 Desktop 64bits
Next Topic: "Package organizer" and other dialogs are size incorrect in linux
Goto Forum:
  


Current Time: Sat Dec 07 00:41:41 CET 2019

Total time taken to generate the page: 0.02220 seconds