A thin wrapper library for building Wayland client GUI programs.
It is derived from Blusher the Wayland GUI framework. These two projects share much of the codebase, however, this is not a direct fork.
Originally, Blusher has too high-level APIs while Wayland protocol is low-level. This gap finally made development more difficult.
So, I decided to make a less abstracted library that works as a middle-ware.
Swingby uses Skia the 2D graphics library as a rendering engine.
Swingby not provide a window directly. But you can build your own window (that client-side decorated).
The event system makes easier to make the event driven GUI programs.
It is based on OpenGL 4.6 (the latest version) for easier buffer management.
Swingby is a Wayland based library. Therefore your system must suppport Wayland before building the project.
We are using the latest version of OpenGL for rendering. The version 4.6 was released in 2017.
Here is the details of the requirements.
- Wayland and protocols.
wayland-scanner
command also required. - OpenGL and EGL. Wayland using EGL. ¹
- CMake.
- ¹. EGL is similar to GLX in X11, or GLFW however it provides very small features. It is unusual to use EGL in desktop development except Wayland client. It seems this mainly used by Android with GLES programming. We are looking for expert of this library.
There are two scripts in the project's root. One is gen-shaders.py
, it simply
converts shader source code to the C string literals. The generated code will
be committed so you don't need to use this script.
The other one is gen-protocols.sh
. This script generate the Wayland interface
code which are not included in the core of Wayland protocol.
I'm not sure that these must be committed or not. Therefore you must generate
the C code with this script.
Additionally, since it uses Skia, you need to build Skia first.
To build Skia, follow the below commands.
$ git submodule update --init --recursive
$ make build-skia
The core is libskia.a
file.
$ file skia/out/Static/libskia.a
You can now build Swingby using CMake.
$ mkdir build
$ cd build
$ cmake ..
$ make
You can test Swingby with the examples.
$ make example
The examples are in the examples/
directory with begin of two digit numbers.
An application is a global object that manage the event loop, Wayland global objects and an application's lifecycle.
A surface is a rectangular region that something to be drawn. It contains real renderig code. But a surface alone does not just appear on the screen.
A desktop surface (this name is from XDG surface) make the surface visible on the compositor (maybe the desktop environment).
The views are the elements that rendered in a surface. A view has it's parent (except the root-view), and contain the children. A view can listen a pointer (mouse) enter, leave, move, click event and etc.
Perhaps this could be called a widget. In Swingby however not privide real controls. But you can make your own buttons, inputs and others with the views.
To make a Wayland client is a very difficult and challenging work.
Any advice, ideas, or suggestions are all welcome.
Please don't hesitate to open any issues, as they drive development forward.
Swingby is developing under MIT License. For the detail, see the LICENSE file.