mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-25 06:13:14 +03:00
GUI: fix issue with gui update on view draw (#301)
This commit is contained in:
parent
6126d117a9
commit
34dbb2ea86
@ -93,14 +93,19 @@ void* view_get_model(View* view) {
|
||||
}
|
||||
|
||||
void view_commit_model(View* view) {
|
||||
furi_assert(view);
|
||||
view_unlock_model(view);
|
||||
if(view->dispatcher) {
|
||||
view_dispatcher_update(view->dispatcher, view);
|
||||
}
|
||||
}
|
||||
|
||||
void view_unlock_model(View* view) {
|
||||
furi_assert(view);
|
||||
if(view->model_type == ViewModelTypeLocking) {
|
||||
ViewModelLocking* model = (ViewModelLocking*)(view->model);
|
||||
furi_check(osMutexRelease(model->mutex) == osOK);
|
||||
}
|
||||
if(view->dispatcher) {
|
||||
view_dispatcher_update(view->dispatcher, view);
|
||||
}
|
||||
}
|
||||
|
||||
void view_draw(View* view, Canvas* canvas) {
|
||||
@ -108,7 +113,7 @@ void view_draw(View* view, Canvas* canvas) {
|
||||
if(view->draw_callback) {
|
||||
void* data = view_get_model(view);
|
||||
view->draw_callback(canvas, data);
|
||||
view_commit_model(view);
|
||||
view_unlock_model(view);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,9 @@ struct View {
|
||||
/* Set View dispatcher */
|
||||
void view_set_dispatcher(View* view, ViewDispatcher* view_dispatcher);
|
||||
|
||||
/* Unlock model */
|
||||
void view_unlock_model(View* view);
|
||||
|
||||
/* Draw Callback for View dispatcher */
|
||||
void view_draw(View* view, Canvas* canvas);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user