2 Commits

Author SHA1 Message Date
575341a22b specify scdoc as a native dependency instead of a runtime dependency 2024-10-05 12:49:16 +00:00
a9f2f4602a use OS sleep instead of polling to reduce CPU usage
without this lvgl never releases the CPU, and just pegs one of the cores
to 100%. see
<https://github.com/lvgl/lvgl/blob/master/docs/porting/timer_handler.rst>
2024-10-05 12:49:16 +00:00
106 changed files with 2535 additions and 3113 deletions

View File

@@ -1,7 +1,8 @@
build-and-test-with-drm: build-and-test-with-drm:
image: alpine:3.19 image: alpine:3.19
tags:
- saas-linux-small-amd64
script: script:
- set -e # Stop on first error
- apk -q add git bash build-base meson linux-headers inih-dev libinput-dev libxkbcommon-dev libdrm-dev scdoc - apk -q add git bash build-base meson linux-headers inih-dev libinput-dev libxkbcommon-dev libdrm-dev scdoc
- git submodule init - git submodule init
- git submodule update - git submodule update
@@ -9,8 +10,9 @@ build-and-test-with-drm:
build-and-test-without-drm: build-and-test-without-drm:
image: alpine:3.19 image: alpine:3.19
tags:
- saas-linux-small-amd64
script: script:
- set -e # Stop on first error
- apk -q add git bash build-base meson linux-headers inih-dev libinput-dev libxkbcommon-dev scdoc - apk -q add git bash build-base meson linux-headers inih-dev libinput-dev libxkbcommon-dev scdoc
- git submodule init - git submodule init
- git submodule update - git submodule update
@@ -18,8 +20,9 @@ build-and-test-without-drm:
build-iskey: build-iskey:
image: alpine:3.19 image: alpine:3.19
tags:
- saas-linux-small-amd64
script: script:
- set -e # Stop on first error
- apk -q add git bash build-base meson linux-headers libevdev-dev - apk -q add git bash build-base meson linux-headers libevdev-dev
- cd iskey - cd iskey
- meson setup _build - meson setup _build

2
.gitmodules vendored
View File

@@ -1,3 +1,3 @@
[submodule "lvgl"] [submodule "lvgl"]
path = lvgl path = lvgl
url = https://github.com/lvgl/lvgl.git url = https://github.com/littlevgl/lvgl.git

View File

@@ -10,25 +10,11 @@ If a change only affects particular applications, they are listed in parentheses
## Unreleased ## Unreleased
- misc: Use standard C library instead of builtin functions (!49, thanks @vstoiakin)
## 3.3.0 (2025-04-15)
- feat: Add a systemd password agent (!33, thanks @vstoiakin)
- feat: Load config from /usr/share aswell (!26 & !28, thanks @fossdd & @pabloyoyoista) - feat: Load config from /usr/share aswell (!26 & !28, thanks @fossdd & @pabloyoyoista)
- feat(buffyboard): Add man pages (!23, thanks @Jarrah) - feat(buffyboard): Add man pages (!23, thanks @Jarrah)
- misc: Unify build system (!23 & !29, thanks @Jarrah & @vladimir.stoyakin) - misc: Unify build system (!23 & !29, thanks @Jarrah & @vladimir.stoyakin)
- misc: Ensure stable file order during builds (!24, thanks @devrtz) - misc: Ensure stable file order during builds (!24, thanks @devrtz)
- fix: Prevent logging internal LVGL errors to stdout - fix: Prevent logging internal LVGL errors to stdout
- misc: Make scdoc a native dependency to enable cross-compilation (!30, thanks @uninsane)
- fix: Use usleep to release CPU when possible (!31, thanks @uninsane)
- feat(buffyboard): Add a buffyboard.service systemd service (!34, @uninsane)
- fix(unl0kr): Select an available DRM device instead of a hard-coded one (!35, thanks @Sorcus)
- feat(unl0kr): Enable software rotation (!32, thanks @xs5871 & @craftyguy)
- misc: do not hardcode endianess of a system (!41, thanks @vstoiakin)
- misc(unl0kr): Optimize the main loop (!38, thanks @vstoiakin)
- feat(unl0kr): Add the option to show a custom message to a user (!39, thanks @vstoiakin)
- misc: Update LVGL to 9.2.2 (!46, thanks @vstoiakin)
## 3.2.0 (2024-06-03) ## 3.2.0 (2024-06-03)

View File

@@ -27,7 +27,7 @@ You can join our development chat at [#buffybox:matrix.org].
Some dependencies are included as git submodules in this repository. You can clone the repository and initialise the submodules with Some dependencies are included as git submodules in this repository. You can clone the repository and initialise the submodules with
``` ```
$ git clone https://gitlab.postmarketos.org/postmarketOS/buffybox.git $ git clone https://gitlab.com/postmarketOS/buffybox.git
$ cd buffybox $ cd buffybox
$ git submodule init $ git submodule init
$ git submodule update $ git submodule update
@@ -45,14 +45,7 @@ $ sudo ./_build/unl0kr/unl0kr # For Unl0kr
$ sudo ./_build/buffyboard/buffyboard # For Buffyboard $ sudo ./_build/buffyboard/buffyboard # For Buffyboard
``` ```
On distributions based on systemd, `unl0kr` can be used as a [password agent](https://systemd.io/PASSWORD_AGENTS/), to give systemd the ability to ask passwords on touchscreen-only devices: With meson <0\.55 use `ninja` instead of `meson compile`\.
```
# systemctl stop systemd-ask-password-console.path
# systemctl stop systemd-ask-password-wall.path
# systemctl start unl0kr-agent.path
# systemd-ask-password --no-tty # Unl0kr is started
```
## Making a release ## Making a release

View File

@@ -10,12 +10,12 @@ echo "Uploading archive to GitLab..."
response=$(curl --request POST \ response=$(curl --request POST \
--header "PRIVATE-TOKEN: $1" \ --header "PRIVATE-TOKEN: $1" \
--form "file=@${archive}" \ --form "file=@${archive}" \
"https://gitlab.postmarketos.org/api/v4/projects/172/uploads") "https://gitlab.com/api/v4/projects/52322952/uploads")
path=$(echo "${response}" | jq -r .full_path) path=$(echo "${response}" | jq -r .full_path)
echo "${response}" echo "${response}"
echo echo
echo "https://gitlab.postmarketos.org${path}" echo "https://gitlab.com${path}"
rm -f "${archive}" rm -f "${archive}"

View File

@@ -13,7 +13,7 @@ Buffyboard uses [LVGL] for input processing and rendering. Key events are forwar
# Status # Status
We are en route to v1 which aims at providing a useable, visually pleasant application including [fbkeyboard]'s most essential features. You may browse the full list of [open issues] to get an idea of what's planned. We are en route to v1 which aims at providing a useable, visually pleasant application including [fbkeyboard]'s most essential features. For details about the current status, see the [v1 milestone]. You may also browse the full list of [open issues] to get an idea of what's planned beyond v1.
Here are a few highlights of what already works: Here are a few highlights of what already works:
@@ -121,9 +121,10 @@ Buffyboard was inspired by [fbkeyboard].
[lv_port_linux_frame_buffer]: https://github.com/lvgl/lv_port_linux_frame_buffer [lv_port_linux_frame_buffer]: https://github.com/lvgl/lv_port_linux_frame_buffer
[lv_sim_emscripten]: https://github.com/lvgl/lv_sim_emscripten/blob/master/mouse_cursor_icon.c [lv_sim_emscripten]: https://github.com/lvgl/lv_sim_emscripten/blob/master/mouse_cursor_icon.c
[lvgl]: https://github.com/lvgl/lvgl [lvgl]: https://github.com/lvgl/lvgl
[open issues]: https://gitlab.postmarketos.org/postmarketOS/buffybox/-/issues [open issues]: https://gitlab.com/cherrypicker/buffyboard/-/issues
[screenshots]: ./screenshots [screenshots]: ./screenshots
[squeek2lvgl]: ../squeek2lvgl [squeek2lvgl]: https://gitlab.com/cherrypicker/squeek2lvgl]
[squeekboard layouts]: https://gitlab.gnome.org/World/Phosh/squeekboard/-/blob/master/data/keyboards [squeekboard layouts]: https://gitlab.gnome.org/World/Phosh/squeekboard/-/blob/master/data/keyboards
[squeekboard's US terminal layout]: https://gitlab.gnome.org/World/Phosh/squeekboard/-/blob/master/data/keyboards/terminal/us.yaml [squeekboard's US terminal layout]: https://gitlab.gnome.org/World/Phosh/squeekboard/-/blob/master/data/keyboards/terminal/us.yaml
[squeekboard]: https://gitlab.gnome.org/World/Phosh/squeekboard/-/tree/master [squeekboard]: https://gitlab.gnome.org/World/Phosh/squeekboard/-/tree/master
[v1 milestone]: https://gitlab.com/cherrypicker/buffyboard/-/milestones/1

View File

@@ -1,38 +0,0 @@
[Unit]
Documentation=https://gitlab.postmarketos.org/postmarketOS/buffybox
[Service]
ExecStart=@bindir@/buffyboard
Restart=on-failure
# Allow access to input devices, framebuffer, tty
DevicePolicy=closed
DeviceAllow=/dev/uinput rw
DeviceAllow=char-fb rw
DeviceAllow=char-input rw
DeviceAllow=char-tty rw
# udev requires some limited networking
RestrictAddressFamilies=AF_NETLINK
# Hardening
CapabilityBoundingSet=
NoNewPrivileges=true
RestrictSUIDSGID=true
PrivateMounts=true
PrivateTmp=true
PrivateUsers=true
ProtectClock=true
ProtectControlGroups=true
ProtectHome=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectSystem=strict
RemoveIPC=true
LockPersonality=true
MemoryDenyWriteExecute=true
SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallFilter=~@privileged
SystemCallFilter=~@resources

View File

@@ -1,110 +0,0 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Manual post-processing steps for the generated lv_conf.h
# 1. Remove LV_BIG_ENDIAN_SYSTEM (handled by meson.build)
# 2. Add `#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(bbx_font_32)` (a bug in generate_lv_conf.py)
LV_COLOR_DEPTH 32
LV_USE_STDLIB_MALLOC LV_STDLIB_CLIB
LV_USE_STDLIB_STRING LV_STDLIB_CLIB
LV_USE_STDLIB_SPRINTF LV_STDLIB_CLIB
LV_USE_DRAW_SW 1
LV_DRAW_SW_COMPLEX 1
LV_DRAW_SW_SUPPORT_RGB565 0
LV_DRAW_SW_SUPPORT_RGB565A8 0
LV_DRAW_SW_SUPPORT_RGB888 1
LV_DRAW_SW_SUPPORT_XRGB8888 1
LV_DRAW_SW_SUPPORT_ARGB8888 1
LV_DRAW_SW_SUPPORT_L8 0
LV_DRAW_SW_SUPPORT_AL88 0
LV_DRAW_SW_SUPPORT_A8 0
LV_DRAW_SW_SUPPORT_I1 0
LV_USE_LOG 1
LV_LOG_LEVEL LV_LOG_LEVEL_WARN
LV_USE_PRIVATE_API 1
LV_FONT_MONTSERRAT_8 0
LV_FONT_MONTSERRAT_10 0
LV_FONT_MONTSERRAT_12 0
LV_FONT_MONTSERRAT_14 0
LV_FONT_MONTSERRAT_16 0
LV_FONT_MONTSERRAT_18 0
LV_FONT_MONTSERRAT_20 0
LV_FONT_MONTSERRAT_22 0
LV_FONT_MONTSERRAT_24 0
LV_FONT_MONTSERRAT_26 0
LV_FONT_MONTSERRAT_28 0
LV_FONT_MONTSERRAT_30 0
LV_FONT_MONTSERRAT_32 0
LV_FONT_MONTSERRAT_34 0
LV_FONT_MONTSERRAT_36 0
LV_FONT_MONTSERRAT_38 0
LV_FONT_MONTSERRAT_40 0
LV_FONT_MONTSERRAT_42 0
LV_FONT_MONTSERRAT_44 0
LV_FONT_MONTSERRAT_46 0
LV_FONT_MONTSERRAT_48 0
LV_FONT_MONTSERRAT_28_COMPRESSED 0
LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0
LV_FONT_SIMSUN_14_CJK 0
LV_FONT_SIMSUN_16_CJK 0
LV_FONT_UNSCII_8 0
LV_FONT_UNSCII_16 0
#LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(bbx_font_32)
LV_FONT_DEFAULT &bbx_font_32
LV_WIDGETS_HAS_DEFAULT_VALUE 0
LV_USE_ANIMIMG 0
LV_USE_ARC 0
LV_USE_BAR 0
LV_USE_BUTTON 0
LV_USE_BUTTONMATRIX 1
LV_USE_CALENDAR 0
LV_USE_CANVAS 0
LV_USE_CHART 0
LV_USE_CHECKBOX 0
LV_USE_DROPDOWN 0
LV_USE_IMAGE 1
LV_USE_IMAGEBUTTON 0
LV_USE_KEYBOARD 1
LV_USE_LABEL 1
LV_LABEL_TEXT_SELECTION 0
LV_LABEL_LONG_TXT_HINT 0
LV_USE_LED 0
LV_USE_LINE 0
LV_USE_LIST 0
LV_USE_LOTTIE 0
LV_USE_MENU 0
LV_USE_MSGBOX 0
LV_USE_ROLLER 0
LV_USE_SCALE 0
LV_USE_SLIDER 0
LV_USE_SPAN 0
LV_USE_SPINBOX 0
LV_USE_SPINNER 0
LV_USE_SWITCH 0
LV_USE_TEXTAREA 1
LV_USE_TABLE 0
LV_USE_TABVIEW 0
LV_USE_TILEVIEW 0
LV_USE_WIN 0
LV_USE_THEME_DEFAULT 0
LV_USE_THEME_SIMPLE 0
LV_USE_THEME_MONO 0
LV_USE_FLEX 0
LV_USE_GRID 0
LV_USE_LINUX_FBDEV 1
LV_LINUX_FBDEV_BSD 0
LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL
LV_USE_LIBINPUT 1
LV_LIBINPUT_BSD 0
LV_LIBINPUT_XKB 0
LV_BUILD_EXAMPLES 0

File diff suppressed because it is too large Load Diff

View File

@@ -51,7 +51,7 @@ static lv_obj_t *keyboard = NULL;
* @param height display height * @param height display height
* @return denominator * @return denominator
*/ */
static int keyboard_height_denominator(int32_t width, int32_t height); static int keyboard_height_denominator(lv_coord_t width, lv_coord_t height);
/** /**
* Handle termination signals sent to the process. * Handle termination signals sent to the process.
@@ -93,12 +93,11 @@ static void pop_checked_modifier_keys(void);
* Static functions * Static functions
*/ */
static int keyboard_height_denominator(int32_t width, int32_t height) { static int keyboard_height_denominator(lv_coord_t width, lv_coord_t height) {
return (height > width) ? 3 : 2; return (height > width) ? 3 : 2;
} }
static void sigaction_handler(int signum) { static void sigaction_handler(int signum) {
LV_UNUSED(signum);
if (resize_terminals) { if (resize_terminals) {
bb_terminal_reset_all(); bb_terminal_reset_all();
} }
@@ -106,7 +105,6 @@ static void sigaction_handler(int signum) {
} }
static void terminal_resize_timer_cb(lv_timer_t *timer) { static void terminal_resize_timer_cb(lv_timer_t *timer) {
LV_UNUSED(timer);
if (resize_terminals) { if (resize_terminals) {
bb_terminal_shrink_current(); bb_terminal_shrink_current();
} }
@@ -229,7 +227,7 @@ int main(int argc, char *argv[]) {
/* Override display properties with command line options if necessary */ /* Override display properties with command line options if necessary */
lv_display_set_offset(disp, cli_opts.x_offset, cli_opts.y_offset); lv_display_set_offset(disp, cli_opts.x_offset, cli_opts.y_offset);
if (cli_opts.hor_res > 0 || cli_opts.ver_res > 0) { if (cli_opts.hor_res > 0 || cli_opts.ver_res > 0) {
lv_display_set_physical_resolution(disp, lv_display_get_horizontal_resolution(disp), lv_display_get_vertical_resolution(disp)); lv_display_set_physical_resolution(disp, lv_disp_get_hor_res(disp), lv_disp_get_ver_res(disp));
lv_display_set_resolution(disp, cli_opts.hor_res, cli_opts.ver_res); lv_display_set_resolution(disp, cli_opts.hor_res, cli_opts.ver_res);
} }
if (cli_opts.dpi > 0) { if (cli_opts.dpi > 0) {
@@ -244,14 +242,14 @@ int main(int argc, char *argv[]) {
switch (cli_opts.rotation) { switch (cli_opts.rotation) {
case LV_DISPLAY_ROTATION_0: case LV_DISPLAY_ROTATION_0:
case LV_DISPLAY_ROTATION_180: { case LV_DISPLAY_ROTATION_180: {
int32_t denom = keyboard_height_denominator(hor_res_phys, ver_res_phys); lv_coord_t denom = keyboard_height_denominator(hor_res_phys, ver_res_phys);
lv_display_set_resolution(disp, hor_res_phys, ver_res_phys / denom); lv_display_set_resolution(disp, hor_res_phys, ver_res_phys / denom);
lv_display_set_offset(disp, 0, (cli_opts.rotation == LV_DISPLAY_ROTATION_0) ? (denom - 1) * ver_res_phys / denom : 0); lv_display_set_offset(disp, 0, (cli_opts.rotation == LV_DISPLAY_ROTATION_0) ? (denom - 1) * ver_res_phys / denom : 0);
break; break;
} }
case LV_DISPLAY_ROTATION_90: case LV_DISPLAY_ROTATION_90:
case LV_DISPLAY_ROTATION_270: { case LV_DISPLAY_ROTATION_270: {
int32_t denom = keyboard_height_denominator(ver_res_phys, hor_res_phys); lv_coord_t denom = keyboard_height_denominator(ver_res_phys, hor_res_phys);
lv_display_set_resolution(disp, hor_res_phys / denom, ver_res_phys); lv_display_set_resolution(disp, hor_res_phys / denom, ver_res_phys);
lv_display_set_offset(disp, 0, (cli_opts.rotation == LV_DISPLAY_ROTATION_90) ? (denom - 1) * hor_res_phys / denom : 0); lv_display_set_offset(disp, 0, (cli_opts.rotation == LV_DISPLAY_ROTATION_90) ? (denom - 1) * hor_res_phys / denom : 0);
break; break;
@@ -263,10 +261,9 @@ int main(int argc, char *argv[]) {
/* Initialise theme */ /* Initialise theme */
bbx_theme_apply(bbx_themes_themes[conf_opts.theme.default_id]); bbx_theme_apply(bbx_themes_themes[conf_opts.theme.default_id]);
lv_theme_apply(lv_screen_active());
/* Add keyboard */ /* Add keyboard */
keyboard = lv_keyboard_create(lv_screen_active()); keyboard = lv_keyboard_create(lv_scr_act());
uint32_t num_keyboard_events = lv_obj_get_event_count(keyboard); uint32_t num_keyboard_events = lv_obj_get_event_count(keyboard);
for(uint32_t i = 0; i < num_keyboard_events; ++i) { for(uint32_t i = 0; i < num_keyboard_events; ++i) {
if(lv_event_dsc_get_cb(lv_obj_get_event_dsc(keyboard, i)) == lv_keyboard_def_event_cb) { if(lv_event_dsc_get_cb(lv_obj_get_event_dsc(keyboard, i)) == lv_keyboard_def_event_cb) {
@@ -293,3 +290,30 @@ int main(int argc, char *argv[]) {
return 0; return 0;
} }
/**
* Tick generation
*/
/**
* Generate tick for LVGL.
*
* @return tick in ms
*/
uint32_t bb_get_tick(void) {
static uint64_t start_ms = 0;
if (start_ms == 0) {
struct timeval tv_start;
gettimeofday(&tv_start, NULL);
start_ms = (tv_start.tv_sec * 1000000 + tv_start.tv_usec) / 1000;
}
struct timeval tv_now;
gettimeofday(&tv_now, NULL);
uint64_t now_ms;
now_ms = (tv_now.tv_sec * 1000000 + tv_now.tv_usec) / 1000;
uint32_t time_ms = now_ms - start_ms;
return time_ms;
}

View File

@@ -24,20 +24,3 @@ executable('buffyboard',
install_data('buffyboard.conf', install_dir: get_option('sysconfdir')) install_data('buffyboard.conf', install_dir: get_option('sysconfdir'))
systemd = dependency('systemd', required: get_option('systemd-buffyboard-service'))
if systemd.found()
system_unit_dir = systemd.get_variable(
pkgconfig: 'systemd_system_unit_dir',
pkgconfig_define: ['prefix', get_option('prefix')],
)
configure_file(
input : 'buffyboard.service.in',
output : 'buffyboard.service',
install : true,
install_dir : system_unit_dir,
configuration : {
'bindir' : get_option('prefix') / get_option('bindir'),
},
)
endif

2
lvgl

Submodule lvgl updated: 7f07a129e8...ceadda8a46

View File

@@ -21,8 +21,6 @@ password is printed to STDOUT. All other output happens on STDERR.
## Optional ## Optional
*-m, --message*
A message that will be displayed to a user.
*-C, --config-override* *-C, --config-override*
Path to a config override file. Can be supplied multiple times. Config Path to a config override file. Can be supplied multiple times. Config
files are merged in the following order: files are merged in the following order:
@@ -36,18 +34,8 @@ password is printed to STDOUT. All other output happens on STDERR.
horizontally by X pixels and vertically by Y pixels. horizontally by X pixels and vertically by Y pixels.
*-d --dpi=N* *-d --dpi=N*
Override the display's DPI value. Override the display's DPI value.
*-r, --rotate=[0-3]*
Rotate the UI to the given orientation. The
values match the ones provided by the kernel in
/sys/class/graphics/fbcon/rotate.
* 0 - normal orientation (0 degree)
* 1 - clockwise orientation (90 degrees)
* 2 - upside down orientation (180 degrees)
* 3 - counterclockwise orientation (270 degrees)
*-h, --help* *-h, --help*
Print this message and exit. Print this message and exit.
*-n*
Do not append a newline character to a password.
*-v, --verbose* *-v, --verbose*
Enable more detailed logging output on STDERR. Enable more detailed logging output on STDERR.
*-V, --version* *-V, --version*

View File

@@ -1,19 +1,14 @@
project('buffybox', 'c', project('buffybox', 'c',
version: '3.3.0', version: '3.2.0',
default_options: ['warning_level=3', 'b_ndebug=if-release'], default_options: 'warning_level=3',
meson_version: '>= 0.59.0' meson_version: '>= 0.59.0'
) )
add_project_arguments( add_project_arguments('-DPROJECT_VERSION="@0@"'.format(meson.project_version()), language: 'c')
'-DPROJECT_VERSION="@0@"'.format(meson.project_version()),
'-DLV_BIG_ENDIAN_SYSTEM=' + (host_machine.endian() == 'big'? '1' : '0'),
language: 'c'
)
depinih = dependency('inih') depinih = dependency('inih')
deplibinput = dependency('libinput') deplibinput = dependency('libinput')
deplibudev = dependency('libudev') deplibudev = dependency('libudev')
depxkbcommon = dependency('xkbcommon') # For unl0kr only
if get_option('man') if get_option('man')
depscdoc = dependency('scdoc', native: true) depscdoc = dependency('scdoc', native: true)

View File

@@ -1,4 +1,2 @@
option('with-drm', type: 'feature', value: 'auto', description: 'Enable DRM backend') option('with-drm', type: 'feature', value: 'auto', description: 'Enable DRM backend')
option('man', type: 'boolean', value: true, description: 'Install manual pages') option('man', type: 'boolean', value: true, description: 'Install manual pages')
option('systemd-buffyboard-service', type: 'feature', value: 'auto', description: 'Install systemd service file for buffyboard')
option('systemd-password-agent', type: 'feature', value: 'auto', description: 'Build a systemd password agent for touchscreens')

View File

@@ -15,14 +15,19 @@ if ! grep "## $1" CHANGELOG.md > /dev/null; then
exit 1 exit 1
fi fi
if ! grep -E "^\s*version:\s*'$1'" meson.build > /dev/null; then if ! grep -E "^\s*version:\s*'$1'" buffyboard/meson.build > /dev/null; then
echo "Error: Version $1 differs from version in buffyboard/meson.build" echo "Error: Version $1 differs from version in buffyboard/meson.build"
exit 1 exit 1
fi fi
if ! grep -E "^\s*version:\s*'$1'" unl0kr/meson.build > /dev/null; then
echo "Error: Version $1 differs from version in unl0kr/meson.build"
exit 1
fi
git tag "$1" git tag "$1"
git push --tags git push --tags
./archive.sh "$2" ./archive.sh "$2"
echo "Now create a release for https://gitlab.postmarketos.org/postmarketOS/buffybox-/tags/$1 and attach the uploaded archive" echo "Now create a release for https://gitlab.com/postmarketOS/buffybox/-/tags/$1 and attach the uploaded archive"

View File

@@ -1,10 +1,15 @@
#ifdef __has_include
#if __has_include("lvgl.h")
#ifndef LV_LVGL_H_INCLUDE_SIMPLE
#define LV_LVGL_H_INCLUDE_SIMPLE
#endif
#endif
#endif
#if defined(LV_LVGL_H_INCLUDE_SIMPLE) #if defined(LV_LVGL_H_INCLUDE_SIMPLE)
#include "lvgl.h" #include "lvgl.h"
#elif defined(LV_BUILD_TEST)
#include "../lvgl.h"
#else #else
#include "lvgl/lvgl.h" #include "lvgl/lvgl.h"
#endif #endif
@@ -12,43 +17,99 @@
#define LV_ATTRIBUTE_MEM_ALIGN #define LV_ATTRIBUTE_MEM_ALIGN
#endif #endif
#ifndef LV_ATTRIBUTE_CURSOR #ifndef LV_ATTRIBUTE_IMG_BBX_CURSOR_IMG_DSC
#define LV_ATTRIBUTE_CURSOR #define LV_ATTRIBUTE_IMG_BBX_CURSOR_IMG_DSC
#endif #endif
static const const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_BBX_CURSOR_IMG_DSC uint8_t bbx_cursor_img_dsc_map[] = {
LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_CURSOR #if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
uint8_t cursor_map[] = { /*Pixel format: Alpha 8 bit, Red: 3 bit, Green: 3 bit, Blue: 2 bit*/
0xff, 0xf7, 0xff, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xfe,0xfe,0xfe,0xf7,0xd6,0xd6,0xd6,0x51,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xff, 0xff, 0xff, 0xf7, 0xdb, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff,0xff,0xff,0xff,0xf3,0xf3,0xf3,0xf7,0xca,0xca,0xca,0x56,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xff, 0xff, 0x49, 0xff, 0xff, 0xf8, 0xdb, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff,0xff,0xff,0xff,0x4e,0x4e,0x4e,0xff,0xf1,0xf1,0xf1,0xf8,0xc7,0xc7,0xc7,0x57,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xff, 0xff, 0x24, 0xff, 0x6d, 0xff, 0xff, 0xf8, 0xdb, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff,0xff,0xff,0xff,0x1e,0x1e,0x1e,0xff,0x51,0x51,0x51,0xff,0xf2,0xf2,0xf2,0xf8,0xc5,0xc5,0xc5,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xff, 0xff, 0x25, 0xff, 0x25, 0xff, 0x6d, 0xff, 0xff, 0xf8, 0xdb, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff,0xff,0xff,0xff,0x21,0x21,0x21,0xff,0x21,0x21,0x21,0xff,0x53,0x53,0x53,0xff,0xf2,0xf2,0xf2,0xf8,0xc5,0xc5,0xc5,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xff, 0xff, 0x25, 0xff, 0x25, 0xff, 0x25, 0xff, 0x6d, 0xff, 0xff, 0xf8, 0xdb, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff,0xff,0xff,0xff,0x25,0x25,0x25,0xff,0x25,0x25,0x25,0xff,0x25,0x25,0x25,0xff,0x57,0x57,0x57,0xff,0xf2,0xf2,0xf2,0xf8,0xc5,0xc5,0xc5,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xff, 0xff, 0x25, 0xff, 0x25, 0xff, 0x25, 0xff, 0x25, 0xff, 0x6d, 0xff, 0xff, 0xf8, 0xdb, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff,0xff,0xff,0xff,0x28,0x28,0x28,0xff,0x28,0x28,0x28,0xff,0x28,0x28,0x28,0xff,0x28,0x28,0x28,0xff,0x59,0x59,0x59,0xff,0xf2,0xf2,0xf2,0xf8,0xc5,0xc5,0xc5,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xff, 0xff, 0x25, 0xff, 0x25, 0xff, 0x25, 0xff, 0x25, 0xff, 0x25, 0xff, 0x6d, 0xff, 0xff, 0xf8, 0xdb, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff,0xff,0xff,0xff,0x2c,0x2c,0x2c,0xff,0x2c,0x2c,0x2c,0xff,0x2c,0x2c,0x2c,0xff,0x2c,0x2c,0x2c,0xff,0x2c,0x2c,0x2c,0xff,0x5c,0x5c,0x5c,0xff,0xf2,0xf2,0xf2,0xf8,0xc5,0xc5,0xc5,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xff, 0xff, 0x25, 0xff, 0x25, 0xff, 0x25, 0xff, 0x25, 0xff, 0x25, 0xff, 0x25, 0xff, 0x6d, 0xff, 0xff, 0xf8, 0xdb, 0x57, 0x00, 0x00, 0x00, 0x00,
0xff,0xff,0xff,0xff,0x2f,0x2f,0x2f,0xff,0x2f,0x2f,0x2f,0xff,0x2f,0x2f,0x2f,0xff,0x2f,0x2f,0x2f,0xff,0x2f,0x2f,0x2f,0xff,0x2f,0x2f,0x2f,0xff,0x5e,0x5e,0x5e,0xff,0xf2,0xf2,0xf2,0xf8,0xc7,0xc7,0xc7,0x57,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xff, 0xff, 0x49, 0xff, 0x49, 0xff, 0x49, 0xff, 0x49, 0xff, 0x49, 0xff, 0x49, 0xff, 0x49, 0xff, 0x6e, 0xff, 0xff, 0xf8, 0xdb, 0x57, 0x00, 0x00,
0xff,0xff,0xff,0xff,0x33,0x33,0x33,0xff,0x33,0x33,0x33,0xff,0x33,0x33,0x33,0xff,0x33,0x33,0x33,0xff,0x33,0x33,0x33,0xff,0x33,0x33,0x33,0xff,0x33,0x33,0x33,0xff,0x61,0x61,0x61,0xff,0xf3,0xf3,0xf3,0xf8,0xc7,0xc7,0xc7,0x57,0x00,0x00,0x00,0x00, 0xff, 0xff, 0x49, 0xff, 0x49, 0xff, 0x49, 0xff, 0x49, 0xff, 0x49, 0xff, 0x49, 0xff, 0x49, 0xff, 0x49, 0xff, 0x6e, 0xff, 0xff, 0xf8, 0xff, 0x53,
0xff,0xff,0xff,0xff,0x36,0x36,0x36,0xff,0x36,0x36,0x36,0xff,0x36,0x36,0x36,0xff,0x36,0x36,0x36,0xff,0x36,0x36,0x36,0xff,0x36,0x36,0x36,0xff,0x36,0x36,0x36,0xff,0x36,0x36,0x36,0xff,0x64,0x64,0x64,0xff,0xf3,0xf3,0xf3,0xf8,0xd1,0xd1,0xd1,0x53, 0xff, 0xff, 0x49, 0xff, 0x49, 0xff, 0x49, 0xff, 0x49, 0xff, 0x49, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7,
0xff,0xff,0xff,0xff,0x3a,0x3a,0x3a,0xff,0x3a,0x3a,0x3a,0xff,0x3c,0x3c,0x3c,0xff,0x3f,0x3f,0x3f,0xff,0x3b,0x3b,0x3b,0xff,0xe1,0xe1,0xe1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfe,0xfe,0xf7, 0xff, 0xff, 0x49, 0xff, 0x49, 0xff, 0xdb, 0xff, 0x92, 0xff, 0x49, 0xff, 0xb6, 0xff, 0xdb, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff,0xff,0xff,0xff,0x3d,0x3d,0x3d,0xff,0x3f,0x3f,0x3f,0xff,0xb7,0xb7,0xb7,0xff,0x8b,0x8b,0x8b,0xff,0x3d,0x3d,0x3d,0xff,0x92,0x92,0x92,0xff,0xcd,0xcd,0xcd,0xcc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xff, 0xff, 0x49, 0xff, 0xdb, 0xff, 0xff, 0xef, 0xff, 0xff, 0x49, 0xff, 0x49, 0xff, 0xff, 0xfa, 0x6d, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff,0xff,0xff,0xff,0x42,0x42,0x42,0xff,0xb8,0xb8,0xb8,0xff,0xe5,0xe5,0xe5,0xef,0xdc,0xdc,0xdc,0xff,0x41,0x41,0x41,0xff,0x4d,0x4d,0x4d,0xff,0xf5,0xf5,0xf5,0xfa,0x5f,0x5f,0x5f,0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xe1, 0x00, 0x00, 0xff, 0xeb, 0x6e, 0xff, 0x49, 0xff, 0xdb, 0xff, 0xff, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff,0xff,0xff,0xff,0xba,0xba,0xba,0xff,0xdb,0xdb,0xdb,0xe1,0x00,0x00,0x00,0x00,0xea,0xea,0xea,0xeb,0x6f,0x6f,0x6f,0xff,0x44,0x44,0x44,0xff,0xb6,0xb6,0xb6,0xff,0xdb,0xdb,0xdb,0x8d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xff, 0xff, 0xff, 0xda, 0x00, 0x00, 0x00, 0x00, 0xdb, 0x9d, 0xdb, 0xff, 0x49, 0xff, 0x6e, 0xff, 0xff, 0xe6, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
0xff,0xff,0xff,0xff,0xdb,0xdb,0xdb,0xda,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb8,0xb8,0xb8,0x9d,0xbd,0xbd,0xbd,0xff,0x48,0x48,0x48,0xff,0x6a,0x6a,0x6a,0xff,0xf7,0xf7,0xf7,0xe6,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xff, 0xca, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfa, 0x6d, 0xff, 0x49, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xec,0xec,0xec,0xca,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf5,0xf5,0xf5,0xfa,0x5b,0x5b,0x5b,0xff,0x4b,0x4b,0x4b,0xff,0xf1,0xf1,0xf1,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0xb2, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc4,0xc4,0xc4,0xb2,0xd9,0xd9,0xd9,0xff,0xcb,0xcb,0xcb,0xff,0xea,0xea,0xea,0xdc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, #endif
#if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP == 0
/*Pixel format: Alpha 8 bit, Red: 5 bit, Green: 6 bit, Blue: 5 bit*/
0xff, 0xff, 0xf7, 0xdb, 0xde, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xbe, 0xf7, 0xf7, 0x59, 0xce, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x8a, 0x52, 0xff, 0x9e, 0xf7, 0xf8, 0x59, 0xce, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x04, 0x21, 0xff, 0x8a, 0x52, 0xff, 0x9e, 0xf7, 0xf8, 0x39, 0xce, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x04, 0x21, 0xff, 0x04, 0x21, 0xff, 0xaa, 0x52, 0xff, 0x9e, 0xf7, 0xf8, 0x39, 0xce, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x25, 0x29, 0xff, 0x25, 0x29, 0xff, 0x25, 0x29, 0xff, 0xcb, 0x5a, 0xff, 0x9e, 0xf7, 0xf8, 0x39, 0xce, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x45, 0x29, 0xff, 0x45, 0x29, 0xff, 0x45, 0x29, 0xff, 0x45, 0x29, 0xff, 0xcb, 0x5a, 0xff, 0x9e, 0xf7, 0xf8, 0x39, 0xce, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x66, 0x31, 0xff, 0x66, 0x31, 0xff, 0x66, 0x31, 0xff, 0x66, 0x31, 0xff, 0x66, 0x31, 0xff, 0xec, 0x62, 0xff, 0x9e, 0xf7, 0xf8, 0x39, 0xce, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x86, 0x31, 0xff, 0x86, 0x31, 0xff, 0x86, 0x31, 0xff, 0x86, 0x31, 0xff, 0x86, 0x31, 0xff, 0x86, 0x31, 0xff, 0x0c, 0x63, 0xff, 0x9e, 0xf7, 0xf8, 0x59, 0xce, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xa6, 0x31, 0xff, 0xa6, 0x31, 0xff, 0xa6, 0x31, 0xff, 0xa6, 0x31, 0xff, 0xa6, 0x31, 0xff, 0xa6, 0x31, 0xff, 0xa6, 0x31, 0xff, 0x0c, 0x63, 0xff, 0xbe, 0xf7, 0xf8, 0x59, 0xce, 0x57, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xc7, 0x39, 0xff, 0xc7, 0x39, 0xff, 0xc7, 0x39, 0xff, 0xc7, 0x39, 0xff, 0xc7, 0x39, 0xff, 0xc7, 0x39, 0xff, 0xc7, 0x39, 0xff, 0xc7, 0x39, 0xff, 0x2d, 0x6b, 0xff, 0xbe, 0xf7, 0xf8, 0x9a, 0xd6, 0x53,
0xff, 0xff, 0xff, 0xe7, 0x39, 0xff, 0xe7, 0x39, 0xff, 0xe8, 0x41, 0xff, 0x08, 0x42, 0xff, 0xe7, 0x39, 0xff, 0x1c, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7,
0xff, 0xff, 0xff, 0xe8, 0x41, 0xff, 0x08, 0x42, 0xff, 0xd7, 0xbd, 0xff, 0x71, 0x8c, 0xff, 0xe8, 0x41, 0xff, 0xb2, 0x94, 0xff, 0x7a, 0xd6, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x28, 0x42, 0xff, 0xd7, 0xbd, 0xff, 0x3d, 0xef, 0xef, 0xfc, 0xe6, 0xff, 0x08, 0x42, 0xff, 0x6a, 0x52, 0xff, 0xbf, 0xff, 0xfa, 0x0c, 0x63, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xf7, 0xbd, 0xff, 0xfb, 0xde, 0xe1, 0x00, 0x00, 0x00, 0x7d, 0xef, 0xeb, 0x8e, 0x73, 0xff, 0x29, 0x4a, 0xff, 0xd7, 0xbd, 0xff, 0xfb, 0xde, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xfb, 0xde, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7, 0xbd, 0x9d, 0xf8, 0xc5, 0xff, 0x49, 0x4a, 0xff, 0x6d, 0x6b, 0xff, 0xdf, 0xff, 0xe6, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7e, 0xf7, 0xca, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0xff, 0xfa, 0xeb, 0x5a, 0xff, 0x69, 0x4a, 0xff, 0x9e, 0xf7, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, 0xce, 0xb2, 0xdb, 0xde, 0xff, 0x79, 0xce, 0xff, 0x7d, 0xef, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
#endif
#if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP != 0
/*Pixel format: Alpha 8 bit, Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 color bytes are swapped*/
0xff, 0xff, 0xf7, 0xde, 0xdb, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xf7, 0xbe, 0xf7, 0xce, 0x59, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x52, 0x8a, 0xff, 0xf7, 0x9e, 0xf8, 0xce, 0x59, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x21, 0x04, 0xff, 0x52, 0x8a, 0xff, 0xf7, 0x9e, 0xf8, 0xce, 0x39, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x21, 0x04, 0xff, 0x21, 0x04, 0xff, 0x52, 0xaa, 0xff, 0xf7, 0x9e, 0xf8, 0xce, 0x39, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x29, 0x25, 0xff, 0x29, 0x25, 0xff, 0x29, 0x25, 0xff, 0x5a, 0xcb, 0xff, 0xf7, 0x9e, 0xf8, 0xce, 0x39, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x29, 0x45, 0xff, 0x29, 0x45, 0xff, 0x29, 0x45, 0xff, 0x29, 0x45, 0xff, 0x5a, 0xcb, 0xff, 0xf7, 0x9e, 0xf8, 0xce, 0x39, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x31, 0x66, 0xff, 0x31, 0x66, 0xff, 0x31, 0x66, 0xff, 0x31, 0x66, 0xff, 0x31, 0x66, 0xff, 0x62, 0xec, 0xff, 0xf7, 0x9e, 0xf8, 0xce, 0x39, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x31, 0x86, 0xff, 0x31, 0x86, 0xff, 0x31, 0x86, 0xff, 0x31, 0x86, 0xff, 0x31, 0x86, 0xff, 0x31, 0x86, 0xff, 0x63, 0x0c, 0xff, 0xf7, 0x9e, 0xf8, 0xce, 0x59, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x31, 0xa6, 0xff, 0x31, 0xa6, 0xff, 0x31, 0xa6, 0xff, 0x31, 0xa6, 0xff, 0x31, 0xa6, 0xff, 0x31, 0xa6, 0xff, 0x31, 0xa6, 0xff, 0x63, 0x0c, 0xff, 0xf7, 0xbe, 0xf8, 0xce, 0x59, 0x57, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x39, 0xc7, 0xff, 0x39, 0xc7, 0xff, 0x39, 0xc7, 0xff, 0x39, 0xc7, 0xff, 0x39, 0xc7, 0xff, 0x39, 0xc7, 0xff, 0x39, 0xc7, 0xff, 0x39, 0xc7, 0xff, 0x6b, 0x2d, 0xff, 0xf7, 0xbe, 0xf8, 0xd6, 0x9a, 0x53,
0xff, 0xff, 0xff, 0x39, 0xe7, 0xff, 0x39, 0xe7, 0xff, 0x41, 0xe8, 0xff, 0x42, 0x08, 0xff, 0x39, 0xe7, 0xff, 0xe7, 0x1c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7,
0xff, 0xff, 0xff, 0x41, 0xe8, 0xff, 0x42, 0x08, 0xff, 0xbd, 0xd7, 0xff, 0x8c, 0x71, 0xff, 0x41, 0xe8, 0xff, 0x94, 0xb2, 0xff, 0xd6, 0x7a, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x42, 0x28, 0xff, 0xbd, 0xd7, 0xff, 0xef, 0x3d, 0xef, 0xe6, 0xfc, 0xff, 0x42, 0x08, 0xff, 0x52, 0x6a, 0xff, 0xff, 0xbf, 0xfa, 0x63, 0x0c, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xbd, 0xf7, 0xff, 0xde, 0xfb, 0xe1, 0x00, 0x00, 0x00, 0xef, 0x7d, 0xeb, 0x73, 0x8e, 0xff, 0x4a, 0x29, 0xff, 0xbd, 0xd7, 0xff, 0xde, 0xfb, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xde, 0xfb, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0xd7, 0x9d, 0xc5, 0xf8, 0xff, 0x4a, 0x49, 0xff, 0x6b, 0x6d, 0xff, 0xff, 0xdf, 0xe6, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xf7, 0x7e, 0xca, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xbf, 0xfa, 0x5a, 0xeb, 0xff, 0x4a, 0x69, 0xff, 0xf7, 0x9e, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0x39, 0xb2, 0xde, 0xdb, 0xff, 0xce, 0x79, 0xff, 0xef, 0x7d, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
#endif
#if LV_COLOR_DEPTH == 32
0xfd, 0xfd, 0xfd, 0xf7, 0xd6, 0xd6, 0xd6, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xf2, 0xf2, 0xf2, 0xf7, 0xc9, 0xc9, 0xc9, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x4e, 0x4e, 0x4e, 0xff, 0xf0, 0xf0, 0xf0, 0xf8, 0xc7, 0xc7, 0xc7, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x1e, 0x1e, 0x1e, 0xff, 0x51, 0x51, 0x51, 0xff, 0xf1, 0xf1, 0xf1, 0xf8, 0xc5, 0xc5, 0xc5, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x21, 0x21, 0x21, 0xff, 0x21, 0x21, 0x21, 0xff, 0x53, 0x53, 0x53, 0xff, 0xf1, 0xf1, 0xf1, 0xf8, 0xc5, 0xc5, 0xc5, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x25, 0x25, 0x25, 0xff, 0x25, 0x25, 0x25, 0xff, 0x25, 0x25, 0x25, 0xff, 0x57, 0x57, 0x57, 0xff, 0xf1, 0xf1, 0xf1, 0xf8, 0xc5, 0xc5, 0xc5, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x28, 0x28, 0x28, 0xff, 0x28, 0x28, 0x28, 0xff, 0x28, 0x28, 0x28, 0xff, 0x28, 0x28, 0x28, 0xff, 0x59, 0x59, 0x59, 0xff, 0xf1, 0xf1, 0xf1, 0xf8, 0xc5, 0xc5, 0xc5, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x2c, 0x2c, 0x2c, 0xff, 0x2c, 0x2c, 0x2c, 0xff, 0x2c, 0x2c, 0x2c, 0xff, 0x2c, 0x2c, 0x2c, 0xff, 0x2c, 0x2c, 0x2c, 0xff, 0x5c, 0x5c, 0x5c, 0xff, 0xf1, 0xf1, 0xf1, 0xf8, 0xc5, 0xc5, 0xc5, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x2f, 0x2f, 0x2f, 0xff, 0x2f, 0x2f, 0x2f, 0xff, 0x2f, 0x2f, 0x2f, 0xff, 0x2f, 0x2f, 0x2f, 0xff, 0x2f, 0x2f, 0x2f, 0xff, 0x2f, 0x2f, 0x2f, 0xff, 0x5e, 0x5e, 0x5e, 0xff, 0xf1, 0xf1, 0xf1, 0xf8, 0xc7, 0xc7, 0xc7, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x33, 0x33, 0x33, 0xff, 0x33, 0x33, 0x33, 0xff, 0x33, 0x33, 0x33, 0xff, 0x33, 0x33, 0x33, 0xff, 0x33, 0x33, 0x33, 0xff, 0x33, 0x33, 0x33, 0xff, 0x33, 0x33, 0x33, 0xff, 0x61, 0x61, 0x61, 0xff, 0xf2, 0xf2, 0xf2, 0xf8, 0xc7, 0xc7, 0xc7, 0x57, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0xff, 0x64, 0x64, 0x64, 0xff, 0xf2, 0xf2, 0xf2, 0xf8, 0xd0, 0xd0, 0xd0, 0x53,
0xff, 0xff, 0xff, 0xff, 0x3a, 0x3a, 0x3a, 0xff, 0x3a, 0x3a, 0x3a, 0xff, 0x3c, 0x3c, 0x3c, 0xff, 0x3f, 0x3f, 0x3f, 0xff, 0x3b, 0x3b, 0x3b, 0xff, 0xe1, 0xe1, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xfd, 0xfd, 0xf7,
0xff, 0xff, 0xff, 0xff, 0x3d, 0x3d, 0x3d, 0xff, 0x3f, 0x3f, 0x3f, 0xff, 0xb7, 0xb7, 0xb7, 0xff, 0x8b, 0x8b, 0x8b, 0xff, 0x3d, 0x3d, 0x3d, 0xff, 0x92, 0x92, 0x92, 0xff, 0xcd, 0xcd, 0xcd, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x42, 0x42, 0x42, 0xff, 0xb8, 0xb8, 0xb8, 0xff, 0xe5, 0xe5, 0xe5, 0xef, 0xdc, 0xdc, 0xdc, 0xff, 0x41, 0x41, 0x41, 0xff, 0x4d, 0x4d, 0x4d, 0xff, 0xf4, 0xf4, 0xf4, 0xfa, 0x5f, 0x5f, 0x5f, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xba, 0xba, 0xba, 0xff, 0xda, 0xda, 0xda, 0xe1, 0x00, 0x00, 0x00, 0x00, 0xea, 0xea, 0xea, 0xeb, 0x6f, 0x6f, 0x6f, 0xff, 0x44, 0x44, 0x44, 0xff, 0xb6, 0xb6, 0xb6, 0xff, 0xda, 0xda, 0xda, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xda, 0xda, 0xda, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, 0xb7, 0xb7, 0x9d, 0xbd, 0xbd, 0xbd, 0xff, 0x48, 0x48, 0x48, 0xff, 0x6a, 0x6a, 0x6a, 0xff, 0xf7, 0xf7, 0xf7, 0xe6, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xec, 0xec, 0xec, 0xca, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0xf4, 0xf4, 0xfa, 0x5b, 0x5b, 0x5b, 0xff, 0x4b, 0x4b, 0x4b, 0xff, 0xf1, 0xf1, 0xf1, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc4, 0xc4, 0xc4, 0xb2, 0xd9, 0xd9, 0xd9, 0xff, 0xcb, 0xcb, 0xcb, 0xff, 0xea, 0xea, 0xea, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
#endif
}; };
const lv_image_dsc_t cursor = { const lv_img_dsc_t bbx_cursor_img_dsc = {
.header.magic = LV_IMAGE_HEADER_MAGIC, .header.cf = LV_COLOR_FORMAT_NATIVE_WITH_ALPHA,
.header.cf = LV_COLOR_FORMAT_ARGB8888,
.header.flags = 0,
.header.w = 12, .header.w = 12,
.header.h = 18, .header.h = 18,
.header.stride = 48, .data = bbx_cursor_img_dsc_map,
.data_size = sizeof(cursor_map),
.data = cursor_map,
}; };

View File

@@ -10,6 +10,6 @@
#include "lvgl/lvgl.h" #include "lvgl/lvgl.h"
/* Image description of the mouse cursor */ /* Image description of the mouse cursor */
extern const lv_image_dsc_t cursor; extern const lv_img_dsc_t bbx_cursor_img_dsc;
#endif /* BBX_CURSOR_H */ #endif /* BBX_CURSOR_H */

1548
shared/cursor/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
{
"dependencies": {
"@swc/core": "^1.3.40",
"lv_img_conv": "^0.4.0"
}
}

View File

@@ -3,15 +3,20 @@
# Copyright 2023 Johannes Marbach # Copyright 2023 Johannes Marbach
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# Dependencies:
# python-pypng
# python-lz4
root=$(git rev-parse --show-toplevel) npm i
"$root/lvgl/scripts/LVGLImage.py" \ ./node_modules/lv_img_conv/lv_img_conv.js -f \
--ofmt C \ -i bbx_cursor_img_dsc \
--cf "ARGB8888" \ -c CF_TRUE_COLOR_ALPHA \
--output "$root/shared/cursor" \ -o cursor.c \
--verbose \ cursor.png
"$root/shared/cursor/cursor.png"
# We need to manually replace the old constants because the image converter hasn't
# yet been updated to https://github.com/lvgl/lvgl/issues/4011
sed 's/LV_IMG_CF_TRUE_COLOR_ALPHA/LV_COLOR_FORMAT_NATIVE_WITH_ALPHA/g' cursor.c \
| sed '/.*LV_IMG_PX_SIZE_ALPHA_BYTE.*/d' \
| sed '/.*header.always_zero.*/d' \
| sed '/.*header.reserved.*/d'\
> cursor.c.tmp
mv cursor.c.tmp cursor.c

View File

@@ -9,6 +9,8 @@
#include "cursor/cursor.h" #include "cursor/cursor.h"
#include "log.h" #include "log.h"
#include "lvgl/src/indev/lv_indev_private.h"
#include <libinput.h> #include <libinput.h>
#include <libudev.h> #include <libudev.h>
#include <limits.h> #include <limits.h>
@@ -351,8 +353,8 @@ static void set_mouse_cursor(struct input_device *device) {
/* Initialise cursor image if needed */ /* Initialise cursor image if needed */
if (!cursor_obj) { if (!cursor_obj) {
cursor_obj = lv_image_create(lv_screen_active()); cursor_obj = lv_img_create(lv_scr_act());
lv_image_set_src(cursor_obj, &cursor); lv_img_set_src(cursor_obj, &bbx_cursor_img_dsc);
} }
/* Apply the cursor image */ /* Apply the cursor image */

View File

@@ -9,6 +9,9 @@
#include "log.h" #include "log.h"
#include "../squeek2lvgl/sq2lv.h" #include "../squeek2lvgl/sq2lv.h"
#include "lvgl/lvgl.h"
/** /**
* Static variables * Static variables
*/ */
@@ -22,25 +25,21 @@ static struct {
lv_style_t header; lv_style_t header;
lv_style_t keyboard; lv_style_t keyboard;
lv_style_t key; lv_style_t key;
#if LV_USE_BUTTON
lv_style_t button; lv_style_t button;
lv_style_t button_pressed; lv_style_t button_pressed;
#endif
lv_style_t textarea; lv_style_t textarea;
lv_style_t textarea_placeholder; lv_style_t textarea_placeholder;
lv_style_t textarea_cursor; lv_style_t textarea_cursor;
#if LV_USE_DROPDOWN
lv_style_t dropdown; lv_style_t dropdown;
lv_style_t dropdown_pressed; lv_style_t dropdown_pressed;
lv_style_t dropdown_list; lv_style_t dropdown_list;
lv_style_t dropdown_list_selected; lv_style_t dropdown_list_selected;
#endif
lv_style_t label; lv_style_t label;
#if LV_USE_MSGBOX
lv_style_t msgbox; lv_style_t msgbox;
lv_style_t msgbox_label; lv_style_t msgbox_label;
lv_style_t msgbox_background; lv_style_t msgbox_background;
#endif lv_style_t bar;
lv_style_t bar_indicator;
} styles; } styles;
static bool are_styles_initialised = false; static bool are_styles_initialised = false;
@@ -116,7 +115,6 @@ static void init_styles(const bbx_theme *theme) {
lv_style_set_border_width(&(styles.key), lv_dpx(theme->keyboard.keys.border_width)); lv_style_set_border_width(&(styles.key), lv_dpx(theme->keyboard.keys.border_width));
lv_style_set_radius(&(styles.key), lv_dpx(theme->keyboard.keys.corner_radius)); lv_style_set_radius(&(styles.key), lv_dpx(theme->keyboard.keys.corner_radius));
#if LV_USE_BUTTON
reset_style(&(styles.button)); reset_style(&(styles.button));
lv_style_set_text_color(&(styles.button), lv_color_hex(theme->button.normal.fg_color)); lv_style_set_text_color(&(styles.button), lv_color_hex(theme->button.normal.fg_color));
lv_style_set_bg_opa(&(styles.button), LV_OPA_COVER); lv_style_set_bg_opa(&(styles.button), LV_OPA_COVER);
@@ -131,7 +129,6 @@ static void init_styles(const bbx_theme *theme) {
lv_style_set_text_color(&(styles.button_pressed), lv_color_hex(theme->button.pressed.fg_color)); lv_style_set_text_color(&(styles.button_pressed), lv_color_hex(theme->button.pressed.fg_color));
lv_style_set_bg_color(&(styles.button_pressed), lv_color_hex(theme->button.pressed.bg_color)); lv_style_set_bg_color(&(styles.button_pressed), lv_color_hex(theme->button.pressed.bg_color));
lv_style_set_border_color(&(styles.button_pressed), lv_color_hex(theme->button.pressed.border_color)); lv_style_set_border_color(&(styles.button_pressed), lv_color_hex(theme->button.pressed.border_color));
#endif
reset_style(&(styles.textarea)); reset_style(&(styles.textarea));
lv_style_set_text_color(&(styles.textarea), lv_color_hex(theme->textarea.fg_color)); lv_style_set_text_color(&(styles.textarea), lv_color_hex(theme->textarea.fg_color));
@@ -150,9 +147,8 @@ static void init_styles(const bbx_theme *theme) {
lv_style_set_border_side(&(styles.textarea_cursor), LV_BORDER_SIDE_LEFT); lv_style_set_border_side(&(styles.textarea_cursor), LV_BORDER_SIDE_LEFT);
lv_style_set_border_width(&(styles.textarea_cursor), lv_dpx(theme->textarea.cursor.width)); lv_style_set_border_width(&(styles.textarea_cursor), lv_dpx(theme->textarea.cursor.width));
lv_style_set_border_color(&(styles.textarea_cursor), lv_color_hex(theme->textarea.cursor.color)); lv_style_set_border_color(&(styles.textarea_cursor), lv_color_hex(theme->textarea.cursor.color));
lv_style_set_anim_duration(&(styles.textarea_cursor), theme->textarea.cursor.period); lv_style_set_anim_time(&(styles.textarea_cursor), theme->textarea.cursor.period);
#if LV_USE_DROPDOWN
reset_style(&(styles.dropdown)); reset_style(&(styles.dropdown));
lv_style_set_text_color(&(styles.dropdown), lv_color_hex(theme->dropdown.button.normal.fg_color)); lv_style_set_text_color(&(styles.dropdown), lv_color_hex(theme->dropdown.button.normal.fg_color));
lv_style_set_bg_opa(&(styles.dropdown), LV_OPA_COVER); lv_style_set_bg_opa(&(styles.dropdown), LV_OPA_COVER);
@@ -182,12 +178,10 @@ static void init_styles(const bbx_theme *theme) {
lv_style_set_text_color(&(styles.dropdown_list_selected), lv_color_hex(theme->dropdown.list.selection_fg_color)); lv_style_set_text_color(&(styles.dropdown_list_selected), lv_color_hex(theme->dropdown.list.selection_fg_color));
lv_style_set_bg_opa(&(styles.dropdown_list_selected), LV_OPA_COVER); lv_style_set_bg_opa(&(styles.dropdown_list_selected), LV_OPA_COVER);
lv_style_set_bg_color(&(styles.dropdown_list_selected), lv_color_hex(theme->dropdown.list.selection_bg_color)); lv_style_set_bg_color(&(styles.dropdown_list_selected), lv_color_hex(theme->dropdown.list.selection_bg_color));
#endif
reset_style(&(styles.label)); reset_style(&(styles.label));
lv_style_set_text_color(&(styles.label), lv_color_hex(theme->label.fg_color)); lv_style_set_text_color(&(styles.label), lv_color_hex(theme->label.fg_color));
#if LV_USE_MSGBOX
reset_style(&(styles.msgbox)); reset_style(&(styles.msgbox));
lv_style_set_text_color(&(styles.msgbox), lv_color_hex(theme->msgbox.fg_color)); lv_style_set_text_color(&(styles.msgbox), lv_color_hex(theme->msgbox.fg_color));
lv_style_set_bg_opa(&(styles.msgbox), LV_OPA_COVER); lv_style_set_bg_opa(&(styles.msgbox), LV_OPA_COVER);
@@ -205,7 +199,16 @@ static void init_styles(const bbx_theme *theme) {
reset_style(&(styles.msgbox_background)); reset_style(&(styles.msgbox_background));
lv_style_set_bg_color(&(styles.msgbox_background), lv_color_hex(theme->msgbox.dimming.color)); lv_style_set_bg_color(&(styles.msgbox_background), lv_color_hex(theme->msgbox.dimming.color));
lv_style_set_bg_opa(&(styles.msgbox_background), theme->msgbox.dimming.opacity); lv_style_set_bg_opa(&(styles.msgbox_background), theme->msgbox.dimming.opacity);
#endif
reset_style(&(styles.bar));
lv_style_set_border_side(&(styles.bar), LV_BORDER_SIDE_FULL);
lv_style_set_border_width(&(styles.bar), lv_dpx(theme->bar.border_width));
lv_style_set_border_color(&(styles.bar), lv_color_hex(theme->bar.border_color));
lv_style_set_radius(&(styles.bar), lv_dpx(theme->bar.corner_radius));
reset_style(&(styles.bar_indicator));
lv_style_set_bg_opa(&(styles.bar_indicator), LV_OPA_COVER);
lv_style_set_bg_color(&(styles.bar_indicator), lv_color_hex(theme->bar.indicator.bg_color));
are_styles_initialised = true; are_styles_initialised = true;
} }
@@ -239,7 +242,6 @@ static void apply_theme_cb(lv_theme_t *theme, lv_obj_t *obj) {
return; return;
} }
#if LV_USE_BUTTON
if (lv_obj_check_type(obj, &lv_button_class)) { if (lv_obj_check_type(obj, &lv_button_class)) {
lv_obj_add_style(obj, &(styles.button), 0); lv_obj_add_style(obj, &(styles.button), 0);
lv_obj_add_style(obj, &(styles.button_pressed), LV_STATE_PRESSED); lv_obj_add_style(obj, &(styles.button_pressed), LV_STATE_PRESSED);
@@ -249,7 +251,6 @@ static void apply_theme_cb(lv_theme_t *theme, lv_obj_t *obj) {
if (lv_obj_check_type(obj, &lv_label_class) && lv_obj_check_type(lv_obj_get_parent(obj), &lv_button_class)) { if (lv_obj_check_type(obj, &lv_label_class) && lv_obj_check_type(lv_obj_get_parent(obj), &lv_button_class)) {
return; /* Inherit styling from button */ return; /* Inherit styling from button */
} }
#endif
if (lv_obj_check_type(obj, &lv_textarea_class)) { if (lv_obj_check_type(obj, &lv_textarea_class)) {
lv_obj_add_style(obj, &(styles.textarea), 0); lv_obj_add_style(obj, &(styles.textarea), 0);
@@ -262,7 +263,6 @@ static void apply_theme_cb(lv_theme_t *theme, lv_obj_t *obj) {
return; /* Inherit styling from textarea */ return; /* Inherit styling from textarea */
} }
#if LV_USE_DROPDOWN
if (lv_obj_check_type(obj, &lv_dropdown_class)) { if (lv_obj_check_type(obj, &lv_dropdown_class)) {
lv_obj_add_style(obj, &(styles.dropdown), 0); lv_obj_add_style(obj, &(styles.dropdown), 0);
lv_obj_add_style(obj, &(styles.dropdown_pressed), LV_STATE_PRESSED); lv_obj_add_style(obj, &(styles.dropdown_pressed), LV_STATE_PRESSED);
@@ -279,9 +279,7 @@ static void apply_theme_cb(lv_theme_t *theme, lv_obj_t *obj) {
if (lv_obj_check_type(obj, &lv_label_class) && lv_obj_check_type(lv_obj_get_parent(obj), &lv_dropdownlist_class)) { if (lv_obj_check_type(obj, &lv_label_class) && lv_obj_check_type(lv_obj_get_parent(obj), &lv_dropdownlist_class)) {
return; /* Inherit styling from dropdown list */ return; /* Inherit styling from dropdown list */
} }
#endif
#if LV_USE_MSGBOX
if (lv_obj_check_type(obj, &lv_msgbox_class)) { if (lv_obj_check_type(obj, &lv_msgbox_class)) {
lv_obj_add_style(obj, &(styles.msgbox), 0); lv_obj_add_style(obj, &(styles.msgbox), 0);
return; return;
@@ -306,12 +304,17 @@ static void apply_theme_cb(lv_theme_t *theme, lv_obj_t *obj) {
lv_obj_add_style(obj, &(styles.msgbox_background), 0); lv_obj_add_style(obj, &(styles.msgbox_background), 0);
return; return;
} }
#endif
if (lv_obj_check_type(obj, &lv_label_class)) { if (lv_obj_check_type(obj, &lv_label_class) || lv_obj_check_type(obj, &lv_spangroup_class)) {
lv_obj_add_style(obj, &(styles.label), 0); lv_obj_add_style(obj, &(styles.label), 0);
return; return;
} }
if (lv_obj_check_type(obj, &lv_bar_class)) {
lv_obj_add_style(obj, &(styles.bar), 0);
lv_obj_add_style(obj, &(styles.bar_indicator), LV_PART_INDICATOR);
return;
}
} }
static void keyboard_draw_task_added_cb(lv_event_t *event) { static void keyboard_draw_task_added_cb(lv_event_t *event) {
@@ -336,7 +339,7 @@ static void keyboard_draw_task_added_cb(lv_event_t *event) {
key = &(current_theme.keyboard.keys.key_char); key = &(current_theme.keyboard.keys.key_char);
} }
bool pressed = lv_buttonmatrix_get_selected_button(obj) == dsc->id1 && lv_obj_has_state(obj, LV_STATE_PRESSED); bool pressed = lv_btnmatrix_get_selected_btn(obj) == dsc->id1 && lv_obj_has_state(obj, LV_STATE_PRESSED);
lv_draw_label_dsc_t *label_dsc = lv_draw_task_get_label_dsc(draw_task); lv_draw_label_dsc_t *label_dsc = lv_draw_task_get_label_dsc(draw_task);
if (label_dsc) { if (label_dsc) {
@@ -379,6 +382,7 @@ void bbx_theme_apply(const bbx_theme *theme) {
current_theme = *theme; current_theme = *theme;
init_styles(theme); init_styles(theme);
lv_obj_report_style_change(NULL); /* Update existing objects */ lv_obj_report_style_change(NULL);
lv_display_set_theme(NULL, &lv_theme); /* Set a theme for future objects */ lv_disp_set_theme(NULL, &lv_theme);
lv_theme_apply(lv_scr_act());
} }

View File

@@ -26,10 +26,10 @@ typedef struct {
/* Header theme */ /* Header theme */
typedef struct { typedef struct {
uint32_t bg_color; uint32_t bg_color;
int32_t border_width; lv_coord_t border_width;
uint32_t border_color; uint32_t border_color;
int32_t pad; lv_coord_t pad;
int32_t gap; lv_coord_t gap;
} bbx_theme_header; } bbx_theme_header;
/* Key theme for one specific key type and state */ /* Key theme for one specific key type and state */
@@ -47,8 +47,8 @@ typedef struct {
/* Key theme */ /* Key theme */
typedef struct { typedef struct {
int32_t border_width; lv_coord_t border_width;
int32_t corner_radius; lv_coord_t corner_radius;
bbx_theme_key key_char; bbx_theme_key key_char;
bbx_theme_key key_non_char; bbx_theme_key key_non_char;
bbx_theme_key key_mod_act; bbx_theme_key key_mod_act;
@@ -58,10 +58,10 @@ typedef struct {
/* Keyboard theme */ /* Keyboard theme */
typedef struct { typedef struct {
uint32_t bg_color; uint32_t bg_color;
int32_t border_width; lv_coord_t border_width;
uint32_t border_color; uint32_t border_color;
int32_t pad; lv_coord_t pad;
int32_t gap; lv_coord_t gap;
bbx_theme_keys keys; bbx_theme_keys keys;
} bbx_theme_keyboard; } bbx_theme_keyboard;
@@ -74,16 +74,16 @@ typedef struct {
/* Button theme */ /* Button theme */
typedef struct { typedef struct {
int32_t border_width; lv_coord_t border_width;
int32_t corner_radius; lv_coord_t corner_radius;
int32_t pad; lv_coord_t pad;
bbx_theme_button_state normal; bbx_theme_button_state normal;
bbx_theme_button_state pressed; bbx_theme_button_state pressed;
} bbx_theme_button; } bbx_theme_button;
/* Text area cursor theme */ /* Text area cursor theme */
typedef struct { typedef struct {
int32_t width; lv_coord_t width;
uint32_t color; uint32_t color;
int period; int period;
} bbx_theme_textarea_cursor; } bbx_theme_textarea_cursor;
@@ -92,10 +92,10 @@ typedef struct {
typedef struct { typedef struct {
uint32_t fg_color; uint32_t fg_color;
uint32_t bg_color; uint32_t bg_color;
int32_t border_width; lv_coord_t border_width;
uint32_t border_color; uint32_t border_color;
int32_t corner_radius; lv_coord_t corner_radius;
int32_t pad; lv_coord_t pad;
uint32_t placeholder_color; uint32_t placeholder_color;
bbx_theme_textarea_cursor cursor; bbx_theme_textarea_cursor cursor;
} bbx_theme_textarea; } bbx_theme_textarea;
@@ -106,10 +106,10 @@ typedef struct {
uint32_t bg_color; uint32_t bg_color;
uint32_t selection_fg_color; uint32_t selection_fg_color;
uint32_t selection_bg_color; uint32_t selection_bg_color;
int32_t border_width; lv_coord_t border_width;
uint32_t border_color; uint32_t border_color;
int32_t corner_radius; lv_coord_t corner_radius;
int32_t pad; lv_coord_t pad;
} bbx_theme_dropdown_list; } bbx_theme_dropdown_list;
/* Dropdown theme */ /* Dropdown theme */
@@ -133,11 +133,11 @@ typedef struct {
typedef struct { typedef struct {
uint32_t fg_color; uint32_t fg_color;
uint32_t bg_color; uint32_t bg_color;
int32_t border_width; lv_coord_t border_width;
uint32_t border_color; uint32_t border_color;
int32_t corner_radius; lv_coord_t corner_radius;
int32_t pad; lv_coord_t pad;
int32_t gap; lv_coord_t gap;
bbx_theme_msgbox_dimming dimming; bbx_theme_msgbox_dimming dimming;
} bbx_theme_msgbox; } bbx_theme_msgbox;
@@ -148,9 +148,9 @@ typedef struct {
/* Progress bar theme */ /* Progress bar theme */
typedef struct { typedef struct {
int32_t border_width; lv_coord_t border_width;
uint32_t border_color; uint32_t border_color;
int32_t corner_radius; lv_coord_t corner_radius;
bbx_theme_bar_indicator indicator; bbx_theme_bar_indicator indicator;
} bbx_theme_bar; } bbx_theme_bar;

View File

@@ -1085,7 +1085,7 @@ static const bbx_theme nord_dark = {
} }
}, },
.label = { .label = {
.fg_color = NORD5 .fg_color = 0x070c0d
}, },
.msgbox = { .msgbox = {
.fg_color = NORD6, .fg_color = NORD6,

View File

@@ -4,7 +4,7 @@ squeek2lvgl is a Python script and an accompanying C library that make it possib
To access [squeekboard]'s layout files, squeek2lvgl shallowly clones the [squeekboard] git repository into a temporary directory and purges it before exiting. To access [squeekboard]'s layout files, squeek2lvgl shallowly clones the [squeekboard] git repository into a temporary directory and purges it before exiting.
**squeek2lvgl has been donated to the postmarketOS project. Development continues in https://gitlab.postmarketos.org/postmarketOS/buffybox.** **squeek2lvgl has been donated to the postmarketOS project. Development continues in https://gitlab.com/postmarketOS/buffybox.**
## Usage ## Usage

View File

@@ -216,7 +216,7 @@ int *sq2lv_get_modifier_indexes(lv_obj_t *keyboard, int *num_modifiers) {
} }
#if SQ2LV_SCANCODES_ENABLED #if SQ2LV_SCANCODES_ENABLED
const int *sq2lv_get_scancodes(lv_obj_t *keyboard, uint16_t btn_id, int *num_scancodes) { const int * const sq2lv_get_scancodes(lv_obj_t *keyboard, uint16_t btn_id, int *num_scancodes) {
if (current_layout_id < 0 || current_layout_id >= sq2lv_num_layouts) { if (current_layout_id < 0 || current_layout_id >= sq2lv_num_layouts) {
*num_scancodes = 0; *num_scancodes = 0;
return NULL; return NULL;

View File

@@ -75,7 +75,7 @@ int *sq2lv_get_modifier_indexes(lv_obj_t *keyboard, int *num_modifiers);
* @param num_scancodes pointer to an integer into which the number of scancodes will be written * @param num_scancodes pointer to an integer into which the number of scancodes will be written
* @return pointer into an array of scancodes at the appropriate index * @return pointer into an array of scancodes at the appropriate index
*/ */
const int *sq2lv_get_scancodes(lv_obj_t *keyboard, uint16_t btn_id, int *num_scancodes); const int * const sq2lv_get_scancodes(lv_obj_t *keyboard, uint16_t btn_id, int *num_scancodes);
#endif /* SQ2LV_SCANCODES_ENABLED */ #endif /* SQ2LV_SCANCODES_ENABLED */
#endif /* SQ2LV_H */ #endif /* SQ2LV_H */

View File

@@ -58,10 +58,8 @@ function ok() {
function run_script() { function run_script() {
info "Executing $1" info "Executing $1"
rc=0 "$1"
"$1" || rc=1
echo echo
return $rc
} }
function read_version_from_meson() { function read_version_from_meson() {

View File

@@ -4,12 +4,8 @@ root=$(dirname "${BASH_SOURCE[0]}")
source "$root/helpers.sh" source "$root/helpers.sh"
rc=0 run_script "$root/build-with-drm.sh"
run_script "$root/test-version-matches-meson-and-changelog.sh"
run_script "$root/build-with-drm.sh" || rc=1 run_script "$root/test-uses-fb-backend-by-default.sh"
run_script "$root/test-version-matches-meson-and-changelog.sh" || rc=1 run_script "$root/test-uses-fb-backend-if-selected-via-config.sh"
run_script "$root/test-uses-fb-backend-by-default.sh" || rc=1 run_script "$root/test-uses-drm-backend-if-selected-via-config-and-available.sh"
run_script "$root/test-uses-fb-backend-if-selected-via-config.sh" || rc=1
run_script "$root/test-uses-drm-backend-if-selected-via-config-and-available.sh" || rc=1
exit $rc

View File

@@ -4,12 +4,8 @@ root=$(dirname "${BASH_SOURCE[0]}")
source "$root/helpers.sh" source "$root/helpers.sh"
rc=0 run_script "$root/build-without-drm.sh"
run_script "$root/test-version-matches-meson-and-changelog.sh"
run_script "$root/build-without-drm.sh" || rc=1 run_script "$root/test-uses-fb-backend-by-default.sh"
run_script "$root/test-version-matches-meson-and-changelog.sh" || rc=1 run_script "$root/test-uses-fb-backend-if-selected-via-config.sh"
run_script "$root/test-uses-fb-backend-by-default.sh" || rc=1 run_script "$root/test-uses-fb-backend-if-drm-selected-via-config-but-unavailable.sh"
run_script "$root/test-uses-fb-backend-if-selected-via-config.sh" || rc=1
run_script "$root/test-uses-fb-backend-if-drm-selected-via-config-but-unavailable.sh" || rc=1
exit $rc

View File

@@ -49,7 +49,6 @@ Unl0kr values the CRYPTTAB_TRIED variable. Upon completion, the entered
password is printed to STDOUT. All other output happens on STDERR. password is printed to STDOUT. All other output happens on STDERR.
Mandatory arguments to long options are mandatory for short options too. Mandatory arguments to long options are mandatory for short options too.
-m, --message A message that will be displayed to a user
-C, --config-override Path to a config override file. Can be supplied -C, --config-override Path to a config override file. Can be supplied
multiple times. Config files are merged in the multiple times. Config files are merged in the
following order: following order:
@@ -62,15 +61,7 @@ Mandatory arguments to long options are mandatory for short options too.
vertical pixels, offset horizontally by X vertical pixels, offset horizontally by X
pixels and vertically by Y pixels pixels and vertically by Y pixels
-d --dpi=N Override the display's DPI value -d --dpi=N Override the display's DPI value
-r, --rotate=[0-3] Rotate the UI to the given orientation. The
values match the ones provided by the kernel in
/sys/class/graphics/fbcon/rotate.
* 0 - normal orientation (0 degree)
* 1 - clockwise orientation (90 degrees)
* 2 - upside down orientation (180 degrees)
* 3 - counterclockwise orientation (270 degrees)
-h, --help Print this message and exit -h, --help Print this message and exit
-n Do not append a newline character to a password
-v, --verbose Enable more detailed logging output on STDERR -v, --verbose Enable more detailed logging output on STDERR
-V, --version Print the unl0kr version and exit -V, --version Print the unl0kr version and exit
``` ```
@@ -159,9 +150,9 @@ The [lv_port_linux_frame_buffer] project served as a starting point for the code
[lvgl]: https://github.com/lvgl/lvgl [lvgl]: https://github.com/lvgl/lvgl
[online font converter]: https://lvgl.io/tools/fontconverter [online font converter]: https://lvgl.io/tools/fontconverter
[osk-sdl]: https://gitlab.com/postmarketOS/osk-sdl [osk-sdl]: https://gitlab.com/postmarketOS/osk-sdl
[package-arch]: https://aur.archlinux.org/packages/buffybox [package-arch]: https://aur.archlinux.org/packages/unl0kr
[package-debian]: https://tracker.debian.org/pkg/unl0kr [package-debian]: https://tracker.debian.org/pkg/unl0kr
[package-pmos]: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/tree/master/main/unl0kr [package-pmos]: https://gitlab.com/postmarketOS/pmaports/-/tree/master/main/unl0kr
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc [scdoc]: https://git.sr.ht/~sircmpwn/scdoc
[screenshots]: ./screenshots [screenshots]: ./screenshots
[squeek2lvgl]: ../squeek2lvgl [squeek2lvgl]: ../squeek2lvgl

View File

@@ -13,7 +13,6 @@
#include <getopt.h> #include <getopt.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
/** /**
@@ -40,14 +39,11 @@ static void print_usage();
static void init_opts(ul_cli_opts *opts) { static void init_opts(ul_cli_opts *opts) {
opts->num_config_files = 0; opts->num_config_files = 0;
opts->config_files = NULL; opts->config_files = NULL;
opts->message = NULL;
opts->hor_res = -1; opts->hor_res = -1;
opts->ver_res = -1; opts->ver_res = -1;
opts->x_offset = 0; opts->x_offset = 0;
opts->y_offset = 0; opts->y_offset = 0;
opts->dpi = 0; opts->dpi = 0;
opts->rotation = LV_DISPLAY_ROTATION_0;
opts->newline = true;
opts->verbose = false; opts->verbose = false;
} }
@@ -60,7 +56,6 @@ static void print_usage() {
"password is printed to STDOUT. All other output happens on STDERR.\n" "password is printed to STDOUT. All other output happens on STDERR.\n"
"\n" "\n"
"Mandatory arguments to long options are mandatory for short options too.\n" "Mandatory arguments to long options are mandatory for short options too.\n"
" -m, --message A message that will be displayed to a user\n"
" -C, --config-override Path to a config override file. Can be supplied\n" " -C, --config-override Path to a config override file. Can be supplied\n"
" multiple times. Config files are merged in the\n" " multiple times. Config files are merged in the\n"
" following order:\n" " following order:\n"
@@ -73,15 +68,7 @@ static void print_usage() {
" vertical pixels, offset horizontally by X\n" " vertical pixels, offset horizontally by X\n"
" pixels and vertically by Y pixels\n" " pixels and vertically by Y pixels\n"
" -d --dpi=N Override the display's DPI value\n" " -d --dpi=N Override the display's DPI value\n"
" -r, --rotate=[0-3] Rotate the UI to the given orientation. The\n"
" values match the ones provided by the kernel in\n"
" /sys/class/graphics/fbcon/rotate.\n"
" * 0 - normal orientation (0 degree)\n"
" * 1 - clockwise orientation (90 degrees)\n"
" * 2 - upside down orientation (180 degrees)\n"
" * 3 - counterclockwise orientation (270 degrees)\n"
" -h, --help Print this message and exit\n" " -h, --help Print this message and exit\n"
" -n Do not append a newline character to a password\n"
" -v, --verbose Enable more detailed logging output on STDERR\n" " -v, --verbose Enable more detailed logging output on STDERR\n"
" -V, --version Print the unl0kr version and exit\n"); " -V, --version Print the unl0kr version and exit\n");
/*-------------------------------- 78 CHARS --------------------------------*/ /*-------------------------------- 78 CHARS --------------------------------*/
@@ -96,11 +83,9 @@ void ul_cli_parse_opts(int argc, char *argv[], ul_cli_opts *opts) {
init_opts(opts); init_opts(opts);
struct option long_opts[] = { struct option long_opts[] = {
{ "message", required_argument, NULL, 'm' },
{ "config-override", required_argument, NULL, 'C' }, { "config-override", required_argument, NULL, 'C' },
{ "geometry", required_argument, NULL, 'g' }, { "geometry", required_argument, NULL, 'g' },
{ "dpi", required_argument, NULL, 'd' }, { "dpi", required_argument, NULL, 'd' },
{ "rotate", required_argument, NULL, 'r' },
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ "verbose", no_argument, NULL, 'v' }, { "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, NULL, 'V' }, { "version", no_argument, NULL, 'V' },
@@ -109,11 +94,8 @@ void ul_cli_parse_opts(int argc, char *argv[], ul_cli_opts *opts) {
int opt, index = 0; int opt, index = 0;
while ((opt = getopt_long(argc, argv, "m:C:g:d:r:hnvV", long_opts, &index)) != -1) { while ((opt = getopt_long(argc, argv, "C:g:d:hvV", long_opts, &index)) != -1) {
switch (opt) { switch (opt) {
case 'm':
opts->message = strdup(optarg);
break;
case 'C': case 'C':
opts->config_files = realloc(opts->config_files, (opts->num_config_files + 1) * sizeof(char *)); opts->config_files = realloc(opts->config_files, (opts->num_config_files + 1) * sizeof(char *));
if (!opts->config_files) { if (!opts->config_files) {
@@ -137,34 +119,9 @@ void ul_cli_parse_opts(int argc, char *argv[], ul_cli_opts *opts) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
break; break;
case 'r': {
int orientation;
if (sscanf(optarg, "%i", &orientation) != 1 || orientation < 0 || orientation > 3) {
fprintf(stderr, "Invalid orientation argument \"%s\"\n", optarg);
exit(EXIT_FAILURE);
}
switch (orientation) {
case 0:
opts->rotation = LV_DISPLAY_ROTATION_0;
break;
case 1:
opts->rotation = LV_DISPLAY_ROTATION_270;
break;
case 2:
opts->rotation = LV_DISPLAY_ROTATION_180;
break;
case 3:
opts->rotation = LV_DISPLAY_ROTATION_90;
break;
}
break;
}
case 'h': case 'h':
print_usage(); print_usage();
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
case 'n':
opts->newline = false;
break;
case 'v': case 'v':
opts->verbose = true; opts->verbose = true;
break; break;

View File

@@ -8,7 +8,6 @@
#define UL_COMMAND_LINE_H #define UL_COMMAND_LINE_H
#include <stdbool.h> #include <stdbool.h>
#include "lvgl/lvgl.h"
/** /**
* Options parsed from command line arguments * Options parsed from command line arguments
@@ -18,8 +17,6 @@ typedef struct {
int num_config_files; int num_config_files;
/* Paths of config file */ /* Paths of config file */
const char **config_files; const char **config_files;
/* Message for a user */
const char *message;
/* Horizontal display resolution */ /* Horizontal display resolution */
int hor_res; int hor_res;
/* Vertical display resolution */ /* Vertical display resolution */
@@ -30,10 +27,6 @@ typedef struct {
int y_offset; int y_offset;
/* DPI */ /* DPI */
int dpi; int dpi;
/* Display rotation */
lv_display_rotation_t rotation;
/* If true, append a newline character to a password */
bool newline;
/* Verbose mode. If true, provide more detailed logging output on STDERR. */ /* Verbose mode. If true, provide more detailed logging output on STDERR. */
bool verbose; bool verbose;
} ul_cli_opts; } ul_cli_opts;

View File

@@ -1,114 +0,0 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Manual post-processing steps for the generated lv_conf.h
# 1. Comment LV_USE_LINUX_DRM (handled by meson.build)
# 2. Remove LV_BIG_ENDIAN_SYSTEM (handled by meson.build)
# 3. Add `#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(bbx_font_32)` (a bug in generate_lv_conf.py)
LV_COLOR_DEPTH 32
LV_USE_STDLIB_MALLOC LV_STDLIB_CLIB
LV_USE_STDLIB_STRING LV_STDLIB_CLIB
LV_USE_STDLIB_SPRINTF LV_STDLIB_CLIB
LV_USE_DRAW_SW 1
LV_DRAW_SW_COMPLEX 1
LV_DRAW_SW_SUPPORT_RGB565 0
LV_DRAW_SW_SUPPORT_RGB565A8 0
LV_DRAW_SW_SUPPORT_RGB888 1
LV_DRAW_SW_SUPPORT_XRGB8888 1
LV_DRAW_SW_SUPPORT_ARGB8888 1
LV_DRAW_SW_SUPPORT_L8 0
LV_DRAW_SW_SUPPORT_AL88 0
LV_DRAW_SW_SUPPORT_A8 0
LV_DRAW_SW_SUPPORT_I1 0
LV_USE_LOG 1
LV_LOG_LEVEL LV_LOG_LEVEL_WARN
LV_USE_PRIVATE_API 1
LV_FONT_MONTSERRAT_8 0
LV_FONT_MONTSERRAT_10 0
LV_FONT_MONTSERRAT_12 0
LV_FONT_MONTSERRAT_14 0
LV_FONT_MONTSERRAT_16 0
LV_FONT_MONTSERRAT_18 0
LV_FONT_MONTSERRAT_20 0
LV_FONT_MONTSERRAT_22 0
LV_FONT_MONTSERRAT_24 0
LV_FONT_MONTSERRAT_26 0
LV_FONT_MONTSERRAT_28 0
LV_FONT_MONTSERRAT_30 0
LV_FONT_MONTSERRAT_32 0
LV_FONT_MONTSERRAT_34 0
LV_FONT_MONTSERRAT_36 0
LV_FONT_MONTSERRAT_38 0
LV_FONT_MONTSERRAT_40 0
LV_FONT_MONTSERRAT_42 0
LV_FONT_MONTSERRAT_44 0
LV_FONT_MONTSERRAT_46 0
LV_FONT_MONTSERRAT_48 0
LV_FONT_MONTSERRAT_28_COMPRESSED 0
LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0
LV_FONT_SIMSUN_14_CJK 0
LV_FONT_SIMSUN_16_CJK 0
LV_FONT_UNSCII_8 0
LV_FONT_UNSCII_16 0
#LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(bbx_font_32)
LV_FONT_DEFAULT &bbx_font_32
LV_WIDGETS_HAS_DEFAULT_VALUE 0
LV_USE_ANIMIMG 0
LV_USE_ARC 0
LV_USE_BAR 0
LV_USE_BUTTON 1
LV_USE_BUTTONMATRIX 1
LV_USE_CALENDAR 0
LV_USE_CANVAS 0
LV_USE_CHART 0
LV_USE_CHECKBOX 0
LV_USE_DROPDOWN 1
LV_USE_IMAGE 1
LV_USE_IMAGEBUTTON 0
LV_USE_KEYBOARD 1
LV_USE_LABEL 1
LV_LABEL_TEXT_SELECTION 0
LV_LABEL_LONG_TXT_HINT 0
LV_USE_LED 0
LV_USE_LINE 0
LV_USE_LIST 0
LV_USE_LOTTIE 0
LV_USE_MENU 0
LV_USE_MSGBOX 1
LV_USE_ROLLER 0
LV_USE_SCALE 0
LV_USE_SLIDER 0
LV_USE_SPAN 0
LV_USE_SPINBOX 0
LV_USE_SPINNER 0
LV_USE_SWITCH 0
LV_USE_TEXTAREA 1
LV_TEXTAREA_DEF_PWD_SHOW_TIME 0 /*ms*/
LV_USE_TABLE 0
LV_USE_TABVIEW 0
LV_USE_TILEVIEW 0
LV_USE_WIN 0
LV_USE_THEME_DEFAULT 0
LV_USE_THEME_SIMPLE 0
LV_USE_THEME_MONO 0
LV_USE_FLEX 1
LV_USE_GRID 0
LV_USE_LINUX_FBDEV 1
LV_LINUX_FBDEV_BSD 0
LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL
LV_USE_LINUX_DRM 0
LV_USE_LIBINPUT 1
LV_LIBINPUT_BSD 0
LV_LIBINPUT_XKB 1
LV_BUILD_EXAMPLES 0

File diff suppressed because it is too large Load Diff

View File

@@ -18,6 +18,7 @@
#include "lvgl/lvgl.h" #include "lvgl/lvgl.h"
#include <pthread.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -25,7 +26,6 @@
#include <unistd.h> #include <unistd.h>
#include <sys/reboot.h> #include <sys/reboot.h>
#include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
@@ -40,18 +40,20 @@ bool is_alternate_theme = false;
bool is_password_obscured = true; bool is_password_obscured = true;
bool is_keyboard_hidden = false; bool is_keyboard_hidden = false;
lv_obj_t *container = NULL;
lv_obj_t *keyboard = NULL; lv_obj_t *keyboard = NULL;
int32_t content_height_with_kb;
int32_t content_height_without_kb;
int32_t content_pad_bottom_with_kb;
int32_t content_pad_bottom_without_kb;
/** /**
* Static prototypes * Static prototypes
*/ */
/**
* Function to invoke in the tick generation thread.
*
* @param args unused
*/
static void *tick_thread (void *args);
/** /**
* Handle LV_EVENT_CLICKED events from the theme toggle button. * Handle LV_EVENT_CLICKED events from the theme toggle button.
* *
@@ -117,13 +119,12 @@ static void toggle_keyboard_hidden(void);
static void set_keyboard_hidden(bool is_hidden); static void set_keyboard_hidden(bool is_hidden);
/** /**
* Callback for the pad animation. * Callback for the keyboard's vertical slide in / out animation.
* *
* @param obj container widget * @param obj keyboard widget
* @param value the current value of the pad * @param value y position
*/ */
static void keyboard_anim_y_cb(void *obj, int32_t value);
static void pad_anim_cb(void *obj, int32_t value);
/** /**
* Handle LV_EVENT_VALUE_CHANGED events from the keyboard layout dropdown. * Handle LV_EVENT_VALUE_CHANGED events from the keyboard layout dropdown.
@@ -198,6 +199,16 @@ static void sigaction_handler(int signum);
* Static functions * Static functions
*/ */
static void *tick_thread (void *args) {
LV_UNUSED(args);
while (1) {
usleep(5 * 1000); /* Sleep for 5 millisecond */
lv_tick_inc(5); /* Tell LVGL that 5 milliseconds have elapsed */
}
return NULL;
}
static void toggle_theme_btn_clicked_cb(lv_event_t *event) { static void toggle_theme_btn_clicked_cb(lv_event_t *event) {
LV_UNUSED(event); LV_UNUSED(event);
toggle_theme(); toggle_theme();
@@ -243,43 +254,22 @@ static void toggle_keyboard_hidden(void) {
static void set_keyboard_hidden(bool is_hidden) { static void set_keyboard_hidden(bool is_hidden) {
if (!conf_opts.general.animations) { if (!conf_opts.general.animations) {
lv_obj_set_height(container, is_hidden? content_height_without_kb : content_height_with_kb); lv_obj_set_y(keyboard, is_hidden ? lv_obj_get_height(keyboard) : 0);
lv_obj_set_style_pad_bottom(container,
is_hidden? content_pad_bottom_without_kb : content_pad_bottom_with_kb, LV_PART_MAIN);
return; return;
} }
lv_anim_t keyboard_anim; lv_anim_t keyboard_anim;
lv_anim_init(&keyboard_anim); lv_anim_init(&keyboard_anim);
lv_anim_set_var(&keyboard_anim, container); lv_anim_set_var(&keyboard_anim, keyboard);
lv_anim_set_exec_cb(&keyboard_anim, (lv_anim_exec_xcb_t) lv_obj_set_height); lv_anim_set_values(&keyboard_anim, is_hidden ? 0 : lv_obj_get_height(keyboard), is_hidden ? lv_obj_get_height(keyboard) : 0);
lv_anim_set_path_cb(&keyboard_anim, lv_anim_path_ease_out); lv_anim_set_path_cb(&keyboard_anim, lv_anim_path_ease_out);
lv_anim_set_time(&keyboard_anim, 500); lv_anim_set_time(&keyboard_anim, 500);
lv_anim_set_exec_cb(&keyboard_anim, keyboard_anim_y_cb);
lv_anim_set_values(&keyboard_anim,
is_hidden? content_height_with_kb : content_height_without_kb,
is_hidden? content_height_without_kb : content_height_with_kb);
lv_anim_start(&keyboard_anim); lv_anim_start(&keyboard_anim);
if (content_pad_bottom_with_kb != content_pad_bottom_without_kb) {
lv_anim_t pad_anim;
lv_anim_init(&pad_anim);
lv_anim_set_var(&pad_anim, container);
lv_anim_set_exec_cb(&pad_anim, pad_anim_cb);
lv_anim_set_path_cb(&pad_anim, lv_anim_path_ease_out);
lv_anim_set_time(&pad_anim, 500);
lv_anim_set_values(&pad_anim,
is_hidden? content_pad_bottom_with_kb : content_pad_bottom_without_kb,
is_hidden? content_pad_bottom_without_kb : content_pad_bottom_with_kb);
lv_anim_start(&pad_anim);
}
} }
static void pad_anim_cb(void *obj, int32_t value) { static void keyboard_anim_y_cb(void *obj, int32_t value) {
lv_obj_set_style_pad_bottom(obj, value, LV_PART_MAIN); lv_obj_set_y(obj, value);
} }
static void layout_dropdown_value_changed_cb(lv_event_t *event) { static void layout_dropdown_value_changed_cb(lv_event_t *event) {
@@ -323,8 +313,8 @@ static void shutdown_mbox_declined_cb(lv_event_t *event) {
static void keyboard_value_changed_cb(lv_event_t *event) { static void keyboard_value_changed_cb(lv_event_t *event) {
lv_obj_t *kb = lv_event_get_target(event); lv_obj_t *kb = lv_event_get_target(event);
uint16_t btn_id = lv_buttonmatrix_get_selected_button(kb); uint16_t btn_id = lv_btnmatrix_get_selected_btn(kb);
if (btn_id == LV_BUTTONMATRIX_BUTTON_NONE) { if (btn_id == LV_BTNMATRIX_BTN_NONE) {
return; return;
} }
@@ -346,11 +336,11 @@ static void textarea_ready_cb(lv_event_t *event) {
static void print_password_and_exit(lv_obj_t *textarea) { static void print_password_and_exit(lv_obj_t *textarea) {
/* Print the password to STDOUT */ /* Print the password to STDOUT */
printf(cli_opts.newline? "%s\n" : "%s", lv_textarea_get_text(textarea)); printf("%s\n", lv_textarea_get_text(textarea));
/* Clear the screen so that when the password field was unobscured, it cannot /* Clear the screen so that when the password field was unobscured, it cannot
* leak via stale display buffers after we've exited */ * leak via stale display buffers after we've exited */
lv_obj_t *rect = lv_obj_create(lv_screen_active()); lv_obj_t *rect = lv_obj_create(lv_scr_act());
lv_obj_set_size(rect, LV_PCT(100), LV_PCT(100)); lv_obj_set_size(rect, LV_PCT(100), LV_PCT(100));
lv_obj_set_pos(rect, 0, 0); lv_obj_set_pos(rect, 0, 0);
lv_obj_set_style_bg_opa(rect, LV_OPA_COVER, LV_PART_MAIN); lv_obj_set_style_bg_opa(rect, LV_OPA_COVER, LV_PART_MAIN);
@@ -389,13 +379,6 @@ int main(int argc, char *argv[]) {
/* Announce ourselves */ /* Announce ourselves */
bbx_log(BBX_LOG_LEVEL_VERBOSE, "unl0kr %s", PROJECT_VERSION); bbx_log(BBX_LOG_LEVEL_VERBOSE, "unl0kr %s", PROJECT_VERSION);
/* Check that we have access to the clock */
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) {
bbx_log(BBX_LOG_LEVEL_ERROR, "Unable to read the clock");
exit(EXIT_FAILURE);
}
/* Parse config files */ /* Parse config files */
ul_config_init_opts(&conf_opts); ul_config_init_opts(&conf_opts);
ul_config_parse_file("/usr/share/unl0kr/unl0kr.conf", &conf_opts); ul_config_parse_file("/usr/share/unl0kr/unl0kr.conf", &conf_opts);
@@ -416,6 +399,10 @@ int main(int argc, char *argv[]) {
lv_init(); lv_init();
lv_log_register_print_cb(bbx_log_print_cb); lv_log_register_print_cb(bbx_log_print_cb);
/* Start the tick thread */
pthread_t ticker;
pthread_create(&ticker, NULL, tick_thread, NULL);
/* Initialise display */ /* Initialise display */
lv_display_t *disp = NULL; lv_display_t *disp = NULL;
switch (conf_opts.general.backend) { switch (conf_opts.general.backend) {
@@ -433,23 +420,7 @@ int main(int argc, char *argv[]) {
case UL_BACKENDS_BACKEND_DRM: case UL_BACKENDS_BACKEND_DRM:
bbx_log(BBX_LOG_LEVEL_VERBOSE, "Using DRM backend"); bbx_log(BBX_LOG_LEVEL_VERBOSE, "Using DRM backend");
disp = lv_linux_drm_create(); disp = lv_linux_drm_create();
lv_linux_drm_set_file(disp, "/dev/dri/card0", -1);
char *format_string = "/dev/dri/card%d";
char drm_path[16] = {0};
struct stat buffer;
for (size_t i = 0; i < 9; i++) {
sprintf(drm_path, format_string, i);
if (stat(drm_path, &buffer) != 0) {
continue;
}
lv_linux_drm_set_file(disp, drm_path, -1);
break;
}
break; break;
#endif /* LV_USE_LINUX_DRM */ #endif /* LV_USE_LINUX_DRM */
default: default:
@@ -460,15 +431,16 @@ int main(int argc, char *argv[]) {
/* Override display properties with command line options if necessary */ /* Override display properties with command line options if necessary */
lv_display_set_offset(disp, cli_opts.x_offset, cli_opts.y_offset); lv_display_set_offset(disp, cli_opts.x_offset, cli_opts.y_offset);
if (cli_opts.hor_res > 0 || cli_opts.ver_res > 0) { if (cli_opts.hor_res > 0 || cli_opts.ver_res > 0) {
lv_display_set_physical_resolution(disp, lv_display_get_horizontal_resolution(disp), lv_display_get_vertical_resolution(disp)); lv_display_set_physical_resolution(disp, lv_disp_get_hor_res(disp), lv_disp_get_ver_res(disp));
lv_display_set_resolution(disp, cli_opts.hor_res, cli_opts.ver_res); lv_display_set_resolution(disp, cli_opts.hor_res, cli_opts.ver_res);
} }
if (cli_opts.dpi > 0) { if (cli_opts.dpi > 0) {
lv_display_set_dpi(disp, cli_opts.dpi); lv_display_set_dpi(disp, cli_opts.dpi);
} }
/* Set up display rotation */ /* Store final display resolution for convenient later access */
lv_display_set_rotation(disp, cli_opts.rotation); const uint32_t hor_res = lv_disp_get_hor_res(disp);
const uint32_t ver_res = lv_disp_get_ver_res(disp);
/* Prepare for routing physical keyboard input into the textarea */ /* Prepare for routing physical keyboard input into the textarea */
lv_group_t *keyboard_input_group = lv_group_create(); lv_group_t *keyboard_input_group = lv_group_create();
@@ -485,33 +457,40 @@ int main(int argc, char *argv[]) {
/* Initialise theme */ /* Initialise theme */
set_theme(is_alternate_theme); set_theme(is_alternate_theme);
/* Figure out a few numbers for sizing and positioning */
const int32_t hor_res = lv_display_get_horizontal_resolution(disp);
const int32_t ver_res = lv_display_get_vertical_resolution(disp);
const int32_t keyboard_height = ver_res > hor_res ? ver_res / 2.5 : ver_res / 1.8; /* Height for 5 rows */
/* Prevent scrolling when keyboard is off-screen */ /* Prevent scrolling when keyboard is off-screen */
lv_obj_t *screen = lv_screen_active(); lv_obj_clear_flag(lv_scr_act(), LV_OBJ_FLAG_SCROLLABLE);
lv_theme_apply(screen);
lv_obj_set_flex_flow(screen, LV_FLEX_FLOW_COLUMN); /* Figure out a few numbers for sizing and positioning */
lv_obj_remove_flag(screen, LV_OBJ_FLAG_SCROLLABLE); const int base_keyboard_height = ver_res > hor_res ? ver_res / 3 : ver_res / 2; /* Height for 4 rows */
const int keyboard_height = base_keyboard_height * 1.25; /* Add space for an extra top row */
const int padding = keyboard_height / 10;
const int textarea_container_max_width = LV_MIN(hor_res, ver_res);
/* Main flexbox */
lv_obj_t *container = lv_obj_create(lv_scr_act());
lv_obj_set_flex_flow(container, LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(container, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
lv_obj_set_size(container, LV_PCT(100), ver_res - keyboard_height);
lv_obj_set_pos(container, 0, 0);
lv_obj_clear_flag(container, LV_OBJ_FLAG_SCROLLABLE);
/* Header flexbox */ /* Header flexbox */
lv_obj_t *header = lv_obj_create(screen); lv_obj_t *header = lv_obj_create(container);
lv_obj_add_flag(header, BBX_WIDGET_HEADER); lv_obj_add_flag(header, BBX_WIDGET_HEADER);
lv_theme_apply(header); /* Force re-apply theme after setting flag so that the widget can be identified */ lv_theme_apply(header); /* Force re-apply theme after setting flag so that the widget can be identified */
lv_obj_set_flex_flow(header, LV_FLEX_FLOW_ROW); lv_obj_set_flex_flow(header, LV_FLEX_FLOW_ROW);
lv_obj_set_flex_align(header, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
lv_obj_set_size(header, LV_PCT(100), LV_SIZE_CONTENT); lv_obj_set_size(header, LV_PCT(100), LV_SIZE_CONTENT);
/* Theme switcher button */ /* Theme switcher button */
lv_obj_t *toggle_theme_btn = lv_button_create(header); lv_obj_t *toggle_theme_btn = lv_btn_create(header);
lv_obj_add_event_cb(toggle_theme_btn, toggle_theme_btn_clicked_cb, LV_EVENT_CLICKED, NULL); lv_obj_add_event_cb(toggle_theme_btn, toggle_theme_btn_clicked_cb, LV_EVENT_CLICKED, NULL);
lv_obj_t *toggle_theme_btn_label = lv_label_create(toggle_theme_btn); lv_obj_t *toggle_theme_btn_label = lv_label_create(toggle_theme_btn);
lv_label_set_text(toggle_theme_btn_label, UL_SYMBOL_ADJUST); lv_label_set_text(toggle_theme_btn_label, UL_SYMBOL_ADJUST);
lv_obj_center(toggle_theme_btn_label); lv_obj_center(toggle_theme_btn_label);
/* Show / hide keyboard button */ /* Show / hide keyboard button */
lv_obj_t *toggle_kb_btn = lv_button_create(header); lv_obj_t *toggle_kb_btn = lv_btn_create(header);
lv_obj_add_event_cb(toggle_kb_btn, toggle_kb_btn_clicked_cb, LV_EVENT_CLICKED, NULL); lv_obj_add_event_cb(toggle_kb_btn, toggle_kb_btn_clicked_cb, LV_EVENT_CLICKED, NULL);
lv_obj_t *toggle_kb_btn_label = lv_label_create(toggle_kb_btn); lv_obj_t *toggle_kb_btn_label = lv_label_create(toggle_kb_btn);
lv_label_set_text(toggle_kb_btn_label, LV_SYMBOL_KEYBOARD); lv_label_set_text(toggle_kb_btn_label, LV_SYMBOL_KEYBOARD);
@@ -529,58 +508,25 @@ int main(int argc, char *argv[]) {
lv_obj_set_flex_grow(spacer, 1); lv_obj_set_flex_grow(spacer, 1);
/* Shutdown button */ /* Shutdown button */
lv_obj_t *shutdown_btn = lv_button_create(header); lv_obj_t *shutdown_btn = lv_btn_create(header);
lv_obj_add_event_cb(shutdown_btn, shutdown_btn_clicked_cb, LV_EVENT_CLICKED, NULL); lv_obj_add_event_cb(shutdown_btn, shutdown_btn_clicked_cb, LV_EVENT_CLICKED, NULL);
lv_obj_t *shutdown_btn_label = lv_label_create(shutdown_btn); lv_obj_t *shutdown_btn_label = lv_label_create(shutdown_btn);
lv_label_set_text(shutdown_btn_label, LV_SYMBOL_POWER); lv_label_set_text(shutdown_btn_label, LV_SYMBOL_POWER);
lv_obj_center(shutdown_btn_label); lv_obj_center(shutdown_btn_label);
lv_obj_update_layout(layout_dropdown); /* Flexible spacer */
const int32_t dropwdown_height = lv_obj_get_height(layout_dropdown); lv_obj_t *flexible_spacer = lv_obj_create(container);
lv_obj_set_size(toggle_theme_btn, dropwdown_height, dropwdown_height); lv_obj_set_size(flexible_spacer, LV_PCT(100), 0);
lv_obj_set_size(toggle_kb_btn, dropwdown_height, dropwdown_height); lv_obj_set_flex_grow(flexible_spacer, 1);
lv_obj_set_size(shutdown_btn, dropwdown_height, dropwdown_height);
lv_obj_update_layout(header);
content_height_without_kb = ver_res - lv_obj_get_height(header);
content_height_with_kb = content_height_without_kb - keyboard_height;
/* Container for a message and an input field */
container = lv_obj_create(screen);
lv_obj_set_flex_flow(container, LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(container, LV_FLEX_ALIGN_END, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START);
lv_obj_set_size(container, LV_PCT(100), is_keyboard_hidden? content_height_without_kb : content_height_with_kb);
lv_obj_set_style_pad_top(container, 10, LV_PART_MAIN);
lv_obj_set_style_pad_left(container, 20, LV_PART_MAIN);
lv_obj_set_style_pad_right(container, 20, LV_PART_MAIN);
int32_t content_pad_row = 10;
/* Message for a user */
lv_obj_t *message_label = NULL;
if (cli_opts.message) {
lv_obj_set_style_pad_row(container, content_pad_row, LV_PART_MAIN);
/* lv_label does not support wrapping and scrolling simultaneously,
so we place it in a scrollable container */
lv_obj_t *message_container = lv_obj_create(container);
lv_obj_set_width(message_container, LV_PCT(100));
lv_obj_set_flex_flow(message_container, LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_grow(message_container, 1);
lv_obj_t *message_spacer = lv_obj_create(message_container);
lv_obj_set_width(message_spacer, 0);
lv_obj_set_flex_grow(message_spacer, 1);
message_label = lv_label_create(message_container);
lv_obj_set_size(message_label, LV_PCT(100), LV_SIZE_CONTENT);
lv_label_set_text(message_label, cli_opts.message);
}
/* Textarea flexbox */ /* Textarea flexbox */
lv_obj_t *textarea_container = lv_obj_create(container); lv_obj_t *textarea_container = lv_obj_create(container);
lv_obj_set_size(textarea_container, LV_PCT(100), LV_SIZE_CONTENT); lv_obj_set_size(textarea_container, LV_PCT(100), LV_SIZE_CONTENT);
lv_obj_set_style_max_width(textarea_container, textarea_container_max_width, LV_PART_MAIN);
lv_obj_set_flex_flow(textarea_container, LV_FLEX_FLOW_ROW); lv_obj_set_flex_flow(textarea_container, LV_FLEX_FLOW_ROW);
lv_obj_set_flex_align(textarea_container, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
lv_obj_set_style_pad_left(textarea_container, padding, LV_PART_MAIN);
lv_obj_set_style_pad_right(textarea_container, padding, LV_PART_MAIN);
/* Textarea */ /* Textarea */
lv_obj_t *textarea = lv_textarea_create(textarea_container); lv_obj_t *textarea = lv_textarea_create(textarea_container);
@@ -595,34 +541,27 @@ int main(int argc, char *argv[]) {
/* Route physical keyboard input into textarea */ /* Route physical keyboard input into textarea */
lv_group_add_obj(keyboard_input_group, textarea); lv_group_add_obj(keyboard_input_group, textarea);
lv_obj_update_layout(textarea);
const int32_t textarea_height = lv_obj_get_height(textarea);
/* Reveal / obscure password button */ /* Reveal / obscure password button */
lv_obj_t *toggle_pw_btn = lv_button_create(textarea_container); lv_obj_t *toggle_pw_btn = lv_btn_create(textarea_container);
const int textarea_height = lv_obj_get_height(textarea);
lv_obj_set_size(toggle_pw_btn, textarea_height, textarea_height); lv_obj_set_size(toggle_pw_btn, textarea_height, textarea_height);
lv_obj_t *toggle_pw_btn_label = lv_label_create(toggle_pw_btn); lv_obj_t *toggle_pw_btn_label = lv_label_create(toggle_pw_btn);
lv_obj_center(toggle_pw_btn_label); lv_obj_center(toggle_pw_btn_label);
lv_label_set_text(toggle_pw_btn_label, LV_SYMBOL_EYE_OPEN); lv_label_set_text(toggle_pw_btn_label, LV_SYMBOL_EYE_OPEN);
lv_obj_add_event_cb(toggle_pw_btn, toggle_pw_btn_clicked_cb, LV_EVENT_CLICKED, NULL); lv_obj_add_event_cb(toggle_pw_btn, toggle_pw_btn_clicked_cb, LV_EVENT_CLICKED, NULL);
/* The bottom pad is used to center content when the keyboard is hidden */ /* Set header button size to match dropdown (for some reason the height is only available here) */
content_pad_bottom_with_kb = 20; const int dropwdown_height = lv_obj_get_height(layout_dropdown);
lv_obj_set_size(toggle_theme_btn, dropwdown_height, dropwdown_height);
lv_obj_set_size(toggle_kb_btn, dropwdown_height, dropwdown_height);
lv_obj_set_size(shutdown_btn, dropwdown_height, dropwdown_height);
int32_t content_native_height = textarea_height; /* Fixed spacer */
if (cli_opts.message) { lv_obj_t *fixed_spacer = lv_obj_create(container);
lv_obj_update_layout(message_label); lv_obj_set_size(fixed_spacer, LV_PCT(100), padding);
content_native_height += content_pad_row + lv_obj_get_height(message_label);
}
content_pad_bottom_without_kb = (content_height_without_kb - content_native_height) / 2;
if (content_pad_bottom_without_kb < content_pad_bottom_with_kb)
content_pad_bottom_without_kb = content_pad_bottom_with_kb;
lv_obj_set_style_pad_bottom(container, is_keyboard_hidden? content_pad_bottom_without_kb : content_pad_bottom_with_kb, LV_PART_MAIN);
/* Keyboard (after textarea / label so that key popovers are not drawn over) */ /* Keyboard (after textarea / label so that key popovers are not drawn over) */
keyboard = lv_keyboard_create(screen); keyboard = lv_keyboard_create(lv_scr_act());
lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_TEXT_LOWER); lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_TEXT_LOWER);
lv_keyboard_set_textarea(keyboard, textarea); lv_keyboard_set_textarea(keyboard, textarea);
uint32_t num_keyboard_events = lv_obj_get_event_count(keyboard); uint32_t num_keyboard_events = lv_obj_get_event_count(keyboard);
@@ -634,7 +573,8 @@ int main(int argc, char *argv[]) {
} }
lv_obj_add_event_cb(keyboard, keyboard_value_changed_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_add_event_cb(keyboard, keyboard_value_changed_cb, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_add_event_cb(keyboard, keyboard_ready_cb, LV_EVENT_READY, NULL); lv_obj_add_event_cb(keyboard, keyboard_ready_cb, LV_EVENT_READY, NULL);
lv_obj_set_size(keyboard, LV_PCT(100), keyboard_height); lv_obj_set_pos(keyboard, 0, is_keyboard_hidden ? keyboard_height : 0);
lv_obj_set_size(keyboard, hor_res, keyboard_height);
bbx_theme_prepare_keyboard(keyboard); bbx_theme_prepare_keyboard(keyboard);
/* Apply textarea options */ /* Apply textarea options */
@@ -650,19 +590,12 @@ int main(int argc, char *argv[]) {
/* Periodically run timer / task handler */ /* Periodically run timer / task handler */
uint32_t timeout = conf_opts.general.timeout * 1000; /* ms */ uint32_t timeout = conf_opts.general.timeout * 1000; /* ms */
while(1) { while(1) {
uint32_t time_till_next = lv_timer_handler(); if (!timeout || lv_disp_get_inactive_time(NULL) < timeout) {
uint32_t time_till_next = lv_timer_handler();
if (timeout != 0) { usleep(time_till_next * 1000);
uint32_t time_idle = lv_display_get_inactive_time(NULL); } else if (timeout) {
if (time_idle >= timeout) shutdown();
shutdown();
uint32_t time_till_shutdown = timeout - time_idle;
if (time_till_shutdown < time_till_next)
time_till_next = time_till_shutdown;
} }
usleep(time_till_next * 1000);
} }
return 0; return 0;

View File

@@ -1,6 +1,8 @@
# Copyright 2021 Clayton Craft # Copyright 2021 Clayton Craft
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
depxkbcommon = dependency('xkbcommon')
unl0kr_sources = files( unl0kr_sources = files(
'backends.c', 'backends.c',
'command_line.c', 'command_line.c',
@@ -15,45 +17,18 @@ unl0kr_dependencies = [
depxkbcommon depxkbcommon
] ]
unl0kr_args = []
deplibdrm = dependency('libdrm', required: get_option('with-drm')) deplibdrm = dependency('libdrm', required: get_option('with-drm'))
if deplibdrm.found() if deplibdrm.found()
unl0kr_dependencies += deplibdrm unl0kr_dependencies += deplibdrm
unl0kr_args += '-DLV_USE_LINUX_DRM=1' add_project_arguments('-DLV_USE_LINUX_DRM=1', language: 'c')
else
unl0kr_args += '-DLV_USE_LINUX_DRM=0'
endif endif
executable('unl0kr', executable('unl0kr',
include_directories: common_include_dirs, include_directories: common_include_dirs,
sources: unl0kr_sources + shared_sources + squeek2lvgl_sources + lvgl_sources, sources: unl0kr_sources + shared_sources + squeek2lvgl_sources + lvgl_sources,
dependencies: unl0kr_dependencies, dependencies: unl0kr_dependencies,
c_args: unl0kr_args,
install: true install: true
) )
install_data('unl0kr.conf', install_dir: get_option('sysconfdir')) install_data('unl0kr.conf', install_dir: get_option('sysconfdir'))
depsystemd = dependency('systemd', required: get_option('systemd-password-agent'))
if depsystemd.found()
executable('unl0kr-agent',
sources: files('unl0kr-agent.c'),
dependencies: depinih,
c_args: '-DUNL0KR_BINARY="@0@"'.format(get_option('prefix') / get_option('bindir') / 'unl0kr'),
install: true,
install_dir: get_option('libexecdir')
)
system_unit_dir = depsystemd.get_variable(pkgconfig: 'systemd_system_unit_dir')
install_data('unl0kr-agent.path', install_dir: system_unit_dir)
configure_file(
configuration: {'LIBEXECDIR': get_option('prefix') / get_option('libexecdir')},
input: 'unl0kr-agent.service.in',
output: 'unl0kr-agent.service',
install: true,
install_dir: system_unit_dir
)
endif

View File

@@ -80,7 +80,7 @@ while read -r theme; do
readme="$readme"$'\n'"## $theme"$'\n\n' readme="$readme"$'\n'"## $theme"$'\n\n'
for res in ${resolutions[@]}; do for res in ${resolutions[@]}; do
$executable -m "Please enter a password to unlock the root volume" -g $res -C $config & $executable -g $res -C $config &
pid=$! pid=$!
sleep 3 # Wait for UI to render sleep 3 # Wait for UI to render

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Some files were not shown because too many files have changed in this diff Show More