Make the layout switchable

This commit is contained in:
Stacy Harper 2021-08-22 23:14:47 +02:00 committed by John Sullivan
parent 0789db751d
commit 1fc0fbe5e6
4 changed files with 13 additions and 6 deletions

View File

@ -1,5 +1,7 @@
include config.mk
NAME=wvkbd
BIN=${NAME}-${LAYOUT}
SRC=.
WLDSRC=wld
@ -8,7 +10,7 @@ PKGS = fontconfig wayland-client xkbcommon pixman-1
WVKBD_SOURCES += $(wildcard $(SRC)/*.c)
WVKBD_HEADERS += $(wildcard $(SRC)/*.h)
CFLAGS += -std=gnu99 -Wall -g -DWITH_WAYLAND_SHM
CFLAGS += -std=gnu99 -Wall -g -DWITH_WAYLAND_SHM -DLAYOUT=\"layout.${LAYOUT}.h\"
CFLAGS += $(shell pkg-config --cflags $(PKGS))
LDFLAGS =wld/libwld.a $(shell pkg-config --libs $(PKGS)) -lm -lutil
@ -20,7 +22,7 @@ SOURCES = $(WVKBD_SOURCES) $(WAYLAND_SRC)
OBJECTS = $(SOURCES:.c=.o)
all: wld wvkbd
all: wld ${BIN}
proto/%-client-protocol.c: proto/%.xml
wayland-scanner code < $? > $@
@ -30,8 +32,8 @@ proto/%-client-protocol.h: proto/%.xml
$(OBJECTS): $(HDRS) $(WVKBD_HEADERS)
wvkbd: $(OBJECTS)
$(CC) -o wvkbd $(OBJECTS) $(LDFLAGS)
wvkbd-${LAYOUT}: $(OBJECTS) layout.${LAYOUT}.h
$(CC) -o wvkbd-${LAYOUT} $(OBJECTS) $(LDFLAGS)
wld: wld/libwld.a
@ -39,7 +41,7 @@ wld/libwld.a:
$(MAKE) -C wld ENABLE_DRM=0
clean:
rm -f $(OBJECTS) $(HDRS) $(WAYLAND_SRC) wvkbd
rm -f $(OBJECTS) $(HDRS) $(WAYLAND_SRC) ${BIN}
$(MAKE) -C wld clean
format:

View File

@ -1,2 +1,3 @@
VERSION = 0.0.1
CFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=700
LAYOUT = mobile

6
main.c
View File

@ -126,7 +126,11 @@ static const struct zwlr_layer_surface_v1_listener layer_surface_listener = {
.closed = layer_surface_closed,
};
#include "config.h"
/* configuration, allows nested code to access above variables */
#ifndef LAYOUT
#error "make sure to define LAYOUT"
#endif
#include LAYOUT
void
wl_touch_down(void *data, struct wl_touch *wl_touch, uint32_t serial,