aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--config.h2
-rw-r--r--keyboard.c12
-rw-r--r--main.c25
-rw-r--r--state.h1
5 files changed, 27 insertions, 18 deletions
diff --git a/README.md b/README.md
index 7aa74fb..4f6b2ea 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,11 @@ To install(have to be root):
make install
```
+Usage: just like dmenu
+
+## FAQ
+Q: What is an ENU?
+
## Todo -
- [x] "selection"
- [x] figure out whats going on with stderr and exit code
diff --git a/config.h b/config.h
index 8deca15..9a2ef97 100644
--- a/config.h
+++ b/config.h
@@ -10,7 +10,7 @@ typedef struct {
static const bool fancy_scroll = false;
static const uint32_t min_width = 500;
-static const uint32_t font_size = 16;
+static const uint32_t font_size = 15;
static const color_t text_color = {0.85, 0.85, 0.85, 1.0};
static const color_t highlight_color = {0.1, 0.3, 0.7, 1.0};
static const color_t background_color = {0.1, 0.1, 0.1, 1.0};
diff --git a/keyboard.c b/keyboard.c
index 470fd11..3836333 100644
--- a/keyboard.c
+++ b/keyboard.c
@@ -56,18 +56,6 @@ void wl_keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard,
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);
-
- if (!xkb_compose_table) {
- fprintf(stderr, "Failed to create xkb compose table");
- state->running = false;
- state->exit_code = EXIT_FAILURE;
- return;
- }
-
- 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,
diff --git a/main.c b/main.c
index f0c53b9..f27bb06 100644
--- a/main.c
+++ b/main.c
@@ -12,7 +12,6 @@
#include "font.h"
#include "array.h"
#include "args.h"
-#include "layout.h"
void poll_events(client_state* state);
@@ -21,13 +20,17 @@ void read_stdin(client_state* state) {
size_t a;
char* line = NULL;
while((len = getline(&line, &a, stdin)) != -1) {
- if (line[len - 1] == '\n') {
- line[len - 1] = '\0';
- len -= 1;
+ if (len) {
+ if (line[len - 1] == '\n') {
+ line[len - 1] = '\0';
+ len -= 1;
+ }
}
if (len != 0) {
array_add(state->items, (item_t){0});
array_last(state->items).text = line;
+ } else {
+ free(line);
}
line = NULL;
}
@@ -37,6 +40,7 @@ void read_stdin(client_state* state) {
int main(int argc, char* argv[]) {
client_state state = {0};
state.running = true;
+ state.items = array_new(item_t, 0);
state.input_buffer = array_new(char, 0);
state.filtered_items = array_new(item_display_t, 0);
state.selected_filtered_item = -1;
@@ -109,8 +113,21 @@ int main(int argc, char* argv[]) {
// cleanup (of course)
if (state.items) {
+ array_for_all(item_t, item, state.items) {
+ free(item->text);
+ }
array_free(state.items);
}
+ array_free(state.input_buffer);
+ array_free(state.filtered_items);
+ array_free(state.page_indices);
+ if (state.clipboard) free(state.clipboard);
+ FT_Done_Face(state.ft_face);
+ FT_Done_FreeType(state.ft_library);
+
+ xkb_state_unref(state.xkb_state);
+ xkb_keymap_unref(state.xkb_keymap);
+ xkb_context_unref(state.xkb_context);
return state.exit_code;
}
diff --git a/state.h b/state.h
index 695ad2f..a58f4d5 100644
--- a/state.h
+++ b/state.h
@@ -78,7 +78,6 @@ typedef struct {
struct xkb_context* xkb_context;
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;
xkb_keysym_t repeat_key;