<body><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
                                        Hmm... interesting. Some of the old EToys code hinted that at some point, the Clipboard should be the fallback for the ExtendedClipboard ... not the other way around.<div><br></div><div>I think it makes sense to use the old set/get primitives as fallback.... yet, not having to update Text-GUI related code is also nice... Hmm...</div><div><br></div><div>Best,</div><div>Marcel</div><div class="mb_sig"></div><blockquote class='history_container' type='cite' style='border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;'>
                        <p style='color: #AAAAAA; margin-top: 10px;'>Am 24.03.2023 18:06:50 schrieb commits@source.squeak.org <commits@source.squeak.org>:</p><div style='font-family:Arial,Helvetica,sans-serif'>Eliot Miranda uploaded a new version of System to project The Trunk:<br>http://source.squeak.org/trunk/System-eem.1399.mcz<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: http://lists.squeakfoundation.org/pipermail/vm-dev/2023-March/038866.html<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: ''.<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></integer></div></blockquote>
                                        </div></body>