From 4ab83f9dfce2db53293f65f22590260217fbbbd5 Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Thu, 24 Mar 2011 19:31:00 +0100 Subject: [PATCH] Adding layouts support. --- Makefile | 5 +-- config.def.h | 73 -------------------------------------- config.mk | 9 +++-- layouts/layout.arrows.h | 20 +++++++++++ layouts/layout.de.h | 78 +++++++++++++++++++++++++++++++++++++++++ layouts/layout.def.h | 74 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 182 insertions(+), 77 deletions(-) create mode 100644 layouts/layout.arrows.h create mode 100644 layouts/layout.de.h create mode 100644 layouts/layout.def.h diff --git a/Makefile b/Makefile index e11b021..0d48614 100644 --- a/Makefile +++ b/Makefile @@ -13,10 +13,11 @@ options: @echo "CFLAGS = ${CFLAGS}" @echo "LDFLAGS = ${LDFLAGS}" @echo "CC = ${CC}" + @echo "LAYOUT = ${LAYOUT}" .c.o: @echo CC $< - @${CC} -c ${CFLAGS} $< + @${CC} ${CPPFLAGS} -c ${CFLAGS} $< ${OBJ}: config.h config.mk @@ -36,7 +37,7 @@ dist: clean @echo creating dist tarball @mkdir -p svkbd-${VERSION} @cp -R LICENSE Makefile README config.def.h config.mk \ - ${SRC} svkbd-${VERSION} + ${SRC} layouts svkbd-${VERSION} @tar -cf svkbd-${VERSION}.tar svkbd-${VERSION} @gzip svkbd-${VERSION}.tar @rm -rf svkbd-${VERSION} diff --git a/config.def.h b/config.def.h index 1bd585f..c85a928 100644 --- a/config.def.h +++ b/config.def.h @@ -6,76 +6,3 @@ static const char hovfgcolor[] = "#000000"; static const char pressbgcolor[] = "#0000cc"; static const char pressfgcolor[] = "#ffffff"; -static int wh = 200; -static int ww = 0; -static int wx = 0; -static int wy = -200; - -static Key keys[] = { - { "1!", XK_1, 1 }, - { "2@", XK_2, 1 }, - { "3#", XK_3, 1 }, - { "4$", XK_4, 1 }, - { "5%", XK_5, 1 }, - { "6^", XK_6, 1 }, - { "7&", XK_7, 1 }, - { "8*", XK_8, 1 }, - { "9(", XK_9, 1 }, - { "0)", XK_0, 1 }, - { "-_", XK_minus, 1 }, - { "=+", XK_plus, 1 }, - { "<-", XK_BackSpace, 2 }, - { 0 }, /* New row */ - { "->|", XK_Tab, 1 }, - { 0, XK_q, 1 }, - { 0, XK_w, 1 }, - { 0, XK_e, 1 }, - { 0, XK_r, 1 }, - { 0, XK_t, 1 }, - { 0, XK_y, 1 }, - { 0, XK_u, 1 }, - { 0, XK_i, 1 }, - { 0, XK_o, 1 }, - { 0, XK_p, 1 }, - { "[", XK_bracketleft, 1 }, - { "]", XK_bracketright, 1 }, - { "Return", XK_Return, 3 }, - { 0 }, /* New row */ - { 0, XK_Caps_Lock, 2 }, - { 0, XK_a, 1 }, - { 0, XK_s, 1 }, - { 0, XK_d, 1 }, - { 0, XK_f, 1 }, - { 0, XK_g, 1 }, - { 0, XK_h, 1 }, - { 0, XK_j, 1 }, - { 0, XK_k, 1 }, - { 0, XK_l, 1 }, - { ":;", XK_semicolon, 1 }, - { "'\"", XK_exclam, 1 }, - { "\\|", XK_backslash, 1 }, - { 0 }, /* New row */ - { 0, XK_Shift_L, 3 }, - { 0, XK_z, 1 }, - { 0, XK_x, 1 }, - { 0, XK_c, 1 }, - { 0, XK_v, 1 }, - { 0, XK_b, 1 }, - { 0, XK_n, 1 }, - { 0, XK_m, 1 }, - { ",", XK_colon, 1 }, - { ".", XK_period, 1 }, - { "/?", XK_slash, 1 }, - { 0, XK_Shift_R, 2 }, - { 0 }, /* New row */ - { "Ctrl", XK_Control_L, 2 }, - { "Alt", XK_Alt_L, 2 }, - { "", XK_space, 5 }, - { "Alt", XK_Alt_R, 2 }, - { "Ctrl", XK_Control_R, 2 }, -}; - -Buttonmod buttonmods[] = { - { XK_Shift_L, Button2 }, - { XK_Alt_L, Button3 }, -}; diff --git a/config.mk b/config.mk index ecaad93..fe83be3 100644 --- a/config.mk +++ b/config.mk @@ -1,6 +1,8 @@ # svkbd version VERSION = 0.1 +LAYOUT?=def + # Customize below to fit your system # paths @@ -11,11 +13,13 @@ X11INC = /usr/X11R6/include X11LIB = /usr/X11R6/lib # includes and libs -INCS = -I. -I/usr/include -I${X11INC} +INCS = -I. -I./layouts -I/usr/include -I${X11INC} LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lXtst # flags -CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} +CPPFLAGS = -DVERSION=\"${VERSION}\" \ + -DCONFIGLAYOUT_H=\"layout.${LAYOUT}.h\" \ + ${XINERAMAFLAGS} CFLAGS = -g -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} LDFLAGS = -g ${LIBS} @@ -25,3 +29,4 @@ LDFLAGS = -g ${LIBS} # compiler and linker CC = cc + diff --git a/layouts/layout.arrows.h b/layouts/layout.arrows.h new file mode 100644 index 0000000..9436334 --- /dev/null +++ b/layouts/layout.arrows.h @@ -0,0 +1,20 @@ + +static int wh = 30; +static int ww = 0; +static int wx = 0; +static int wy = -30; + +static Key keys[] = { + { 0, XK_Shift_L, 2 }, + { "←", XK_Left, 1 }, + { "↓", XK_Down, 1 }, + { "↑", XK_Up, 1 }, + { "→", XK_Right, 1}, + { "Alt", XK_Alt_L, 2 }, +}; + +Buttonmod buttonmods[] = { + { XK_Shift_L, Button2 }, + { XK_Alt_L, Button3 }, +}; + diff --git a/layouts/layout.de.h b/layouts/layout.de.h new file mode 100644 index 0000000..43852e7 --- /dev/null +++ b/layouts/layout.de.h @@ -0,0 +1,78 @@ +static int wh = 200; +static int ww = 0; +static int wx = 0; +static int wy = -200; + +static Key keys[] = { + { "^°′", XK_dead_circumflex, 1}, + { "1!¹", XK_1, 1 }, + { "2\"²", XK_2, 1 }, + { "3§³", XK_3, 1 }, + { "4$¼", XK_4, 1 }, + { "5%½", XK_5, 1 }, + { "6&¬", XK_6, 1 }, + { "7/{", XK_7, 1 }, + { "8([", XK_8, 1 }, + { "9)]", XK_9, 1 }, + { "0=}", XK_0, 1 }, + { "ß?\\", XK_ssharp, 1 }, + { "´`¸", XK_dead_acute, 1 }, + { "<-", XK_BackSpace, 2 }, + { 0 }, /* New row */ + { "->|", XK_Tab, 1 }, + { "qQ@", XK_q, 1 }, + { "wWł", XK_w, 1 }, + { "eE€", XK_e, 1 }, + { "rR¶", XK_r, 1 }, + { "tTŧ", XK_t, 1 }, + { "zZ←", XK_z, 1 }, + { "uU↓", XK_u, 1 }, + { "iI→", XK_i, 1 }, + { "oOø", XK_o, 1 }, + { "pPþ", XK_p, 1 }, + { "üܨ", 0xfc, 1 }, + { "+*~", XK_plus, 1 }, + { "Return", XK_Return, 3 }, + { 0 }, /* New row */ + { 0, XK_Caps_Lock, 2 }, + { "aAæ", XK_a, 1 }, + { "sSſ", XK_s, 1 }, + { "dDð", XK_d, 1 }, + { "fFđ", XK_f, 1 }, + { "gGŋ", XK_g, 1 }, + { "hHħ", XK_h, 1 }, + { "jJ̣̣", XK_j, 1 }, + { "kKĸ", XK_k, 1 }, + { "lLł", XK_l, 1 }, + { "öÖ˝", 0xf6, 1 }, + { "äÄ^", 0xe4, 1 }, + { "#'’", XK_numbersign, 1 }, + { 0 }, /* New row */ + { 0, XK_Shift_L, 2 }, + { "<>|", XK_less, 1 }, + { "yY»", XK_y, 1 }, + { "xX«", XK_x, 1 }, + { "cC¢", XK_c, 1 }, + { "vV„", XK_v, 1 }, + { "bB“", XK_b, 1 }, + { "nN”", XK_n, 1 }, + { "mMµ", XK_m, 1 }, + { ",;·", XK_comma, 1 }, + { ".:…", XK_period, 1 }, + { "-_–", XK_minus, 1 }, + { 0, XK_Shift_R, 2 }, + { 0 }, /* New row */ + { "Ctrl", XK_Control_L, 2 }, + { "Win", XK_Super_L, 2 }, + { "Alt", XK_Alt_L, 2 }, + { "", XK_space, 5 }, + { "Alt Gr", XK_ISO_Level3_Shift, 2 }, + { "Menu", XK_Menu, 2 }, + { "Ctrl", XK_Control_R, 2 }, +}; + +Buttonmod buttonmods[] = { + { XK_Shift_L, Button2 }, + { XK_Alt_L, Button3 }, +}; + diff --git a/layouts/layout.def.h b/layouts/layout.def.h new file mode 100644 index 0000000..c054aa5 --- /dev/null +++ b/layouts/layout.def.h @@ -0,0 +1,74 @@ +static int wh = 200; +static int ww = 0; +static int wx = 0; +static int wy = -200; + +static Key keys[] = { + { "1!", XK_1, 1 }, + { "2@", XK_2, 1 }, + { "3#", XK_3, 1 }, + { "4$", XK_4, 1 }, + { "5%", XK_5, 1 }, + { "6^", XK_6, 1 }, + { "7&", XK_7, 1 }, + { "8*", XK_8, 1 }, + { "9(", XK_9, 1 }, + { "0)", XK_0, 1 }, + { "-_", XK_minus, 1 }, + { "=+", XK_plus, 1 }, + { "<-", XK_BackSpace, 2 }, + { 0 }, /* New row */ + { "->|", XK_Tab, 1 }, + { 0, XK_q, 1 }, + { 0, XK_w, 1 }, + { 0, XK_e, 1 }, + { 0, XK_r, 1 }, + { 0, XK_t, 1 }, + { 0, XK_y, 1 }, + { 0, XK_u, 1 }, + { 0, XK_i, 1 }, + { 0, XK_o, 1 }, + { 0, XK_p, 1 }, + { "[", XK_bracketleft, 1 }, + { "]", XK_bracketright, 1 }, + { "Return", XK_Return, 3 }, + { 0 }, /* New row */ + { 0, XK_Caps_Lock, 2 }, + { 0, XK_a, 1 }, + { 0, XK_s, 1 }, + { 0, XK_d, 1 }, + { 0, XK_f, 1 }, + { 0, XK_g, 1 }, + { 0, XK_h, 1 }, + { 0, XK_j, 1 }, + { 0, XK_k, 1 }, + { 0, XK_l, 1 }, + { ":;", XK_semicolon, 1 }, + { "'\"", XK_exclam, 1 }, + { "\\|", XK_backslash, 1 }, + { 0 }, /* New row */ + { 0, XK_Shift_L, 3 }, + { 0, XK_z, 1 }, + { 0, XK_x, 1 }, + { 0, XK_c, 1 }, + { 0, XK_v, 1 }, + { 0, XK_b, 1 }, + { 0, XK_n, 1 }, + { 0, XK_m, 1 }, + { ",", XK_colon, 1 }, + { ".", XK_period, 1 }, + { "/?", XK_slash, 1 }, + { 0, XK_Shift_R, 2 }, + { 0 }, /* New row */ + { "Ctrl", XK_Control_L, 2 }, + { "Alt", XK_Alt_L, 2 }, + { "", XK_space, 5 }, + { "Alt", XK_Alt_R, 2 }, + { "Ctrl", XK_Control_R, 2 }, +}; + +Buttonmod buttonmods[] = { + { XK_Shift_L, Button2 }, + { XK_Alt_L, Button3 }, +}; +