BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lvgl
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
lvgl
Commits
d6739192
Commit
d6739192
authored
Nov 07, 2017
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add early return on LV_RES_INV in signal function
parent
410ea1f8
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
89 additions
and
131 deletions
+89
-131
lv_btn.c
lv_objx/lv_btn.c
+2
-5
lv_cb.c
lv_objx/lv_cb.c
+2
-5
lv_cont.c
lv_objx/lv_cont.c
+2
-5
lv_ddlist.c
lv_objx/lv_ddlist.c
+65
-68
lv_ddlist.h
lv_objx/lv_ddlist.h
+0
-9
lv_list.c
lv_objx/lv_list.c
+2
-5
lv_mbox.c
lv_objx/lv_mbox.c
+2
-5
lv_page.c
lv_objx/lv_page.c
+4
-11
lv_roller.c
lv_objx/lv_roller.c
+4
-8
lv_ta.c
lv_objx/lv_ta.c
+6
-10
No files found.
lv_objx/lv_btn.c
View file @
d6739192
...
...
@@ -256,10 +256,8 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
/* Include the ancient signal function */
res
=
ancestor_signal
(
btn
,
sign
,
param
);
if
(
res
!=
LV_RES_OK
)
return
res
;
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
res
==
LV_RES_OK
)
{
lv_btn_ext_t
*
ext
=
lv_obj_get_ext_attr
(
btn
);
lv_btn_state_t
state
=
lv_btn_get_state
(
btn
);
bool
tgl
=
lv_btn_get_toggle
(
btn
);
...
...
@@ -351,9 +349,8 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
}
}
}
}
return
res
;
return
LV_RES_OK
;
}
...
...
lv_objx/lv_cb.c
View file @
d6739192
...
...
@@ -241,13 +241,11 @@ static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
/* Include the ancient signal function */
res
=
ancestor_signal
(
cb
,
sign
,
param
);
if
(
res
!=
LV_RES_OK
)
return
res
;
lv_cb_ext_t
*
ext
=
lv_obj_get_ext_attr
(
cb
);
lv_style_t
*
style
=
lv_obj_get_style
(
cb
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
res
==
LV_RES_OK
)
{
if
(
sign
==
LV_SIGNAL_STYLE_CHG
)
{
lv_obj_set_size
(
ext
->
bullet
,
font_get_height
(
style
->
text
.
font
),
font_get_height
(
style
->
text
.
font
));
lv_btn_set_state
(
ext
->
bullet
,
lv_btn_get_state
(
cb
));
...
...
@@ -263,9 +261,8 @@ static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
lv_btn_set_state
(
ext
->
bullet
,
lv_btn_get_state
(
cb
));
}
}
}
return
res
;
return
LV_RES_OK
;
}
#endif
lv_objx/lv_cont.c
View file @
d6739192
...
...
@@ -191,10 +191,8 @@ static lv_res_t lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param)
/* Include the ancient signal function */
res
=
ancestor_signal
(
cont
,
sign
,
param
);
if
(
res
!=
LV_RES_OK
)
return
res
;
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
res
==
LV_RES_OK
)
{
if
(
sign
==
LV_SIGNAL_STYLE_CHG
)
{
/*Recalculate the padding if the style changed*/
lv_cont_refr_layout
(
cont
);
lv_cont_refr_autofit
(
cont
);
...
...
@@ -208,9 +206,8 @@ static lv_res_t lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param)
lv_cont_refr_autofit
(
cont
);
}
}
}
return
res
;
return
LV_RES_OK
;
}
...
...
lv_objx/lv_ddlist.c
View file @
d6739192
...
...
@@ -29,6 +29,7 @@
* STATIC PROTOTYPES
**********************/
static
bool
lv_ddlist_design
(
lv_obj_t
*
ddlist
,
const
area_t
*
mask
,
lv_design_mode_t
mode
);
lv_res_t
lv_ddlist_signal
(
lv_obj_t
*
ddlist
,
lv_signal_t
sign
,
void
*
param
);
static
lv_res_t
lv_ddlist_scrl_signal
(
lv_obj_t
*
scrl
,
lv_signal_t
sign
,
void
*
param
);
static
lv_res_t
lv_ddlist_rel_action
(
lv_obj_t
*
ddlist
);
static
void
lv_ddlist_refr_size
(
lv_obj_t
*
ddlist
,
uint16_t
anim_time
);
...
...
@@ -118,70 +119,6 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy)
return
new_ddlist
;
}
/**
* Signal function of the drop down list
* @param ddlist pointer to a drop down list object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return true: the object is still valid (not deleted), false: the object become invalid
*/
bool
lv_ddlist_signal
(
lv_obj_t
*
ddlist
,
lv_signal_t
sign
,
void
*
param
)
{
bool
valid
;
/* Include the ancient signal function */
valid
=
ancestor_signal
(
ddlist
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
valid
!=
false
)
{
if
(
sign
==
LV_SIGNAL_STYLE_CHG
)
{
lv_ddlist_refr_size
(
ddlist
,
0
);
lv_obj_t
*
scrl
=
lv_page_get_scrl
(
ddlist
);
lv_obj_refresh_ext_size
(
scrl
);
/*Because of the wider selected rectangle*/
}
else
if
(
sign
==
LV_SIGNAL_FOCUS
)
{
lv_ddlist_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ddlist
);
if
(
ext
->
opened
==
false
)
{
ext
->
opened
=
true
;
lv_ddlist_refr_size
(
ddlist
,
true
);
}
}
else
if
(
sign
==
LV_SIGNAL_DEFOCUS
)
{
lv_ddlist_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ddlist
);
if
(
ext
->
opened
!=
false
)
{
ext
->
opened
=
false
;
lv_ddlist_refr_size
(
ddlist
,
true
);
}
}
else
if
(
sign
==
LV_SIGNAL_CONTROLL
)
{
lv_ddlist_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ddlist
);
char
c
=
*
((
char
*
)
param
);
if
(
c
==
LV_GROUP_KEY_RIGHT
||
c
==
LV_GROUP_KEY_DOWN
)
{
if
(
ext
->
selected_option_id
+
1
<
ext
->
option_cnt
)
{
ext
->
selected_option_id
++
;
lv_obj_invalidate
(
ddlist
);
if
(
ext
->
callback
!=
NULL
)
{
ext
->
callback
(
ddlist
);
}
}
}
else
if
(
c
==
LV_GROUP_KEY_LEFT
||
c
==
LV_GROUP_KEY_UP
)
{
if
(
ext
->
selected_option_id
>
0
)
{
ext
->
selected_option_id
--
;
lv_obj_invalidate
(
ddlist
);
if
(
ext
->
callback
!=
NULL
)
{
ext
->
callback
(
ddlist
);
}
}
}
else
if
(
c
==
LV_GROUP_KEY_ENTER
||
c
==
LV_GROUP_KEY_ESC
)
{
if
(
ext
->
opened
!=
false
)
ext
->
opened
=
false
;
if
(
ext
->
opened
==
false
)
ext
->
opened
=
true
;
lv_ddlist_refr_size
(
ddlist
,
true
);
}
}
}
return
valid
;
}
/*=====================
* Setter functions
*====================*/
...
...
@@ -452,6 +389,69 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const area_t * mask, lv_design_m
}
/**
* Signal function of the drop down list
* @param ddlist pointer to a drop down list object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
lv_res_t
lv_ddlist_signal
(
lv_obj_t
*
ddlist
,
lv_signal_t
sign
,
void
*
param
)
{
lv_res_t
res
;
/* Include the ancient signal function */
res
=
ancestor_signal
(
ddlist
,
sign
,
param
);
if
(
res
!=
LV_RES_OK
)
return
res
;
if
(
sign
==
LV_SIGNAL_STYLE_CHG
)
{
lv_ddlist_refr_size
(
ddlist
,
0
);
lv_obj_t
*
scrl
=
lv_page_get_scrl
(
ddlist
);
lv_obj_refresh_ext_size
(
scrl
);
/*Because of the wider selected rectangle*/
}
else
if
(
sign
==
LV_SIGNAL_FOCUS
)
{
lv_ddlist_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ddlist
);
if
(
ext
->
opened
==
false
)
{
ext
->
opened
=
true
;
lv_ddlist_refr_size
(
ddlist
,
true
);
}
}
else
if
(
sign
==
LV_SIGNAL_DEFOCUS
)
{
lv_ddlist_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ddlist
);
if
(
ext
->
opened
!=
false
)
{
ext
->
opened
=
false
;
lv_ddlist_refr_size
(
ddlist
,
true
);
}
}
else
if
(
sign
==
LV_SIGNAL_CONTROLL
)
{
lv_ddlist_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ddlist
);
char
c
=
*
((
char
*
)
param
);
if
(
c
==
LV_GROUP_KEY_RIGHT
||
c
==
LV_GROUP_KEY_DOWN
)
{
if
(
ext
->
selected_option_id
+
1
<
ext
->
option_cnt
)
{
ext
->
selected_option_id
++
;
lv_obj_invalidate
(
ddlist
);
if
(
ext
->
callback
!=
NULL
)
{
ext
->
callback
(
ddlist
);
}
}
}
else
if
(
c
==
LV_GROUP_KEY_LEFT
||
c
==
LV_GROUP_KEY_UP
)
{
if
(
ext
->
selected_option_id
>
0
)
{
ext
->
selected_option_id
--
;
lv_obj_invalidate
(
ddlist
);
if
(
ext
->
callback
!=
NULL
)
{
ext
->
callback
(
ddlist
);
}
}
}
else
if
(
c
==
LV_GROUP_KEY_ENTER
||
c
==
LV_GROUP_KEY_ESC
)
{
if
(
ext
->
opened
!=
false
)
ext
->
opened
=
false
;
if
(
ext
->
opened
==
false
)
ext
->
opened
=
true
;
lv_ddlist_refr_size
(
ddlist
,
true
);
}
}
return
res
;
}
/**
* Signal function of the drop down list's scrollable part
* @param scrl pointer to a drop down list's scrollable part
* @param sign a signal type from lv_signal_t enum
...
...
@@ -464,10 +464,8 @@ static lv_res_t lv_ddlist_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void *
/* Include the ancient signal function */
res
=
ancestor_scrl_signal
(
scrl
,
sign
,
param
);
if
(
res
!=
LV_RES_OK
)
return
res
;
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
res
!=
false
)
{
if
(
sign
==
LV_SIGNAL_REFR_EXT_SIZE
)
{
/* Because of the wider selected rectangle ext. size
* In this way by dragging the scrollable part the wider rectangle area can be redrawn too*/
...
...
@@ -475,7 +473,6 @@ static lv_res_t lv_ddlist_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void *
lv_style_t
*
style
=
lv_ddlist_get_style_bg
(
ddlist
);
if
(
scrl
->
ext_size
<
style
->
body
.
padding
.
hor
)
scrl
->
ext_size
=
style
->
body
.
padding
.
hor
;
}
}
return
res
;
}
...
...
lv_objx/lv_ddlist.h
View file @
d6739192
...
...
@@ -65,15 +65,6 @@ typedef struct
lv_obj_t
*
lv_ddlist_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
);
/**
* Signal function of the drop down list
* @param ddlist pointer to a drop down list object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return true: the object is still valid (not deleted), false: the object become invalid
*/
bool
lv_ddlist_signal
(
lv_obj_t
*
ddlist
,
lv_signal_t
sign
,
void
*
param
);
/**
* Set the options in a drop down list from a string
* @param ddlist pointer to drop down list object
* @param options a string with '\n' separated options. E.g. "One\nTwo\nThree"
...
...
lv_objx/lv_list.c
View file @
d6739192
...
...
@@ -406,10 +406,8 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
/* Include the ancient signal function */
res
=
ancestor_signal
(
list
,
sign
,
param
);
if
(
res
!=
LV_RES_OK
)
return
res
;
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
res
==
LV_RES_OK
)
{
if
(
sign
==
LV_SIGNAL_CORD_CHG
)
{
/*Be sure the width of the buttons are correct*/
cord_t
w
=
lv_obj_get_width
(
list
);
...
...
@@ -501,8 +499,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
}
}
}
}
return
res
;
return
LV_RES_OK
;
}
/**
...
...
lv_objx/lv_mbox.c
View file @
d6739192
...
...
@@ -308,10 +308,8 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
/* Include the ancient signal function */
res
=
ancestor_signal
(
mbox
,
sign
,
param
);
if
(
res
!=
LV_RES_OK
)
return
res
;
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
res
==
LV_RES_OK
)
{
lv_mbox_ext_t
*
ext
=
lv_obj_get_ext_attr
(
mbox
);
if
(
sign
==
LV_SIGNAL_CORD_CHG
)
{
if
(
lv_obj_get_width
(
mbox
)
!=
area_get_width
(
param
))
{
...
...
@@ -424,9 +422,8 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
}
}
}
}
return
res
;
return
LV_RES_OK
;
}
/**
...
...
lv_objx/lv_page.c
View file @
d6739192
...
...
@@ -410,10 +410,8 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
/* Include the ancient signal function */
res
=
ancestor_signal
(
page
,
sign
,
param
);
if
(
res
!=
LV_RES_OK
)
return
res
;
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
res
==
LV_RES_OK
)
{
lv_page_ext_t
*
ext
=
lv_obj_get_ext_attr
(
page
);
lv_style_t
*
style
=
lv_obj_get_style
(
page
);
lv_obj_t
*
child
;
...
...
@@ -476,9 +474,8 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
if
(
page
->
ext_size
<
(
-
ext
->
sb
.
style
->
body
.
padding
.
hor
))
page
->
ext_size
=
-
ext
->
sb
.
style
->
body
.
padding
.
hor
;
if
(
page
->
ext_size
<
(
-
ext
->
sb
.
style
->
body
.
padding
.
ver
))
page
->
ext_size
=
-
ext
->
sb
.
style
->
body
.
padding
.
ver
;
}
}
return
res
;
return
LV_RES_OK
;
}
/**
...
...
@@ -494,10 +491,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
/* Include the ancient signal function */
res
=
ancestor_signal
(
scrl
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
res
!=
false
)
{
if
(
res
!=
LV_RES_OK
)
return
res
;
lv_obj_t
*
page
=
lv_obj_get_parent
(
scrl
);
lv_style_t
*
page_style
=
lv_obj_get_style
(
page
);
...
...
@@ -602,9 +596,8 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
}
}
}
}
return
res
;
return
LV_RES_OK
;
}
...
...
lv_objx/lv_roller.c
View file @
d6739192
...
...
@@ -215,10 +215,9 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
/* Include the ancient signal function */
res
=
ancestor_signal
(
roller
,
sign
,
param
);
if
(
res
!=
LV_RES_OK
)
return
res
;
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
res
==
LV_RES_OK
)
{
lv_roller_ext_t
*
ext
=
lv_obj_get_ext_attr
(
roller
);
if
(
sign
==
LV_SIGNAL_STYLE_CHG
)
{
lv_obj_set_height
(
lv_page_get_scrl
(
roller
),
...
...
@@ -240,7 +239,6 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
refr_position
(
roller
,
false
);
}
}
}
return
res
;
}
...
...
@@ -258,10 +256,8 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
/* Include the ancient signal function */
res
=
ancestor_scrl_signal
(
roller_scrl
,
sign
,
param
);
if
(
res
!=
LV_RES_OK
)
return
res
;
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
res
==
LV_RES_OK
)
{
lv_indev_t
*
indev
=
lv_indev_get_act
();
int32_t
id
=
-
1
;
lv_obj_t
*
roller
=
lv_obj_get_parent
(
roller_scrl
);
...
...
@@ -269,6 +265,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
lv_style_t
*
style_label
=
lv_obj_get_style
(
ext
->
ddlist
.
options_label
);
const
font_t
*
font
=
style_label
->
text
.
font
;
cord_t
font_h
=
font_get_height
(
font
)
>>
FONT_ANTIALIAS
;
if
(
sign
==
LV_SIGNAL_DRAG_END
)
{
/*If dragged then align the list to there be an element in the middle*/
cord_t
label_y1
=
ext
->
ddlist
.
options_label
->
coords
.
y1
-
roller
->
coords
.
y1
;
...
...
@@ -296,7 +293,6 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
if
(
id
!=
-
1
)
{
refr_position
(
roller
,
true
);
}
}
return
res
;
}
...
...
lv_objx/lv_ta.c
View file @
d6739192
...
...
@@ -861,10 +861,8 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
/* Include the ancient signal function */
res
=
ancestor_signal
(
ta
,
sign
,
param
);
if
(
res
!=
LV_RES_OK
)
return
res
;
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
res
==
LV_RES_OK
)
{
lv_ta_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ta
);
if
(
sign
==
LV_SIGNAL_CLEANUP
)
{
if
(
ext
->
pwd_tmp
!=
NULL
)
dm_free
(
ext
->
pwd_tmp
);
...
...
@@ -914,8 +912,8 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
lv_ta_cursor_down
(
ta
);
}
}
}
return
res
;
return
LV_RES_OK
;
}
/**
...
...
@@ -931,10 +929,8 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
/* Include the ancient signal function */
res
=
scrl_signal
(
scrl
,
sign
,
param
);
if
(
res
!=
LV_RES_OK
)
return
res
;
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
res
==
LV_RES_OK
)
{
if
(
sign
==
LV_SIGNAL_REFR_EXT_SIZE
)
{
/*Set ext. size because the cursor might be out of this object*/
lv_obj_t
*
ta
=
lv_obj_get_parent
(
scrl
);
...
...
@@ -943,8 +939,8 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
cord_t
font_h
=
font_get_height
(
style_label
->
text
.
font
)
>>
FONT_ANTIALIAS
;
scrl
->
ext_size
=
MATH_MAX
(
scrl
->
ext_size
,
style_label
->
text
.
line_space
+
font_h
);
}
}
return
res
;
return
LV_RES_OK
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment