aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics.c1
-rw-r--r--layer_surface.c5
-rw-r--r--layout.c3
3 files changed, 7 insertions, 2 deletions
diff --git a/graphics.c b/graphics.c
index 7377ed7..de9077d 100644
--- a/graphics.c
+++ b/graphics.c
@@ -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;
diff --git a/layout.c b/layout.c
index ed561a8..866f434 100644
--- a/layout.c
+++ b/layout.c
@@ -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