aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics.c14
-rw-r--r--input_field.c4
-rw-r--r--layer_surface.c2
3 files changed, 9 insertions, 11 deletions
diff --git a/graphics.c b/graphics.c
index b2fead7..f462402 100644
--- a/graphics.c
+++ b/graphics.c
@@ -185,9 +185,7 @@ void render_frame(client_state *state) {
// calculate input buffer
float input_y = state->line_height * state->lines;
- float input_width;
- if (state->lines > 0) { input_width = state->width; }
- else { input_width = state->width / 3.0f; }
+ float input_width = state->lines ? state->width : state->width / 3.0f;
// draw input buffer
if (array_size(state->filtered_items) != 0) {
@@ -210,7 +208,7 @@ void render_frame(client_state *state) {
float start;
// set up starting pen and scissor for options
- if (state->lines > 0) {
+ if (state->lines) {
glScissor(0, 0, state->width, input_y);
start = input_y - state->line_height + state->scroll;
@@ -261,7 +259,7 @@ void render_frame(client_state *state) {
item_t* item = display->item;
float x,y;
- if (state->lines > 0) {
+ if (state->lines) {
x = 0;
y = start - display->offset;
}
@@ -274,7 +272,7 @@ void render_frame(client_state *state) {
glUniform4f(state->b_color_uniform, highlight_color.r,highlight_color.g,highlight_color.b,highlight_color.a);
glUniform2f(state->b_screen_size_uniform, state->width, state->height);
glUniform2f(state->b_start_uniform, x, y);
- glUniform2f(state->b_size_uniform, (state->lines > 0) ? state->width : item->pixel_len + state->horizontal_spacing, state->line_height);
+ glUniform2f(state->b_size_uniform, (state->lines) ? state->width : item->pixel_len + state->horizontal_spacing * 2, state->line_height);
glDrawArrays(GL_TRIANGLES, 0, 6);
}
@@ -289,7 +287,7 @@ void render_frame(client_state *state) {
item_t* item = display->item;
float x,y;
- if (state->lines > 0) {
+ if (state->lines) {
x = 0;
y = start - display->offset;
}
@@ -299,7 +297,7 @@ void render_frame(client_state *state) {
}
glBindVertexArray(item->text_buffer.vao);
- glUniform2f(state->t_offset_uniform, x + state->horizontal_spacing / 2.0f, y - state->atlas.vert_shift);
+ glUniform2f(state->t_offset_uniform, x + (state->lines ? state->horizontal_spacing / 2.0f : state->horizontal_spacing), y - state->atlas.vert_shift);
glDrawElements(GL_TRIANGLES, item->text_buffer.num_elements, GL_UNSIGNED_INT, 0);
}
diff --git a/input_field.c b/input_field.c
index 328254e..7df1799 100644
--- a/input_field.c
+++ b/input_field.c
@@ -34,8 +34,8 @@ void filter_items(client_state* state) {
float offset = 0;
array_for_all(item_display_t, display, state->filtered_items) {
display->offset = offset;
- if (state->lines > 0) offset += state->line_height;
- else offset += display->item->pixel_len + state->horizontal_spacing;
+ if (state->lines) offset += state->line_height;
+ else offset += display->item->pixel_len + state->horizontal_spacing * 2.0f;
}
}
diff --git a/layer_surface.c b/layer_surface.c
index bf17d45..bc3ef56 100644
--- a/layer_surface.c
+++ b/layer_surface.c
@@ -18,7 +18,7 @@ void create_surface(client_state* state) {
if (state->center) {
desired_width = MAX(state->required_width, min_width);
}
- if (state->lines > 0) {
+ if (state->lines) {
desired_height = (state->lines + 1) * state->line_height;
}