Commit f5b3df7a authored by Kevin Bracey's avatar Kevin Bracey
Browse files

Added ability to override modifier keys (eg Ctrl).

Added ability to redefine keys already specified (eg in inc.[tag]).
Added customisations for 3rd party using aforementioned features.

Version 0.63. Tagged as 'IntKey-0_63'
parent 8ae047c4
......@@ -69,7 +69,7 @@ The layer section contains a series of key definitions, in any order. A key
definition consists of a 2-digit hex number on the first line, followed by eight
lines giving the character for each part of a key:
<key number>
<key number> {replace}
<key>
<Shift+key>
<Ctrl+key>
......@@ -79,6 +79,14 @@ lines giving the character for each part of a key:
<Alt+Ctrl+key>
<Alt+Ctrl+Shift+key>
To replace a previously defined character (which may be required when included
files are in use), you must add the word "replace" after the key number.
The 10 standard modifier keys (Left Shift, Right Shift, Left Ctrl, Right Ctrl,
Left Alt, Right Alt, Select, Menu, Adjust, Break) need not, and indeed cannot,
be specified in a layer. However, it is possible to override the behaviour
of any of these keys to act like a standard key.
Any pairs of characters may be tagged as a capital/lower case pair by placing
a bracket symbol in front of each character name. Bracket symbols are [], {},
<> and () - the opening bracket marks the lower-case character and the closing
......@@ -173,7 +181,8 @@ A character name may take the form of
there are some exceptions. For example Caps Lock is only on the
shifted form of the key on a Japanese keyboard.
Special keys are:
Special keys are those that require specific code to handle them. These
are:
CAPS LOCK
NUM LOCK
......
......@@ -5,8 +5,10 @@
GBLA Module_Version
GBLS Module_MinorVersion
GBLS Module_Date
Module_MajorVersion SETS "0.62"
Module_Version SETA 62
GBLS Module_FullVersion
Module_MajorVersion SETS "0.63"
Module_Version SETA 63
Module_MinorVersion SETS ""
Module_Date SETS "22 Mar 1999"
END
Module_Date SETS "26 Apr 1999"
Module_FullVersion SETS "0.63"
END
......@@ -207,7 +207,7 @@ static UCS4 function_key_code(const char *p)
return ci->code;
}
return 0x80000000 ^ ctrl ^ shift + ci->code;
return (0x80000000 + ci->code) ^ ctrl ^ shift;
}
static UCS4 special_key_code(const char *p)
......@@ -356,7 +356,7 @@ int is_keypad_key(int key)
int is_special_key(int key)
{
return key == K_ScrollLock || key == K_NumLock || key == K_Tab ||
key == K_CapsLock;
key == K_CapsLock || is_modifier_key(key);
}
void read_keypad(Keyboard *kb)
......@@ -415,7 +415,7 @@ void read_layer(Keyboard *kb, int layerno)
{
char buffer[256];
char scaps[8], caps[8];
int key, i;
int key, i, replace=0;
char *p;
while (getline(buffer, 256))
......@@ -429,14 +429,25 @@ void read_layer(Keyboard *kb, int layerno)
}
key = (int) strtol(buffer, &p, 16);
if (p == buffer || *p != '\0' || key < 0 || key >= MAXKEYS)
if (p == buffer || key < 0 || key >= MAXKEYS)
error("Expected key number");
if (kb->key[key].definedinlayer[layerno])
while (*p <= ' ' && *p != '\0')
p++;
if (*p != '\0')
{
if (strcmp(p, "replace") == 0)
replace = 1;
else
error("Unexpected trailing garbage after key number");
}
if (!replace && kb->key[key].definedinlayer[layerno])
error("Key already defined");
if (is_modifier_key(key))
error("Cannot alter modifier keys");
kb->needshiftinglist = 1;
if (is_keypad_key(key))
error("Use $Keypad to alter keypad keys");
......@@ -689,17 +700,27 @@ void output_simples(FILE *out, Keyboard *kb)
fprintf(out, "KeyTran%dEnd\n\n", kb->country);
fprintf(out, "\nSpecialList%d\n"
" = SpecialList%dEnd - SpecialList%d - 1\n"
" = K1ShiftLeft, K1ShiftRight, K1CtrlLeft, K1CtrlRight\n"
" = K1AltLeft, K1AltRight\n"
" = K1LeftMouse, K1CentreMouse, K1RightMouse, K1Break\n"
"SpecialList%dPad\n"
" = SpecialList%dEnd - SpecialList%d - 1\n",
kb->country, kb->country, kb->country);
if (!kb->key[K_ShiftL].defined) fprintf(out, " = K1ShiftLeft\n");
if (!kb->key[K_ShiftR].defined) fprintf(out, " = K1ShiftRight\n");
if (!kb->key[K_CtrlL].defined) fprintf(out, " = K1CtrlLeft\n");
if (!kb->key[K_CtrlR].defined) fprintf(out, " = K1CtrlRight\n");
if (!kb->key[K_AltL].defined) fprintf(out, " = K1AltLeft\n");
if (!kb->key[K_AltR].defined) fprintf(out, " = K1AltRight\n");
if (!kb->key[K_MSelect].defined) fprintf(out, " = K1LeftMouse\n");
if (!kb->key[K_MMenu].defined) fprintf(out, " = K1CentreMouse\n");
if (!kb->key[K_MAdjust].defined) fprintf(out, " = K1RightMouse\n");
if (!kb->key[K_Break].defined) fprintf(out, " = K1Break\n");
fprintf(out, "SpecialList%dPad\n"
" = K1NumPadSlash, K1NumPadStar, K1NumPadHash\n"
" = K1NumPad7, K1NumPad8, K1NumPad9, K1NumPadMinus\n"
" = K1NumPad4, K1NumPad5, K1NumPad6, K1NumPadPlus\n"
" = K1NumPad1, K1NumPad2, K1NumPad3\n"
" = K1NumPad0, K1NumPadDot, K1NumPadEnter\n",
kb->country, kb->country, kb->country, kb->country);
kb->country);
if (!kb->key[K_ScrollLock].defined) fprintf(out, " = K1ScrollLock\n");
if (!kb->key[K_NumLock].defined) fprintf(out, " = K1NumLock\n");
......@@ -728,6 +749,7 @@ void process_keyboard(FILE *in, FILE *out)
kb->layers = 0;
kb->numkeys = 0;
kb->needcodetable = 0;
kb->needshiftinglist = 0;
kb->custompad = 0;
kb->leftaltlayerswitch = 0;
......@@ -755,11 +777,18 @@ void process_keyboard(FILE *in, FILE *out)
fprintf(out, "KeyStruct%d\n"
" & KeyTran%d-KeyStruct%d\n"
" & (KeyTran%dEnd-KeyTran%d) :SHR: 2\n"
" & InkeyTran-KeyStruct%d\n"
" & ShiftingKeyList-KeyStruct%d\n"
" & SpecialList%d-KeyStruct%d\n",
" & InkeyTran-KeyStruct%d\n",
kb->country, kb->country, kb->country, kb->country, kb->country,
kb->country, kb->country, kb->country, kb->country);
kb->country);
if (kb->needshiftinglist)
fprintf(out, " & ShiftingKeyList%d-KeyStruct%d\n", kb->country, kb->country);
else
fprintf(out, " & ShiftingKeyList-KeyStruct%d\n", kb->country);
fprintf(out, " & SpecialList%d-KeyStruct%d\n",
kb->country, kb->country);
if (kb->needcodetable)
fprintf(out, " & SpecialCodeTable%d-KeyStruct%d\n", kb->country, kb->country);
else
......@@ -836,6 +865,28 @@ void process_keyboard(FILE *in, FILE *out)
fprintf(out, " & ProcessUCS - SpecialCodeTable%d\n", kb->country);
}
if (kb->needshiftinglist)
{
fprintf(out, "\nShiftingKeyList%d\n"
" = ShiftingKeyList%dEnd - ShiftingKeyList%d - 1\n",
kb->country, kb->country, kb->country);
if (!kb->key[K_ShiftL].defined) fprintf(out, " = K1ShiftLeft\n");
if (!kb->key[K_ShiftR].defined) fprintf(out, " = K1ShiftRight\n");
if (!kb->key[K_CtrlL].defined) fprintf(out, " = K1CtrlLeft\n");
if (!kb->key[K_CtrlR].defined) fprintf(out, " = K1CtrlRight\n");
if (!kb->key[K_AltL].defined) fprintf(out, " = K1AltLeft\n");
if (!kb->key[K_AltR].defined) fprintf(out, " = K1AltRight\n");
if (!kb->key[K_MAdjust].defined) fprintf(out, " = K1RightMouse\n");
if (!kb->key[K_MMenu].defined) fprintf(out, " = K1CentreMouse\n");
if (!kb->key[K_MSelect].defined) fprintf(out, " = K1LeftMouse\n");
if (!kb->key[K_Break].defined) fprintf(out, " = K1Break\n");
fprintf(out, "ShiftingKeyList%dEnd\n"
" ALIGN\n",
kb->country);
}
for (i=0; i<kb->layers; i++)
output_layer(out, kb, i);
......
......@@ -38,6 +38,7 @@ typedef struct Keyboard
char keypad[2][17];
char custompad;
char needcodetable;
char needshiftinglist;
char leftaltlayerswitch;
}
Keyboard;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment