Fixed nasty bug in linux kbd code.

This commit is contained in:
Alexander S. Aganichev 2000-05-12 15:55:28 +00:00
parent dd5d107d71
commit 3670f5d5a3

View File

@ -952,13 +952,7 @@ gkey kbxget_raw(int mode) {
if(mode == 2) { if(mode == 2) {
// We can't do much but we can at least this :-) // We can't do much but we can at least this :-)
k = kbxget_raw(1); k = kbxget_raw(1);
#ifdef __linux__ key = 0;
// Under Linux we could use TIOCLINUX fn. 6 to read shift states on console
// Of course it is very unportable but should produce good results :-)
key = 6;
if(ioctl(fileno(stdin), TIOCLINUX, &key) == -1)
#endif
key = 0;
switch(k) { switch(k) {
case Key_C_Brk: case Key_C_Brk:
key = GCTRL; key = GCTRL;
@ -1259,7 +1253,11 @@ gkey kbxget_raw(int mode) {
#ifdef __linux__ #ifdef __linux__
if(linux_cui_key(k)) { if(linux_cui_key(k)) {
int shifts = kbxget_raw(2); // Under Linux we could use TIOCLINUX fn. 6 to read shift states on console
// Of course it is very unportable but should produce good results :-)
int shifts = 6;
if(ioctl(fileno(stdin), TIOCLINUX, &shifts) == -1)
shifts = 0;
if(shifts & (LSHIFT | RSHIFT)) if(shifts & (LSHIFT | RSHIFT))
KCodScn(k) |= 0x80; KCodScn(k) |= 0x80;
else if(shifts & GCTRL) { else if(shifts & GCTRL) {
@ -1297,7 +1295,11 @@ gkey kbxget_raw(int mode) {
} }
} }
} else if(k == Key_BS) { } else if(k == Key_BS) {
int shifts = kbxget_raw(2); // Under Linux we could use TIOCLINUX fn. 6 to read shift states on console
// Of course it is very unportable but should produce good results :-)
int shifts = 6;
if(ioctl(fileno(stdin), TIOCLINUX, &shifts) == -1)
shifts = 0;
if(shifts & ALT) if(shifts & ALT)
key = Key_A_BS; key = Key_A_BS;
} }