33e6eb45b3 | ||
---|---|---|
.. | ||
README.md | ||
wayland.c | ||
wayland.h |
README.md
Wayland display and input driver
Wayland display and input driver, with support for keyboard, mouse and touchscreen. Keyboard support is based on libxkbcommon.
NOTE: current implementation only supports
wl_shell
shell with no decorations.
Install headers and libraries
Ubuntu
sudo apt-get install libwayland-dev libxkbcommon-dev
Fedora
sudo dnf install wayland-devel libxkbcommon-devel
Build configuration under Eclipse
In "Project properties > C/C++ Build > Settings" set the followings:
-
"Cross GCC Compiler > Command line pattern"
- Add
${wayland-cflags}
and${xkbcommon-cflags}
to the end (add a space between the last command and this)
- Add
-
"Cross GCC Linker > Command line pattern"
- Add
${wayland-libs}
and${xkbcommon-libs}
to the end (add a space between the last command and this)
- Add
-
"Cross GCC Linker > Libraries"
- Add
pthread
- Add
-
In "C/C++ Build > Build variables"
-
Configuration: [All Configuration]
-
Add
- Variable name:
wayland-cflags
- Type:
String
- Value:
pkg-config --cflags wayland-client
- Type:
- Variable name:
wayland-libs
- Type:
String
- Value:
pkg-config --libs wayland-client
- Type:
- Variable name:
xkbcommon-cflags
- Type:
String
- Value:
pkg-config --cflags xkbcommon
- Type:
- Variable name:
xkbcommon-libs
- Type:
String
- Value:
pkg-config --libs xkbcommon
- Type:
- Variable name:
-
Init Wayland in LVGL
- In
main.c
#incude "lv_drivers/wayland/wayland.h"
- Enable the Wayland driver in
lv_drv_conf.h
withUSE_WAYLAND 1
LV_COLOR_DEPTH
should be set either to32
or16
inlv_conf.h
; support for8
and1
depends on target platform.- After
lv_init()
callwayland_init()
- Before
lv_deinit()
callwayland_deinit()
- Add a display:
static lv_disp_buf_t disp_buf1;
static lv_color_t buf1[LV_HOR_RES_MAX * LV_VER_RES_MAX];
lv_disp_buf_init(&disp_buf1, buf1, NULL, LV_HOR_RES_MAX * LV_VER_RES_MAX);
/* Create a display */
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.buffer = &disp_buf1;
disp_drv.flush_cb = wayland_flush;
- Add keyboard:
lv_indev_drv_t indev_drv_kb;
lv_indev_drv_init(&indev_drv_kb);
indev_drv_kb.type = LV_INDEV_TYPE_KEYPAD;
indev_drv_kb.read_cb = wayland_keyboard_read;
lv_indev_drv_register(&indev_drv_kb);
- Add touchscreen:
lv_indev_drv_t indev_drv_touch;
lv_indev_drv_init(&indev_drv_touch);
indev_drv_touch.type = LV_INDEV_TYPE_POINTER;
indev_drv_touch.read_cb = wayland_touch_read;
lv_indev_drv_register(&indev_drv_touch);
- Add mouse:
lv_indev_drv_t indev_drv_mouse;
lv_indev_drv_init(&indev_drv_mouse);
indev_drv_mouse.type = LV_INDEV_TYPE_POINTER;
indev_drv_mouse.read_cb = wayland_pointer_read;
lv_indev_drv_register(&indev_drv_mouse);
- Add mouse wheel as encoder:
lv_indev_drv_t indev_drv_mousewheel;
lv_indev_drv_init(&indev_drv_mousewheel);
indev_drv_mousewheel.type = LV_INDEV_TYPE_ENCODER;
indev_drv_mousewheel.read_cb = wayland_pointeraxis_read;
lv_indev_drv_register(&indev_drv_mousewheel);