<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi All,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">    if you're on Windows and after updating trunk you get a primitive failure in the ExtendedClipboardWinoInterface when copying text, don't panic. Simply evaluate <a href="http://lists.squeakfoundation.org/pipermail/vm-dev/2023-March/038866.html">http://lists.squeakfoundation.org/pipermail/vm-dev/2023-March/038866.html</a> (which youshou;d be able to paste in from this mail message).</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you're on Mac then please know that I'm working as fast as I can to fix the situation ;-)</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 24, 2023 at 10:06 AM <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Eliot Miranda uploaded a new version of System to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/System-eem.1399.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/trunk/System-eem.1399.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: System-eem.1399<br>
Author: eem<br>
Time: 24 March 2023, 10:06:23.813457 am<br>
UUID: 301b87c4-dafb-4ff3-9d14-7468fac48fa7<br>
Ancestors: System-mt.1398<br>
<br>
Have the Clipboard defer to ExtendedClipboardInterface current to paste text, and only fall back on the old default behaviour if ExtendedClipboardInterface current>>clipboardText: fails. On Mac and Windows paste both HTML and UTF-8.  At time of writing, achieving the same on Unix/X11 depends on the ClipboardExtendedPlugin platform specifics being implemented, see this vm-dev thread: <a href="http://lists.squeakfoundation.org/pipermail/vm-dev/2023-March/038866.html" rel="noreferrer" target="_blank">http://lists.squeakfoundation.org/pipermail/vm-dev/2023-March/038866.html</a><br>
<br>
=============== Diff against System-mt.1398 ===============<br>
<br>
Item was changed:<br>
  ----- Method: Clipboard>>clipboardText: (in category 'accessing') -----<br>
  clipboardText: text <br>
+       (ExtendedClipboardInterface current clipboardText: text) ifFalse:<br>
+               [self clipboardText: text notifyWith: nil]!<br>
- <br>
-       self clipboardText: text notifyWith: nil!<br>
<br>
Item was changed:<br>
  Object subclass: #ExtendedClipboardInterface<br>
        instanceVariableNames: 'clipboard'<br>
+       classVariableNames: 'Current PluginVersion'<br>
-       classVariableNames: 'Current WinClipboardTypes'<br>
        poolDictionaries: ''<br>
        category: 'System-Clipboard'!<br>
  ExtendedClipboardInterface class<br>
        instanceVariableNames: 'mimeTypeMap clipboardFormatMap'!<br>
+ <br>
+ !ExtendedClipboardInterface commentStamp: 'eem 3/24/2023 09:53' prior: 0!<br>
+ An ExtendedClipboardInterface is an interface to the ClipboardExtendedPlugin which provides broader access to the platform's clipboard than the old Clipboard>>#primitiveClipboardText: & Clipboard>>#primitiveClipboardText (primitive 141). ExtendedClipboardInterface is most fully realised on MacOS and Windows. COntributors are encouraged to provide Unix/Linux implementations.  When fully implemented an ExtendedClipboardInterface can copy and paste UTF8 text, HTML Text, images in various formats, and filenames.<br>
+ <br>
+ Instance Variables<br>
+       clipboard:              <Integer><br>
+ <br>
+ clipboard<br>
+       - this is supposed to be a handle on the platform's clipboard, but in practice the plugin primitives don't access it.<br>
+ <br>
+ N.B. When exploring the platform's clipboard capabilities, readAvailableRawFormats is very useful for seeing what formats are pasted onto the clipboard by various applications.<br>
+ !<br>
  ExtendedClipboardInterface class<br>
        instanceVariableNames: 'mimeTypeMap clipboardFormatMap'!<br>
<br>
Item was added:<br>
+ ----- Method: ExtendedClipboardInterface class>>pluginName (in category 'private') -----<br>
+ pluginName<br>
+       "Answer the version string of the ClipboardExtendedPlugin plugin, or nil if none."<br>
+       1 to: SmallInteger maxVal do:<br>
+               [:i|<br>
+               (Smalltalk listLoadedModule: i)<br>
+                       ifNil: [^nil]<br>
+                       ifNotNil:<br>
+                               [:moduleName|<br>
+                               (moduleName beginsWith: 'ClipboardExtendedPlugin') ifTrue:<br>
+                                       [^moduleName]]].<br>
+       "NOTREACHED"!<br>
<br>
Item was added:<br>
+ ----- Method: ExtendedClipboardInterface class>>pluginVersion (in category 'private') -----<br>
+ pluginVersion<br>
+       ^PluginVersion ifNil:<br>
+               [PluginVersion := self pluginName<br>
+                                                               ifNil: [0]<br>
+                                                               ifNotNil: [:pluginName| Integer readFrom: (pluginName subsequences: $.) last]]!<br>
<br>
Item was changed:<br>
  ----- Method: ExtendedClipboardInterface class>>startUp: (in category 'system startup') -----<br>
  startUp: resuming<br>
        "The image is either being newly started (resuming is true), or it's just been snapshotted"<br>
<br>
+       resuming ifTrue:<br>
+               [Current := nil.<br>
+                PluginVersion := nil]!<br>
-       Current := nil!<br>
<br>
Item was added:<br>
+ ----- Method: ExtendedClipboardInterface>>clipboardText: (in category 'general-api-add') -----<br>
+ clipboardText: aText<br>
+       "Attempt to paste aText to the system clipboard in as many formats as makes sense on the platform.<br>
+        Answer if the attempt succeeded.  By default answer false. Subclasses override if they're able."<br>
+       ^false!<br>
<br>
Item was added:<br>
+ ----- Method: ExtendedClipboardMacInterface>>clipboardText: (in category 'general-api-add') -----<br>
+ clipboardText: aText<br>
+       "Attempt to paste aText to the system clipboard in as many formats as makes sense on the platform.<br>
+        Answer if the attempt succeeded.  On the Mac we paste HTML and UTF8. But we can only paste more<br>
+        than one thing at a time with the VMMaker.oscog-eem.3276 version of the plugin, or later."<br>
+       | htmlPayload |<br>
+       (aText isText<br>
+        and: [self class pluginVersion >= 3276]) ifFalse:<br>
+               [^false].<br>
+       htmlPayload := String streamContents:<br>
+                                               [:stream |<br>
+                                               stream nextPutAll: '<meta charset="UTF-8">'.<br>
+                                               aText printHtmlOn: stream].<br>
+       self<br>
+               addClipboardData: htmlPayload dataFormat: 'public.html';<br>
+               addClipboardData: (UTF8TextConverter new encodeString: aText asString) dataFormat: 'public.utf8-plain-text'.<br>
+       ^true!<br>
<br>
Item was added:<br>
+ ----- Method: ExtendedClipboardWinInterface>>clipboardText: (in category 'private') -----<br>
+ clipboardText: aText<br>
+       "Attempt to paste aText to the system clipboard in as many formats as makes sense on the platform.<br>
+        Answer if the attempt succeeded.  On Windows we paste HTML and UTF8. But we can only paste more<br>
+        than one thing at a time with the VMMaker.oscog-eem.3276 version of the plugin, or later.  Note that<br>
+        the funky HTML format (see packageAsHTML:) has been derived by observing Chrome and Edge."<br>
+       | htmlPayload |<br>
+       (aText isText<br>
+        and: [self class pluginVersion >= 3276]) ifFalse:<br>
+               [^false].<br>
+       htmlPayload := self packageAsHTML: aText printHtmlString.<br>
+       self<br>
+               addClipboardData: htmlPayload dataFormat: CF_HTMLTEXT;<br>
+               addClipboardData: (UTF8TextConverter new encodeString: aText asString) dataFormat: CF_UTF8TEXT.<br>
+       ^true!<br>
<br>
<br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div>