Hi,
I want to copy to the OS clipboard DrGeo sketch as SVG image.
The clipboard in the image is only for text. I read about Extented Clipboard (Mac OSX) plugin to manage other type of data. I was told the plugin also existed for Linux at some time (when Sophie was developed). Is it possible to retrieve it?
Thanks
Hilaire
I don't recall making one for Unix. I think the source for all that is in the Squeak OldTrunk branch Consider Sophie-Clipboard SophieSUnitClipboard.st
apps and documents here, but you need a 32 bit MacOS to run them https://github.com/CorporateSmalltalkConsultingLtd/Sophie
.... John M. McIntosh. Corporate Smalltalk Consulting Ltd https://www.linkedin.com/in/smalltalk
------- Original Message ------- On Thursday, March 23rd, 2023 at 11:40 AM, Hilaire Fernandes hfern@free.fr wrote:
Hi,
I want to copy to the OS clipboard DrGeo sketch as SVG image.
The clipboard in the image is only for text. I read about Extented Clipboard (Mac OSX) plugin to manage other type of data. I was told the plugin also existed for Linux at some time (when Sophie was developed). Is it possible to retrieve it?
Thanks
Hilaire
-- GNU Dr. Geo http://drgeo.eu
On Thu, Mar 23, 2023 at 11:40 AM Hilaire Fernandes hfern@free.fr wrote:
Hi,
I want to copy to the OS clipboard DrGeo sketch as SVG image.
The clipboard in the image is only for text. I read about Extented Clipboard (Mac OSX) plugin to manage other type of data. I was told the plugin also existed for Linux at some time (when Sophie was developed). Is it possible to retrieve it?
As John said it doesn't appear to exist for Linux. But X11 has a clipboard and implementing the innards for X11 shouldn't be that difficult. The only complication is that if one wants to do the job "properly" one has to extend the indirection scheme Ian Piumarta came up with so that it can work on the other graphical back-ends such as the raw frame buffer. Hillaire, if you're interested in implementing the X11 ExtendedClipboard internals I'm happy to answer any questions you have.
Just a little bit about what I'm trying to do:
We use the ClipboardExtendedPlugin to bring in data to Virtend, in particular images, filenames, and text. I love to be able to paste Shout-styled text into email and currently that's difficult: 1. select some styled text 2. use the "copy as html" menu item 3. paste the HTML text into a file called 'foo.html' 4. open the file in a web browser 5. select the text in the web browser
So I'm making sure that the plugin can paste multiple forms of text. Currently on Mac I have the following (a variation of which I just used to paste the following) [| text styledText htmlText | text *:=* (Text sourceCodeAt: #printHtmlString) asText. styledText *:=* SHTextStylerST80 new parseAMethod: true; styledTextFor: text . htmlText *:=* styledText printHtmlString.
*"If one does only the addClipboardData:...dataFormat: 'public.html' then Safari pastes styled text correctly.Do both that and addClipboardData: ... dataFormat: 'public.text' and Safari pastes plain text.So the plugin is doing damage using declareTypes: every time. It needs to augment the types."* ExtendedClipboardInterface current clearClipboard; addClipboardData: '<meta charset="UTF-8">', htmlText asString dataFormat: 'public.html'; addClipboardData: (UTF8TextConverter new encodeString: text asString) dataFormat: 'public.utf8-plain-text'].
So the Mac plugin primitives don't yet support being able to paste multiple alternatives in a series of invocations. I could implement an interface that takes multiple alternatives in a single primitive invocation, but I think John's design intent is better; one should be able to use a sequence of invocations, each of which adds to the clipboard. So I'm trying to get that to work right now. I'm working on MacOS and Windows to make sure that things work there. I'm not working on Linux cuz there's no there there yet ;-)
Thanks
Hilaire
-- GNU Dr. Geohttp://drgeo.euhttp://blog.drgeo.eu
On Thu, Mar 23, 2023 at 1:05 PM Eliot Miranda eliot.miranda@gmail.com wrote:
On Thu, Mar 23, 2023 at 11:40 AM Hilaire Fernandes hfern@free.fr wrote:
Hi,
I want to copy to the OS clipboard DrGeo sketch as SVG image.
The clipboard in the image is only for text. I read about Extented Clipboard (Mac OSX) plugin to manage other type of data. I was told the plugin also existed for Linux at some time (when Sophie was developed). Is it possible to retrieve it?
As John said it doesn't appear to exist for Linux. But X11 has a clipboard and implementing the innards for X11 shouldn't be that difficult. The only complication is that if one wants to do the job "properly" one has to extend the indirection scheme Ian Piumarta came up with so that it can work on the other graphical back-ends such as the raw frame buffer. Hillaire, if you're interested in implementing the X11 ExtendedClipboard internals I'm happy to answer any questions you have.
Just a little bit about what I'm trying to do:
We use the ClipboardExtendedPlugin to bring in data to Virtend, in particular images, filenames, and text. I love to be able to paste Shout-styled text into email and currently that's difficult:
- select some styled text
- use the "copy as html" menu item
- paste the HTML text into a file called 'foo.html'
- open the file in a web browser
- select the text in the web browser
So I'm making sure that the plugin can paste multiple forms of text. Currently on Mac I have the following (a variation of which I just used to paste the following) [| text styledText htmlText | text *:=* (Text sourceCodeAt: #printHtmlString) asText. styledText *:=* SHTextStylerST80 new parseAMethod: true; styledTextFor: text. htmlText *:=* styledText printHtmlString.
*"If one does only the addClipboardData:...dataFormat: 'public.html' then Safari pastes styled text correctly.Do both that and addClipboardData: ... dataFormat: 'public.text' and Safari pastes plain text.So the plugin is doing damage using declareTypes: every time. It needs to augment the types."* ExtendedClipboardInterface current clearClipboard; addClipboardData: '<meta charset="UTF-8">', htmlText asString dataFormat: 'public.html'; addClipboardData: (UTF8TextConverter new encodeString: text asString) dataFormat: 'public.utf8-plain-text'].
So the Mac plugin primitives don't yet support being able to paste multiple alternatives in a series of invocations. I could implement an interface that takes multiple alternatives in a single primitive invocation, but I think John's design intent is better; one should be able to use a sequence of invocations, each of which adds to the clipboard. So I'm trying to get that to work right now. I'm working on MacOS and Windows to make sure that things work there. I'm not working on Linux cuz there's no there there yet ;-)
Ah, that was easy. Use addTypes:owner: instead of declareTypes:owner: (in the Mac Objective-C innards) and the Mac works. Now Windows...
Thanks
Hilaire
-- GNU Dr. Geohttp://drgeo.euhttp://blog.drgeo.eu
-- _,,,^..^,,,_ best, Eliot
Hi Eliot,
I will try to take a deep look as I have also interest for tablet support on Linux. This is a completely new domain (VM) for me.
Thanks
Hilaire
Le 23/03/2023 à 21:05, Eliot Miranda a écrit :
As John said it doesn't appear to exist for Linux. But X11 has a clipboard and implementing the innards for X11 shouldn't be that difficult. The only complication is that if one wants to do the job "properly" one has to extend the indirection scheme Ian Piumarta came up with so that it can work on the other graphical back-ends such as the raw frame buffer. Hillaire, if you're interested in implementing the X11 ExtendedClipboard internals I'm happy to answer any questions you have.
Hi Folks,
I was pretty sure I had seen _something_ about a ClipboardExtendedPlugin for Linux at some time.
Found it. It seems it was part of an OLPC Etoys specific branch of the old interpreter vm. I don't know how complete this was, or if it was actually used. Anyway, in case it is of any use, see http://squeakvm.org/svn/squeak/branches/olpc/platforms/unix/src/plugins/Clip...
Thanks,
On 3/23/2023 9:58 PM, Eliot Miranda wrote:
Hi Hilaire,
On Mar 23, 2023, at 2:38 PM, Hilaire Fernandes hfern@free.fr wrote:
Hi Eliot,
I will try to take a deep look as I have also interest for tablet support on Linux. This is a completely new domain (VM) for me.
I hope you find it fun!
Your job is to implement this interface:
void sqPasteboardClear(void *inPasteboard); sqInt sqPasteboardGetItemCount(void *inPasteboard); sqInt sqPasteboardCopyItemFlavorsitemNumber(void *inPasteboard, sqInt formatNumber); void*sqCreateClipboard(void); voidsqPasteboardPutItemFlavordatalengthformatTypeformatLength(void*inPasteboard, char*inData, sqInt dataLength, char*format, sqInt formatLength); void sqPasteboardPutItemFlavordatalengthformatType(void *inPasteboard, char *inData, sqInt dataLength, sqInt format); sqInt sqPasteboardCopyItemFlavorDataformatformatLength(void*inPasteboard, char*format, sqInt formatLength); sqInt sqPasteboardCopyItemFlavorDataformat(void*inPasteboard, sqInt format); sqInt sqPasteboardhasDataInFormatformatLength(void *inPasteboard, char *format, sqInt formatLength); sqInt sqPasteboardhasDataInFormat(void*inPasteboard, sqInt format);
which is present only in src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c, a departure from the house style which would have put it in platforms/Cross/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.h; no doubt John had his reasons.
Use platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.m & platforms/win32/plugins/ClipboardExtendedPlugin/sqWin32ExtendedClipboard.c as guides. The Mac uses strings to identify clipboard types (the char*format, sqInt formatLength) variant, as opposed to win32, which uses integers (the sqInt format variant). Whichever works.
You’ll implement it in platforms/unix/plugins/ClipboardExtendedPlugin/sqUnixExtendedClipboard.c
Thanks
Hilaire
Le 23/03/2023 à 21:05, Eliot Miranda a écrit :
As John said it doesn't appear to exist for Linux. But X11 has a clipboard and implementing the innards for X11 shouldn't be that difficult. The only complication is that if one wants to do the job "properly" one has to extend the indirection scheme Ian Piumarta came up with so that it can work on the other graphical back-ends such as the raw frame buffer. Hillaire, if you're interested in implementing the X11 ExtendedClipboard internals I'm happy to answer any questions you have.
-- GNU Dr. Geo http://drgeo.eu http://blog.drgeo.eu
Hi Juan, Hi All,
On Thu, Mar 23, 2023 at 6:19 PM Juan Vuletich juan@cuis.st wrote:
Hi Folks,
I was pretty sure I had seen _something_ about a ClipboardExtendedPlugin for Linux at some time.
Found it. It seems it was part of an OLPC Etoys specific branch of the old interpreter vm. I don't know how complete this was, or if it was actually used. Anyway, in case it is of any use, see http://squeakvm.org/svn/squeak/branches/olpc/platforms/unix/src/plugins/Clip...
Alas this isn't unix specific. It is the generated plugin, which in this case (and in several other plugins, such as the FilePlugin and the SocketPlugin) is just the platform-independent wrapper around the platform-specific functionality. The source doesn't really belong there. In OpenSmalltalk you'll find it only in src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c. So...
The upper level of a plugin which is generated from VMMaker source is in <root>/src/plugins/<PluginName>/<PluginName>.c It is generated from a class called <PluginName> that inherits from InterpreterPlugin in category VMMaker-Plugins. The header file that defines the interface between the plugin and any platform-specific code is typically in <root>/platforms/Cross/plugins/<PluginName>/<PluginName>.h and in this case is missing (which should be fixed). The various implementations of platform-specific code are often in <root>/platforms/{iOS,unix,win32,etc}/plugins/<PluginName>/ sq[Mac,Unix,Win32,etc}<PluginName>.{c,cc,m,etc} but sometimes more than one file is required to implement the plugin internals. For example, the SoundPlugin typically requires a handful of source files and occasionally a specific makefile.
HTH
Thanks,
On 3/23/2023 9:58 PM, Eliot Miranda wrote:
Hi Hilaire,
On Mar 23, 2023, at 2:38 PM, Hilaire Fernandes hfern@free.fr hfern@free.fr wrote:
Hi Eliot,
I will try to take a deep look as I have also interest for tablet support on Linux. This is a completely new domain (VM) for me.
I hope you find it fun!
Your job is to implement this interface:
void sqPasteboardClear(void *inPasteboard); sqInt sqPasteboardGetItemCount(void *inPasteboard); sqInt sqPasteboardCopyItemFlavorsitemNumber(void *inPasteboard, sqInt formatNumber); void *sqCreateClipboard(void); void sqPasteboardPutItemFlavordatalengthformatTypeformatLength(void *inPasteboard, char *inData, sqInt dataLength, char *format, sqInt formatLength); void sqPasteboardPutItemFlavordatalengthformatType(void *inPasteboard, char *inData, sqInt dataLength, sqInt format); sqInt sqPasteboardCopyItemFlavorDataformatformatLength(void *inPasteboard, char *format, sqInt formatLength); sqInt sqPasteboardCopyItemFlavorDataformat(void *inPasteboard, sqInt format); sqInt sqPasteboardhasDataInFormatformatLength(void *inPasteboard, char *format, sqInt formatLength); sqInt sqPasteboardhasDataInFormat(void *inPasteboard, sqInt format);
which is present only in src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c, a departure from the house style which would have put it in platforms/Cross/ plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.h; no doubt John had his reasons.
Use platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.m & platforms/win32/plugins/ClipboardExtendedPlugin/sqWin32ExtendedClipboard.c as guides. The Mac uses strings to identify clipboard types (the char *format, sqInt formatLength) variant, as opposed to win32, which uses integers (the sqInt format variant). Whichever works.
You’ll implement it in platforms/unix/plugins/ClipboardExtendedPlugin/ sqUnixExtendedClipboard.c
Thanks
Hilaire Le 23/03/2023 à 21:05, Eliot Miranda a écrit :
As John said it doesn't appear to exist for Linux. But X11 has a clipboard and implementing the innards for X11 shouldn't be that difficult. The only complication is that if one wants to do the job "properly" one has to extend the indirection scheme Ian Piumarta came up with so that it can work on the other graphical back-ends such as the raw frame buffer. Hillaire, if you're interested in implementing the X11 ExtendedClipboard internals I'm happy to answer any questions you have.
-- GNU Dr. Geohttp://drgeo.euhttp://blog.drgeo.eu
-- Juan Vuletichcuis.stgithub.com/jvuletichresearchgate.net/profile/Juan-Vuletichindependent.academia.edu/JuanVuletichpatents.justia.com/inventor/juan-manuel-vuletichlinkedin.com/in/juan-vuletich-75611b3twitter.com/JuanVuletich
On Fri, Mar 24, 2023 at 03:41:58PM -0700, Eliot Miranda wrote:
Hi Juan, Hi All,
On Thu, Mar 23, 2023 at 6:19???PM Juan Vuletich juan@cuis.st wrote:
Hi Folks,
I was pretty sure I had seen _something_ about a ClipboardExtendedPlugin for Linux at some time.
Found it. It seems it was part of an OLPC Etoys specific branch of the old interpreter vm. I don't know how complete this was, or if it was actually used. Anyway, in case it is of any use, see http://squeakvm.org/svn/squeak/branches/olpc/platforms/unix/src/plugins/Clip...
Alas this isn't unix specific. It is the generated plugin, which in this case (and in several other plugins, such as the FilePlugin and the SocketPlugin) is just the platform-independent wrapper around the platform-specific functionality. The source doesn't really belong there. In OpenSmalltalk you'll find it only in src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c. So...
Here is some background that I hope may help.
Juan's pointer above was off by just a bit, the platform source in the olpc branch with original commits by author takashi is at:
http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/branches/olpc/platforms/unix/p...
This was one of several plugins from olpc that Ian added to the SVN trunk in 2008:
------------------------------------------------------------------------ r1860 | piumarta | 2008-04-28 15:15:56 -0400 (Mon, 28 Apr 2008) | 1 line
add generated code for Rome, Kedama, Aio, ImmX11, Ogg, ClipboardExtended, Kedana2, GStreamer, DBus plugins ------------------------------------------------------------------------ r1859 | piumarta | 2008-04-28 15:11:59 -0400 (Mon, 28 Apr 2008) | 1 line
add platform support for new plugins ------------------------------------------------------------------------
So the unix platform source along with cmake build support is now here:
http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/trunk/platforms/unix/plugins/C...
The source appears to be incomplete (I don't know why it was not finished):
http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/trunk/platforms/unix/plugins/C...
This plugin builds cleanly on unix and it runs, but I do not know if it does anything useful at this point. I keep an up to date interpreter VM on my pc, and here are the contents of the VM folder:
$ ls -l /usr/local/lib/squeak/4.20.4-3822/ total 7180 -rwxr-xr-x 1 root root 33264 Jan 16 11:29 ckformat -rw-r--r-- 1 root root 28616 Jan 16 11:29 so.AioPlugin -rw-r--r-- 1 root root 229088 Jan 16 11:29 so.B3DAcceleratorPlugin -rw-r--r-- 1 root root 58656 Jan 16 11:29 so.CameraPlugin -rw-r--r-- 1 root root 32200 Jan 16 11:29 so.ClipboardExtendedPlugin -rw-r--r-- 1 root root 90072 Jan 16 11:29 so.DBusPlugin -rw-r--r-- 1 root root 28336 Jan 16 11:29 so.FileCopyPlugin -rw-r--r-- 1 root root 87512 Jan 16 11:29 so.FT2Plugin -rw-r--r-- 1 root root 35632 Jan 16 11:29 so.HostWindowPlugin -rw-r--r-- 1 root root 35240 Jan 16 11:29 so.ImmX11Plugin -rw-r--r-- 1 root root 176048 Jan 16 11:29 so.KedamaPlugin2 -rw-r--r-- 1 root root 927416 Jan 16 11:29 so.Mpeg3Plugin -rw-r--r-- 1 root root 194808 Jan 16 11:29 so.RomePlugin -rw-r--r-- 1 root root 121344 Jan 16 11:29 so.ScratchPlugin -rw-r--r-- 1 root root 243304 Jan 16 11:29 so.Squeak3D -rw-r--r-- 1 root root 116896 Jan 16 11:29 so.SqueakFFIPrims -rw-r--r-- 1 root root 161568 Jan 16 11:29 so.SqueakSSL -rw-r--r-- 1 root root 53824 Jan 16 11:29 so.UnicodePlugin -rw-r--r-- 1 root root 134304 Jan 16 11:29 so.UnixOSProcessPlugin -rw-r--r-- 1 root root 26712 Jan 16 11:29 so.UUIDPlugin -rw-r--r-- 1 root root 229784 Jan 16 11:29 so.VectorEnginePlugin -rw-r--r-- 1 root root 47136 Jan 16 11:29 so.vm-display-custom -rw-r--r-- 1 root root 149528 Jan 16 11:29 so.vm-display-fbdev -rw-r--r-- 1 root root 26536 Jan 16 11:29 so.vm-display-null -rw-r--r-- 1 root root 357312 Jan 16 11:29 so.vm-display-X11 -rw-r--r-- 1 root root 26104 Jan 16 11:29 so.vm-sound-custom -rw-r--r-- 1 root root 35656 Jan 16 11:29 so.vm-sound-NAS -rw-r--r-- 1 root root 16616 Jan 16 11:29 so.vm-sound-null -rw-r--r-- 1 root root 47264 Jan 16 11:29 so.vm-sound-pulse -rw-r--r-- 1 root root 29840 Jan 16 11:29 so.WeDoPlugin -rw-r--r-- 1 root root 27752 Jan 16 11:29 so.XDisplayControlPlugin -rwxr-xr-x 1 root root 3484728 Jan 16 11:29 squeakvm
This means we have a running plugin available, and the missing implementation needs to be filled in as Eliot explains below.
Finally, I note that the original commit notice by takashi explains the plugin design, and points to implementation code in sqUnixX11.c:
http://squeakvm.org/cgi-bin/viewvc.cgi/squeak?view=revision&revision=167...
I think that this topic originated from a question on the Cuis list. Cuis maintains a V3 version of the image that can run on an interpreter VM, so if someone is working with Cuis on Linux, you may want to check and see if the existing plugin might actually be working. Or if you can explain what I should look for in Cuis, I can take a look at it (I know Cuis but I don't really know anything about how this plugin is used in the image).
HTH, Dave
The upper level of a plugin which is generated from VMMaker source is in <root>/src/plugins/<PluginName>/<PluginName>.c It is generated from a class called <PluginName> that inherits from InterpreterPlugin in category VMMaker-Plugins. The header file that defines the interface between the plugin and any platform-specific code is typically in <root>/platforms/Cross/plugins/<PluginName>/<PluginName>.h and in this case is missing (which should be fixed). The various implementations of platform-specific code are often in <root>/platforms/{iOS,unix,win32,etc}/plugins/<PluginName>/ sq[Mac,Unix,Win32,etc}<PluginName>.{c,cc,m,etc} but sometimes more than one file is required to implement the plugin internals. For example, the SoundPlugin typically requires a handful of source files and occasionally a specific makefile.
HTH
Thanks,
On 3/23/2023 9:58 PM, Eliot Miranda wrote:
Hi Hilaire,
On Mar 23, 2023, at 2:38 PM, Hilaire Fernandes hfern@free.fr hfern@free.fr wrote:
???
Hi Eliot,
I will try to take a deep look as I have also interest for tablet support on Linux. This is a completely new domain (VM) for me.
I hope you find it fun!
Your job is to implement this interface:
void sqPasteboardClear(void *inPasteboard); sqInt sqPasteboardGetItemCount(void *inPasteboard); sqInt sqPasteboardCopyItemFlavorsitemNumber(void *inPasteboard, sqInt formatNumber); void *sqCreateClipboard(void); void sqPasteboardPutItemFlavordatalengthformatTypeformatLength(void *inPasteboard, char *inData, sqInt dataLength, char *format, sqInt formatLength); void sqPasteboardPutItemFlavordatalengthformatType(void *inPasteboard, char *inData, sqInt dataLength, sqInt format); sqInt sqPasteboardCopyItemFlavorDataformatformatLength(void *inPasteboard, char *format, sqInt formatLength); sqInt sqPasteboardCopyItemFlavorDataformat(void *inPasteboard, sqInt format); sqInt sqPasteboardhasDataInFormatformatLength(void *inPasteboard, char *format, sqInt formatLength); sqInt sqPasteboardhasDataInFormat(void *inPasteboard, sqInt format);
which is present only in src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c, a departure from the house style which would have put it in platforms/Cross/ plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.h; no doubt John had his reasons.
Use platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.m & platforms/win32/plugins/ClipboardExtendedPlugin/sqWin32ExtendedClipboard.c as guides. The Mac uses strings to identify clipboard types (the char *format, sqInt formatLength) variant, as opposed to win32, which uses integers (the sqInt format variant). Whichever works.
You???ll implement it in platforms/unix/plugins/ClipboardExtendedPlugin/ sqUnixExtendedClipboard.c
Thanks
Hilaire Le 23/03/2023 ?? 21:05, Eliot Miranda a ??crit :
As John said it doesn't appear to exist for Linux. But X11 has a clipboard and implementing the innards for X11 shouldn't be that difficult. The only complication is that if one wants to do the job "properly" one has to extend the indirection scheme Ian Piumarta came up with so that it can work on the other graphical back-ends such as the raw frame buffer. Hillaire, if you're interested in implementing the X11 ExtendedClipboard internals I'm happy to answer any questions you have.
-- GNU Dr. Geohttp://drgeo.euhttp://blog.drgeo.eu
-- Juan Vuletichcuis.stgithub.com/jvuletichresearchgate.net/profile/Juan-Vuletichindependent.academia.edu/JuanVuletichpatents.justia.com/inventor/juan-manuel-vuletichlinkedin.com/in/juan-vuletich-75611b3twitter.com/JuanVuletich
-- _,,,^..^,,,_ best, Eliot
Hi Dave, can you email me the file or commit it to the opensmalltalk repo? If you do the latter don't worry; nothing will break because it isn't included in any plugins.int/.ext yet
On Fri, Mar 24, 2023 at 4:43 PM David T. Lewis lewis@mail.msen.com wrote:
On Fri, Mar 24, 2023 at 03:41:58PM -0700, Eliot Miranda wrote:
Hi Juan, Hi All,
On Thu, Mar 23, 2023 at 6:19???PM Juan Vuletich juan@cuis.st wrote:
Hi Folks,
I was pretty sure I had seen _something_ about a
ClipboardExtendedPlugin
for Linux at some time.
Found it. It seems it was part of an OLPC Etoys specific branch of the
old
interpreter vm. I don't know how complete this was, or if it was
actually
used. Anyway, in case it is of any use, see
http://squeakvm.org/svn/squeak/branches/olpc/platforms/unix/src/plugins/Clip...
Alas this isn't unix specific. It is the generated plugin, which in this case (and in several other plugins, such as the FilePlugin and the SocketPlugin) is just the platform-independent wrapper around the platform-specific functionality. The source doesn't really belong there. In OpenSmalltalk you'll find it only in src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c. So...
Here is some background that I hope may help.
Juan's pointer above was off by just a bit, the platform source in the olpc branch with original commits by author takashi is at:
http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/branches/olpc/platforms/unix/p...
This was one of several plugins from olpc that Ian added to the SVN trunk in 2008:
r1860 | piumarta | 2008-04-28 15:15:56 -0400 (Mon, 28 Apr 2008) | 1 line
add generated code for Rome, Kedama, Aio, ImmX11, Ogg, ClipboardExtended, Kedana2, GStreamer, DBus plugins
r1859 | piumarta | 2008-04-28 15:11:59 -0400 (Mon, 28 Apr 2008) | 1 line
add platform support for new plugins
So the unix platform source along with cmake build support is now here:
http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/trunk/platforms/unix/plugins/C...
The source appears to be incomplete (I don't know why it was not finished):
http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/trunk/platforms/unix/plugins/C...
This plugin builds cleanly on unix and it runs, but I do not know if it does anything useful at this point. I keep an up to date interpreter VM on my pc, and here are the contents of the VM folder:
$ ls -l /usr/local/lib/squeak/4.20.4-3822/ total 7180 -rwxr-xr-x 1 root root 33264 Jan 16 11:29 ckformat -rw-r--r-- 1 root root 28616 Jan 16 11:29 so.AioPlugin -rw-r--r-- 1 root root 229088 Jan 16 11:29 so.B3DAcceleratorPlugin -rw-r--r-- 1 root root 58656 Jan 16 11:29 so.CameraPlugin -rw-r--r-- 1 root root 32200 Jan 16 11:29 so.ClipboardExtendedPlugin -rw-r--r-- 1 root root 90072 Jan 16 11:29 so.DBusPlugin -rw-r--r-- 1 root root 28336 Jan 16 11:29 so.FileCopyPlugin -rw-r--r-- 1 root root 87512 Jan 16 11:29 so.FT2Plugin -rw-r--r-- 1 root root 35632 Jan 16 11:29 so.HostWindowPlugin -rw-r--r-- 1 root root 35240 Jan 16 11:29 so.ImmX11Plugin -rw-r--r-- 1 root root 176048 Jan 16 11:29 so.KedamaPlugin2 -rw-r--r-- 1 root root 927416 Jan 16 11:29 so.Mpeg3Plugin -rw-r--r-- 1 root root 194808 Jan 16 11:29 so.RomePlugin -rw-r--r-- 1 root root 121344 Jan 16 11:29 so.ScratchPlugin -rw-r--r-- 1 root root 243304 Jan 16 11:29 so.Squeak3D -rw-r--r-- 1 root root 116896 Jan 16 11:29 so.SqueakFFIPrims -rw-r--r-- 1 root root 161568 Jan 16 11:29 so.SqueakSSL -rw-r--r-- 1 root root 53824 Jan 16 11:29 so.UnicodePlugin -rw-r--r-- 1 root root 134304 Jan 16 11:29 so.UnixOSProcessPlugin -rw-r--r-- 1 root root 26712 Jan 16 11:29 so.UUIDPlugin -rw-r--r-- 1 root root 229784 Jan 16 11:29 so.VectorEnginePlugin -rw-r--r-- 1 root root 47136 Jan 16 11:29 so.vm-display-custom -rw-r--r-- 1 root root 149528 Jan 16 11:29 so.vm-display-fbdev -rw-r--r-- 1 root root 26536 Jan 16 11:29 so.vm-display-null -rw-r--r-- 1 root root 357312 Jan 16 11:29 so.vm-display-X11 -rw-r--r-- 1 root root 26104 Jan 16 11:29 so.vm-sound-custom -rw-r--r-- 1 root root 35656 Jan 16 11:29 so.vm-sound-NAS -rw-r--r-- 1 root root 16616 Jan 16 11:29 so.vm-sound-null -rw-r--r-- 1 root root 47264 Jan 16 11:29 so.vm-sound-pulse -rw-r--r-- 1 root root 29840 Jan 16 11:29 so.WeDoPlugin -rw-r--r-- 1 root root 27752 Jan 16 11:29 so.XDisplayControlPlugin -rwxr-xr-x 1 root root 3484728 Jan 16 11:29 squeakvm
This means we have a running plugin available, and the missing implementation needs to be filled in as Eliot explains below.
Finally, I note that the original commit notice by takashi explains the plugin design, and points to implementation code in sqUnixX11.c:
http://squeakvm.org/cgi-bin/viewvc.cgi/squeak?view=revision&revision=167...
I think that this topic originated from a question on the Cuis list. Cuis maintains a V3 version of the image that can run on an interpreter VM, so if someone is working with Cuis on Linux, you may want to check and see if the existing plugin might actually be working. Or if you can explain what I should look for in Cuis, I can take a look at it (I know Cuis but I don't really know anything about how this plugin is used in the image).
HTH, Dave
The upper level of a plugin which is generated from VMMaker source is in <root>/src/plugins/<PluginName>/<PluginName>.c It is generated from a class called <PluginName> that inherits from InterpreterPlugin in category VMMaker-Plugins. The header file that defines the interface between the plugin and any platform-specific code is typically in <root>/platforms/Cross/plugins/<PluginName>/<PluginName>.h and in this case is missing (which should be fixed). The various implementations of platform-specific code are often in <root>/platforms/{iOS,unix,win32,etc}/plugins/<PluginName>/ sq[Mac,Unix,Win32,etc}<PluginName>.{c,cc,m,etc} but sometimes more than one file is required to implement the plugin internals. For example, the SoundPlugin typically requires a handful of source files and occasionally a specific makefile.
HTH
Thanks,
On 3/23/2023 9:58 PM, Eliot Miranda wrote:
Hi Hilaire,
On Mar 23, 2023, at 2:38 PM, Hilaire Fernandes hfern@free.fr hfern@free.fr wrote:
???
Hi Eliot,
I will try to take a deep look as I have also interest for tablet
support
on Linux. This is a completely new domain (VM) for me.
I hope you find it fun!
Your job is to implement this interface:
void sqPasteboardClear(void *inPasteboard); sqInt sqPasteboardGetItemCount(void *inPasteboard); sqInt sqPasteboardCopyItemFlavorsitemNumber(void *inPasteboard, sqInt formatNumber); void *sqCreateClipboard(void); void sqPasteboardPutItemFlavordatalengthformatTypeformatLength(void *inPasteboard, char *inData, sqInt dataLength, char *format, sqInt formatLength); void sqPasteboardPutItemFlavordatalengthformatType(void *inPasteboard, char *inData, sqInt dataLength, sqInt format); sqInt sqPasteboardCopyItemFlavorDataformatformatLength(void *inPasteboard, char *format, sqInt formatLength); sqInt sqPasteboardCopyItemFlavorDataformat(void *inPasteboard, sqInt format); sqInt sqPasteboardhasDataInFormatformatLength(void *inPasteboard, char *format, sqInt formatLength); sqInt sqPasteboardhasDataInFormat(void *inPasteboard, sqInt format);
which is present only in
src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c,
a departure from the house style which would have put it in
platforms/Cross/
plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.h; no doubt
John
had his reasons.
Use
platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.m
&
platforms/win32/plugins/ClipboardExtendedPlugin/sqWin32ExtendedClipboard.c
as guides. The Mac uses strings to identify clipboard types (the char *format, sqInt formatLength) variant, as opposed to win32, which uses integers (the sqInt format variant). Whichever works.
You???ll implement it in
platforms/unix/plugins/ClipboardExtendedPlugin/
sqUnixExtendedClipboard.c
Thanks
Hilaire Le 23/03/2023 ?? 21:05, Eliot Miranda a ??crit :
As John said it doesn't appear to exist for Linux. But X11 has a clipboard and implementing the innards for X11 shouldn't be that difficult. The only complication is that if one wants to do the job "properly" one has to extend the indirection scheme Ian Piumarta came
up
with so that it can work on the other graphical back-ends such as the
raw
frame buffer. Hillaire, if you're interested in implementing the X11 ExtendedClipboard internals I'm happy to answer any questions you have.
-- GNU Dr. Geohttp://drgeo.euhttp://blog.drgeo.eu
-- Juan
Vuletichcuis.stgithub.com/jvuletichresearchgate.net/profile/Juan-Vuletichindependent.academia.edu/JuanVuletichpatents.justia.com/inventor/juan-manuel-vuletichlinkedin.com/in/juan-vuletich-75611b3twitter.com/JuanVuletich
-- _,,,^..^,,,_ best, Eliot
On Fri, Mar 24, 2023 at 05:42:34PM -0700, Eliot Miranda wrote:
Hi Dave, can you email me the file or commit it to the opensmalltalk repo? If you do the latter don't worry; nothing will break because it isn't included in any plugins.int/.ext yet
I committed the original OLPC source, then updated the include order so it builds cleanly. There are undefined symbol errors when the plugin is loaded (no surprise) but this should be a good starting point.
Dave
Just for the record, here is the original change history from the OLPC project:
------------------------------------------------------------------------ r1800 | takashi | 2007-12-09 19:36:52 -0500 (Sun, 09 Dec 2007) | 10 lines
Asynchronous drag drop out. Serializing happens only after the destination app requests (which means it works fine with Sugar frame).
The request is noticed with sqDragDropFilesEvent(DragRequest). I decided not to reuse clipboard mechanism to pass the data from image to vm because clipboard and dnd are so different.
(svn merge -r 1789:1799 http://squeakvm.org/svn/squeak/branches/takashi-branch)
------------------------------------------------------------------------ r1740 | takashi | 2007-07-12 01:03:17 -0400 (Thu, 12 Jul 2007) | 4 lines
- Show the cursor forced when you drag out. - Fixed a too stupid bug about type index for clipboard. (svn merge -r 1736:1739 http://squeakvm.org/svn/squeak/branches/takashi-branch)
------------------------------------------------------------------------ r1725 | takashi | 2007-06-25 22:57:01 -0400 (Mon, 25 Jun 2007) | 8 lines
Merged from Drag and Drop output.
- Event handler for DnD was restructured. - Unnecessary public functions I made were set to static. - Layout of OggPlugin and ClipboardExtendedPlugin was proper place.
(svn merge -r 1685:HEAD http://squeakvm.org/svn/squeak/branches/takashi-branch)
------------------------------------------------------------------------ r1683 | takashi | 2007-05-15 12:20:53 -0400 (Tue, 15 May 2007) | 21 lines
Merged a part of ClipboardExtendedPlugin for X11
- This patch allows you to paste data with any types from another application. I have tested with Firefox, gimp, gedit and Abiword (It is not implemented yet to copy FROM squeak to others).
- Also, drag and drop is improved to handle any types besides text/url-list.
- sqUnixExtendedClipboard.c is just a interface. The body of the code is implemented in sqUnixX11.c.
- When you drop non text/url-list file, DropFilesEvent with zero file count is generated. The the image retrieve the data from clipboard by the event. For the image, dropped contents and pasted contents are seen as same. Dropped contents is removed after it is retrieved once (it is necessary because Squeak has to send finish event to the peer), but pasted contents is kept until when selection owner is changed.
(svn merge -r 1672:1682 http://squeakvm.org/svn/squeak/branches/takashi-branch)
------------------------------------------------------------------------ r1682 | takashi | 2007-05-15 09:15:26 -0400 (Tue, 15 May 2007) | 1 line
tiny comment ------------------------------------------------------------------------ r1681 | takashi | 2007-05-15 05:52:36 -0400 (Tue, 15 May 2007) | 1 line
further memory reduce for DnD ------------------------------------------------------------------------ r1680 | takashi | 2007-05-15 05:06:02 -0400 (Tue, 15 May 2007) | 1 line
Target window for DnD is always stParent ------------------------------------------------------------------------ r1677 | takashi | 2007-05-13 23:09:58 -0400 (Sun, 13 May 2007) | 1 line
INCR protocol and partial property reading was suppored in clipboard (but a bug remains). ------------------------------------------------------------------------ r1674 | takashi | 2007-05-12 09:07:10 -0400 (Sat, 12 May 2007) | 1 line
Just simple fixes to pass -Wall ------------------------------------------------------------------------ r1673 | takashi | 2007-05-12 02:04:01 -0400 (Sat, 12 May 2007) | 1 line
Implemented a back end to get type name and type value for ClipboardExtendedPlugin. ClipboardExtendedPlugin is just a API to get clipboard. actual mechanism is written in sqUnixX11.c. And sqUnixXdnd.c was modified to handle multiple data types. When drag event with image type is come, sqUnixXdnd.c generate DropFileEvent with zero file count. Then, system will retrieve data from getSelectionData() with XdndSqueakSelection. ------------------------------------------------------------------------
Fab Dave, exactly what’s needed. Thank you!!
_,,,^..^,,,_ (phone)
On Mar 25, 2023, at 8:40 AM, David T. Lewis lewis@mail.msen.com wrote:
On Fri, Mar 24, 2023 at 05:42:34PM -0700, Eliot Miranda wrote:
Hi Dave, can you email me the file or commit it to the opensmalltalk repo? If you do the latter don't worry; nothing will break because it isn't included in any plugins.int/.ext yet
I committed the original OLPC source, then updated the include order so it builds cleanly. There are undefined symbol errors when the plugin is loaded (no surprise) but this should be a good starting point.
Dave
Just for the record, here is the original change history from the OLPC project:
r1800 | takashi | 2007-12-09 19:36:52 -0500 (Sun, 09 Dec 2007) | 10 lines
Asynchronous drag drop out. Serializing happens only after the destination app requests (which means it works fine with Sugar frame).
The request is noticed with sqDragDropFilesEvent(DragRequest). I decided not to reuse clipboard mechanism to pass the data from image to vm because clipboard and dnd are so different.
(svn merge -r 1789:1799 http://squeakvm.org/svn/squeak/branches/takashi-branch)
r1740 | takashi | 2007-07-12 01:03:17 -0400 (Thu, 12 Jul 2007) | 4 lines
- Show the cursor forced when you drag out.
- Fixed a too stupid bug about type index for clipboard.
(svn merge -r 1736:1739 http://squeakvm.org/svn/squeak/branches/takashi-branch)
r1725 | takashi | 2007-06-25 22:57:01 -0400 (Mon, 25 Jun 2007) | 8 lines
Merged from Drag and Drop output.
- Event handler for DnD was restructured.
- Unnecessary public functions I made were set to static.
- Layout of OggPlugin and ClipboardExtendedPlugin was proper place.
(svn merge -r 1685:HEAD http://squeakvm.org/svn/squeak/branches/takashi-branch)
r1683 | takashi | 2007-05-15 12:20:53 -0400 (Tue, 15 May 2007) | 21 lines
Merged a part of ClipboardExtendedPlugin for X11
- This patch allows you to paste data with any types from another
application. I have tested with Firefox, gimp, gedit and Abiword (It is not implemented yet to copy FROM squeak to others).
Also, drag and drop is improved to handle any types besides text/url-list.
sqUnixExtendedClipboard.c is just a interface. The body of the code
is implemented in sqUnixX11.c.
- When you drop non text/url-list file, DropFilesEvent with zero file
count is generated. The the image retrieve the data from clipboard by the event. For the image, dropped contents and pasted contents are seen as same. Dropped contents is removed after it is retrieved once (it is necessary because Squeak has to send finish event to the peer), but pasted contents is kept until when selection owner is changed.
(svn merge -r 1672:1682 http://squeakvm.org/svn/squeak/branches/takashi-branch)
r1682 | takashi | 2007-05-15 09:15:26 -0400 (Tue, 15 May 2007) | 1 line
tiny comment
r1681 | takashi | 2007-05-15 05:52:36 -0400 (Tue, 15 May 2007) | 1 line
further memory reduce for DnD
r1680 | takashi | 2007-05-15 05:06:02 -0400 (Tue, 15 May 2007) | 1 line
Target window for DnD is always stParent
r1677 | takashi | 2007-05-13 23:09:58 -0400 (Sun, 13 May 2007) | 1 line
INCR protocol and partial property reading was suppored in clipboard (but a bug remains).
r1674 | takashi | 2007-05-12 09:07:10 -0400 (Sat, 12 May 2007) | 1 line
Just simple fixes to pass -Wall
r1673 | takashi | 2007-05-12 02:04:01 -0400 (Sat, 12 May 2007) | 1 line
Implemented a back end to get type name and type value for ClipboardExtendedPlugin. ClipboardExtendedPlugin is just a API to get clipboard. actual mechanism is written in sqUnixX11.c. And sqUnixXdnd.c was modified to handle multiple data types. When drag event with image type is come, sqUnixXdnd.c generate DropFileEvent with zero file count. Then, system will retrieve data from getSelectionData() with XdndSqueakSelection.
The undefined symbol errors might just be something in the build or makefiles. For the oscog build, I see console errors like undefined symbol: sqPasteboardPutItemFlavordatalengthformatType.
The actual code is present in both the generated ./src file and the ./platforms source. I'm probably overlooking something obvious.
Dave
On Sat, Mar 25, 2023 at 09:39:54AM -0700, Eliot Miranda wrote:
Fab Dave, exactly what???s needed. Thank you!!
_,,,^..^,,,_ (phone)
On Mar 25, 2023, at 8:40 AM, David T. Lewis lewis@mail.msen.com wrote:
???
On Fri, Mar 24, 2023 at 05:42:34PM -0700, Eliot Miranda wrote:
Hi Dave, can you email me the file or commit it to the opensmalltalk repo? If you do the latter don't worry; nothing will break because it isn't included in any plugins.int/.ext yet
I committed the original OLPC source, then updated the include order so it builds cleanly. There are undefined symbol errors when the plugin is loaded (no surprise) but this should be a good starting point.
Dave
Just for the record, here is the original change history from the OLPC project:
r1800 | takashi | 2007-12-09 19:36:52 -0500 (Sun, 09 Dec 2007) | 10 lines
Asynchronous drag drop out. Serializing happens only after the destination app requests (which means it works fine with Sugar frame).
The request is noticed with sqDragDropFilesEvent(DragRequest). I decided not to reuse clipboard mechanism to pass the data from image to vm because clipboard and dnd are so different.
(svn merge -r 1789:1799 http://squeakvm.org/svn/squeak/branches/takashi-branch)
r1740 | takashi | 2007-07-12 01:03:17 -0400 (Thu, 12 Jul 2007) | 4 lines
- Show the cursor forced when you drag out.
- Fixed a too stupid bug about type index for clipboard.
(svn merge -r 1736:1739 http://squeakvm.org/svn/squeak/branches/takashi-branch)
r1725 | takashi | 2007-06-25 22:57:01 -0400 (Mon, 25 Jun 2007) | 8 lines
Merged from Drag and Drop output.
- Event handler for DnD was restructured.
- Unnecessary public functions I made were set to static.
- Layout of OggPlugin and ClipboardExtendedPlugin was proper place.
(svn merge -r 1685:HEAD http://squeakvm.org/svn/squeak/branches/takashi-branch)
r1683 | takashi | 2007-05-15 12:20:53 -0400 (Tue, 15 May 2007) | 21 lines
Merged a part of ClipboardExtendedPlugin for X11
- This patch allows you to paste data with any types from another
application. I have tested with Firefox, gimp, gedit and Abiword (It is not implemented yet to copy FROM squeak to others).
Also, drag and drop is improved to handle any types besides text/url-list.
sqUnixExtendedClipboard.c is just a interface. The body of the code
is implemented in sqUnixX11.c.
- When you drop non text/url-list file, DropFilesEvent with zero file
count is generated. The the image retrieve the data from clipboard by the event. For the image, dropped contents and pasted contents are seen as same. Dropped contents is removed after it is retrieved once (it is necessary because Squeak has to send finish event to the peer), but pasted contents is kept until when selection owner is changed.
(svn merge -r 1672:1682 http://squeakvm.org/svn/squeak/branches/takashi-branch)
r1682 | takashi | 2007-05-15 09:15:26 -0400 (Tue, 15 May 2007) | 1 line
tiny comment
r1681 | takashi | 2007-05-15 05:52:36 -0400 (Tue, 15 May 2007) | 1 line
further memory reduce for DnD
r1680 | takashi | 2007-05-15 05:06:02 -0400 (Tue, 15 May 2007) | 1 line
Target window for DnD is always stParent
r1677 | takashi | 2007-05-13 23:09:58 -0400 (Sun, 13 May 2007) | 1 line
INCR protocol and partial property reading was suppored in clipboard (but a bug remains).
r1674 | takashi | 2007-05-12 09:07:10 -0400 (Sat, 12 May 2007) | 1 line
Just simple fixes to pass -Wall
r1673 | takashi | 2007-05-12 02:04:01 -0400 (Sat, 12 May 2007) | 1 line
Implemented a back end to get type name and type value for ClipboardExtendedPlugin. ClipboardExtendedPlugin is just a API to get clipboard. actual mechanism is written in sqUnixX11.c. And sqUnixXdnd.c was modified to handle multiple data types. When drag event with image type is come, sqUnixXdnd.c generate DropFileEvent with zero file count. Then, system will retrieve data from getSelectionData() with XdndSqueakSelection.
Hi Hilaire, Hi unix/linux bods,
I've got the ClipboardExtendedPlugin to compile and run on linux, but the results are disappointing. The guts of the implementation is in this interfacer in platforms/unix/vm-display/x11/sqUnixX11.c:
char **clipboardGetTypeNames(); sqInt clipboardSizeWithType(char *typeName, int ntypeName); sqInt clipboardReadIntoAt(sqInt count, sqInt byteArrayIndex, sqInt startIndex); void *firstIndexableField(sqInt oop); void clipboardWriteWithType(char *data, size_t ndata, char *typeName, size_t ntypeName, int isDnd, int isClaiming);
At a trivial level the code in platforms/unix/plugins/ClipboardExtendedPlugin/sqUnixExtendedClipboard.c ncould be improved if
// TODO: clipboardGetTypeNames() should be cached. And the simplest way to do // this is to have display_clipboardGetTypeNames do the cacheing and freeing, // it freeing the previous invocation's data if the clipboard has changed, // then all the multiple frees below can disappear. Further, the signature can // be changed to include a pointer to the item count and then the indexing // can safely be done directly. eem. '23/3/25
But more fundamentally the API implementation in sqUnixX11.c needs extending. I recommend playing with e.g. firefox and the file finder, copying various items, and observing the state of the clipboard, through a suitable viewer. I prematurely deleted some dubious code from sqUnixExtendedClipboard.c that one might be able to construct a simple viewer/lister from. In any case, the relevant information does not percolate up from the sqUnixX11.c API to allow the sqUnixExtendedClipboard.c API to pass the desired information up to Squeak. An X11 maven should be able to get this going quickly. Any HPI linux users feel like having a go?
If so, viel Glück!
On Thu, Mar 23, 2023 at 5:58 PM Eliot Miranda eliot.miranda@gmail.com wrote:
Hi Hilaire,
On Mar 23, 2023, at 2:38 PM, Hilaire Fernandes hfern@free.fr wrote:
Hi Eliot,
I will try to take a deep look as I have also interest for tablet support on Linux. This is a completely new domain (VM) for me.
I hope you find it fun!
Your job is to implement this interface:
void sqPasteboardClear(void *inPasteboard); sqInt sqPasteboardGetItemCount (void *inPasteboard); sqInt sqPasteboardCopyItemFlavorsitemNumber(void *inPasteboard, sqInt formatNumber); void *sqCreateClipboard(void); void sqPasteboardPutItemFlavordatalengthformatTypeformatLength(void *inPasteboard, char *inData, sqInt dataLength, char *format, sqInt formatLength); void sqPasteboardPutItemFlavordatalengthformatType(void *inPasteboard, char *inData, sqInt dataLength, sqInt format); sqInt sqPasteboardCopyItemFlavorDataformatformatLength(void *inPasteboard, char *format, sqInt formatLength); sqInt sqPasteboardCopyItemFlavorDataformat( void *inPasteboard, sqInt format); sqInt sqPasteboardhasDataInFormatformatLength(void *inPasteboard, char *format, sqInt formatLength); sqInt sqPasteboardhasDataInFormat(void *inPasteboard, sqInt format); which is present only in src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c, a departure from the house style which would have put it in platforms/Cross/ plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.h; no doubt John had his reasons.
Use platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.m & platforms/win32/plugins/ClipboardExtendedPlugin/sqWin32ExtendedClipboard.c as guides. The Mac uses strings to identify clipboard types (the char *format, sqInt formatLength) variant, as opposed to win32, which uses integers (the sqInt format variant). Whichever works.
You’ll implement it in platforms/unix/plugins/ClipboardExtendedPlugin/ sqUnixExtendedClipboard.c
Thanks
Hilaire Le 23/03/2023 à 21:05, Eliot Miranda a écrit :
As John said it doesn't appear to exist for Linux. But X11 has a clipboard and implementing the innards for X11 shouldn't be that difficult. The only complication is that if one wants to do the job "properly" one has to extend the indirection scheme Ian Piumarta came up with so that it can work on the other graphical back-ends such as the raw frame buffer. Hillaire, if you're interested in implementing the X11 ExtendedClipboard internals I'm happy to answer any questions you have.
-- GNU Dr. Geohttp://drgeo.euhttp://blog.drgeo.eu
Hi All,
xclip can be used to inspect the clipboard:
$ xclip -verbose -o -t TARGETS Connected to X server. Using TARGETS. Type is ATOM. TARGETS image/png image/jpeg
and the source code is available. Using it the code in sqUnixX11.c should be fixable. Good luck!
On Tue, Mar 28, 2023 at 1:47 PM Eliot Miranda eliot.miranda@gmail.com wrote:
Hi Hilaire, Hi unix/linux bods,
I've got the ClipboardExtendedPlugin to compile and run on linux, but
the results are disappointing. The guts of the implementation is in this interfacer in platforms/unix/vm-display/x11/sqUnixX11.c:
char **clipboardGetTypeNames(); sqInt clipboardSizeWithType(char *typeName, int ntypeName); sqInt clipboardReadIntoAt(sqInt count, sqInt byteArrayIndex, sqInt startIndex); void *firstIndexableField(sqInt oop); void clipboardWriteWithType(char *data, size_t ndata, char *typeName, size_t ntypeName, int isDnd, int isClaiming);
At a trivial level the code in platforms/unix/plugins/ClipboardExtendedPlugin/sqUnixExtendedClipboard.c ncould be improved if
// TODO: clipboardGetTypeNames() should be cached. And the simplest way to do // this is to have display_clipboardGetTypeNames do the cacheing and freeing, // it freeing the previous invocation's data if the clipboard has changed, // then all the multiple frees below can disappear. Further, the signature can // be changed to include a pointer to the item count and then the indexing // can safely be done directly. eem. '23/3/25
But more fundamentally the API implementation in sqUnixX11.c needs extending. I recommend playing with e.g. firefox and the file finder, copying various items, and observing the state of the clipboard, through a suitable viewer. I prematurely deleted some dubious code from sqUnixExtendedClipboard.c that one might be able to construct a simple viewer/lister from. In any case, the relevant information does not percolate up from the sqUnixX11.c API to allow the sqUnixExtendedClipboard.c API to pass the desired information up to Squeak. An X11 maven should be able to get this going quickly. Any HPI linux users feel like having a go?
If so, viel Glück!
On Thu, Mar 23, 2023 at 5:58 PM Eliot Miranda eliot.miranda@gmail.com wrote:
Hi Hilaire,
On Mar 23, 2023, at 2:38 PM, Hilaire Fernandes hfern@free.fr wrote:
Hi Eliot,
I will try to take a deep look as I have also interest for tablet support on Linux. This is a completely new domain (VM) for me.
I hope you find it fun!
Your job is to implement this interface:
void sqPasteboardClear(void *inPasteboard); sqInt sqPasteboardGetItemCount(void *inPasteboard); sqInt sqPasteboardCopyItemFlavorsitemNumber(void *inPasteboard, sqInt formatNumber); void *sqCreateClipboard(void); void sqPasteboardPutItemFlavordatalengthformatTypeformatLength(void *inPasteboard, char *inData, sqInt dataLength, char *format, sqInt formatLength); void sqPasteboardPutItemFlavordatalengthformatType(void *inPasteboard, char *inData, sqInt dataLength, sqInt format); sqInt sqPasteboardCopyItemFlavorDataformatformatLength(void *inPasteboard, char *format, sqInt formatLength); sqInt sqPasteboardCopyItemFlavorDataformat( void *inPasteboard, sqInt format); sqInt sqPasteboardhasDataInFormatformatLength(void *inPasteboard, char *format, sqInt formatLength); sqInt sqPasteboardhasDataInFormat(void *inPasteboard, sqInt format); which is present only in src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c, a departure from the house style which would have put it in platforms/Cross/ plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.h; no doubt John had his reasons.
Use platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.m & platforms/win32/plugins/ClipboardExtendedPlugin/sqWin32ExtendedClipboard.c as guides. The Mac uses strings to identify clipboard types (the char *format, sqInt formatLength) variant, as opposed to win32, which uses integers (the sqInt format variant). Whichever works.
You’ll implement it in platforms/unix/plugins/ClipboardExtendedPlugin/ sqUnixExtendedClipboard.c
Thanks
Hilaire Le 23/03/2023 à 21:05, Eliot Miranda a écrit :
As John said it doesn't appear to exist for Linux. But X11 has a clipboard and implementing the innards for X11 shouldn't be that difficult. The only complication is that if one wants to do the job "properly" one has to extend the indirection scheme Ian Piumarta came up with so that it can work on the other graphical back-ends such as the raw frame buffer. Hillaire, if you're interested in implementing the X11 ExtendedClipboard internals I'm happy to answer any questions you have.
-- GNU Dr. Geohttp://drgeo.euhttp://blog.drgeo.eu
-- _,,,^..^,,,_ best, Eliot
Hi,
Compiled VM with extented clipboard plugin (hopefully). From the cuis image, with extended clipboard Smalltalk package installed, got primitive error when copying text: primClearClipboard.
Is it the expected behavior?
Thanks
Hilaire
Hi All,
now thanks to Hilaire's advocacy and David's work we have a plugin that loads and runs on Unix. There's of course more to do before we're finished:
a) sqPasteboardClear needs to be implemented b) ideally the memory management contract between sqUnixExtendedClipboard.c and clipboardGetTypeNames (implemented in platforms/unix/vm-display-X11/sqUnixX11.c) can be d=fixed. See my comment at line 45 of sqUnixExtendedClipboard.c c) the image-level ExtendedClipboardUnixInterface code needs implementing, using the Mac & WIndows siblings as a guide, and seeing what Firefox & Chrome do when pasting images and HTML text, and what happens when one copies filenames in the desktop file manager
On Thu, Mar 23, 2023 at 11:40 AM Hilaire Fernandes hfern@free.fr wrote:
Hi,
I want to copy to the OS clipboard DrGeo sketch as SVG image.
The clipboard in the image is only for text. I read about Extented Clipboard (Mac OSX) plugin to manage other type of data. I was told the plugin also existed for Linux at some time (when Sophie was developed). Is it possible to retrieve it?
Thanks
Hilaire
-- GNU Dr. Geohttp://drgeo.euhttp://blog.drgeo.eu
Hi Eliot, David,
Thanks for working on this!
Just FYI, there is the Cuis package ExtendedClipboard.pck.st which does contain image level code for Mac, Win and Unix: https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev/blob/master/Packages/Sy...
IIRC, Juan worked on this for the StyledTextEditor.
However, it looks like it uses a different primitive interface than described in your mails. So I don’t know if it is useful in any way.
Cheers, Bernhard
Am 26.03.2023 um 18:58 schrieb Eliot Miranda eliot.miranda@gmail.com:
Hi All,
now thanks to Hilaire's advocacy and David's work we have a plugin that loads and runs on Unix. There's of course more to do before we're finished:
a) sqPasteboardClear needs to be implemented b) ideally the memory management contract between sqUnixExtendedClipboard.c and clipboardGetTypeNames (implemented in platforms/unix/vm-display-X11/sqUnixX11.c) can be d=fixed. See my comment at line 45 of sqUnixExtendedClipboard.c c) the image-level ExtendedClipboardUnixInterface code needs implementing, using the Mac & WIndows siblings as a guide, and seeing what Firefox & Chrome do when pasting images and HTML text, and what happens when one copies filenames in the desktop file manager
On Thu, Mar 23, 2023 at 11:40 AM Hilaire Fernandes hfern@free.fr wrote:
Hi,
I want to copy to the OS clipboard DrGeo sketch as SVG image.
The clipboard in the image is only for text. I read about Extented Clipboard (Mac OSX) plugin to manage other type of data. I was told the plugin also existed for Linux at some time (when Sophie was developed). Is it possible to retrieve it?
Thanks
Hilaire
-- GNU Dr. Geo [http://drgeo.eu%5D(http://drgeo.eu/)
--
_,,,^..^,,,_ best, Eliot
Hi all,
Wow! You are moving so fast, I did not even start looking.
Thanks
Hilaire
Awesome!
Just to confirm that indeed, at some point this worked in the version of Squeak/Etoys that shipped on the OLPC machines.
You could for example copy a morph and insert it into an OpenOffice document (it was converted to a bitmap).
If I remember correctly you could even copy morphs including their running scripts from one image to another, by way of serializing the morph and using a Squeak-specific MIME type.
Vanessa
On Sun, Mar 26, 2023 at 1:35 PM Eliot Miranda eliot.miranda@gmail.com wrote:
Hi Bernard,
On Mar 26, 2023, at 12:39 PM, Bernhard Pieber bernhard@pieber.com wrote:
Hi Eliot, David,
Thanks for working on this!
Just FYI, there is the Cuis package ExtendedClipboard.pck.st which does contain image level code for Mac, Win and Unix:
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev/blob/master/Packages/Sy...
IIRC, Juan worked on this for the StyledTextEditor.
However, it looks like it uses a different primitive interface than described in your mails. So I don’t know if it is useful in any way.
Cool! In any case the image level data manipulation is very useful. Since the Cuis package uses the FFI (v nice) it can guide the intervals of the plugin implementation. Thank you kindly!
Cheers, Bernhard
Am 26.03.2023 um 18:58 schrieb Eliot Miranda eliot.miranda@gmail.com:
Hi All,
now thanks to Hilaire's advocacy and David's work we have a plugin that loads and runs on Unix. There's of course more to do before we're finished:
a) sqPasteboardClear needs to be implemented b) ideally the memory management contract between sqUnixExtendedClipboard.c and clipboardGetTypeNames (implemented in platforms/unix/vm-display-X11/sqUnixX11.c) can be d=fixed. See my comment at line 45 of sqUnixExtendedClipboard.c c) the image-level ExtendedClipboardUnixInterface code needs implementing, using the Mac & WIndows siblings as a guide, and seeing what Firefox & Chrome do when pasting images and HTML text, and what happens when one copies filenames in the desktop file manager
On Thu, Mar 23, 2023 at 11:40 AM Hilaire Fernandes hfern@free.fr wrote:
Hi,
I want to copy to the OS clipboard DrGeo sketch as SVG image.
The clipboard in the image is only for text. I read about Extented Clipboard (Mac OSX) plugin to manage other type of data. I was told the plugin also existed for Linux at some time (when Sophie was developed). Is it possible to retrieve it?
Thanks
Hilaire
-- GNU Dr. Geohttp://drgeo.euhttp://blog.drgeo.eu
-- _,,,^..^,,,_ best, Eliot
On Mon, Mar 27, 2023 at 08:13:58PM -0700, Vanessa Freudenberg wrote:
Awesome!
Just to confirm that indeed, at some point this worked in the version of Squeak/Etoys that shipped on the OLPC machines.
You could for example copy a morph and insert it into an OpenOffice document (it was converted to a bitmap).
If I remember correctly you could even copy morphs including their running scripts from one image to another, by way of serializing the morph and using a Squeak-specific MIME type.
Thanks Vanessa,
I am not keeping up very well with the current clipboard development, but I am try to help by putting together the historical pieces.
The OLPC image should be a good reference. It's on Linux and it delivers Etoys and all of the clipboard functionality that worked at that time.
Can you say if the Etoys development image Etoys-Dev-4.1.2381.zip is the same as what was delivered on OLPC? If so it should serve as a useful reference.
If anyone would like to try looking at Etoys-Dev-4.1.2381.zip, here are a few notes:
- The image will run in SqueakJS on https://try.squeak.org/. It's a bit slow but it works and allows anyone to browse the system and look at the source.
- The image also runs on an up to date interpreter VM, which is useful if you want to run Etoys on a native Linux VM and try the clipboard functions on Linux.
- I found that I now need to compile the VM with the gcc -fno-stack-protector option, otherwise the VM exits with a stack smashing warning. I am assuming this is due to recent gcc security updates (exit on stack smashing detected) that are triggered by the existing VM/image when running the Etoys image. Home hobby Squeakers compiling the VM will need to follow the instructions at https://wiki.squeak.org/squeak/6354 but also add the -fno-stack-protector compiler option in order to run the Etoys development image on Linux.
BTW I do not recall the link for downloading Etoys-Dev-4.1.2381.zip but hopefully it is still available on the net. If not maybe we can put a copy on the files.squeak.org server.
Dave
Hi Dave,
I put my hand on the VM, just enough to be able to compile it and run a GDB session with a breakpoint in the plugin. I followed the instructions on VM github repo VM to compile a COG version wtih debug symbols for Linux. I did not met the problem with flag you mentioned, I am still on Ubuntu 20.04, may my gcc version is older.
The Squeak wiki page about VM source seems wrong, it writes github repo is for archiving and development goes on squeakvm. From my perception it is the contrary.
I will try to put together the peaces from the latest Etoys OLPC VM Juan pointed.
Thanks
Hilaire
Le 01/04/2023 à 01:32, David T. Lewis a écrit :
Thanks Vanessa,
I am not keeping up very well with the current clipboard development, but I am try to help by putting together the historical pieces.
The OLPC image should be a good reference. It's on Linux and it delivers Etoys and all of the clipboard functionality that worked at that time.
Can you say if the Etoys development image Etoys-Dev-4.1.2381.zip is the same as what was delivered on OLPC? If so it should serve as a useful reference.
If anyone would like to try looking at Etoys-Dev-4.1.2381.zip, here are a few notes:
- The image will run in SqueakJS onhttps://try.squeak.org/. It's
a bit slow but it works and allows anyone to browse the system and look at the source.
- The image also runs on an up to date interpreter VM, which is
useful if you want to run Etoys on a native Linux VM and try the clipboard functions on Linux.
- I found that I now need to compile the VM with the gcc -fno-stack-protector
option, otherwise the VM exits with a stack smashing warning. I am assuming this is due to recent gcc security updates (exit on stack smashing detected) that are triggered by the existing VM/image when running the Etoys image. Home hobby Squeakers compiling the VM will need to follow the instructions athttps://wiki.squeak.org/squeak/6354 but also add the -fno-stack-protector compiler option in order to run the Etoys development image on Linux.
BTW I do not recall the link for downloading Etoys-Dev-4.1.2381.zip but hopefully it is still available on the net. If not maybe we can put a copy on the files.squeak.org server.
vm-dev@lists.squeakfoundation.org