Recent

Author Topic: Clipboard Formats  (Read 1948 times)

dbannon

  • Hero Member
  • *****
  • Posts: 3647
    • tomboy-ng, a rewrite of the classic Tomboy
Clipboard Formats
« on: September 24, 2024, 02:48:28 am »
(While, perhaps, a linux only problem, its a cross platform issue).

LCL copies and pastes in several format (see below). but not in the commonly used text/plain;charset=utf8. 

I have an end user who uses Linux desktop Enlightenment. And, being Enlightenment, has to be different, its terminal application, "Terminology" only copies (or "sends") in "text/plain:charset-utf8". But an LCL based app cannot paste such content from the clipboard because it wants only "text/plain"

Copying and pasting utf8 content to/from an LCL app works fine under the format text/plain, it really is text/plain;charset=utf8 in every aspect except its label. Should LCL apps add the widely used text/plain;charset=utf8 which is just a copy of text/plain, to its list ?

That is is pretty much what most other text apps do these days. I could not find a text app (other than LCL ones) that do not support text/plain:charset=utf8.

Davo

* LCL Copy/Paste formats seem to include text/plain, UTF8_STRING, STRING, TEXT
Attached is a small Lazarus project that shows what is in your clipboard and what formats are available.

Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

paweld

  • Hero Member
  • *****
  • Posts: 1561
Re: Clipboard Formats
« Reply #1 on: September 24, 2024, 07:42:01 am »
Hi dbannon,
attached is a fix that solves the problem. I tested on Debian 12 with Xfce4 + Terminology. Report the bug along with the patch, maybe it will be accepted
Best regards / Pozdrawiam
paweld

dbannon

  • Hero Member
  • *****
  • Posts: 3647
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Clipboard Formats
« Reply #2 on: September 25, 2024, 01:22:47 am »
Oh, thanks paweld !  I was not going to bother making a patch unless I got some indication it might be accepted. But you have done the "hard work", I guess it better be submitted !

Thanks Indeed.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dbannon

  • Hero Member
  • *****
  • Posts: 3647
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Clipboard Formats
« Reply #3 on: September 27, 2024, 11:38:05 am »
paweld, just so you know what is happening, my tests of your patch tell me that it works fine with GTK2 but fails with Qt5.  Now, your patch does exactly what I expected, and there seems absolutly no difference in how Qt5 uses the clipboard compared to gtk2 (or Windows, MacOS etc). But there is a difference.

So, I have not yet submitted a bug report, I will have to build a new Enlightenment based VM, I don't have room on my current testing VM for FPC/Lazarus to run the debugger. And I need that to work out just what is happening. No point in putting in a bugreport/patch if we are not sure.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

paweld

  • Hero Member
  • *****
  • Posts: 1561
Re: Clipboard Formats
« Reply #4 on: September 27, 2024, 03:11:44 pm »
Hi Davo,   

Thank you for the feedback.I checked with myself and there was also a problem with qt5. I had to add a check to see if the content size for a given type is greater than 0 - because popm despite the fact that there is no “text/plain” format in the clipboard, the function that checks for the existence of the format for QT5 returned True.   
The new fix is attached.
Best regards / Pozdrawiam
paweld

dbannon

  • Hero Member
  • *****
  • Posts: 3647
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Clipboard Formats
« Reply #5 on: September 30, 2024, 01:56:13 am »
OK, thanks paweld, I did not get any further that unsuccessful attempts to build Lazarus on a Mageia box (to debug where the problem is easily seen) when I was, as you know, distracted by Chinese Fonts !

(but the Chinese Font issue has been very interesting !)

I'll get back to it, hopefully no to far away....

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

AlexTP

  • Hero Member
  • *****
  • Posts: 2669
    • UVviewsoft
Re: Clipboard Formats
« Reply #6 on: December 07, 2025, 04:39:19 pm »
@paweld
I made the bugtracker issue for your modified patch:
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41946

Better late than never.
« Last Edit: December 07, 2025, 05:00:08 pm by AlexTP »

dbannon

  • Hero Member
  • *****
  • Posts: 3647
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Clipboard Formats
« Reply #7 on: December 08, 2025, 05:18:37 am »
Thanks Alex, think I dropped the ball on this one. My end user seems to have stopped using Enlightenment (and therefore  Terminology, no other Desktop uses it by default).

And, possibly Terminology has fixed it at its end.

But would still be nice to fix the problem in case it crops up elsewhere too.

Davo

Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

AlexTP

  • Hero Member
  • *****
  • Posts: 2669
    • UVviewsoft
Re: Clipboard Formats
« Reply #8 on: December 08, 2025, 08:51:22 am »
The Terminology which is suggested by Ubuntu 22.4 ie 1.12.1 - has not the fix. Maybe later one has?

dbannon

  • Hero Member
  • *****
  • Posts: 3647
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Clipboard Formats
« Reply #9 on: December 09, 2025, 12:11:00 am »
The Terminology which is suggested by Ubuntu 22.4 ie 1.12.1 - has not the fix. Maybe later one has?

I have no idea. I do know it was reported, may or may not have been acted on.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018