suggestion picker: a persistent layer to complement virtual keyboards like wvkbd
layout: Remove layout file
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | Makefile | 14 | ||||
| -rw-r--r-- | config.h | 3 | ||||
| -rw-r--r-- | config.mk | 1 | ||||
| -rw-r--r-- | keyboard.c | 10 | ||||
| -rw-r--r-- | keyboard.h | 4 | ||||
| -rw-r--r-- | main.c | 8 |
7 files changed, 17 insertions, 25 deletions
@@ -4,4 +4,4 @@ *-client-protocol.h .gdb_history *.log -wvkbd +suggpicker @@ -1,7 +1,7 @@ include config.mk -NAME=wvkbd -BIN=${NAME}-${LAYOUT} +NAME=suggpicker +BIN=${NAME} SRC=. PKGS = wayland-client xkbcommon pangocairo @@ -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\" +CFLAGS += -std=gnu99 -Wall -g -DWITH_WAYLAND_SHM CFLAGS += $(shell pkg-config --cflags $(PKGS)) LDFLAGS =$(shell pkg-config --libs $(PKGS)) -lm -lutil -lrt @@ -31,8 +31,8 @@ proto/%-client-protocol.h: proto/%.xml $(OBJECTS): $(HDRS) $(WVKBD_HEADERS) -wvkbd-${LAYOUT}: config.h $(OBJECTS) layout.${LAYOUT}.h - $(CC) -o wvkbd-${LAYOUT} $(OBJECTS) $(LDFLAGS) +${BIN}: config.h $(OBJECTS) + $(CC) -o ${BIN} $(OBJECTS) $(LDFLAGS) clean: rm -f $(OBJECTS) $(HDRS) $(WAYLAND_SRC) ${BIN} @@ -42,5 +42,5 @@ format: install: all mkdir -p ${DESTDIR}${PREFIX}/bin - cp -f ${NAME}-${LAYOUT} ${DESTDIR}${PREFIX}/bin - chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME}-${LAYOUT} + cp -f ${BIN} ${DESTDIR}${PREFIX}/bin + chmod 755 ${DESTDIR}${PREFIX}/bin/${BIN} @@ -1,6 +1,9 @@ #ifndef config_def_h_INCLUDED #define config_def_h_INCLUDED +#define KBD_PIXEL_HEIGHT 40 +#define KBD_PIXEL_LANDSCAPE_HEIGHT 40 + static const char *default_font = "Monospace 14"; struct clr_scheme scheme = { @@ -1,3 +1,2 @@ VERSION = 0.2 CFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=700 -LAYOUT = mobintl @@ -4,7 +4,7 @@ #include "drw.h" #include "os-compatibility.h" -#define MAX_LAYERS 25 +#define KBD_KEY_BORDER 1 /* lazy die macro */ #define die(...) \ @@ -147,12 +147,12 @@ kbd_resize(struct kbd *kb) { void draw_inset(struct drwsurf *ds, uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t border, Color color) { - drw_fill_rectangle(ds, color, x + border, y + border, width - border, - height - border); + drw_fill_rectangle(ds, color, x + border, y + border, width - (border*2), + height - (border*2)); } void draw_over_inset(struct drwsurf *ds, uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t border, Color color) { - drw_over_rectangle(ds, color, x + border, y + border, width - border, - height - border); + drw_over_rectangle(ds, color, x + border, y + border, width - (border*2), + height - (border*2)); } @@ -63,8 +63,4 @@ void kbd_draw_layout(struct kbd *kb); void kbd_resize(struct kbd *kb); double kbd_get_row_length(struct key *k); -#ifndef LAYOUT -#error "make sure to define LAYOUT" -#endif -#include LAYOUT #endif @@ -310,7 +310,7 @@ handle_global_remove(void *data, struct wl_registry *registry, uint32_t name) {} void layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *surface, uint32_t serial, uint32_t w, uint32_t h) { - keyboard.w = w + KBD_PIXEL_OVERSCAN_WIDTH; + keyboard.w = w; keyboard.h = h; kbd_resize(&keyboard); @@ -399,12 +399,6 @@ main(int argc, char **argv) { height = normal_height = KBD_PIXEL_HEIGHT; landscape_height = KBD_PIXEL_LANDSCAPE_HEIGHT; - char *tmp; - if ((tmp = getenv("WVKBD_HEIGHT"))) - normal_height = atoi(tmp); - if ((tmp = getenv("WVKBD_LANDSCAPE_HEIGHT"))) - landscape_height = atoi(tmp); - /* keyboard settings */ keyboard.scheme = scheme; |