aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--args.c4
-rw-r--r--array.c54
-rw-r--r--array.h32
-rw-r--r--data-device.c16
-rw-r--r--font.c70
-rw-r--r--graphics.c4
-rw-r--r--input_field.c2
-rw-r--r--keyboard.c106
-rw-r--r--main.c56
-rw-r--r--seat.c10
-rw-r--r--shader.c54
-rw-r--r--state.h38
12 files changed, 223 insertions, 223 deletions
diff --git a/args.c b/args.c
index 73307e5..1580919 100644
--- a/args.c
+++ b/args.c
@@ -14,8 +14,8 @@ void parse_args(client_state* state, int argc, char* argv[]) {
{0, 0, 0, 0}
};
- int opt;
- int long_index = 0;
+ int opt;
+ int long_index = 0;
while ((opt = getopt_long(argc, argv, "l:cev", long_opts, &long_index)) != -1) {
switch (opt) {
case 'l':
diff --git a/array.c b/array.c
index 4345346..d863c59 100644
--- a/array.c
+++ b/array.c
@@ -21,30 +21,30 @@ array_info* array_new_(size_t item_size, size_t size) {
}
// make array
- array_info* info = calloc(1, sizeof(array_info) + item_size * cap);
+ array_info* info = calloc(1, sizeof(array_info) + item_size * cap);
info->size = size;
- info->capacity = cap;
- return info;
+ info->capacity = cap;
+ return info;
}
void* array_add_(void* array, size_t item_size) {
- array_info* info = NULL;
- if (!array) {
- info = array_new_(item_size, 0);
- }
- else {
- info = ((array_info*)array) - 1;
- }
- if (info->size == info->capacity) {
- info->capacity <<= 1;
- info = realloc(info, sizeof(array_info) + (info->capacity * item_size));
- }
- info->size++;
- return &(info[1]);
+ array_info* info = NULL;
+ if (!array) {
+ info = array_new_(item_size, 0);
+ }
+ else {
+ info = ((array_info*)array) - 1;
+ }
+ if (info->size == info->capacity) {
+ info->capacity <<= 1;
+ info = realloc(info, sizeof(array_info) + (info->capacity * item_size));
+ }
+ info->size++;
+ return &(info[1]);
}
void array_resize(void* array, size_t size) {
- array_info* info = &((array_info*)array)[-1];
+ array_info* info = &((array_info*)array)[-1];
info->size = size;
if (size > info->capacity) {
info->capacity = size;
@@ -61,18 +61,18 @@ void array_resize(void* array, size_t size) {
}
void array_print(void* array) {
- array_info* info = &((array_info*)array)[-1];
- printf( "size: %lu\n"
- "capacity: %lu\n"
- "array: %p\n",
- info->size,
- info->capacity,
- info->array);
+ array_info* info = &((array_info*)array)[-1];
+ printf( "size: %lu\n"
+ "capacity: %lu\n"
+ "array: %p\n",
+ info->size,
+ info->capacity,
+ info->array);
}
void array_pop(void* array) {
- array_info* info = &((array_info*)array)[-1];
- if (info->size)
- info->size--;
+ array_info* info = &((array_info*)array)[-1];
+ if (info->size)
+ info->size--;
}
diff --git a/array.h b/array.h
index b82e1e3..3ea2057 100644
--- a/array.h
+++ b/array.h
@@ -4,9 +4,9 @@
#include <stdbool.h>
typedef struct {
- size_t size;
- size_t capacity;
- char array[];
+ size_t size;
+ size_t capacity;
+ char array[];
} array_info;
array_info* array_new_(size_t item_size, size_t size);
@@ -23,16 +23,16 @@ void* array_add_(void* array, size_t item_size);
#define array_new(type, size) ((type*)(array_new_(sizeof(type), size)->array))
#define array_free(array) do { \
- free(((array_info*)(array)) - 1); \
- (array) = NULL; \
+ free(((array_info*)(array)) - 1); \
+ (array) = NULL; \
} while (0)
-#define array_erase(array, index) do { \
- if ((index)) {\
- for (int __i = (index) - 1; __i < array_size((array)) - 1; __i++) \
- (array)[__i] = (array)[__i + 1]; \
- ((array_info*)(array))[-1].size--; \
- } \
+#define array_erase(array, index) do { \
+ if ((index)) { \
+ for (int __i = (index) - 1; __i < array_size((array)) - 1; __i++) \
+ (array)[__i] = (array)[__i + 1]; \
+ ((array_info*)(array))[-1].size--; \
+ } \
} while(0)
#define array_insert(array, index, value) do { \
@@ -45,15 +45,15 @@ void* array_add_(void* array, size_t item_size);
#define array_add(array, value) do { \
- void* __temp = array_add_((array), sizeof(*(array))); \
- (array) = __temp; \
- (array)[array_size((array)) - 1] = value; \
+ void* __temp = array_add_((array), sizeof(*(array))); \
+ (array) = __temp; \
+ (array)[array_size((array)) - 1] = value; \
} while (0)
#define array_last(array) (array)[array_size(array) - 1]
-#define array_for_all(type__, name__, array__) \
-type__* CONCAT(it__, __LINE__) = array__; type__* CONCAT(end__, __LINE__) = array__ ? array__ + array_size(array__) : NULL; \
+#define array_for_all(type__, name__, array__) \
+type__* CONCAT(it__, __LINE__) = array__; type__* CONCAT(end__, __LINE__) = array__ ? array__ + array_size(array__) : NULL; \
for (type__* name__; (CONCAT(it__, __LINE__) < CONCAT(end__, __LINE__)) ? (name__ = CONCAT(it__, __LINE__), true) : false; CONCAT(it__, __LINE__)++)
#endif // ARRAY_H_
diff --git a/data-device.c b/data-device.c
index 3d04f1e..09926f6 100644
--- a/data-device.c
+++ b/data-device.c
@@ -9,7 +9,7 @@ void setup_data_device(client_state* state) {
}
static void data_offer_handle_offer(void *data, struct wl_data_offer *offer,
- const char *mime_type) {
+ const char *mime_type) {
}
static const struct wl_data_offer_listener data_offer_listener = {
@@ -17,13 +17,13 @@ static const struct wl_data_offer_listener data_offer_listener = {
};
static void data_device_handle_data_offer(void *data,
- struct wl_data_device *data_device, struct wl_data_offer *offer) {
+ struct wl_data_device *data_device, struct wl_data_offer *offer) {
// An application has created a new data source
wl_data_offer_add_listener(offer, &data_offer_listener, NULL);
}
static void data_device_handle_selection(void *data,
- struct wl_data_device *data_device, struct wl_data_offer *offer) {
+ struct wl_data_device *data_device, struct wl_data_offer *offer) {
client_state *state = data;
state->data_offer = offer;
@@ -64,11 +64,11 @@ static void data_device_handle_selection(void *data,
state->clipboard_size = current_clip; // we don't need the ACTUAL length of the buffer anymore, just the string :D
// remove newlines
int i, j;
- for (i = 0, j = 0; i < state->clipboard_size; i++) {
- if (state->clipboard[i] != '\n' && state->clipboard[i] != '\r') {
- state->clipboard[j++] = state->clipboard[i];
- }
- }
+ for (i = 0, j = 0; i < state->clipboard_size; i++) {
+ if (state->clipboard[i] != '\n' && state->clipboard[i] != '\r') {
+ state->clipboard[j++] = state->clipboard[i];
+ }
+ }
state->clipboard_size = j;
wl_data_offer_destroy(offer);
diff --git a/font.c b/font.c
index 2795ab3..0ce3561 100644
--- a/font.c
+++ b/font.c
@@ -1,9 +1,9 @@
#include <fontconfig/fontconfig.h>
+#include <freetype/ftmodapi.h>
#include "font.h"
#include "array.h"
#include "config.h"
-#include <freetype/ftmodapi.h>
const float ATLAS_PADDING = 3.0f;
@@ -14,8 +14,8 @@ char* get_font(const char* font_name) {
return NULL;
}
- FcConfigSubstitute(0, pattern, FcMatchPattern);
- FcDefaultSubstitute(pattern);
+ FcConfigSubstitute(0, pattern, FcMatchPattern);
+ FcDefaultSubstitute(pattern);
FcResult result = 0;
FcFontSet* font_patterns = FcFontSort(0, pattern, FcTrue, 0, &result);
@@ -100,26 +100,26 @@ void atlas_init(client_state* state) {
}
void atlas_create_texture(client_state* state) {
- glActiveTexture(GL_TEXTURE0);
- glGenTextures(1, &state->atlas.texture);
- glBindTexture(GL_TEXTURE_2D, state->atlas.texture);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glTexImage2D(
- GL_TEXTURE_2D,
- 0,
- GL_RED,
- (GLsizei) state->atlas.width,
- (GLsizei) state->atlas.height,
- 0,
- GL_RED,
- GL_UNSIGNED_BYTE,
- NULL);
+ glActiveTexture(GL_TEXTURE0);
+ glGenTextures(1, &state->atlas.texture);
+ glBindTexture(GL_TEXTURE_2D, state->atlas.texture);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glTexImage2D(
+ GL_TEXTURE_2D,
+ 0,
+ GL_RED,
+ (GLsizei) state->atlas.width,
+ (GLsizei) state->atlas.height,
+ 0,
+ GL_RED,
+ GL_UNSIGNED_BYTE,
+ NULL);
uint32_t x = 0;
for (int i = 32; i < 128; i++) {
@@ -130,18 +130,18 @@ void atlas_create_texture(client_state* state) {
metric_t* metric = &state->atlas.metrics[i];
metric->texture_x_start = (float)x / state->atlas.width;
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glTexSubImage2D(
- GL_TEXTURE_2D,
- 0,
- x,
- 0,
- metric->bitmap_width,
- metric->bitmap_height,
- GL_RED,
- GL_UNSIGNED_BYTE,
- state->ft_face->glyph->bitmap.buffer);
- x += metric->bitmap_width;
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glTexSubImage2D(
+ GL_TEXTURE_2D,
+ 0,
+ x,
+ 0,
+ metric->bitmap_width,
+ metric->bitmap_height,
+ GL_RED,
+ GL_UNSIGNED_BYTE,
+ state->ft_face->glyph->bitmap.buffer);
+ x += metric->bitmap_width;
metric->texture_x_end = (float)x / state->atlas.width;
x += ATLAS_PADDING;
}
diff --git a/graphics.c b/graphics.c
index 43d1069..b2fead7 100644
--- a/graphics.c
+++ b/graphics.c
@@ -396,6 +396,6 @@ void init_text_buffer(client_state* state, text_buffer_t* buffer, char* text, si
void destroy_text_buffer(text_buffer_t* buffer) {
glDeleteVertexArrays(1, &buffer->vao);
- glDeleteBuffers(1, &buffer->vbo);
- glDeleteBuffers(1, &buffer->ebo);
+ glDeleteBuffers(1, &buffer->vbo);
+ glDeleteBuffers(1, &buffer->ebo);
}
diff --git a/input_field.c b/input_field.c
index 6b34b1f..328254e 100644
--- a/input_field.c
+++ b/input_field.c
@@ -5,7 +5,7 @@
#include "graphics.h"
int compare(const void *a, const void *b) {
- return strlen(((item_display_t*)a)->item->text) > strlen(((item_display_t*)b)->item->text);
+ return strlen(((item_display_t*)a)->item->text) > strlen(((item_display_t*)b)->item->text);
}
void filter_items(client_state* state) {
diff --git a/keyboard.c b/keyboard.c
index 3ed761c..710ec76 100644
--- a/keyboard.c
+++ b/keyboard.c
@@ -17,66 +17,66 @@ void setup_keyboard(client_state* state) {
// listeners
void wl_keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard,
- uint32_t format, int32_t fd, uint32_t size) {
- client_state* state = data;
+ uint32_t format, int32_t fd, uint32_t size) {
+ client_state* state = data;
- if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
- fprintf(stderr, "unknown keyboard format");
+ if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
+ fprintf(stderr, "unknown keyboard format");
state->running = false;
state->exit_code = EXIT_FAILURE;
return;
- }
+ }
- char* buffer = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
- if (buffer == MAP_FAILED) {
- fprintf(stderr, "Failed to mmap keymap");
+ char* buffer = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
+ if (buffer == MAP_FAILED) {
+ fprintf(stderr, "Failed to mmap keymap");
state->running = false;
state->exit_code = EXIT_FAILURE;
- return;
- }
+ return;
+ }
- state->xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
- if (!state->xkb_context) {
- fprintf(stderr, "Failed to create xkb context\n");
+ state->xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
+ if (!state->xkb_context) {
+ fprintf(stderr, "Failed to create xkb context\n");
state->running = false;
state->exit_code = EXIT_FAILURE;
- return;
- }
-
- state->xkb_keymap = xkb_keymap_new_from_buffer(state->xkb_context, buffer, size - 1,
- XKB_KEYMAP_FORMAT_TEXT_V1,
- XKB_KEYMAP_COMPILE_NO_FLAGS);
- munmap(buffer, size);
- close(fd);
-
- state->xkb_state = xkb_state_new(state->xkb_keymap);
- if (!state->xkb_state) {
- fprintf(stderr, "Failed to create state");
+ return;
+ }
+
+ state->xkb_keymap = xkb_keymap_new_from_buffer(state->xkb_context, buffer, size - 1,
+ XKB_KEYMAP_FORMAT_TEXT_V1,
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
+ munmap(buffer, size);
+ close(fd);
+
+ state->xkb_state = xkb_state_new(state->xkb_keymap);
+ if (!state->xkb_state) {
+ fprintf(stderr, "Failed to create state");
state->running = false;
state->exit_code = EXIT_FAILURE;
return;
- }
+ }
- struct xkb_compose_table* xkb_compose_table = xkb_compose_table_new_from_locale(
- state->xkb_context, setlocale(LC_CTYPE, NULL), XKB_COMPOSE_COMPILE_NO_FLAGS);
+ struct xkb_compose_table* xkb_compose_table = xkb_compose_table_new_from_locale(
+ state->xkb_context, setlocale(LC_CTYPE, NULL), XKB_COMPOSE_COMPILE_NO_FLAGS);
- if (!xkb_compose_table) {
- fprintf(stderr, "Failed to create xkb compose table");
+ if (!xkb_compose_table) {
+ fprintf(stderr, "Failed to create xkb compose table");
state->running = false;
state->exit_code = EXIT_FAILURE;
- return;
- }
+ return;
+ }
- state->xkb_compose_state = xkb_compose_state_new(xkb_compose_table, XKB_COMPOSE_STATE_NO_FLAGS);
+ state->xkb_compose_state = xkb_compose_state_new(xkb_compose_table, XKB_COMPOSE_STATE_NO_FLAGS);
}
void wl_keyboard_enter(void *data, struct wl_keyboard *wl_keyboard,
- uint32_t serial, struct wl_surface *surface,
- struct wl_array *keys) {
+ uint32_t serial, struct wl_surface *surface,
+ struct wl_array *keys) {
}
void wl_keyboard_leave(void *data, struct wl_keyboard *wl_keyboard,
- uint32_t serial, struct wl_surface *surface) {
+ uint32_t serial, struct wl_surface *surface) {
client_state *state = data;
// close on focus lost
@@ -85,8 +85,8 @@ void wl_keyboard_leave(void *data, struct wl_keyboard *wl_keyboard,
}
void wl_keyboard_key(void *data, struct wl_keyboard *wl_keyboard,
- uint32_t serial, uint32_t time, uint32_t key,
- uint32_t key_state) {
+ uint32_t serial, uint32_t time, uint32_t key,
+ uint32_t key_state) {
client_state *state = data;
xkb_keysym_t keysym = xkb_state_key_get_one_sym(state->xkb_state, key + 8);
@@ -121,25 +121,25 @@ void wl_keyboard_key(void *data, struct wl_keyboard *wl_keyboard,
}
void wl_keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard,
- uint32_t serial, uint32_t mods_depressed,
- uint32_t mods_latched, uint32_t mods_locked,
- uint32_t group) {
- client_state* state = data;
- xkb_state_update_mask(state->xkb_state, mods_depressed, mods_latched, mods_locked, 0, 0, group);
+ uint32_t serial, uint32_t mods_depressed,
+ uint32_t mods_latched, uint32_t mods_locked,
+ uint32_t group) {
+ client_state* state = data;
+ xkb_state_update_mask(state->xkb_state, mods_depressed, mods_latched, mods_locked, 0, 0, group);
}
void wl_keyboard_repeat_info(void *data, struct wl_keyboard *wl_keyboard,
- int32_t rate, int32_t delay) {
- client_state* state = data;
- state->key_repeat_rate = rate;
- state->key_repeat_delay = delay;
+ int32_t rate, int32_t delay) {
+ client_state* state = data;
+ state->key_repeat_rate = rate;
+ state->key_repeat_delay = delay;
}
struct wl_keyboard_listener keyboard_listener = {
- .keymap = wl_keyboard_keymap,
- .enter = wl_keyboard_enter,
- .leave = wl_keyboard_leave,
- .key = wl_keyboard_key,
- .modifiers = wl_keyboard_modifiers,
- .repeat_info = wl_keyboard_repeat_info,
+ .keymap = wl_keyboard_keymap,
+ .enter = wl_keyboard_enter,
+ .leave = wl_keyboard_leave,
+ .key = wl_keyboard_key,
+ .modifiers = wl_keyboard_modifiers,
+ .repeat_info = wl_keyboard_repeat_info,
};
diff --git a/main.c b/main.c
index 714e3a5..ce9022d 100644
--- a/main.c
+++ b/main.c
@@ -115,33 +115,33 @@ void poll_events(client_state* state) {
[KEYREPEAT_FD] = { state->key_repeat_timer_fd, POLLIN },
};
- bool event = false;
- while (!event) {
- while (wl_display_prepare_read(state->display) != 0) {
- if (wl_display_dispatch_pending(state->display) > 0) {
- return;
- }
- }
- if (poll(fds, sizeof(fds) / sizeof(fds[0]), -1) == -1) {
- wl_display_cancel_read(state->display);
- return;
- }
- if (fds[DISPLAY_FD].revents & POLLIN) {
- wl_display_read_events(state->display);
- if (wl_display_dispatch_pending(state->display) > 0)
- event = true;
- }
- else {
- wl_display_cancel_read(state->display);
- }
- if (fds[KEYREPEAT_FD].revents & POLLIN) {
- uint64_t repeats;
- if (read(state->key_repeat_timer_fd, &repeats, sizeof(repeats)) == 8) {
- for (uint64_t i = 0; i < repeats; i++) {
+ bool event = false;
+ while (!event) {
+ while (wl_display_prepare_read(state->display) != 0) {
+ if (wl_display_dispatch_pending(state->display) > 0) {
+ return;
+ }
+ }
+ if (poll(fds, sizeof(fds) / sizeof(fds[0]), -1) == -1) {
+ wl_display_cancel_read(state->display);
+ return;
+ }
+ if (fds[DISPLAY_FD].revents & POLLIN) {
+ wl_display_read_events(state->display);
+ if (wl_display_dispatch_pending(state->display) > 0)
+ event = true;
+ }
+ else {
+ wl_display_cancel_read(state->display);
+ }
+ if (fds[KEYREPEAT_FD].revents & POLLIN) {
+ uint64_t repeats;
+ if (read(state->key_repeat_timer_fd, &repeats, sizeof(repeats)) == 8) {
+ for (uint64_t i = 0; i < repeats; i++) {
type_key(state, state->repeat_key);
- }
- event = true;
- }
- }
- }
+ }
+ event = true;
+ }
+ }
+ }
}
diff --git a/seat.c b/seat.c
index fb5ffb1..9a04681 100644
--- a/seat.c
+++ b/seat.c
@@ -11,14 +11,14 @@ void setup_seat(client_state* state) {
// listeners
void capabilities(void *data, struct wl_seat *wl_seat, uint32_t capabilities) {
- client_state* state = data;
+ client_state* state = data;
setup_data_device(state);
- if (capabilities & WL_SEAT_CAPABILITY_KEYBOARD && !state->keyboard) {
+ if (capabilities & WL_SEAT_CAPABILITY_KEYBOARD && !state->keyboard) {
setup_keyboard(state);
- }
- if (capabilities & WL_SEAT_CAPABILITY_POINTER && !state->pointer) {
+ }
+ if (capabilities & WL_SEAT_CAPABILITY_POINTER && !state->pointer) {
setup_pointer(state);
- }
+ }
}
void name(void *data, struct wl_seat *wl_seat, const char *name) {
diff --git a/shader.c b/shader.c
index 087777e..f700485 100644
--- a/shader.c
+++ b/shader.c
@@ -3,42 +3,42 @@
#include <stdio.h>
GLuint createShader(const char *vertexCode, const char *fragmentCode) {
- GLuint vertex, fragment;
- int success;
- char infoLog[512];
+ GLuint vertex, fragment;
+ int success;
+ char infoLog[512];
- vertex = glCreateShader(GL_VERTEX_SHADER);
- glShaderSource(vertex, 1, &vertexCode, NULL);
- glCompileShader(vertex);
+ vertex = glCreateShader(GL_VERTEX_SHADER);
+ glShaderSource(vertex, 1, &vertexCode, NULL);
+ glCompileShader(vertex);
- glGetShaderiv(vertex, GL_COMPILE_STATUS, &success);
- if (!success) {
- glGetShaderInfoLog(vertex, 512, NULL, infoLog);
+ glGetShaderiv(vertex, GL_COMPILE_STATUS, &success);
+ if (!success) {
+ glGetShaderInfoLog(vertex, 512, NULL, infoLog);
fprintf(stderr, "ERROR: Failed to compile vertex shader: %s\n", infoLog);
- }
+ }
- fragment = glCreateShader(GL_FRAGMENT_SHADER);
- glShaderSource(fragment, 1, &fragmentCode, NULL);
- glCompileShader(fragment);
+ fragment = glCreateShader(GL_FRAGMENT_SHADER);
+ glShaderSource(fragment, 1, &fragmentCode, NULL);
+ glCompileShader(fragment);
- glGetShaderiv(fragment, GL_COMPILE_STATUS, &success);
- if (!success) {
- glGetShaderInfoLog(fragment, 512, NULL, infoLog);
+ glGetShaderiv(fragment, GL_COMPILE_STATUS, &success);
+ if (!success) {
+ glGetShaderInfoLog(fragment, 512, NULL, infoLog);
fprintf(stderr, "ERROR: Failed to compile fragment shader: %s\n", infoLog);
- }
+ }
- GLuint ShaderProgram = glCreateProgram();
- glAttachShader(ShaderProgram, vertex);
- glAttachShader(ShaderProgram, fragment);
- glLinkProgram(ShaderProgram);
+ GLuint ShaderProgram = glCreateProgram();
+ glAttachShader(ShaderProgram, vertex);
+ glAttachShader(ShaderProgram, fragment);
+ glLinkProgram(ShaderProgram);
- glGetProgramiv(ShaderProgram, GL_LINK_STATUS, &success);
- if (!success) {
+ glGetProgramiv(ShaderProgram, GL_LINK_STATUS, &success);
+ if (!success) {
fprintf(stderr, "Failed to link shaders\n");
- }
+ }
- glDeleteShader(vertex);
- glDeleteShader(fragment);
+ glDeleteShader(vertex);
+ glDeleteShader(fragment);
- return ShaderProgram;
+ return ShaderProgram;
}
diff --git a/state.h b/state.h
index 53fa16a..bda822c 100644
--- a/state.h
+++ b/state.h
@@ -53,18 +53,18 @@ typedef struct {
typedef struct {
// wayland
- struct wl_display* display;
- struct wl_registry* registry;
- struct wl_compositor* compositor;
- struct wl_surface* surface;
- struct zwlr_layer_shell_v1* layer_shell;
- struct zwlr_layer_surface_v1* layer_surface;
- struct wl_seat* seat;
+ struct wl_display* display;
+ struct wl_registry* registry;
+ struct wl_compositor* compositor;
+ struct wl_surface* surface;
+ struct zwlr_layer_shell_v1* layer_shell;
+ struct zwlr_layer_surface_v1* layer_surface;
+ struct wl_seat* seat;
struct wl_data_device_manager *data_device_manager;
struct wl_data_device *data_device;
struct wl_data_offer *data_offer;
- struct wl_keyboard* keyboard;
- struct wl_pointer* pointer;
+ struct wl_keyboard* keyboard;
+ struct wl_pointer* pointer;
struct wp_cursor_shape_manager_v1* cursor_shape_manager;
struct wp_cursor_shape_device_v1* cursor_shape_device;
char* clipboard;
@@ -72,19 +72,19 @@ typedef struct {
// xkb
struct xkb_context* xkb_context;
- struct xkb_keymap* xkb_keymap;
- struct xkb_state* xkb_state;
+ struct xkb_keymap* xkb_keymap;
+ struct xkb_state* xkb_state;
struct xkb_compose_state* xkb_compose_state;
int key_repeat_rate, key_repeat_delay;
- int key_repeat_timer_fd;
+ int key_repeat_timer_fd;
xkb_keysym_t repeat_key;
// egl
- struct wl_egl_window* egl_window;
- EGLDisplay egl_display;
- EGLSurface egl_surface;
- EGLConfig egl_config;
- EGLContext egl_context;
+ struct wl_egl_window* egl_window;
+ EGLDisplay egl_display;
+ EGLSurface egl_surface;
+ EGLConfig egl_config;
+ EGLContext egl_context;
// graphics
GLuint text_shader;
@@ -118,9 +118,9 @@ typedef struct {
item_t* items;
// state
- bool running;
+ bool running;
int exit_code;
- uint32_t width, height;
+ uint32_t width, height;
item_display_t* filtered_items;
int selected_filtered_item;
char* input_buffer;