Mercurial > hg > rlgwebd
annotate termemu-keys.js @ 192:addc4e3456c4
Begin adding systemd compatibility.
The Makefile can be used to build and install rlgwebd. On systems with
systemd, the unit file controls starting and stopping the service, and
the shell script is not needed.
The unit file uses KillMode=none because socat does not actually stop
rlgwebd, it only asks it to stop and exits without waiting for a
response. Until a better stopping method is introduced, this setting
prevents systemd from killing all the rlgwebd processes as soon as
socat exits.
author | John "Elwin" Edwards |
---|---|
date | Fri, 01 Jan 2016 16:11:34 -0500 |
parents | 6cfaf6d202be |
children |
rev | line source |
---|---|
6
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
1 /* termemu-keys.js: some key-handling code common to both drivers. */ |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
2 |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
3 /* ASCII values of keys 0-9. */ |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
4 var numShifts = [41, 33, 64, 35, 36, 37, 94, 38, 42, 40]; |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
5 |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
6 var keyHexCodes = { |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
7 init: function () { |
70
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
8 this[13] = ["0d", "0d"]; // return |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
9 this[32] = ["20", "20"]; // space |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
10 this[9] = ["09", "09"]; // tab |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
11 this[192] = ["60", "7e"]; // backtick, tilde |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
12 this[219] = ["5b", "7b"]; // open bracket, open brace |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
13 this[221] = ["5d", "7d"]; // close bracket, close brace |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
14 this[220] = ["5c", "7c"]; // backslash, pipe |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
15 this[59] = ["3b", "3a"]; // semicolon, colon |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
16 this[186] = ["3b", "3a"]; // semicolon, colon (Chrome) |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
17 this[222] = ["27", "22"]; // single quote, double quote |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
18 this[188] = ["2c", "3c"]; // comma, less than |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
19 this[190] = ["2e", "3e"]; // period, right angle |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
20 this[191] = ["2f", "3f"]; // slash, question mark |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
21 this[61] = ["3d", "2b"]; // equal, plus |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
22 this[187] = ["3d", "2b"]; // equal, plus (Chrome) |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
23 this[109] = ["2d", "5f"]; // subtract, underscore (maybe on numpad) |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
24 this[173] = ["2d", "5f"]; // subtract, underscore (maybe not on numpad) |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
25 this[189] = ["2d", "5f"]; // subtract, underscore (Chrome) |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
26 this[8] = ["08", "08"]; // backspace |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
27 this[46] = ["1b5b337e", "1b5b337e"]; // delete |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
28 this[27] = ["1b", "1b"]; // escape |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
29 this[33] = ["1b5b357e", "1b5b357e"]; // page up |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
30 this[34] = ["1b5b367e", "1b5b367e"]; // page down |
122
6cfaf6d202be
Improve the probability of detecting numpad 5.
John "Elwin" Edwards <elwin@sdf.org>
parents:
70
diff
changeset
|
31 this[12] = ["1b5b45", "1b5b45"]; // Clear key = numpad 5 (Firefox) |
6
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
32 this.appCursor(false); |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
33 this.appKeypad(false); |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
34 }, |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
35 /* Multi-char control sequences! Neat! */ |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
36 appCursor: function (on) { |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
37 /* Aren't special keys vile? */ |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
38 if (on) { |
70
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
39 this[37] = ["1b4f44", "1b4f44"]; // left arror |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
40 this[39] = ["1b4f43", "1b4f43"]; // right arrow |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
41 this[38] = ["1b4f41", "1b4f41"]; // up arrow |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
42 this[40] = ["1b4f42", "1b4f42"]; // down arrow |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
43 this[35] = ["1b4f46", "1b4f46"]; // end |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
44 this[36] = ["1b4f48", "1b4f48"]; // home |
6
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
45 } |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
46 else { |
70
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
47 this[37] = ["1b5b44", "1b5b44"]; // left arror |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
48 this[39] = ["1b5b43", "1b5b43"]; // right arrow |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
49 this[38] = ["1b5b41", "1b5b41"]; // up arrow |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
50 this[40] = ["1b5b42", "1b5b42"]; // down arrow |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
51 this[35] = ["1b5b46", "1b5b46"]; // end |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
52 this[36] = ["1b5b48", "1b5b48"]; // home |
6
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
53 } |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
54 }, |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
55 appKeypad: function (on) { |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
56 /* In theory, these should produce either numerals or the k[a-c][1-3] |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
57 * sequences. Since we can't count on the terminfo description actually |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
58 * containing those sequences, pretend they're just arrow keys etc. |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
59 */ |
70
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
60 this[97] = ["1b4f46", "1b4f46"]; |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
61 this[98] = ["1b4f42", "1b4f42"]; |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
62 this[99] = ["1b5b367e", "1b5b367e"]; |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
63 this[100] = ["1b4f44", "1b4f44"]; |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
64 this[101] = ["1b5b45", "1b5b45"]; |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
65 this[102] = ["1b4f43", "1b4f43"]; |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
66 this[103] = ["1b4f48", "1b4f48"]; |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
67 this[104] = ["1b4f41", "1b4f41"]; |
d7eb63cd7a16
Try to get some compatibility for keys.
John "Elwin" Edwards <elwin@sdf.org>
parents:
6
diff
changeset
|
68 this[105] = ["1b5b357e", "1b5b357e"]; |
6
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
69 return; |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
70 } |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
71 }; |
21738794755e
Put common key tables into a common file.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
72 |