diff --git a/build.sh b/build.sh index 6eca25d..556308a 100755 --- a/build.sh +++ b/build.sh @@ -7,6 +7,8 @@ TARGET="coolkbd" FLAGS="$(pkg-config --cflags --libs x11 xft xtst xrandr)" FLAGS="$FLAGS -Wall -lm" MODE_FLAGS="-O3 -DNDEBUG" +DEF_CONFIG="config.h" +CONFIG="$DEF_CONFIG" while [ "$#" != "0" ]; do if [ "$1" = "-release" ]; then @@ -16,26 +18,30 @@ while [ "$#" != "0" ]; do MODE_FLAGS="-g -O0" elif [ "$1" = "-direct-touch" ]; then FLAGS="$FLAGS -DDIRECT_TOUCH $(pkg-config --cflags --libs mtdev)" + elif [ "$1" = "-config" ] && [ -n "$2" ]; then + CONFIG="$2" + echo "use config $CONFIG" + shift elif [ "$1" = "-target" ] && [ -n "$2" ]; then TARGET="$2" shift else - echo "usage: ./build.sh [-debug|-release] [-direct-touch] [-target TARGET]" + echo "usage: ./build.sh [-debug|-release] [-direct-touch] [-config CONFIG.H] [-target TARGET]" exit 1 fi shift done -if [ ! -f "config.h" ]; then - echo "copy config.h from example" - cp config.h.example config.h +if [ "$CONFIG" == "$DEF_CONFIG" ] && [ ! -f "$DEF_CONFIG" ]; then + echo "copy $DEF_CONFIG from example" + cp config.h.example $DEF_CONFIG fi echo "build target: $TARGET" -echo cc main.c $MODE_FLAGS $FLAGS -o "$TARGET" - cc main.c $MODE_FLAGS $FLAGS -o "$TARGET" +echo cc main.c $MODE_FLAGS $FLAGS -include "$CONFIG" -o "$TARGET" + cc main.c $MODE_FLAGS $FLAGS -include "$CONFIG" -o "$TARGET" echo done diff --git a/maemo/build.sh b/maemo/build.sh index 927a206..edb27d5 100755 --- a/maemo/build.sh +++ b/maemo/build.sh @@ -6,20 +6,15 @@ echo "build executables for maemo" cd .. BUILD_DIR="maemo" -ARGS="$*" - function build() { - echo "copy config $BUILD_DIR/$1 -> config.h" - cp "$BUILD_DIR/$1" "config.h" - shift - local TARGET="$BUILD_DIR/$1" + local TYPE="$1" shift - echo ./build.sh "$@" -target "$TARGET" - ./build.sh "$@" -target "$TARGET" + echo ./build.sh "$@" -config "$BUILD_DIR/config.$TYPE.h" -target "$BUILD_DIR/coolkbd.$TYPE" + ./build.sh "$@" -config "$BUILD_DIR/config.$TYPE.h" -target "$BUILD_DIR/coolkbd.$TYPE" } -build config.h.dock coolkbd.dock "$@" -build config.h.bottom coolkbd.bottom "$@" -build config.h.top coolkbd.top "$@" +build dock "$@" +build bottom "$@" +build top "$@" diff --git a/maemo/config.bottom.h b/maemo/config.bottom.h new file mode 100644 index 0000000..705e73e --- /dev/null +++ b/maemo/config.bottom.h @@ -0,0 +1,36 @@ +#ifndef CONFIG_H +#define CONFIG_H + + + +#define NOBORDER +#define NOTITLE +#define LOCK_SIZE +//#define DOCK +//#define TOP_RESIZE +//#define TOP +#define SCREEN_EVENTS + +#define WIDTH_SCALE 1/1 // (nominator)/(denomitator) +#define HEIGHT_SCALE 2/5 +#define WIDTH_SCALE_P 1/1 // scales for portrait mode, if you need different +#define HEIGHT_SCALE_P 1/3 // you need to comment/uncomment both lines + +#define TITLE "coolkbd" +#define MIN_WIDTH 200 +#define MIN_HEIGHT 100 +#define LONGPRESS_MS 1500 + +#define FONTS { "DejaVu Sans:bold", "DejaVu Sans", "DejaVu" } +#define FONT_SIZES { 2, 3, 4, 6, 8, 10, 12, 16, 18, 24, 32, 40, 48 } +#define FONT_MAX_SIZES 16 + +#define TOUCH_THRESHOLD0 0.3 // threshold for detect a touch should be a bit greater +#define TOUCH_THRESHOLD1 0.2 // then threshold to detect resease + +#define LABEL_MAXLEN 32 + +#define KEY_BORDER 2 // see also S in layout.defs.h + + +#endif diff --git a/maemo/config.dock.h b/maemo/config.dock.h new file mode 100644 index 0000000..fe1ff98 --- /dev/null +++ b/maemo/config.dock.h @@ -0,0 +1,36 @@ +#ifndef CONFIG_H +#define CONFIG_H + + + +//#define NOBORDER +//#define NOTITLE +//#define LOCK_SIZE +#define DOCK +//#define TOP_RESIZE +//#define TOP +#define SCREEN_EVENTS + +#define WIDTH_SCALE 1/1 // (nominator)/(denomitator) +#define HEIGHT_SCALE 2/5 +#define WIDTH_SCALE_P 1/1 // scales for portrait mode, if you need different +#define HEIGHT_SCALE_P 1/3 // you need to comment/uncomment both lines + +#define TITLE "coolkbd" +#define MIN_WIDTH 200 +#define MIN_HEIGHT 100 +#define LONGPRESS_MS 1500 + +#define FONTS { "DejaVu Sans:bold", "DejaVu Sans", "DejaVu" } +#define FONT_SIZES { 2, 3, 4, 6, 8, 10, 12, 16, 18, 24, 32, 40, 48 } +#define FONT_MAX_SIZES 16 + +#define TOUCH_THRESHOLD0 0.3 // threshold for detect a touch should be a bit greater +#define TOUCH_THRESHOLD1 0.2 // then threshold to detect resease + +#define LABEL_MAXLEN 32 + +#define KEY_BORDER 2 // see also S in layout.defs.h + + +#endif diff --git a/maemo/config.h.bottom b/maemo/config.h.bottom deleted file mode 100644 index 705e73e..0000000 --- a/maemo/config.h.bottom +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - - - -#define NOBORDER -#define NOTITLE -#define LOCK_SIZE -//#define DOCK -//#define TOP_RESIZE -//#define TOP -#define SCREEN_EVENTS - -#define WIDTH_SCALE 1/1 // (nominator)/(denomitator) -#define HEIGHT_SCALE 2/5 -#define WIDTH_SCALE_P 1/1 // scales for portrait mode, if you need different -#define HEIGHT_SCALE_P 1/3 // you need to comment/uncomment both lines - -#define TITLE "coolkbd" -#define MIN_WIDTH 200 -#define MIN_HEIGHT 100 -#define LONGPRESS_MS 1500 - -#define FONTS { "DejaVu Sans:bold", "DejaVu Sans", "DejaVu" } -#define FONT_SIZES { 2, 3, 4, 6, 8, 10, 12, 16, 18, 24, 32, 40, 48 } -#define FONT_MAX_SIZES 16 - -#define TOUCH_THRESHOLD0 0.3 // threshold for detect a touch should be a bit greater -#define TOUCH_THRESHOLD1 0.2 // then threshold to detect resease - -#define LABEL_MAXLEN 32 - -#define KEY_BORDER 2 // see also S in layout.defs.h - - -#endif diff --git a/maemo/config.h.dock b/maemo/config.h.dock deleted file mode 100644 index fe1ff98..0000000 --- a/maemo/config.h.dock +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - - - -//#define NOBORDER -//#define NOTITLE -//#define LOCK_SIZE -#define DOCK -//#define TOP_RESIZE -//#define TOP -#define SCREEN_EVENTS - -#define WIDTH_SCALE 1/1 // (nominator)/(denomitator) -#define HEIGHT_SCALE 2/5 -#define WIDTH_SCALE_P 1/1 // scales for portrait mode, if you need different -#define HEIGHT_SCALE_P 1/3 // you need to comment/uncomment both lines - -#define TITLE "coolkbd" -#define MIN_WIDTH 200 -#define MIN_HEIGHT 100 -#define LONGPRESS_MS 1500 - -#define FONTS { "DejaVu Sans:bold", "DejaVu Sans", "DejaVu" } -#define FONT_SIZES { 2, 3, 4, 6, 8, 10, 12, 16, 18, 24, 32, 40, 48 } -#define FONT_MAX_SIZES 16 - -#define TOUCH_THRESHOLD0 0.3 // threshold for detect a touch should be a bit greater -#define TOUCH_THRESHOLD1 0.2 // then threshold to detect resease - -#define LABEL_MAXLEN 32 - -#define KEY_BORDER 2 // see also S in layout.defs.h - - -#endif diff --git a/maemo/config.h.top b/maemo/config.h.top deleted file mode 100644 index 5719e87..0000000 --- a/maemo/config.h.top +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - - - -#define NOBORDER -#define NOTITLE -#define LOCK_SIZE -//#define DOCK -//#define TOP_RESIZE -#define TOP -#define SCREEN_EVENTS - -#define WIDTH_SCALE 1/1 // (nominator)/(denomitator) -#define HEIGHT_SCALE 2/5 -#define WIDTH_SCALE_P 1/1 // scales for portrait mode, if you need different -#define HEIGHT_SCALE_P 1/3 // you need to comment/uncomment both lines - -#define TITLE "coolkbd" -#define MIN_WIDTH 200 -#define MIN_HEIGHT 100 -#define LONGPRESS_MS 1500 - -#define FONTS { "DejaVu Sans:bold", "DejaVu Sans", "DejaVu" } -#define FONT_SIZES { 2, 3, 4, 6, 8, 10, 12, 16, 18, 24, 32, 40, 48 } -#define FONT_MAX_SIZES 16 - -#define TOUCH_THRESHOLD0 0.3 // threshold for detect a touch should be a bit greater -#define TOUCH_THRESHOLD1 0.2 // then threshold to detect resease - -#define LABEL_MAXLEN 32 - -#define KEY_BORDER 2 // see also S in layout.defs.h - - -#endif diff --git a/maemo/config.top.h b/maemo/config.top.h new file mode 100644 index 0000000..5719e87 --- /dev/null +++ b/maemo/config.top.h @@ -0,0 +1,36 @@ +#ifndef CONFIG_H +#define CONFIG_H + + + +#define NOBORDER +#define NOTITLE +#define LOCK_SIZE +//#define DOCK +//#define TOP_RESIZE +#define TOP +#define SCREEN_EVENTS + +#define WIDTH_SCALE 1/1 // (nominator)/(denomitator) +#define HEIGHT_SCALE 2/5 +#define WIDTH_SCALE_P 1/1 // scales for portrait mode, if you need different +#define HEIGHT_SCALE_P 1/3 // you need to comment/uncomment both lines + +#define TITLE "coolkbd" +#define MIN_WIDTH 200 +#define MIN_HEIGHT 100 +#define LONGPRESS_MS 1500 + +#define FONTS { "DejaVu Sans:bold", "DejaVu Sans", "DejaVu" } +#define FONT_SIZES { 2, 3, 4, 6, 8, 10, 12, 16, 18, 24, 32, 40, 48 } +#define FONT_MAX_SIZES 16 + +#define TOUCH_THRESHOLD0 0.3 // threshold for detect a touch should be a bit greater +#define TOUCH_THRESHOLD1 0.2 // then threshold to detect resease + +#define LABEL_MAXLEN 32 + +#define KEY_BORDER 2 // see also S in layout.defs.h + + +#endif