mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
Merge branch 'dev' of https://github.com/littlevgl/lvgl into dev
This commit is contained in:
commit
e65e80c1f8
@ -584,6 +584,12 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
|
||||
lv_draw_res_t draw_res = call_draw_cb(obj, area_p, LV_DRAW_MODE_COVER_CHECK);
|
||||
if(draw_res == LV_DRAW_RES_MASKED) return NULL;
|
||||
|
||||
lv_draw_res_t event_draw_res = LV_DRAW_RES_OK;
|
||||
lv_event_send(obj, LV_EVENT_COVER_CHECK, &event_draw_res);
|
||||
if(event_draw_res == LV_DRAW_RES_MASKED) return NULL;
|
||||
if(event_draw_res == LV_DRAW_RES_NOT_COVER) draw_res = LV_DRAW_RES_NOT_COVER;
|
||||
|
||||
|
||||
if(draw_res == LV_DRAW_RES_COVER && lv_obj_get_style_opa(obj, LV_PART_MAIN) != LV_OPA_COVER) {
|
||||
draw_res = LV_DRAW_RES_NOT_COVER;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file hal_indev.c
|
||||
* @file lv_hal_indev.c
|
||||
*
|
||||
* @description Input device HAL interface
|
||||
*
|
||||
@ -26,7 +26,6 @@
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_indev_read_timer_cb(lv_timer_t * timer);
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
@ -60,8 +59,8 @@ void lv_indev_drv_init(lv_indev_drv_t * driver)
|
||||
lv_memset_00(driver, sizeof(lv_indev_drv_t));
|
||||
|
||||
driver->type = LV_INDEV_TYPE_NONE;
|
||||
driver->scroll_limit = LV_INDEV_DEF_SCROLL_LIMIT;
|
||||
driver->scroll_throw = 3;//LV_INDEV_DEF_SCROLL_THROW;
|
||||
driver->scroll_limit = LV_INDEV_DEF_SCROLL_LIMIT;
|
||||
driver->scroll_throw = LV_INDEV_DEF_SCROLL_THROW;
|
||||
driver->long_press_time = LV_INDEV_DEF_LONG_PRESS_TIME;
|
||||
driver->long_press_rep_time = LV_INDEV_DEF_LONG_PRESS_REP_TIME;
|
||||
driver->gesture_limit = LV_INDEV_DEF_GESTURE_LIMIT;
|
||||
@ -94,9 +93,6 @@ lv_indev_t * lv_indev_drv_register(lv_indev_drv_t * driver)
|
||||
lv_memcpy(&indev->driver, driver, sizeof(lv_indev_drv_t));
|
||||
|
||||
indev->proc.reset_query = 1;
|
||||
indev->cursor = NULL;
|
||||
indev->group = NULL;
|
||||
indev->btn_points = NULL;
|
||||
indev->driver.read_timer = lv_timer_create(lv_indev_read_timer_cb, LV_INDEV_DEF_READ_PERIOD, indev);
|
||||
|
||||
return indev;
|
||||
@ -138,7 +134,7 @@ bool _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
|
||||
|
||||
lv_memset_00(data, sizeof(lv_indev_data_t));
|
||||
|
||||
/* For touchpad sometimes users don't the last pressed coordinate on release.
|
||||
/* For touchpad sometimes users don't set the last pressed coordinate on release.
|
||||
* So be sure a coordinates are initialized to the last point */
|
||||
if(indev->driver.type == LV_INDEV_TYPE_POINTER) {
|
||||
data->point.x = indev->proc.types.pointer.act_point.x;
|
||||
@ -151,7 +147,6 @@ bool _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
|
||||
/*For compatibility assume that used button was enter (encoder push) */
|
||||
else if(indev->driver.type == LV_INDEV_TYPE_ENCODER) {
|
||||
data->key = LV_KEY_ENTER;
|
||||
data->enc_diff = 0;
|
||||
}
|
||||
|
||||
if(indev->driver.read_cb) {
|
||||
|
@ -27,10 +27,10 @@ extern "C" {
|
||||
*********************/
|
||||
|
||||
/* Drag threshold in pixels */
|
||||
#define LV_INDEV_DEF_SCROLL_LIMIT 10
|
||||
#define LV_INDEV_DEF_SCROLL_LIMIT 10
|
||||
|
||||
/* Drag throw slow-down in [%]. Greater value -> faster slow-down */
|
||||
#define LV_INDEV_DEF_SCROLL_THROW 10
|
||||
#define LV_INDEV_DEF_SCROLL_THROW 10
|
||||
|
||||
/* Long press time in milliseconds.
|
||||
* Time to send `LV_EVENT_LONG_PRESSSED`) */
|
||||
@ -54,6 +54,7 @@ extern "C" {
|
||||
|
||||
struct _lv_obj_t;
|
||||
struct _lv_disp_t;
|
||||
struct _lv_group_t;
|
||||
struct _lv_indev_t;
|
||||
struct _lv_indev_drv_t;
|
||||
|
||||
@ -119,7 +120,7 @@ typedef struct _lv_indev_drv_t {
|
||||
/**< Pointer to the assigned display*/
|
||||
struct _lv_disp_t * disp;
|
||||
|
||||
/**< Task to read the periodically read the input device*/
|
||||
/**< Timer to periodically read the input device*/
|
||||
lv_timer_t * read_timer;
|
||||
|
||||
/**< Number of pixels to slide before actually drag the object*/
|
||||
@ -146,25 +147,31 @@ typedef struct _lv_indev_drv_t {
|
||||
*/
|
||||
typedef struct _lv_indev_proc_t {
|
||||
lv_indev_state_t state; /**< Current state of the input device. */
|
||||
/*Flags*/
|
||||
uint8_t long_pr_sent : 1;
|
||||
uint8_t reset_query : 1;
|
||||
uint8_t disabled : 1;
|
||||
uint8_t wait_until_release : 1;
|
||||
|
||||
union {
|
||||
struct {
|
||||
/*Pointer and button data*/
|
||||
lv_point_t act_point; /**< Current point of input device. */
|
||||
lv_point_t last_point; /**< Last point of input device. */
|
||||
lv_point_t vect; /**< Difference between `act_point` and `last_point`. */
|
||||
lv_point_t scroll_sum; /*Count the dragged pixels to check LV_INDEV_DEF_DRAG_LIMIT*/
|
||||
lv_point_t scroll_sum; /*Count the dragged pixels to check LV_INDEV_DEF_SCROLL_LIMIT*/
|
||||
lv_point_t scroll_throw_vect;
|
||||
lv_point_t scroll_throw_vect_ori;
|
||||
struct _lv_obj_t * act_obj; /*The object being pressed*/
|
||||
struct _lv_obj_t * last_obj; /*The last object which was pressed*/
|
||||
struct _lv_obj_t * scroll_obj; /*The object being scrolled*/
|
||||
struct _lv_obj_t * scroll_obj; /*The object being scrolled*/
|
||||
struct _lv_obj_t * last_pressed; /*The lastly pressed object*/
|
||||
lv_area_t scroll_area;
|
||||
|
||||
lv_gesture_dir_t gesture_dir;
|
||||
lv_point_t gesture_sum; /*Count the gesture pixels to check LV_INDEV_DEF_GESTURE_LIMIT*/
|
||||
/*Flags*/
|
||||
lv_indev_scroll_dir_t scroll_dir : 2;
|
||||
lv_indev_scroll_dir_t scroll_dir : 2;
|
||||
lv_gesture_dir_t gesture_dir : 2;
|
||||
uint8_t gesture_sent : 1;
|
||||
} pointer;
|
||||
struct {
|
||||
@ -176,17 +183,8 @@ typedef struct _lv_indev_proc_t {
|
||||
|
||||
uint32_t pr_timestamp; /**< Pressed time stamp*/
|
||||
uint32_t longpr_rep_timestamp; /**< Long press repeat time stamp*/
|
||||
|
||||
/*Flags*/
|
||||
uint8_t long_pr_sent : 1;
|
||||
uint8_t reset_query : 1;
|
||||
uint8_t disabled : 1;
|
||||
uint8_t wait_until_release : 1;
|
||||
} lv_indev_proc_t;
|
||||
|
||||
struct _lv_obj_t;
|
||||
struct _lv_group_t;
|
||||
|
||||
/** The main input device descriptor with driver, runtime data ('proc') and some additional
|
||||
* information*/
|
||||
typedef struct _lv_indev_t {
|
||||
|
@ -34,7 +34,7 @@ extern "C" {
|
||||
struct _lv_timer_t;
|
||||
|
||||
/**
|
||||
* Tasks execute this type of functions.
|
||||
* Timers execute this type of functions.
|
||||
*/
|
||||
typedef void (*lv_timer_cb_t)(struct _lv_timer_t *);
|
||||
|
||||
@ -44,7 +44,7 @@ typedef void (*lv_timer_cb_t)(struct _lv_timer_t *);
|
||||
typedef struct _lv_timer_t {
|
||||
uint32_t period; /**< How often the timer should run */
|
||||
uint32_t last_run; /**< Last time the timer ran */
|
||||
lv_timer_cb_t timer_cb; /**< Task function */
|
||||
lv_timer_cb_t timer_cb; /**< Timer function */
|
||||
void * user_data; /**< Custom user data */
|
||||
int32_t repeat_count; /**< 1: One time; -1 : infinity; n>0: residual times */
|
||||
uint32_t paused :1;
|
||||
|
@ -36,7 +36,7 @@ static lv_res_t lv_table_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
static lv_coord_t get_row_height(lv_obj_t * obj, uint16_t row_id, const lv_font_t * font,
|
||||
lv_coord_t letter_space, lv_coord_t line_space,
|
||||
lv_coord_t cell_left, lv_coord_t cell_right, lv_coord_t cell_top, lv_coord_t cell_bottom);
|
||||
static void refr_size(lv_obj_t * obj);
|
||||
static void refr_size(lv_obj_t * obj, uint32_t strat_row);
|
||||
static lv_res_t get_pressed_cell(lv_obj_t * obj, uint16_t * row, uint16_t * col);
|
||||
|
||||
/**********************
|
||||
@ -101,7 +101,7 @@ void lv_table_set_cell_value(lv_obj_t * obj, uint16_t row, uint16_t col, const c
|
||||
#endif
|
||||
|
||||
table->cell_data[cell][0] = ctrl;
|
||||
refr_size(obj) ;
|
||||
refr_size(obj, row);
|
||||
}
|
||||
|
||||
void lv_table_set_cell_value_fmt(lv_obj_t * obj, uint16_t row, uint16_t col, const char * fmt, ...)
|
||||
@ -172,7 +172,7 @@ void lv_table_set_cell_value_fmt(lv_obj_t * obj, uint16_t row, uint16_t col, con
|
||||
va_end(ap2);
|
||||
|
||||
table->cell_data[cell][0] = ctrl;
|
||||
refr_size(obj) ;
|
||||
refr_size(obj, row);
|
||||
}
|
||||
|
||||
void lv_table_set_row_cnt(lv_obj_t * obj, uint16_t row_cnt)
|
||||
@ -198,7 +198,7 @@ void lv_table_set_row_cnt(lv_obj_t * obj, uint16_t row_cnt)
|
||||
lv_memset_00(&table->cell_data[old_cell_cnt], (new_cell_cnt - old_cell_cnt) * sizeof(table->cell_data[0]));
|
||||
}
|
||||
|
||||
refr_size(obj) ;
|
||||
refr_size(obj, 0) ;
|
||||
}
|
||||
|
||||
void lv_table_set_col_cnt(lv_obj_t * obj, uint16_t col_cnt)
|
||||
@ -242,7 +242,7 @@ void lv_table_set_col_cnt(lv_obj_t * obj, uint16_t col_cnt)
|
||||
table->cell_data = new_cell_data;
|
||||
|
||||
|
||||
refr_size(obj) ;
|
||||
refr_size(obj, 0) ;
|
||||
}
|
||||
|
||||
void lv_table_set_col_width(lv_obj_t * obj, uint16_t col_id, lv_coord_t w)
|
||||
@ -255,7 +255,7 @@ void lv_table_set_col_width(lv_obj_t * obj, uint16_t col_id, lv_coord_t w)
|
||||
if(col_id >= table->col_cnt) lv_table_set_col_cnt(obj, col_id + 1);
|
||||
|
||||
table->col_w[col_id] = w;
|
||||
refr_size(obj) ;
|
||||
refr_size(obj, 0) ;
|
||||
}
|
||||
|
||||
void lv_table_add_cell_ctrl(lv_obj_t * obj, uint16_t row, uint16_t col, lv_table_cell_ctrl_t ctrl)
|
||||
@ -640,7 +640,7 @@ static lv_res_t lv_table_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
lv_table_t * table = (lv_table_t *)obj;
|
||||
|
||||
if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
refr_size(obj);
|
||||
refr_size(obj, 0);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_SELF_SIZE) {
|
||||
lv_point_t * p = param;
|
||||
@ -717,7 +717,7 @@ static lv_res_t lv_table_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
}
|
||||
|
||||
|
||||
static void refr_size(lv_obj_t * obj)
|
||||
static void refr_size(lv_obj_t * obj, uint32_t strat_row)
|
||||
{
|
||||
lv_table_t * table = (lv_table_t *)obj;
|
||||
|
||||
@ -732,7 +732,7 @@ static void refr_size(lv_obj_t * obj)
|
||||
lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_ITEMS);
|
||||
const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_ITEMS);
|
||||
|
||||
for(i = 0; i < table->row_cnt; i++) {
|
||||
for(i = strat_row; i < table->row_cnt; i++) {
|
||||
table->row_h[i] = get_row_height(obj, i, font, letter_space, line_space,
|
||||
cell_left, cell_right, cell_top, cell_bottom);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user