REBOL3 tracker
  0.9.12 beta
Ticket #0002029 User: anonymous

Project:



rss
TypeWish Statussubmitted Date27-May-2013 09:51
Versionr3 master CategoryPlatform Submitted byjohnk
PlatformAll Severityminor Prioritylow

Summary Extend clipboard:// implementation to all supported platforms
Description Clipboard:// does not work correctly across all platforms
Example code
Linux -> Fail
>> print read clipboard:// 
none

Windows -> Success

Mac -> Fail
>> print read clipboard:// 
none

Assigned ton/a Fixed in- Last Update12-Jun-2013 16:54


Comments
(0003863)
BrianH
6-Jun-2013 05:51

Clipboards in general don't work the same across platforms. In particular, there are platforms like Linux that don't have a single unified clipboard, they have several different clipboards with different APIs supported by different classes of apps. How would you propose to deal with that?
(0003864)
johnk
6-Jun-2013 07:21

Based on my (non-exhaustive) search I agree that this looks surprisingly difficult in Linux without relying on large 3rd party gui toolkits. The Mac on the other hand looks like it might be possible.
(0003865)
BrianH
6-Jun-2013 22:43

Relying on third-party toolkits would be OK if we only support them if they're already installed to support apps that use them. But that's not what I was talking about: Linux standard GUIs have multiple, incompatible clipboards, at the same time. In general, each GUI or non-G UI framework has a different clipboard. Linux itself doesn't have a clipboard at all.

Different approaches:

  • For Rebol builds that are meant to integrate into a particular user-space framework, just support the standard clipboard of that framework. This will work for high-level frameworks like Gnome, KDE, or Android, or application-level integration like LibreOffice.

  • For a general-purpose our-own-gui build that is supposed to run on some low-level graphical framework like X11 or Wayland, do feature-detection to determine which set of clipboards are available, and use whichever one most general-purpose apps tend to use by default.

  • If you need to use a particular clipboard on something like Linux, maybe we could use the path part of the url to pick a particular one, like clipboard://x11, and use something like get-modes clipboard:// 'something to get the list of available clipboards in the environment where the program is running (as determined by feature detection).

  • For platforms where Rebol is being used to create a standalone app, maybe just running on a framebuffer or something, build in your own clipboard if it's appropriate for the app.

  • For command-line use of the standard interpreter clipboard:// can just not work, because Linux doesn't have a clipboard.


Fortunately R3 is primarily made for application building or integration. The standalone interpreter is just one such application, meant to assist in running one-off utility scripts, and maybe to be distributed in operating systems; it doesn't have to support a clipboard if the system doesn't have one.
(0003866)
rgchris
7-Jun-2013 03:30

On Mac: there are pbcopy and pbpaste that provides comprehensive access to the Mac's clipboard. I wrote a wrapper in R2 for them: http://reb4.me/r/clipboard
I know it's a dependency, but as OS X is a stable, consistent platform it might be considered a safe one...
(0003867)
johnk
7-Jun-2013 04:15

If the wrapper approach is acceptable for OS X then xclip could be used in a similar way to pbcopy/pbpaste. This approach is dependant on call/ouput and call/input. Not an ideal solution, but would be acceptable for me
(0003868)
BrianH
7-Jun-2013 05:04

With the wrapper approach, the clipboard:// port will stop working when CALL is blocked for security. So that might work as a workaround, but not as a solution.
(0003871)
IngoHohmann
12-Jun-2013 16:54

As far as I know, on Linux there are basically two clipboards,

a) where you can mark text, and paste it with middle mouse button
b) cut/copy -> paste like in windows

I'd say, rebol only needs to handle option b), which seems to be
consistent with freedesktop.org.

http://standards.freedesktop.org/clipboards-spec/clipboards-latest.txt

Date User Field Action Change
12-Jun-2013 16:54 IngoHohmann Comment : 0003871 Added -
7-Jun-2013 05:04 BrianH Comment : 0003868 Added -
7-Jun-2013 04:15 johnk Comment : 0003867 Added -
7-Jun-2013 03:30 rgchris Comment : 0003866 Added -
6-Jun-2013 22:45 BrianH Comment : 0003865 Modified -
6-Jun-2013 22:43 BrianH Comment : 0003865 Added -
6-Jun-2013 07:21 johnk Comment : 0003864 Added -
6-Jun-2013 05:51 BrianH Comment : 0003863 Added -
27-May-2013 14:53 johnk Code Modified -
27-May-2013 09:51 johnk Ticket Added -