An open API service indexing awesome lists of open source software.

https://github.com/drewt/chicken-wayland-server

CHICKEN Scheme bindings for the libwayland server API
https://github.com/drewt/chicken-wayland-server

chicken-scheme chicken-scheme-eggs wayland

Last synced: 7 months ago
JSON representation

CHICKEN Scheme bindings for the libwayland server API

Awesome Lists containing this project

README

          

wayland-server
==============

CHICKEN Scheme bindings for the libwayland server API.

Building
--------

Dependencies:

* CHICKEN 5
* libwayland

Run chicken-install in this directory to build and install the
bindings.

Usage
-----

(import wayland-server)

### Naming Conventions

Procedures use the usual kebab-case convention. Predicates get a ?
suffix, e.g. wl-list-empty?.

Struct members are available as SRFI-17 getters/setters named
struct-name-member-name.

Enums use the convention enum-prefix/kind, e.g.
wl-seat-capability/pointer.

### Differences from the C API

#### wl\_listener

The make-wl-listener function takes a procedure of one argument
and returns a *wrapped* wl\_listener struct. The argument to this
procedure is the void\* argument that would normally be passed to
a regular wl\_listener.

In C, you would put your wl\_listener inside of another struct
and use the wl\_container\_of macro to access its contents from
the listener's notify function. In Scheme, you should set up a lexical
environment where your data is available, and then create a lambda to pass
to make-wl-listener. Or you could implement the usual callback +
user-data convention with a simple wrapper, like so:

(define (*make-wl-listener proc arg)
(make-wl-listener (lambda (wl-arg) (proc arg wl-arg))))

#### wl\_list

The wl\_list\_for\_each family of macros are available as
procedures:

(wl-list-for-each list proc #!optional (convert values))
(wl-list-for-each/safe list proc #!optional (convert values))
(wl-list-for-each/reverse list proc #!optional (convert values))
(wl-list-for-each/reverse-safe list proc #!optional (convert values))

The convert argument should be a function taking a
wl\_list argument and returning some other data type. It is called
on each node and the result is passed to the procedure proc.

A function wl-list-\>list is provided for converting from
wl\_list to native Scheme lists.