diff options
| author | Jack Jamison <jackqjamison@gmail.com> | 2025-10-26 20:59:05 -0400 |
|---|---|---|
| committer | Jack Jamison <jackqjamison@gmail.com> | 2025-10-26 21:04:55 -0400 |
| commit | 77c11183c22d640939cd8a6a7588329a5879c64c (patch) | |
| tree | 88d79731cb0563e1986280fa282618de1e121b23 /input_field.c | |
| parent | 7557fb423436f21e485e27ffd7f10e2c15232135 (diff) | |
refactor to layout
Diffstat (limited to 'input_field.c')
| -rw-r--r-- | input_field.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/input_field.c b/input_field.c index 69ddf62..dc62503 100644 --- a/input_field.c +++ b/input_field.c @@ -3,11 +3,17 @@ #include "input_field.h" #include "array.h" #include "graphics.h" +#include "layout.h" int compare(const void *a, const void *b) { return strlen(((item_display_t*)a)->item->text) > strlen(((item_display_t*)b)->item->text); } +void update_layout(client_state* state) { + rect_t input, options; + calculate_layout(state, &input, &options, true); +} + void filter_items(client_state* state) { if (!state->items) return; @@ -30,13 +36,8 @@ void filter_items(client_state* state) { if (array_size(state->filtered_items) > 0) state->selected_filtered_item = 0; else state->selected_filtered_item = -1; - // lay out items - float offset = 0; - array_for_all(item_display_t, display, state->filtered_items) { - display->offset = offset; - if (state->lines) offset += state->line_height; - else offset += display->item->pixel_len + state->horizontal_spacing; - } + // update layout + update_layout(state); } void update_text_buffer(client_state* state) { |
