svkbd

Simple X11 onscreen keyboard.
git clone git://r-36.net/svkbd
Log | Files | Refs | LICENSE

commit 3619838eb7809043fae15ed0564fee9b6f237832
parent 31e00125e8b79809808c203f631b18b7a517097f
Author: Enno Boland (Gottox) <tox@s01.de>
Date:   Mon,  4 Apr 2011 13:39:31 +0200

Adding Christoph Lohmanns patches again. Thx :D
Diffstat:
Makefile | 40++++++++++++++++++++++++----------------
config.mk | 2+-
svkbd.c | 13+++++++++++--
3 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/Makefile b/Makefile @@ -6,7 +6,7 @@ include config.mk SRC = svkbd.c LAYOUTS = en de arrows -all: options svkbd +all: options svkbd.en options: @echo svkbd build options: @@ -19,11 +19,6 @@ config.h: config.mk @echo creating $@ from config.def.h @cp config.def.h $@ - -svkbd: svkbd.en - @echo CP $@ - @cp $< $@ - svkbd.%: layout.%.h config.h ${SRC} @echo creating layout.h from $< @cp $< layout.h @@ -32,32 +27,45 @@ svkbd.%: layout.%.h config.h ${SRC} clean: @echo cleaning - @for i in ${LAYOUTS}; do rm svkbd.$$i 2> /dev/null; done; true - @rm -f svkbd ${OBJ} svkbd-${VERSION}.tar.gz 2> /dev/null; true + @for i in ${LAYOUTS}; \ + do \ + rm -f svkbd.$$i 2> /dev/null; \ + done; true + @rm -f ${OBJ} svkbd-${VERSION}.tar.gz 2> /dev/null; true dist: clean @echo creating dist tarball @mkdir -p svkbd-${VERSION} @cp LICENSE Makefile README config.def.h config.mk \ ${SRC} svkbd-${VERSION} - @for i in ${LAYOUTS}; do cp layout.$$i.h svkbd.${VERSION} || exit 1; done + @for i in ${LAYOUTS}; \ + do \ + cp layout.$$i.h svkbd-${VERSION}; \ + done @tar -cf svkbd-${VERSION}.tar svkbd-${VERSION} @gzip svkbd-${VERSION}.tar @rm -rf svkbd-${VERSION} install: all - @echo installing executable file to ${DESTDIR}${PREFIX}/bin + @echo installing executable files to ${DESTDIR}${PREFIX}/bin @mkdir -p ${DESTDIR}${PREFIX}/bin - @cp -f svkbd ${DESTDIR}${PREFIX}/bin - @chmod 755 ${DESTDIR}${PREFIX}/bin/svkbd - @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 - @mkdir -p ${DESTDIR}${MANPREFIX}/man1 + @for i in ${LAYOUTS}; \ + do \ + if [ -e svkbd.$$i ]; \ + then \ + echo CP svkbd.$$i; \ + cp svkbd.$$i ${DESTDIR}${PREFIX}/bin; \ + chmod 755 ${DESTDIR}${PREFIX}/bin/svkbd.$$i; \ + fi \ + done +# @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 +# @mkdir -p ${DESTDIR}${MANPREFIX}/man1 # @sed "s/VERSION/${VERSION}/g" < svkbd.1 > ${DESTDIR}${MANPREFIX}/man1/svkbd.1 # @chmod 644 ${DESTDIR}${MANPREFIX}/man1/svkbd.1 uninstall: - @echo removing executable file from ${DESTDIR}${PREFIX}/bin - @rm -f ${DESTDIR}${PREFIX}/bin/svkbd + @echo removing executable files from ${DESTDIR}${PREFIX}/bin + @rm -f ${DESTDIR}${PREFIX}/bin/svkbd.* # @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 # @rm -f ${DESTDIR}${MANPREFIX}/man1/svkbd.1 diff --git a/config.mk b/config.mk @@ -6,7 +6,7 @@ LAYOUT ?= en # Customize below to fit your system # paths -PREFIX = /usr/local +PREFIX ?= /usr/local MANPREFIX = ${PREFIX}/share/man X11INC = /usr/X11R6/include diff --git a/svkbd.c b/svkbd.c @@ -333,8 +333,8 @@ setup(void) { /* init screen */ screen = DefaultScreen(dpy); root = RootWindow(dpy, screen); - sw = DisplayWidth(dpy, screen); - sh = DisplayHeight(dpy, screen); + sw = DisplayWidth(dpy, screen) - 1; + sh = DisplayHeight(dpy, screen) - 1; initfont(font); /* init atoms */ @@ -344,12 +344,21 @@ setup(void) { countrows(); if(!ww) ww = sw - wx; + if(ww < 0) + ww = sw + ww; if(!wx) wx = 0; + if(wx < 0) + wx = sw + wx; if(!wh) wh = sh * rows / 32; + if(wh < 0) + wh = sh + wh; if(!wy) wy = sh - wh; + if(wy < 0) + wy = sh + wy - wh; + dc.norm[ColBG] = getcolor(normbgcolor); dc.norm[ColFG] = getcolor(normfgcolor); dc.press[ColBG] = getcolor(pressbgcolor);