Parameterized the dot movement keys, making them configurable at compile-time. … | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 671af52f913d608f39b9c91c9dc2545fd5d6467d | |
parent f8183e171e2e3023251bf5346193b2abbee889bc | |
Author: Rob King <[email protected]> | |
Date: Tue, 4 Aug 2015 22:45:53 -0500 | |
Parameterized the dot movement keys, making them configurable at | |
compile-time. | |
Diffstat: | |
config.mk | 9 +++++++++ | |
samterm/Makefile | 2 +- | |
samterm/main.c | 28 ++++++++++++++++++++++------ | |
3 files changed, 32 insertions(+), 7 deletions(-) | |
--- | |
diff --git a/config.mk b/config.mk | |
@@ -21,3 +21,11 @@ FREETYPEINC=/usr/include/freetype2 | |
# TMPDIR should be set to a directory for temporary files with lots of room | |
TMPDIR=/tmp | |
+ | |
+# If you want to have keyboard control of dot's position, set the following | |
+# variables to the appropriate ASCII control codes. The default values | |
+# emulate the WordStar diamond. Setting any command to zero disables it. | |
+LINEUP=0x05 | |
+LINEDOWN=0x18 | |
+CHARLEFT=0x13 | |
+CHARRIGHT=0x04 | |
+\ No newline at end of file | |
diff --git a/samterm/Makefile b/samterm/Makefile | |
@@ -28,7 +28,7 @@ SAMTERM=$(BINDIR)/samterm | |
# or if you need extra libraries to load with X11 applications | |
XLIBS=-lXt -lX11 -lXft | |
-CFLAGS=$(OS) $(INCS) -D_LIBXG_EXTENSION | |
+CFLAGS=$(OS) $(INCS) -D_LIBXG_EXTENSION -DLINEUP=$(LINEUP) -DLINEDOWN=$(LINEDO… | |
LIBS=../libframe/libframe.a ../libXg/libXg.a | |
CC=cc | |
diff --git a/samterm/main.c b/samterm/main.c | |
@@ -24,6 +24,22 @@ char hasunlocked = 0; | |
int chord = 0; | |
char *machine = "localhost"; | |
+#ifndef LINEUP | |
+#define LINEUP 0x00 | |
+#endif | |
+ | |
+#ifndef LINEDOWN | |
+#define LINEDOWN 0x00 | |
+#endif | |
+ | |
+#ifndef CHARLEFT | |
+#define CHARLEFT 0x00 | |
+#endif | |
+ | |
+#ifndef CHARRIGHT | |
+#define CHARRIGHT 0x00 | |
+#endif | |
+ | |
void | |
main(int argc, char *argv[]) | |
{ | |
@@ -468,7 +484,7 @@ type(Flayer *l, int res) /* what a bloody mess this … | |
int pc = qpeekc(); | |
scrollkey = pc==SCROLLKEY; /* ICK */ | |
upkey = pc == UPKEY; | |
- movekey = (pc == 0x13 || pc == 0x04 || pc == 0x05 || pc == 0x18); | |
+ movekey = (pc == CHARLEFT || pc == CHARRIGHT || pc == LINEUP || pc == … | |
} | |
if(lock || t->lock){ | |
@@ -489,7 +505,7 @@ type(Flayer *l, int res) /* what a bloody mess this … | |
break; | |
/* ctrl-s, ctrl-e, ctrl-d, ctrl-x */ | |
- if (c==0x13 || c==0x04 || c==0x05 || c==0x18){ | |
+ if (c==CHARLEFT || c==CHARRIGHT || c==LINEUP || c==LIN… | |
moving = 1; | |
break; | |
} | |
@@ -529,7 +545,7 @@ type(Flayer *l, int res) /* what a bloody mess this … | |
/* backspacing immediately after outcmd(): sorry */ | |
} else if (moving){ | |
switch(c){ | |
- case 0x13: /* ctrl-s */ | |
+ case CHARLEFT: /* ctrl-s */ | |
flsetselect(l, a, a); | |
flushtyping(0); | |
if (a > 0) | |
@@ -538,7 +554,7 @@ type(Flayer *l, int res) /* what a bloody mess this … | |
center(l, a); | |
break; | |
- case 0x04: /* ctrl-d */ | |
+ case CHARRIGHT: /* ctrl-d */ | |
flsetselect(l, a, a); | |
flushtyping(0); | |
if (a < t->rasp.nrunes) | |
@@ -547,7 +563,7 @@ type(Flayer *l, int res) /* what a bloody mess this … | |
center(l, a); | |
break; | |
- case 0x05: /* ctrl-e */ | |
+ case LINEUP: /* ctrl-e */ | |
flsetselect(l, a, a); | |
flushtyping(1); | |
if (a > 0){ | |
@@ -570,7 +586,7 @@ type(Flayer *l, int res) /* what a bloody mess this … | |
} | |
break; | |
- case 0x18: /* ctrl-x */ | |
+ case LINEDOWN: /* ctrl-x */ | |
flsetselect(l, a, a); | |
flushtyping(1); | |
if (a < t->rasp.nrunes){ |