Modules: locking view model (#2189)

* Popup, dialog_ex: locking model
* Desktop: do not use the model where it is not needed

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Sergey Gavrilov 2022-12-27 05:46:05 +10:00 committed by GitHub
parent a34fbf6976
commit 9192520c70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 9 deletions

View File

@ -102,7 +102,6 @@ DesktopMainView* desktop_main_alloc() {
DesktopMainView* main_view = malloc(sizeof(DesktopMainView)); DesktopMainView* main_view = malloc(sizeof(DesktopMainView));
main_view->view = view_alloc(); main_view->view = view_alloc();
view_allocate_model(main_view->view, ViewModelTypeLockFree, 1);
view_set_context(main_view->view, main_view); view_set_context(main_view->view, main_view);
view_set_input_callback(main_view->view, desktop_main_input_callback); view_set_input_callback(main_view->view, desktop_main_input_callback);

View File

@ -18,7 +18,7 @@ struct DesktopViewPinSetupDone {
static void desktop_view_pin_done_draw(Canvas* canvas, void* model) { static void desktop_view_pin_done_draw(Canvas* canvas, void* model) {
furi_assert(canvas); furi_assert(canvas);
furi_assert(model); UNUSED(model);
canvas_set_font(canvas, FontPrimary); canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned( elements_multiline_text_aligned(
@ -59,7 +59,6 @@ void desktop_view_pin_done_set_callback(
DesktopViewPinSetupDone* desktop_view_pin_done_alloc() { DesktopViewPinSetupDone* desktop_view_pin_done_alloc() {
DesktopViewPinSetupDone* view = malloc(sizeof(DesktopViewPinSetupDone)); DesktopViewPinSetupDone* view = malloc(sizeof(DesktopViewPinSetupDone));
view->view = view_alloc(); view->view = view_alloc();
view_allocate_model(view->view, ViewModelTypeLockFree, 1);
view_set_context(view->view, view); view_set_context(view->view, view);
view_set_draw_callback(view->view, desktop_view_pin_done_draw); view_set_draw_callback(view->view, desktop_view_pin_done_draw);
view_set_input_callback(view->view, desktop_view_pin_done_input); view_set_input_callback(view->view, desktop_view_pin_done_input);

View File

@ -147,7 +147,7 @@ DialogEx* dialog_ex_alloc() {
DialogEx* dialog_ex = malloc(sizeof(DialogEx)); DialogEx* dialog_ex = malloc(sizeof(DialogEx));
dialog_ex->view = view_alloc(); dialog_ex->view = view_alloc();
view_set_context(dialog_ex->view, dialog_ex); view_set_context(dialog_ex->view, dialog_ex);
view_allocate_model(dialog_ex->view, ViewModelTypeLockFree, sizeof(DialogExModel)); view_allocate_model(dialog_ex->view, ViewModelTypeLocking, sizeof(DialogExModel));
view_set_draw_callback(dialog_ex->view, dialog_ex_view_draw_callback); view_set_draw_callback(dialog_ex->view, dialog_ex_view_draw_callback);
view_set_input_callback(dialog_ex->view, dialog_ex_view_input_callback); view_set_input_callback(dialog_ex->view, dialog_ex_view_input_callback);
with_view_model( with_view_model(

View File

@ -117,7 +117,7 @@ Popup* popup_alloc() {
popup->timer_enabled = false; popup->timer_enabled = false;
view_set_context(popup->view, popup); view_set_context(popup->view, popup);
view_allocate_model(popup->view, ViewModelTypeLockFree, sizeof(PopupModel)); view_allocate_model(popup->view, ViewModelTypeLocking, sizeof(PopupModel));
view_set_draw_callback(popup->view, popup_view_draw_callback); view_set_draw_callback(popup->view, popup_view_draw_callback);
view_set_input_callback(popup->view, popup_view_input_callback); view_set_input_callback(popup->view, popup_view_input_callback);
view_set_enter_callback(popup->view, popup_start_timer); view_set_enter_callback(popup->view, popup_start_timer);

View File

@ -17,7 +17,7 @@ struct DesktopSettingsViewPinSetupHowto {
static void desktop_settings_view_pin_setup_howto_draw(Canvas* canvas, void* model) { static void desktop_settings_view_pin_setup_howto_draw(Canvas* canvas, void* model) {
furi_assert(canvas); furi_assert(canvas);
furi_assert(model); UNUSED(model);
canvas_draw_icon(canvas, 16, 18, &I_Pin_attention_dpad_29x29); canvas_draw_icon(canvas, 16, 18, &I_Pin_attention_dpad_29x29);
elements_button_right(canvas, "Next"); elements_button_right(canvas, "Next");
@ -57,7 +57,6 @@ void desktop_settings_view_pin_setup_howto_set_callback(
DesktopSettingsViewPinSetupHowto* desktop_settings_view_pin_setup_howto_alloc() { DesktopSettingsViewPinSetupHowto* desktop_settings_view_pin_setup_howto_alloc() {
DesktopSettingsViewPinSetupHowto* view = malloc(sizeof(DesktopSettingsViewPinSetupHowto)); DesktopSettingsViewPinSetupHowto* view = malloc(sizeof(DesktopSettingsViewPinSetupHowto));
view->view = view_alloc(); view->view = view_alloc();
view_allocate_model(view->view, ViewModelTypeLockFree, 1);
view_set_context(view->view, view); view_set_context(view->view, view);
view_set_draw_callback(view->view, desktop_settings_view_pin_setup_howto_draw); view_set_draw_callback(view->view, desktop_settings_view_pin_setup_howto_draw);
view_set_input_callback(view->view, desktop_settings_view_pin_setup_howto_input); view_set_input_callback(view->view, desktop_settings_view_pin_setup_howto_input);

View File

@ -18,7 +18,7 @@ struct DesktopSettingsViewPinSetupHowto2 {
static void desktop_settings_view_pin_setup_howto2_draw(Canvas* canvas, void* model) { static void desktop_settings_view_pin_setup_howto2_draw(Canvas* canvas, void* model) {
furi_assert(canvas); furi_assert(canvas);
furi_assert(model); UNUSED(model);
canvas_set_font(canvas, FontSecondary); canvas_set_font(canvas, FontSecondary);
elements_multiline_text_aligned( elements_multiline_text_aligned(
@ -79,7 +79,6 @@ void desktop_settings_view_pin_setup_howto2_set_ok_callback(
DesktopSettingsViewPinSetupHowto2* desktop_settings_view_pin_setup_howto2_alloc() { DesktopSettingsViewPinSetupHowto2* desktop_settings_view_pin_setup_howto2_alloc() {
DesktopSettingsViewPinSetupHowto2* view = malloc(sizeof(DesktopSettingsViewPinSetupHowto2)); DesktopSettingsViewPinSetupHowto2* view = malloc(sizeof(DesktopSettingsViewPinSetupHowto2));
view->view = view_alloc(); view->view = view_alloc();
view_allocate_model(view->view, ViewModelTypeLockFree, 1);
view_set_context(view->view, view); view_set_context(view->view, view);
view_set_draw_callback(view->view, desktop_settings_view_pin_setup_howto2_draw); view_set_draw_callback(view->view, desktop_settings_view_pin_setup_howto2_draw);
view_set_input_callback(view->view, desktop_settings_view_pin_setup_howto2_input); view_set_input_callback(view->view, desktop_settings_view_pin_setup_howto2_input);