@ -13,18 +13,21 @@ const logger = std.log.scoped(.screen);
/ / / a touch screen activity or wake event is triggered .
/ / / a touch screen activity or wake event is triggered .
/ / / sleep removes all input devices at enter and reinstates them at exit so that
/ / / sleep removes all input devices at enter and reinstates them at exit so that
/ / / a touch event triggers no accidental action .
/ / / a touch event triggers no accidental action .
pub fn sleep ( mu : * std . Thread . Mutex , wake : * const Thread . ResetEvent ) void {
/ / /
/ / / the UI mutex is held while calling LVGL UI functions , and released during
/ / / idling or waiting for wake event .
/ / / although sleep is safe for concurrent use , the input drivers init / deinit
/ / / implementation used on entry and exit might not be .
pub fn sleep ( ui : * std . Thread . Mutex , wake : * const Thread . ResetEvent ) void {
ui . lock ( ) ;
drv . deinitInput ( ) ;
drv . deinitInput ( ) ;
mu . lock ( ) ;
widget . topdrop ( . show ) ;
widget . topdrop ( . show ) ;
mu . unlock ( ) ;
ui . unlock ( ) ;
defer {
defer {
ui . lock ( ) ;
defer ui . unlock ( ) ;
drv . initInput ( ) catch | err | logger . err ( " drv.initInput: {any} " , . { err } ) ;
drv . initInput ( ) catch | err | logger . err ( " drv.initInput: {any} " , . { err } ) ;
mu . lock ( ) ;
widget . topdrop ( . remove ) ;
widget . topdrop ( . remove ) ;
mu . unlock ( ) ;
}
}
const watcher = drv . InputWatcher ( ) catch | err | {
const watcher = drv . InputWatcher ( ) catch | err | {