Restore software rotation

Fixes: #26
This commit is contained in:
Johannes Marbach
2024-03-21 14:27:20 +01:00
parent 7285fb9e04
commit 785e831063
5 changed files with 25 additions and 27 deletions

View File

@@ -54,8 +54,8 @@ static void auto_connect(lv_libinput_capability capability, int max_num_devs, in
*/ */
static void auto_connect(lv_libinput_capability capability, int max_num_devs, int *num_devs, char *devs[], lv_indev_t *indevs[]) { static void auto_connect(lv_libinput_capability capability, int max_num_devs, int *num_devs, char *devs[], lv_indev_t *indevs[]) {
memset(devs, 0, max_num_devs * sizeof(char *)); lv_memset(devs, 0, max_num_devs * sizeof(char *));
memset(indevs, 0, max_num_devs * sizeof(lv_indev_t *)); lv_memset(indevs, 0, max_num_devs * sizeof(lv_indev_t *));
*num_devs = lv_libinput_find_devs(capability, devs, max_num_devs, false); *num_devs = lv_libinput_find_devs(capability, devs, max_num_devs, false);

View File

@@ -238,7 +238,7 @@ int main(int argc, char *argv[]) {
if (resize_terminals) { if (resize_terminals) {
/* Clean up on termination */ /* Clean up on termination */
struct sigaction action; struct sigaction action;
memset(&action, 0, sizeof(action)); lv_memset(&action, 0, sizeof(action));
action.sa_handler = sigaction_handler; action.sa_handler = sigaction_handler;
sigaction(SIGINT, &action, NULL); sigaction(SIGINT, &action, NULL);
sigaction(SIGTERM, &action, NULL); sigaction(SIGTERM, &action, NULL);
@@ -261,27 +261,23 @@ int main(int argc, char *argv[]) {
int32_t hor_res_phys = lv_display_get_horizontal_resolution(disp); int32_t hor_res_phys = lv_display_get_horizontal_resolution(disp);
int32_t ver_res_phys = lv_display_get_vertical_resolution(disp); int32_t ver_res_phys = lv_display_get_vertical_resolution(disp);
lv_display_set_physical_resolution(disp, hor_res_phys, ver_res_phys); lv_display_set_physical_resolution(disp, hor_res_phys, ver_res_phys);
// TODO: Sofware-rotation is currently broken in the framebuffer driver (https://gitlab.com/postmarketOS/buffybox/-/issues/26) lv_display_set_rotation(disp, cli_opts.rotation);
lv_coord_t denom = keyboard_height_denominator(hor_res_phys, ver_res_phys); switch (cli_opts.rotation) {
lv_display_set_resolution(disp, hor_res_phys, ver_res_phys / denom); case LV_DISPLAY_ROTATION_0:
lv_display_set_offset(disp, 0, (denom - 1) * ver_res_phys / denom); case LV_DISPLAY_ROTATION_180: {
// lv_display_set_rotation(disp, cli_opts.rotation); lv_coord_t denom = keyboard_height_denominator(hor_res_phys, ver_res_phys);
// switch (cli_opts.rotation) { lv_display_set_resolution(disp, hor_res_phys, ver_res_phys / denom);
// case LV_DISPLAY_ROTATION_0: lv_display_set_offset(disp, 0, (cli_opts.rotation == LV_DISPLAY_ROTATION_0) ? (denom - 1) * ver_res_phys / denom : 0);
// case LV_DISPLAY_ROTATION_180: { break;
// 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); case LV_DISPLAY_ROTATION_90:
// lv_display_set_offset(disp, 0, (cli_opts.rotation == LV_DISPLAY_ROTATION_0) ? (denom - 1) * ver_res_phys / denom : 0); case LV_DISPLAY_ROTATION_270: {
// break; 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);
// case LV_DISPLAY_ROTATION_90: lv_display_set_offset(disp, 0, (cli_opts.rotation == LV_DISPLAY_ROTATION_90) ? (denom - 1) * hor_res_phys / denom : 0);
// case LV_DISPLAY_ROTATION_270: { break;
// 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_offset(disp, (cli_opts.rotation == LV_DISPLAY_ROTATION_90) ? (denom - 1) * hor_res_phys / denom : 0, 0);
// break;
// }
// }
/* Connect input devices */ /* Connect input devices */
bb_indev_auto_connect(); bb_indev_auto_connect();

2
lvgl

Submodule lvgl updated: 1ea51ad616...f37aebf332

View File

@@ -6,6 +6,8 @@
#include "sq2lv.h" #include "sq2lv.h"
#include <string.h>
/** /**
* Static variables * Static variables
@@ -214,7 +216,7 @@ int *sq2lv_get_modifier_indexes(lv_obj_t *keyboard, int *num_modifiers) {
} }
#if SQ2LV_SCANCODES_ENABLED #if SQ2LV_SCANCODES_ENABLED
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

@@ -70,7 +70,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
*/ */
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 */