Move cursor to shared component
This commit is contained in:
15
README.md
15
README.md
@@ -4,9 +4,17 @@ BuffyBox is a suite of graphical applications for the terminal.
|
|||||||
|
|
||||||
## Components
|
## Components
|
||||||
|
|
||||||
* [buffyboard] – Touch-enabled on-screen keyboard for virtual terminals
|
### Standalone apps
|
||||||
* [squeek2lvgl] – Converter for transforming [Squeekboard] layouts into [LVGL]-compatible C code
|
|
||||||
* [unl0kr] – Disk unlocking UI for the initramfs
|
**[buffyboard]** – Touch-enabled on-screen keyboard for virtual terminals
|
||||||
|
|
||||||
|
**[unl0kr]** – Disk unlocking UI for the initramfs
|
||||||
|
|
||||||
|
### Utilities
|
||||||
|
|
||||||
|
**[squeek2lvgl]** – Converter for transforming [Squeekboard] layouts into [LVGL]-compatible C code
|
||||||
|
|
||||||
|
**[shared]** – Internal code that is shared by some or all applications in the suite but not meant to be used externally
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
@@ -32,6 +40,7 @@ This project is licensed under the GNU General Public License as published by th
|
|||||||
[buffyboard]: ./buffyboard
|
[buffyboard]: ./buffyboard
|
||||||
[git-archive-all]: https://github.com/Kentzo/git-archive-all
|
[git-archive-all]: https://github.com/Kentzo/git-archive-all
|
||||||
[LVGL]: https://github.com/lvgl/lvgl
|
[LVGL]: https://github.com/lvgl/lvgl
|
||||||
|
[shared]: ./shared
|
||||||
[squeek2lvgl]: ./squeek2lvgl
|
[squeek2lvgl]: ./squeek2lvgl
|
||||||
[Squeekboard]: https://gitlab.gnome.org/World/Phosh/squeekboard
|
[Squeekboard]: https://gitlab.gnome.org/World/Phosh/squeekboard
|
||||||
[unl0kr]: ./unl0kr
|
[unl0kr]: ./unl0kr
|
||||||
|
@@ -92,10 +92,6 @@ Below is a short explanation of the different unicode ranges used above.
|
|||||||
- Standard `LV_SYMBOL_*` glyphs (`0xF001,0xF008,0xF00B,0xF00C,0xF00D,0xF011,0xF013,0xF015,0xF019,0xF01C,0xF021,0xF026,0xF027,0xF028,0xF03E,0xF0E0,0xF304,0xF043,0xF048,0xF04B,0xF04C,0xF04D,0xF051,0xF052,0xF053,0xF054,0xF067,0xF068,0xF06E,0xF070,0xF071,0xF074,0xF077,0xF078,0xF079,0xF07B,0xF093,0xF095,0xF0C4,0xF0C5,0xF0C7,0xF0C9,0xF0E7,0xF0EA,0xF0F3,0xF11C,0xF124,0xF158,0xF1EB,0xF240,0xF241,0xF242,0xF243,0xF244,0xF287,0xF293,0xF2ED,0xF55A,0xF7C2,0xF8A2`)
|
- Standard `LV_SYMBOL_*` glyphs (`0xF001,0xF008,0xF00B,0xF00C,0xF00D,0xF011,0xF013,0xF015,0xF019,0xF01C,0xF021,0xF026,0xF027,0xF028,0xF03E,0xF0E0,0xF304,0xF043,0xF048,0xF04B,0xF04C,0xF04D,0xF051,0xF052,0xF053,0xF054,0xF067,0xF068,0xF06E,0xF070,0xF071,0xF074,0xF077,0xF078,0xF079,0xF07B,0xF093,0xF095,0xF0C4,0xF0C5,0xF0C7,0xF0C9,0xF0E7,0xF0EA,0xF0F3,0xF11C,0xF124,0xF158,0xF1EB,0xF240,0xF241,0xF242,0xF243,0xF244,0xF287,0xF293,0xF2ED,0xF55A,0xF7C2,0xF8A2`)
|
||||||
- [arrow-alt-circle-up] (`0xF35B`)
|
- [arrow-alt-circle-up] (`0xF35B`)
|
||||||
|
|
||||||
## Mouse cursor
|
|
||||||
|
|
||||||
Buffyboard's mouse cursor is adapted from Ubuntu's [Yaru] theme suite. Similar to fonts, the mouse cursor image needs to be converted to LVGL-compatible C code. To do this, run `regenerate-cursor.sh` after any change of `cursor.png` to update the code.
|
|
||||||
|
|
||||||
## Keyboard layouts
|
## Keyboard layouts
|
||||||
|
|
||||||
Buffyboard uses [squeekboard layouts] converted to C via [squeek2lvgl]. To regenerate the layouts, ensure that you have pipenv installed (e.g. via `pip install --user pipenv`) and then run
|
Buffyboard uses [squeekboard layouts] converted to C via [squeek2lvgl]. To regenerate the layouts, ensure that you have pipenv installed (e.g. via `pip install --user pipenv`) and then run
|
||||||
@@ -143,4 +139,3 @@ The [FontAwesome] font is licensed under the Open Font License version 1.1.
|
|||||||
[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
|
[v1 milestone]: https://gitlab.com/cherrypicker/buffyboard/-/milestones/1
|
||||||
[wiki]: https://gitlab.com/cherrypicker/buffyboard/-/wikis/home
|
[wiki]: https://gitlab.com/cherrypicker/buffyboard/-/wikis/home
|
||||||
[Yaru]: https://github.com/ubuntu/yaru
|
|
||||||
|
@@ -4,10 +4,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "cursor.h"
|
|
||||||
#include "indev.h"
|
#include "indev.h"
|
||||||
|
|
||||||
#include "../lvgl/lvgl.h"
|
#include "../shared/cursor/cursor.h"
|
||||||
|
|
||||||
|
#include "lvgl/lvgl.h"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
project(
|
project(
|
||||||
'buffyboard',
|
'buffyboard',
|
||||||
'c',
|
'c',
|
||||||
version: '0.2.0',
|
version: '3.0.0',
|
||||||
default_options: 'warning_level=1',
|
default_options: 'warning_level=1',
|
||||||
meson_version: '>=0.53.0'
|
meson_version: '>=0.53.0'
|
||||||
)
|
)
|
||||||
@@ -14,7 +14,6 @@ add_project_arguments('-DBB_VERSION="@0@"'.format(meson.project_version()), lang
|
|||||||
|
|
||||||
buffyboard_sources = [
|
buffyboard_sources = [
|
||||||
'command_line.c',
|
'command_line.c',
|
||||||
'cursor.c',
|
|
||||||
'font_32.c',
|
'font_32.c',
|
||||||
'indev.c',
|
'indev.c',
|
||||||
'main.c',
|
'main.c',
|
||||||
@@ -23,6 +22,10 @@ buffyboard_sources = [
|
|||||||
'uinput_device.c',
|
'uinput_device.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
shared_sources = [
|
||||||
|
'../shared/cursor/cursor.c'
|
||||||
|
]
|
||||||
|
|
||||||
squeek2lvgl_sources = [
|
squeek2lvgl_sources = [
|
||||||
'../squeek2lvgl/sq2lv.c',
|
'../squeek2lvgl/sq2lv.c',
|
||||||
]
|
]
|
||||||
@@ -31,7 +34,7 @@ lvgl_sources = run_command('../find-lvgl-sources.sh', '../lvgl', check: true).st
|
|||||||
|
|
||||||
executable(
|
executable(
|
||||||
'buffyboard',
|
'buffyboard',
|
||||||
sources: buffyboard_sources + squeek2lvgl_sources + lvgl_sources,
|
sources: buffyboard_sources + shared_sources + squeek2lvgl_sources + lvgl_sources,
|
||||||
include_directories: ['..'],
|
include_directories: ['..'],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
dependency('libinput'),
|
dependency('libinput'),
|
||||||
|
@@ -15,8 +15,13 @@ 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 meson.build"
|
echo "Error: Version $1 differs from version in buffyboard/meson.build"
|
||||||
|
exit 1
|
||||||
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
6
shared/cursor/README.md
Normal file
6
shared/cursor/README.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Mouse Cursor
|
||||||
|
============
|
||||||
|
|
||||||
|
This is the mouse cursor image used in BuffyBox applications. The bitmap is adapted from Ubuntu's [Yaru] theme suite. Similar to fonts, the cursor image needs to be converted to LVGL-compatible C code before it can be used. Therefore, after any change to `cursor.png`, run `regenerate.sh` to recreate `cursor.c`.
|
||||||
|
|
||||||
|
[Yaru]: https://github.com/ubuntu/yaru
|
@@ -17,11 +17,11 @@
|
|||||||
#define LV_ATTRIBUTE_MEM_ALIGN
|
#define LV_ATTRIBUTE_MEM_ALIGN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LV_ATTRIBUTE_IMG_UL_CURSOR_IMG_DSC
|
#ifndef LV_ATTRIBUTE_IMG_BB_CURSOR_IMG_DSC
|
||||||
#define LV_ATTRIBUTE_IMG_UL_CURSOR_IMG_DSC
|
#define LV_ATTRIBUTE_IMG_BB_CURSOR_IMG_DSC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_UL_CURSOR_IMG_DSC uint8_t ul_cursor_img_dsc_map[] = {
|
const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_BB_CURSOR_IMG_DSC uint8_t bb_cursor_img_dsc_map[] = {
|
||||||
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
|
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
|
||||||
/*Pixel format: Alpha 8 bit, Red: 3 bit, Green: 3 bit, Blue: 2 bit*/
|
/*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,
|
0xff, 0xf7, 0xff, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
@@ -107,9 +107,9 @@ const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_UL_CURSOR
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
const lv_img_dsc_t ul_cursor_img_dsc = {
|
const lv_img_dsc_t bb_cursor_img_dsc = {
|
||||||
.header.cf = LV_COLOR_FORMAT_NATIVE_WITH_ALPHA,
|
.header.cf = LV_COLOR_FORMAT_NATIVE_WITH_ALPHA,
|
||||||
.header.w = 12,
|
.header.w = 12,
|
||||||
.header.h = 18,
|
.header.h = 18,
|
||||||
.data = ul_cursor_img_dsc_map,
|
.data = bb_cursor_img_dsc_map,
|
||||||
};
|
};
|
@@ -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_img_dsc_t ul_cursor_img_dsc;
|
extern const lv_img_dsc_t bb_cursor_img_dsc;
|
||||||
|
|
||||||
#endif /* UL_CURSOR_H */
|
#endif /* UL_CURSOR_H */
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "unl0kr",
|
"name": "shared",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
@@ -153,11 +153,6 @@ Below is a short explanation of the different unicode ranges used above.
|
|||||||
- [arrow-alt-circle-up](https://fontawesome.com/v5/icons/arrow-alt-circle-up) (`0xF35B`)
|
- [arrow-alt-circle-up](https://fontawesome.com/v5/icons/arrow-alt-circle-up) (`0xF35B`)
|
||||||
- [chevron-left](https://fontawesome.com/v5/icons/chevron-left) (`0xF053`)
|
- [chevron-left](https://fontawesome.com/v5/icons/chevron-left) (`0xF053`)
|
||||||
|
|
||||||
|
|
||||||
## Mouse cursor
|
|
||||||
|
|
||||||
Unl0kr's mouse cursor is adapted from Ubuntu's [Yaru] theme suite. Similar to fonts, the mouse cursor image needs to be converted to LVGL-compatible C code. To do this, run `regenerate-cursor.sh` after any change of `cursor.png` to update the code.
|
|
||||||
|
|
||||||
## Keyboard layouts
|
## Keyboard layouts
|
||||||
|
|
||||||
Unl0kr uses [squeekboard layouts] converted to C via [squeek2lvgl]. To regenerate the layouts, ensure that you have pipenv installed (e.g. via `pip install --user pipenv`) and then run
|
Unl0kr uses [squeekboard layouts] converted to C via [squeek2lvgl]. To regenerate the layouts, ensure that you have pipenv installed (e.g. via `pip install --user pipenv`) and then run
|
||||||
@@ -220,4 +215,3 @@ The [FontAwesome] font is licensed under the Open Font License version 1.1.
|
|||||||
[squeek2lvgl]: ../squeek2lvgl
|
[squeek2lvgl]: ../squeek2lvgl
|
||||||
[squeekboard layouts]: https://gitlab.gnome.org/World/Phosh/squeekboard/-/tree/master/data/keyboards
|
[squeekboard layouts]: https://gitlab.gnome.org/World/Phosh/squeekboard/-/tree/master/data/keyboards
|
||||||
[unl0kr.conf]: ./unl0kr.conf
|
[unl0kr.conf]: ./unl0kr.conf
|
||||||
[Yaru]: https://github.com/ubuntu/yaru
|
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <ini.h>
|
#include <ini.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "../squeek2lvgl/sq2lv.h"
|
#include "../squeek2lvgl/sq2lv.h"
|
||||||
|
|
||||||
|
@@ -6,15 +6,17 @@
|
|||||||
|
|
||||||
#include "indev.h"
|
#include "indev.h"
|
||||||
|
|
||||||
#include "cursor.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
#include "../shared/cursor/cursor.h"
|
||||||
|
|
||||||
#include "lvgl/src/indev/lv_indev_private.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>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
|
|
||||||
@@ -353,7 +355,7 @@ 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_img_create(lv_scr_act());
|
cursor_obj = lv_img_create(lv_scr_act());
|
||||||
lv_img_set_src(cursor_obj, &ul_cursor_img_dsc);
|
lv_img_set_src(cursor_obj, &bb_cursor_img_dsc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply the cursor image */
|
/* Apply the cursor image */
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <sys/reboot.h>
|
#include <sys/reboot.h>
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
project(
|
project(
|
||||||
'unl0kr',
|
'unl0kr',
|
||||||
'c',
|
'c',
|
||||||
version: '2.0.2',
|
version: '3.0.0',
|
||||||
default_options: 'warning_level=3',
|
default_options: 'warning_level=3',
|
||||||
meson_version: '>=0.53.0'
|
meson_version: '>=0.53.0'
|
||||||
)
|
)
|
||||||
@@ -16,7 +16,6 @@ unl0kr_sources = [
|
|||||||
'backends.c',
|
'backends.c',
|
||||||
'command_line.c',
|
'command_line.c',
|
||||||
'config.c',
|
'config.c',
|
||||||
'cursor.c',
|
|
||||||
'font_32.c',
|
'font_32.c',
|
||||||
'indev.c',
|
'indev.c',
|
||||||
'log.c',
|
'log.c',
|
||||||
@@ -27,6 +26,10 @@ unl0kr_sources = [
|
|||||||
'themes.c',
|
'themes.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
shared_sources = [
|
||||||
|
'../shared/cursor/cursor.c'
|
||||||
|
]
|
||||||
|
|
||||||
squeek2lvgl_sources = [
|
squeek2lvgl_sources = [
|
||||||
'../squeek2lvgl/sq2lv.c',
|
'../squeek2lvgl/sq2lv.c',
|
||||||
]
|
]
|
||||||
@@ -55,7 +58,7 @@ install_data(sources: 'unl0kr.conf', install_dir : get_option('sysconfdir'))
|
|||||||
|
|
||||||
executable(
|
executable(
|
||||||
'unl0kr',
|
'unl0kr',
|
||||||
sources: unl0kr_sources + squeek2lvgl_sources + lvgl_sources,
|
sources: unl0kr_sources + shared_sources + squeek2lvgl_sources + lvgl_sources,
|
||||||
include_directories: ['..'],
|
include_directories: ['..'],
|
||||||
dependencies: unl0kr_dependencies,
|
dependencies: unl0kr_dependencies,
|
||||||
install: true
|
install: true
|
||||||
|
@@ -1,22 +0,0 @@
|
|||||||
#!/bin/sh -ex
|
|
||||||
|
|
||||||
# Copyright 2023 Johannes Marbach
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
|
|
||||||
npm i
|
|
||||||
|
|
||||||
./node_modules/lv_img_conv/lv_img_conv.js -f \
|
|
||||||
-i ul_cursor_img_dsc \
|
|
||||||
-c CF_TRUE_COLOR_ALPHA \
|
|
||||||
-o cursor.c \
|
|
||||||
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
|
|
@@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#include "themes.h"
|
#include "themes.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static variables
|
* Static variables
|
||||||
|
Reference in New Issue
Block a user