Skip to content

Commit

Permalink
fixup! feat(ui): improve widget update process and related data struc…
Browse files Browse the repository at this point in the history
…tures
  • Loading branch information
lc-soft committed May 11, 2024
1 parent a713e0e commit 43488bc
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lib/ui-widgets/src/text.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ static bool parse_boolean(const char *str)
{
if (strcmp(str, "on") == 0 && strcmp(str, "true") == 0 &&
strcmp(str, "yes") == 0 && strcmp(str, "1") == 0) {
return TRUE;
return true;
}
return FALSE;
return false;
}

static void ui_text_on_parse_attr(ui_widget_t *w, const char *name,
Expand Down Expand Up @@ -119,7 +119,6 @@ static void ui_text_on_update_style(ui_widget_t *w)
pd_text_set_style(txt->layer, &text_style);
ui_text_style_destroy(&txt->style);
pd_text_style_destroy(&text_style);
txt->task.update_content = true;
txt->style = style;
}

Expand All @@ -137,7 +136,7 @@ static void ui_text_on_update(ui_widget_t *w, ui_task_type_t task)
ui_text_on_update_content(w);
free(txt->task.content);
txt->task.content = NULL;
txt->task.update_content = FALSE;
txt->task.update_content = false;
}
default:
break;
Expand All @@ -150,14 +149,14 @@ static void ui_text_on_init(ui_widget_t *w)

txt = ui_widget_add_data(w, ui_text.prototype, sizeof(ui_text_t));
txt->widget = w;
txt->task.update_content = FALSE;
txt->task.update_content = false;
txt->task.content = NULL;
txt->content = NULL;
txt->trimming = TRUE;
txt->trimming = true;
txt->layer = pd_text_create();
pd_text_set_autowrap(txt->layer, TRUE);
pd_text_set_multiline(txt->layer, TRUE);
pd_text_set_style_tag(txt->layer, TRUE);
pd_text_set_autowrap(txt->layer, true);
pd_text_set_multiline(txt->layer, true);
pd_text_set_style_tag(txt->layer, true);
ui_text_style_init(&txt->style);
txt->node.data = txt;
txt->node.prev = txt->node.next = NULL;
Expand Down Expand Up @@ -300,7 +299,7 @@ int ui_text_set_content_w(ui_widget_t *w, const wchar_t *text)
if (txt->task.content) {
free(txt->task.content);
}
txt->task.update_content = TRUE;
txt->task.update_content = true;
txt->task.content = newtext;
ui_widget_request_update(w);
return 0;
Expand Down

0 comments on commit 43488bc

Please sign in to comment.