[squeak-dev] Windows Users please read (Was The Trunk: System-eem.1399.mcz)

Eliot Miranda eliot.miranda at gmail.com
Fri Mar 24 17:25:30 UTC 2023


Hi All,

    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
http://lists.squeakfoundation.org/pipermail/vm-dev/2023-March/038866.html
(which youshou;d be able to paste in from this mail message).

If you're on Mac then please know that I'm working as fast as I can to fix
the situation ;-)

On Fri, Mar 24, 2023 at 10:06 AM <commits at source.squeak.org> wrote:

> Eliot Miranda uploaded a new version of System to project The Trunk:
> http://source.squeak.org/trunk/System-eem.1399.mcz
>
> ==================== Summary ====================
>
> Name: System-eem.1399
> Author: eem
> Time: 24 March 2023, 10:06:23.813457 am
> UUID: 301b87c4-dafb-4ff3-9d14-7468fac48fa7
> Ancestors: System-mt.1398
>
> 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
>
> =============== Diff against System-mt.1398 ===============
>
> Item was changed:
>   ----- Method: Clipboard>>clipboardText: (in category 'accessing') -----
>   clipboardText: text
> +       (ExtendedClipboardInterface current clipboardText: text) ifFalse:
> +               [self clipboardText: text notifyWith: nil]!
> -
> -       self clipboardText: text notifyWith: nil!
>
> Item was changed:
>   Object subclass: #ExtendedClipboardInterface
>         instanceVariableNames: 'clipboard'
> +       classVariableNames: 'Current PluginVersion'
> -       classVariableNames: 'Current WinClipboardTypes'
>         poolDictionaries: ''
>         category: 'System-Clipboard'!
>   ExtendedClipboardInterface class
>         instanceVariableNames: 'mimeTypeMap clipboardFormatMap'!
> +
> + !ExtendedClipboardInterface commentStamp: 'eem 3/24/2023 09:53' prior: 0!
> + 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.
> +
> + Instance Variables
> +       clipboard:              <Integer>
> +
> + clipboard
> +       - this is supposed to be a handle on the platform's clipboard, but
> in practice the plugin primitives don't access it.
> +
> + 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.
> + !
>   ExtendedClipboardInterface class
>         instanceVariableNames: 'mimeTypeMap clipboardFormatMap'!
>
> Item was added:
> + ----- Method: ExtendedClipboardInterface class>>pluginName (in category
> 'private') -----
> + pluginName
> +       "Answer the version string of the ClipboardExtendedPlugin plugin,
> or nil if none."
> +       1 to: SmallInteger maxVal do:
> +               [:i|
> +               (Smalltalk listLoadedModule: i)
> +                       ifNil: [^nil]
> +                       ifNotNil:
> +                               [:moduleName|
> +                               (moduleName beginsWith:
> 'ClipboardExtendedPlugin') ifTrue:
> +                                       [^moduleName]]].
> +       "NOTREACHED"!
>
> Item was added:
> + ----- Method: ExtendedClipboardInterface class>>pluginVersion (in
> category 'private') -----
> + pluginVersion
> +       ^PluginVersion ifNil:
> +               [PluginVersion := self pluginName
> +                                                               ifNil: [0]
> +                                                               ifNotNil:
> [:pluginName| Integer readFrom: (pluginName subsequences: $.) last]]!
>
> Item was changed:
>   ----- Method: ExtendedClipboardInterface class>>startUp: (in category
> 'system startup') -----
>   startUp: resuming
>         "The image is either being newly started (resuming is true), or
> it's just been snapshotted"
>
> +       resuming ifTrue:
> +               [Current := nil.
> +                PluginVersion := nil]!
> -       Current := nil!
>
> Item was added:
> + ----- Method: ExtendedClipboardInterface>>clipboardText: (in category
> 'general-api-add') -----
> + clipboardText: aText
> +       "Attempt to paste aText to the system clipboard in as many formats
> as makes sense on the platform.
> +        Answer if the attempt succeeded.  By default answer false.
> Subclasses override if they're able."
> +       ^false!
>
> Item was added:
> + ----- Method: ExtendedClipboardMacInterface>>clipboardText: (in category
> 'general-api-add') -----
> + clipboardText: aText
> +       "Attempt to paste aText to the system clipboard in as many formats
> as makes sense on the platform.
> +        Answer if the attempt succeeded.  On the Mac we paste HTML and
> UTF8. But we can only paste more
> +        than one thing at a time with the VMMaker.oscog-eem.3276 version
> of the plugin, or later."
> +       | htmlPayload |
> +       (aText isText
> +        and: [self class pluginVersion >= 3276]) ifFalse:
> +               [^false].
> +       htmlPayload := String streamContents:
> +                                               [:stream |
> +                                               stream nextPutAll: '<meta
> charset="UTF-8">'.
> +                                               aText printHtmlOn: stream].
> +       self
> +               addClipboardData: htmlPayload dataFormat: 'public.html';
> +               addClipboardData: (UTF8TextConverter new encodeString:
> aText asString) dataFormat: 'public.utf8-plain-text'.
> +       ^true!
>
> Item was added:
> + ----- Method: ExtendedClipboardWinInterface>>clipboardText: (in category
> 'private') -----
> + clipboardText: aText
> +       "Attempt to paste aText to the system clipboard in as many formats
> as makes sense on the platform.
> +        Answer if the attempt succeeded.  On Windows we paste HTML and
> UTF8. But we can only paste more
> +        than one thing at a time with the VMMaker.oscog-eem.3276 version
> of the plugin, or later.  Note that
> +        the funky HTML format (see packageAsHTML:) has been derived by
> observing Chrome and Edge."
> +       | htmlPayload |
> +       (aText isText
> +        and: [self class pluginVersion >= 3276]) ifFalse:
> +               [^false].
> +       htmlPayload := self packageAsHTML: aText printHtmlString.
> +       self
> +               addClipboardData: htmlPayload dataFormat: CF_HTMLTEXT;
> +               addClipboardData: (UTF8TextConverter new encodeString:
> aText asString) dataFormat: CF_UTF8TEXT.
> +       ^true!
>
>
>

-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230324/786c39a6/attachment.html>


More information about the Squeak-dev mailing list