9

[ANN] ocaml-wayland (pure OCaml wayland protocol library)

 3 years ago
source link: https://discuss.ocaml.org/t/ann-ocaml-wayland-pure-ocaml-wayland-protocol-library/7616
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
[ANN] ocaml-wayland (pure OCaml wayland protocol library)

I’ve just released ocaml-wayland 33, a pure OCaml Wayland implementation. You can get it with:

opam install wayland

Wayland is a communications system intended for use between processes on a single computer. It is mainly used by graphical applications (clients) to talk to display servers, but nothing about it is specific to graphics and it could be used for other things.

A Wayland protocol is defined by writing a schema file. Typed bindings can then be created automatically from that for various languages. Wayland’s main interesting feature is that you can pass file descriptors as message arguments. For example, to send a frame of video you can get a file descriptor to some shared memory, draw the image to it, and then pass the FD to the server for rendering, with no need to copy the data.

The ocaml-wayland library can be used to write applications, display servers, or proxies. The example 16 in the repository opens a window showing some scrolling squares. Clicking reverses the direction and pressing keys changes the colours.

I used the library to write wayland-virtwl-proxy 7, which allows applications running in VMs to open windows directly on the host desktop, as described in my recent blog post “Qubes-lite with KVM and Wayland 20”.

Note that, unlike the older X11 protocol, Wayland doesn’t provide any graphics primitives (such as drawing rectangles or text). Instead, applications render the window contents however they please and then simply share the buffer with the compositor. So if you want to write a normal application using it, you’ll need to find or write a separate GUI toolkit too.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK