mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
feat(indev): add possibility to enable/disable all input devices at once (#3179)
* add possibility to globally enable/disable all input devices * fix copy/paste error * merge lv_indev_globally_enable into lv_indev_enable * add missing simicolon * remove unused variable
This commit is contained in:
parent
fcf833f9af
commit
962d374791
@ -171,6 +171,7 @@ A new screen can be loaded with animation by using `lv_scr_load_anim(scr, transi
|
|||||||
Setting `auto_del` to `true` will automatically delete the old screen when the animation is finished.
|
Setting `auto_del` to `true` will automatically delete the old screen when the animation is finished.
|
||||||
|
|
||||||
The new screen will become active (returned by `lv_scr_act()`) when the animation starts after `delay` time.
|
The new screen will become active (returned by `lv_scr_act()`) when the animation starts after `delay` time.
|
||||||
|
All inputs are disabled during the screen animation.
|
||||||
|
|
||||||
### Handling multiple displays
|
### Handling multiple displays
|
||||||
Screens are created on the currently selected *default display*.
|
Screens are created on the currently selected *default display*.
|
||||||
|
@ -122,9 +122,18 @@ void lv_indev_read_timer_cb(lv_timer_t * timer)
|
|||||||
|
|
||||||
void lv_indev_enable(lv_indev_t * indev, bool en)
|
void lv_indev_enable(lv_indev_t * indev, bool en)
|
||||||
{
|
{
|
||||||
if(!indev) return;
|
uint8_t enable = en ? 0 : 1;
|
||||||
|
|
||||||
indev->proc.disabled = en ? 0 : 1;
|
if(indev) {
|
||||||
|
indev->proc.disabled = enable;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lv_indev_t * i = lv_indev_get_next(NULL);
|
||||||
|
while(i) {
|
||||||
|
indev->proc.disabled = enable;
|
||||||
|
i = lv_indev_get_next(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_indev_t * lv_indev_get_act(void)
|
lv_indev_t * lv_indev_get_act(void)
|
||||||
|
@ -36,8 +36,8 @@ extern "C" {
|
|||||||
void lv_indev_read_timer_cb(lv_timer_t * timer);
|
void lv_indev_read_timer_cb(lv_timer_t * timer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable or disable an input device (default enabled)
|
* Enable or disable one or all input devices (default enabled)
|
||||||
* @param indev pointer to an input device
|
* @param indev pointer to an input device or NULL to enable/disable all of them
|
||||||
* @param en true to enable, false to disable
|
* @param en true to enable, false to disable
|
||||||
*/
|
*/
|
||||||
void lv_indev_enable(lv_indev_t * indev, bool en);
|
void lv_indev_enable(lv_indev_t * indev, bool en);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user