#gui #lv2

sys pugl-sys

A Rust wrapper for pugl

9 unstable releases (3 breaking)

0.4.2 Dec 23, 2020
0.4.1 Nov 24, 2020
0.3.3 Jul 4, 2020
0.3.1 Jun 28, 2020
0.1.0 Jun 25, 2020

#141 in GUI

Download history 19/week @ 2021-04-02 2/week @ 2021-04-09 26/week @ 2021-04-16 9/week @ 2021-04-23 10/week @ 2021-04-30 1/week @ 2021-05-07 10/week @ 2021-05-14 3/week @ 2021-05-21 2/week @ 2021-05-28 5/week @ 2021-06-04 11/week @ 2021-06-11 1/week @ 2021-06-18 2/week @ 2021-06-25 4/week @ 2021-07-02 2/week @ 2021-07-09 12/week @ 2021-07-16

56 downloads per month
Used in pugl-ui

ISC license

2MB
39K SLoC

Python 27K SLoC // 0.3% comments C 7K SLoC // 0.1% comments Rust 1.5K SLoC // 0.0% comments Objective-C 1.5K SLoC // 0.1% comments C++ 1.5K SLoC // 0.1% comments GLSL 49 SLoC // 0.2% comments

pugl-sys – a rust wrapper for pugl

Build Status Current Crates.io Version Documentation Version

pugl is a minimal portable API for embeddable GUIs https://gitlab.com/lv2/pugl/

This crate aims to provide crate bindings for Rust.

Goal

Basis for small light weight self contained GUI toolkits, especially to implement UIs of LV2 plugins. GUIs for LV2 plugins need to be self contained, i.e. they should be statically linked and must not dynamically link any other GUI toolkit. Otherwise symbols of the same GUI toolkit in different versions used by different plugins running in the same host would clash.

Status

Beta testing stage. Not all features of pugl are available yet (see below). Currently only tested on Linux/X11. Rust hackers interested in programming small embeddable GUIs are encouraged to try it out.

API stability

Before reaching the 1.0.0 release, incompatible API changes can happen. There is no large base of applications using pugl-sys as of yet. So experience with the API is limited. The 1.0.0 release will not happen before several developers have used pugl-sys for real life applications and given feedback.

If it turns out that there is a better way to design the API it will be done.

After 1.0.0 incompatible API changes will be rare. They will happen if pugl changes the API in an incompatible way which would not be sensible to hide behind some abstraction layer.

How to use

It's available at crates.io so just add it as dependency in your Cargo.toml

Usage

This crate has only one minimal example in the docs. There is the pugl-ui crate that is a stub of a GUI toolkit implementing widget layout and event propagation. Maybe you want to check this out.

Todo

Not all features of pugl are implemented.

  • World as separately accessible entity

    So far the World is only accessible via the View and only by unsafe FFI functions. The only World function that is safely wrapped is puglUpdate()

    To implement that it takes a mechanism to share references to the same World across multiple views, that makes sure that the World is destroyed after the last View is destroyed but not while at least one View still exists.

  • Support for manually sending events

    This is basically wrapping the function puglSendEvent(). To implement it it takes a conversion from pugl::Event to the PuglEvent FFI type.

  • Support for Clipboard

    Probably easy for plain text. For other MIME data some other dependency would be required.

  • Support for other backends than Cairo

    As of now, a view simply sets the Cairo backend and converts the handle to a cairo::Context when an exposure event happens.

  • Some minor functions are not wrapped

  • Properly implement PuglViewHint

  • Test (and make it work) on platforms other than Linux

Dependencies

~1.2–3.5MB
~72K SLoC