diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2019-08-25 00:36:44 +0100 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2019-08-25 00:36:44 +0100 |
commit | 40a738b43b38c187233ae3b0905a785ce824b03f (patch) | |
tree | f779bc677b9161987f797344458d4485e71a947d | |
parent | a9b4be7e4a75a8e3d7041cedc99cb808d1da5e1d (diff) | |
download | imv-40a738b43b38c187233ae3b0905a785ce824b03f.tar.gz |
Remove unused imv_window_get_keymap function
-rw-r--r-- | src/dummy_window.c | 6 | ||||
-rw-r--r-- | src/window.h | 6 | ||||
-rw-r--r-- | src/wl_window.c | 16 | ||||
-rw-r--r-- | src/x11_window.c | 12 |
4 files changed, 4 insertions, 36 deletions
diff --git a/src/dummy_window.c b/src/dummy_window.c index e6ce54d..ae6e9c3 100644 --- a/src/dummy_window.c +++ b/src/dummy_window.c @@ -94,9 +94,3 @@ void imv_window_pump_events(struct imv_window *window, imv_event_handler handler (void)handler; (void)data; } - -const char *imv_window_get_keymap(struct imv_window *window) -{ - (void)window; - return NULL; -} diff --git a/src/window.h b/src/window.h index 6c692cc..f84cbaf 100644 --- a/src/window.h +++ b/src/window.h @@ -92,10 +92,4 @@ typedef void (*imv_event_handler)(void *data, const struct imv_event *e); * queue */ void imv_window_pump_events(struct imv_window *window, imv_event_handler handler, void *data); -/* If the current keyboard layout is known, returns a null-terminated string - * describing the keyboard layout and options, suitable for libxkbcommon to - * parse. If unknown, returns NULL. - */ -const char *imv_window_get_keymap(struct imv_window *window); - #endif diff --git a/src/wl_window.c b/src/wl_window.c index cb61899..806e243 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -53,8 +53,6 @@ struct imv_window { bool fullscreen; int scale; - char *keymap; - struct { struct { double last; @@ -108,16 +106,10 @@ static void keyboard_keymap(void *data, struct wl_keyboard *keyboard, (void)keyboard; (void)format; struct imv_window *window = data; - if (window->keymap) { - free(window->keymap); - } - window->keymap = malloc(size); char *src = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); - memcpy(window->keymap, src, size); + imv_keyboard_set_keymap(window->keyboard, src); munmap(src, size); close(fd); - - imv_keyboard_set_keymap(window->keyboard, window->keymap); } static void keyboard_enter(void *data, struct wl_keyboard *keyboard, @@ -785,7 +777,6 @@ void imv_window_free(struct imv_window *window) { timer_delete(&window->timer_id); imv_keyboard_free(window->keyboard); - free(window->keymap); shutdown_wayland(window); list_deep_free(window->wl_outputs); free(window); @@ -911,8 +902,3 @@ void imv_window_pump_events(struct imv_window *window, imv_event_handler handler cleanup_event(&e); } } - -const char *imv_window_get_keymap(struct imv_window *window) -{ - return window->keymap; -} diff --git a/src/x11_window.c b/src/x11_window.c index 734a1c4..d4b187f 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -39,7 +39,6 @@ struct imv_window { struct imv_keyboard *keyboard; int pipe_fds[2]; - char *keymap; }; static void set_nonblocking(int fd) @@ -80,7 +79,9 @@ static void setup_keymap(struct imv_window *window) struct xkb_keymap *keymap = xkb_x11_keymap_new_from_device(context, conn, device, 0); if (keymap) { - window->keymap = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_USE_ORIGINAL_FORMAT); + char *keymap_str = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_USE_ORIGINAL_FORMAT); + imv_keyboard_set_keymap(window->keyboard, keymap_str); + free(keymap_str); } else { imv_log(IMV_ERROR, "x11_window: Failed to load keymap. xkb_x11_keymap_new_from_device returned NULL."); } @@ -148,7 +149,6 @@ struct imv_window *imv_window_create(int w, int h, const char *title) assert(window->keyboard); setup_keymap(window); - imv_keyboard_set_keymap(window->keyboard, window->keymap); return window; } @@ -160,7 +160,6 @@ void imv_window_free(struct imv_window *window) close(window->pipe_fds[1]); glXDestroyContext(window->x_display, window->x_glc); XCloseDisplay(window->x_display); - free(window->keymap); free(window); } @@ -424,8 +423,3 @@ void imv_window_pump_events(struct imv_window *window, imv_event_handler handler } } } - -const char *imv_window_get_keymap(struct imv_window *window) -{ - return window->keymap; -} |