diff options
| author | Jack Jamison <jackqjamison@gmail.com> | 2025-11-09 02:18:03 -0500 |
|---|---|---|
| committer | Jack Jamison <jackqjamison@gmail.com> | 2025-11-09 02:18:03 -0500 |
| commit | c078f5275f27a8812301a7d9c795ab4284d69bd3 (patch) | |
| tree | 6245399e52c1c01c0a6630db3a8739581df01f12 | |
| parent | d0b1b2db2210d4fe31701d144d03a37ea55ece00 (diff) | |
improve prompt layout
| -rw-r--r-- | graphics.c | 1 | ||||
| -rw-r--r-- | layer_surface.c | 5 | ||||
| -rw-r--r-- | layout.c | 3 |
3 files changed, 7 insertions, 2 deletions
@@ -211,6 +211,7 @@ void render_frame(client_state *state) { } // draw selected input background + glScissor(input.x, input.y, input.dx, input.dy); if (state->selected_filtered_item == -1 && !state->exact_match) { glUseProgram(state->box_shader); glUniform4f(state->b_color_uniform, config.highlight_color.r,config.highlight_color.g,config.highlight_color.b,config.highlight_color.a); diff --git a/layer_surface.c b/layer_surface.c index c1d7caa..ce41ac5 100644 --- a/layer_surface.c +++ b/layer_surface.c @@ -1,6 +1,8 @@ #include "./state.h" #include "config.h" +#include "font.h" + struct zwlr_layer_surface_v1_listener layer_surface_listener; void create_surface(client_state* state) { @@ -17,6 +19,9 @@ void create_surface(client_state* state) { uint32_t desired_height = state->line_height; if (state->center) { desired_width = MAX(state->required_width, config.min_width); + if (!state->lines) { + desired_width += state->prompt ? atlas_get_strwidth(state, state->prompt) + state->horizontal_spacing : 0.0f; + } } if (state->lines) { desired_height = (state->lines + 1) * state->line_height; @@ -4,7 +4,6 @@ void calculate_layout(client_state* state, rect_t* prompt, rect_t* input, rect_t* options, bool recalc_options, bool recalc_pages) { if (state->prompt && *state->prompt) { - *prompt = (rect_t){ .x = 0, .y = state->line_height * state->lines, .dx = state->prompt_text_buffer.pixel_len + state->horizontal_spacing, .dy = state->line_height }; } else { @@ -13,7 +12,7 @@ void calculate_layout(client_state* state, rect_t* prompt, rect_t* input, rect_t // calculate input rect *input = (rect_t){ .x = prompt->dx, .y = state->line_height * state->lines, .dx = state->width - prompt->dx, .dy = state->line_height }; if (state->lines == 0 && array_size(state->filtered_items) != 0) { - input->dx = state->width / 3.0f - input->x; + input->dx = state->width / 3.0f; } // calculate options rect |
