From 5db6b737251f7c54862b9df55e2f74d9e9b64f4e Mon Sep 17 00:00:00 2001 From: Themba Dube Date: Fri, 5 Apr 2019 08:48:39 -0400 Subject: [PATCH] Change lv_drag_direction_t to lv_drag_dir_t and update documentation --- src/lv_core/lv_indev.c | 4 ++-- src/lv_core/lv_obj.c | 8 ++++---- src/lv_core/lv_obj.h | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lv_core/lv_indev.c b/src/lv_core/lv_indev.c index 886aeceb5..af2062570 100644 --- a/src/lv_core/lv_indev.c +++ b/src/lv_core/lv_indev.c @@ -1030,7 +1030,7 @@ static void indev_drag(lv_indev_proc_t * state) if(lv_obj_get_drag(drag_obj) == false) return; - lv_drag_direction_t allowed_dirs = lv_obj_get_drag_dir(drag_obj); + lv_drag_dir_t allowed_dirs = lv_obj_get_drag_dir(drag_obj); /*Count the movement by drag*/ state->types.pointer.drag_sum.x += state->types.pointer.vect.x; @@ -1120,7 +1120,7 @@ static void indev_drag_throw(lv_indev_proc_t * proc) return; } - lv_drag_direction_t allowed_dirs = lv_obj_get_drag_dir(drag_obj); + lv_drag_dir_t allowed_dirs = lv_obj_get_drag_dir(drag_obj); /*Reduce the vectors*/ proc->types.pointer.drag_throw_vect.x = diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index 52cd04e7f..cc37886dd 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -1104,9 +1104,9 @@ void lv_obj_set_drag(lv_obj_t * obj, bool en) /** * Set the directions an object can be dragged in * @param obj pointer to an object - * @param en true: make the object dragable + * @param drag_dir bitwise OR of allowed directions an object can be dragged in */ -void lv_obj_set_drag_dir(lv_obj_t * obj, lv_drag_direction_t drag_dir) +void lv_obj_set_drag_dir(lv_obj_t * obj, lv_drag_dir_t drag_dir) { obj->drag_dir = drag_dir; @@ -1713,9 +1713,9 @@ bool lv_obj_get_drag(const lv_obj_t * obj) /** * Get the directions an object can be dragged * @param obj pointer to an object - * @return directions an object can be dragged + * @return bitwise OR of allowed directions an object can be dragged in */ -lv_drag_direction_t lv_obj_get_drag_dir(const lv_obj_t * obj) +lv_drag_dir_t lv_obj_get_drag_dir(const lv_obj_t * obj) { return obj->drag_dir; } diff --git a/src/lv_core/lv_obj.h b/src/lv_core/lv_obj.h index 8180c3466..6cc9a3275 100644 --- a/src/lv_core/lv_obj.h +++ b/src/lv_core/lv_obj.h @@ -174,7 +174,7 @@ enum { LV_DRAG_DIR_VER = 0x2 }; -typedef uint8_t lv_drag_direction_t; +typedef uint8_t lv_drag_dir_t; typedef struct _lv_obj_t { @@ -196,7 +196,7 @@ typedef struct _lv_obj_t /*Attributes and states*/ uint8_t click : 1; /*1: Can be pressed by an input device*/ uint8_t drag : 1; /*1: Enable the dragging*/ - lv_drag_direction_t drag_dir; /* Which directions the object can be dragged in */ + lv_drag_dir_t drag_dir : 2; /* Which directions the object can be dragged in */ uint8_t drag_throw : 1; /*1: Enable throwing with drag*/ uint8_t drag_parent : 1; /*1: Parent will be dragged instead*/ uint8_t hidden : 1; /*1: Object is hidden*/ @@ -457,9 +457,9 @@ void lv_obj_set_drag(lv_obj_t * obj, bool en); /** * Set the directions an object can be dragged in * @param obj pointer to an object - * @param en true: make the object dragable + * @param drag_dir bitwise OR of allowed drag directions */ -void lv_obj_set_drag_dir(lv_obj_t * obj, lv_drag_direction_t drag_dir); +void lv_obj_set_drag_dir(lv_obj_t * obj, lv_drag_dir_t drag_dir); /** * Enable the throwing of an object after is is dragged @@ -754,9 +754,9 @@ bool lv_obj_get_drag(const lv_obj_t * obj); /** * Get the directions an object can be dragged * @param obj pointer to an object - * @return directions an object can be dragged + * @return bitwise OR of allowed directions an object can be dragged in */ -lv_drag_direction_t lv_obj_get_drag_dir(const lv_obj_t * obj); +lv_drag_dir_t lv_obj_get_drag_dir(const lv_obj_t * obj); /** * Get the drag throw enable attribute of an object