about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--keyboard.c39
-rw-r--r--keyboard.h2
3 files changed, 1 insertions, 42 deletions
diff --git a/Makefile b/Makefile
index a1bcca3..0bdd98e 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ PKGS = wayland-client xkbcommon pangocairo
 WVKBD_SOURCES += $(wildcard $(SRC)/*.c)
 WVKBD_HEADERS += $(wildcard $(SRC)/*.h)
 
-CFLAGS += -std=gnu99 -Wall -g -DWITH_WAYLAND_SHM -DLAYOUT=\"layout.${LAYOUT}.h\" -DKEYMAP=\"keymap.${LAYOUT}.h\"
+CFLAGS += -std=gnu99 -Wall -g -DWITH_WAYLAND_SHM -DLAYOUT=\"layout.${LAYOUT}.h\"
 CFLAGS += $(shell pkg-config --cflags $(PKGS))
 LDFLAGS =$(shell pkg-config --libs $(PKGS)) -lm -lutil -lrt
 
diff --git a/keyboard.c b/keyboard.c
index 5a6471d..41b345d 100644
--- a/keyboard.c
+++ b/keyboard.c
@@ -12,11 +12,6 @@
 	fprintf(stderr, __VA_ARGS__);                                                \
 	exit(1)
 
-#ifndef KEYMAP
-#error "make sure to define KEYMAP"
-#endif
-#include KEYMAP
-
 void
 kbd_switch_layout(struct kbd *kb, struct layout *l) {
 	kb->prevlayout = kb->layout;
@@ -26,7 +21,6 @@ kbd_switch_layout(struct kbd *kb, struct layout *l) {
 	if ((!kb->prevlayout) ||
 	    (strcmp(kb->prevlayout->keymap_name, kb->layout->keymap_name) != 0)) {
 		fprintf(stderr, "Switching to keymap %s\n", kb->layout->keymap_name);
-		create_and_upload_keymap(kb, kb->layout->keymap_name, 0, 0);
 	}
 	kbd_draw_layout(kb);
 }
@@ -107,9 +101,6 @@ kbd_init(struct kbd *kb, struct layout *layouts, char *layer_names_list) {
 
 	kb->layout = &kb->layouts[layer];
 	kb->prevlayout = kb->layout;
-
-	/* upload keymap */
-	create_and_upload_keymap(kb, kb->layout->keymap_name, 0, 0);
 }
 
 void
@@ -356,33 +347,3 @@ draw_over_inset(struct drwsurf *ds, uint32_t x, uint32_t y, uint32_t width,
 	drw_over_rectangle(ds, color, x + border, y + border, width - border,
 	                   height - border);
 }
-
-void
-create_and_upload_keymap(struct kbd *kb, const char *name, uint32_t comp_unichr,
-                         uint32_t comp_shift_unichr) {
-	int keymap_index = -1;
-	for (int i = 0; i < NUMKEYMAPS; i++) {
-		if (!strcmp(keymap_names[i], name)) {
-			keymap_index = i;
-		}
-	}
-	if (keymap_index == -1) {
-		fprintf(stderr, "No such keymap defined: %s\n", name);
-		exit(9);
-	}
-	const char *keymap_template = keymaps[keymap_index];
-	const size_t keymap_size = strlen(keymap_template) + 64;
-	char *keymap_str = malloc(keymap_size);
-	sprintf(keymap_str, keymap_template, comp_unichr, comp_shift_unichr);
-	int keymap_fd = os_create_anonymous_file(keymap_size);
-	if (keymap_fd < 0) {
-		die("could not create keymap fd\n");
-	}
-	void *ptr =
-	  mmap(NULL, keymap_size, PROT_READ | PROT_WRITE, MAP_SHARED, keymap_fd, 0);
-	if (ptr == (void *)-1) {
-		die("could not map keymap data\n");
-	}
-	strcpy(ptr, keymap_str);
-	free((void *)keymap_str);
-}
diff --git a/keyboard.h b/keyboard.h
index 24162ef..6aacbb7 100644
--- a/keyboard.h
+++ b/keyboard.h
@@ -130,8 +130,6 @@ uint8_t kbd_get_rows(struct layout *l);
 double kbd_get_row_length(struct key *k);
 void kbd_switch_layout(struct kbd *kb, struct layout *l);
 
-void create_and_upload_keymap(struct kbd *kb, const char *name,
-                              uint32_t comp_unichr, uint32_t comp_shift_unichr);
 
 #ifndef LAYOUT
 #error "make sure to define LAYOUT"