@illgrenoble/webx-client 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +8 -0
- package/dist/WebXClient.d.ts +94 -0
- package/dist/WebXClient.js +302 -0
- package/dist/WebXClient.js.map +1 -0
- package/dist/display/WebXCursor.d.ts +28 -0
- package/dist/display/WebXCursor.js +94 -0
- package/dist/display/WebXCursor.js.map +1 -0
- package/dist/display/WebXCursorFactory.d.ts +18 -0
- package/dist/display/WebXCursorFactory.js +36 -0
- package/dist/display/WebXCursorFactory.js.map +1 -0
- package/dist/display/WebXDisplay.d.ts +70 -0
- package/dist/display/WebXDisplay.js +248 -0
- package/dist/display/WebXDisplay.js.map +1 -0
- package/dist/display/WebXSubImage.d.ts +19 -0
- package/dist/display/WebXSubImage.js +20 -0
- package/dist/display/WebXSubImage.js.map +1 -0
- package/dist/display/WebXTextureFactory.d.ts +14 -0
- package/dist/display/WebXTextureFactory.js +101 -0
- package/dist/display/WebXTextureFactory.js.map +1 -0
- package/dist/display/WebXWindow.d.ts +59 -0
- package/dist/display/WebXWindow.js +205 -0
- package/dist/display/WebXWindow.js.map +1 -0
- package/dist/display/WebXWindowProperties.d.ts +14 -0
- package/dist/display/WebXWindowProperties.js +17 -0
- package/dist/display/WebXWindowProperties.js.map +1 -0
- package/dist/display/index.d.ts +7 -0
- package/dist/display/index.js +24 -0
- package/dist/display/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/input/WebXKeyboard.d.ts +230 -0
- package/dist/input/WebXKeyboard.js +593 -0
- package/dist/input/WebXKeyboard.js.map +1 -0
- package/dist/input/WebXMouse.d.ts +97 -0
- package/dist/input/WebXMouse.js +205 -0
- package/dist/input/WebXMouse.js.map +1 -0
- package/dist/input/index.d.ts +4 -0
- package/dist/input/index.js +21 -0
- package/dist/input/index.js.map +1 -0
- package/dist/input/keyboard/WebXKeyEvent.d.ts +47 -0
- package/dist/input/keyboard/WebXKeyEvent.js +212 -0
- package/dist/input/keyboard/WebXKeyEvent.js.map +1 -0
- package/dist/input/keyboard/WebXKeyPressEvent.d.ts +13 -0
- package/dist/input/keyboard/WebXKeyPressEvent.js +26 -0
- package/dist/input/keyboard/WebXKeyPressEvent.js.map +1 -0
- package/dist/input/keyboard/WebXKeyUpEvent.d.ts +12 -0
- package/dist/input/keyboard/WebXKeyUpEvent.js +28 -0
- package/dist/input/keyboard/WebXKeyUpEvent.js.map +1 -0
- package/dist/input/keyboard/WebXKeyboardModifierState.d.ts +47 -0
- package/dist/input/keyboard/WebXKeyboardModifierState.js +87 -0
- package/dist/input/keyboard/WebXKeyboardModifierState.js.map +1 -0
- package/dist/input/keyboard/WebXKeyboardUtils.d.ts +9 -0
- package/dist/input/keyboard/WebXKeyboardUtils.js +48 -0
- package/dist/input/keyboard/WebXKeyboardUtils.js.map +1 -0
- package/dist/input/keyboard/WebXKeydownEvent.d.ts +29 -0
- package/dist/input/keyboard/WebXKeydownEvent.js +71 -0
- package/dist/input/keyboard/WebXKeydownEvent.js.map +1 -0
- package/dist/input/keyboard/index.d.ts +6 -0
- package/dist/input/keyboard/index.js +23 -0
- package/dist/input/keyboard/index.js.map +1 -0
- package/dist/input/mouse/WebXMouseState.d.ts +78 -0
- package/dist/input/mouse/WebXMouseState.js +104 -0
- package/dist/input/mouse/WebXMouseState.js.map +1 -0
- package/dist/input/mouse/index.d.ts +1 -0
- package/dist/input/mouse/index.js +18 -0
- package/dist/input/mouse/index.js.map +1 -0
- package/dist/instruction/WebXConnectInstruction.d.ts +4 -0
- package/dist/instruction/WebXConnectInstruction.js +12 -0
- package/dist/instruction/WebXConnectInstruction.js.map +1 -0
- package/dist/instruction/WebXCursorImageInstruction.d.ts +6 -0
- package/dist/instruction/WebXCursorImageInstruction.js +16 -0
- package/dist/instruction/WebXCursorImageInstruction.js.map +1 -0
- package/dist/instruction/WebXImageInstruction.d.ts +7 -0
- package/dist/instruction/WebXImageInstruction.js +19 -0
- package/dist/instruction/WebXImageInstruction.js.map +1 -0
- package/dist/instruction/WebXInstruction.d.ts +13 -0
- package/dist/instruction/WebXInstruction.js +34 -0
- package/dist/instruction/WebXInstruction.js.map +1 -0
- package/dist/instruction/WebXInstructionResponse.d.ts +13 -0
- package/dist/instruction/WebXInstructionResponse.js +40 -0
- package/dist/instruction/WebXInstructionResponse.js.map +1 -0
- package/dist/instruction/WebXInstructionType.d.ts +13 -0
- package/dist/instruction/WebXInstructionType.js +38 -0
- package/dist/instruction/WebXInstructionType.js.map +1 -0
- package/dist/instruction/WebXKeyboardInstruction.d.ts +10 -0
- package/dist/instruction/WebXKeyboardInstruction.js +26 -0
- package/dist/instruction/WebXKeyboardInstruction.js.map +1 -0
- package/dist/instruction/WebXMouseInstruction.d.ts +13 -0
- package/dist/instruction/WebXMouseInstruction.js +33 -0
- package/dist/instruction/WebXMouseInstruction.js.map +1 -0
- package/dist/instruction/WebXQualityInstruction.d.ts +7 -0
- package/dist/instruction/WebXQualityInstruction.js +19 -0
- package/dist/instruction/WebXQualityInstruction.js.map +1 -0
- package/dist/instruction/WebXScreenInstruction.d.ts +4 -0
- package/dist/instruction/WebXScreenInstruction.js +12 -0
- package/dist/instruction/WebXScreenInstruction.js.map +1 -0
- package/dist/instruction/WebXWindowsInstruction.d.ts +4 -0
- package/dist/instruction/WebXWindowsInstruction.js +12 -0
- package/dist/instruction/WebXWindowsInstruction.js.map +1 -0
- package/dist/instruction/index.d.ts +11 -0
- package/dist/instruction/index.js +28 -0
- package/dist/instruction/index.js.map +1 -0
- package/dist/message/WebXCursorImageMessage.d.ts +17 -0
- package/dist/message/WebXCursorImageMessage.js +36 -0
- package/dist/message/WebXCursorImageMessage.js.map +1 -0
- package/dist/message/WebXImageMessage.d.ts +15 -0
- package/dist/message/WebXImageMessage.js +32 -0
- package/dist/message/WebXImageMessage.js.map +1 -0
- package/dist/message/WebXMessage.d.ts +8 -0
- package/dist/message/WebXMessage.js +17 -0
- package/dist/message/WebXMessage.js.map +1 -0
- package/dist/message/WebXMessageType.d.ts +10 -0
- package/dist/message/WebXMessageType.js +15 -0
- package/dist/message/WebXMessageType.js.map +1 -0
- package/dist/message/WebXMouseMessage.d.ts +10 -0
- package/dist/message/WebXMouseMessage.js +24 -0
- package/dist/message/WebXMouseMessage.js.map +1 -0
- package/dist/message/WebXPollMessage.d.ts +4 -0
- package/dist/message/WebXPollMessage.js +12 -0
- package/dist/message/WebXPollMessage.js.map +1 -0
- package/dist/message/WebXScreenMessage.d.ts +12 -0
- package/dist/message/WebXScreenMessage.js +16 -0
- package/dist/message/WebXScreenMessage.js.map +1 -0
- package/dist/message/WebXSubImagesMessage.d.ts +11 -0
- package/dist/message/WebXSubImagesMessage.js +24 -0
- package/dist/message/WebXSubImagesMessage.js.map +1 -0
- package/dist/message/WebXWindowsMessage.d.ts +7 -0
- package/dist/message/WebXWindowsMessage.js +16 -0
- package/dist/message/WebXWindowsMessage.js.map +1 -0
- package/dist/message/index.d.ts +9 -0
- package/dist/message/index.js +26 -0
- package/dist/message/index.js.map +1 -0
- package/dist/tracer/WebXHandler.d.ts +3 -0
- package/dist/tracer/WebXHandler.js +3 -0
- package/dist/tracer/WebXHandler.js.map +1 -0
- package/dist/tracer/WebXInstructionHandler.d.ts +4 -0
- package/dist/tracer/WebXInstructionHandler.js +7 -0
- package/dist/tracer/WebXInstructionHandler.js.map +1 -0
- package/dist/tracer/WebXMessageHandler.d.ts +4 -0
- package/dist/tracer/WebXMessageHandler.js +7 -0
- package/dist/tracer/WebXMessageHandler.js.map +1 -0
- package/dist/tracer/WebXStatsHandler.d.ts +7 -0
- package/dist/tracer/WebXStatsHandler.js +7 -0
- package/dist/tracer/WebXStatsHandler.js.map +1 -0
- package/dist/tracer/index.d.ts +4 -0
- package/dist/tracer/index.js +21 -0
- package/dist/tracer/index.js.map +1 -0
- package/dist/transport/WebXBinarySerializer.d.ts +11 -0
- package/dist/transport/WebXBinarySerializer.js +43 -0
- package/dist/transport/WebXBinarySerializer.js.map +1 -0
- package/dist/transport/WebXInstructionBuffer.d.ts +35 -0
- package/dist/transport/WebXInstructionBuffer.js +80 -0
- package/dist/transport/WebXInstructionBuffer.js.map +1 -0
- package/dist/transport/WebXInstructionEncoder.d.ts +101 -0
- package/dist/transport/WebXInstructionEncoder.js +175 -0
- package/dist/transport/WebXInstructionEncoder.js.map +1 -0
- package/dist/transport/WebXMessageBuffer.d.ts +19 -0
- package/dist/transport/WebXMessageBuffer.js +58 -0
- package/dist/transport/WebXMessageBuffer.js.map +1 -0
- package/dist/transport/WebXMessageDecoder.d.ts +16 -0
- package/dist/transport/WebXMessageDecoder.js +156 -0
- package/dist/transport/WebXMessageDecoder.js.map +1 -0
- package/dist/transport/index.d.ts +5 -0
- package/dist/transport/index.js +22 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/tunnel/WebXDefaultQoSHandler.d.ts +16 -0
- package/dist/tunnel/WebXDefaultQoSHandler.js +57 -0
- package/dist/tunnel/WebXDefaultQoSHandler.js.map +1 -0
- package/dist/tunnel/WebXQoSHandler.d.ts +6 -0
- package/dist/tunnel/WebXQoSHandler.js +7 -0
- package/dist/tunnel/WebXQoSHandler.js.map +1 -0
- package/dist/tunnel/WebXSocketIOTunnel.d.ts +15 -0
- package/dist/tunnel/WebXSocketIOTunnel.js +41 -0
- package/dist/tunnel/WebXSocketIOTunnel.js.map +1 -0
- package/dist/tunnel/WebXTunnel.d.ts +24 -0
- package/dist/tunnel/WebXTunnel.js +106 -0
- package/dist/tunnel/WebXTunnel.js.map +1 -0
- package/dist/tunnel/WebXWebSocketTunnel.d.ts +12 -0
- package/dist/tunnel/WebXWebSocketTunnel.js +41 -0
- package/dist/tunnel/WebXWebSocketTunnel.js.map +1 -0
- package/dist/tunnel/index.d.ts +5 -0
- package/dist/tunnel/index.js +22 -0
- package/dist/tunnel/index.js.map +1 -0
- package/dist/utils/Config.d.ts +4 -0
- package/dist/utils/Config.js +10 -0
- package/dist/utils/Config.js.map +1 -0
- package/dist/utils/WebXAsyncExec.d.ts +5 -0
- package/dist/utils/WebXAsyncExec.js +18 -0
- package/dist/utils/WebXAsyncExec.js.map +1 -0
- package/dist/utils/WebXColourGenerator.d.ts +5 -0
- package/dist/utils/WebXColourGenerator.js +27 -0
- package/dist/utils/WebXColourGenerator.js.map +1 -0
- package/dist/utils/WebXFileSize.d.ts +3 -0
- package/dist/utils/WebXFileSize.js +14 -0
- package/dist/utils/WebXFileSize.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebXKeyboard = void 0;
|
|
4
|
+
const keyboard_1 = require("./keyboard");
|
|
5
|
+
class WebXKeyboard {
|
|
6
|
+
/**
|
|
7
|
+
* Create a new keyboard instance
|
|
8
|
+
* @param element the element to bind the keyboard to
|
|
9
|
+
*/
|
|
10
|
+
constructor(element) {
|
|
11
|
+
/**
|
|
12
|
+
* The state of every key, indexed by keysym. If a particular key is
|
|
13
|
+
* pressed, the value of pressed for that keysym will be true. If a key
|
|
14
|
+
* is not currently pressed, it will not be defined.
|
|
15
|
+
*/
|
|
16
|
+
this._pressed = {};
|
|
17
|
+
/**
|
|
18
|
+
* The state of every key, indexed by keysym, for strictly those keys whose
|
|
19
|
+
* status has been indirectly determined through observation of other key
|
|
20
|
+
* events. If a particular key is implicitly pressed, the value of
|
|
21
|
+
* implicitlyPressed for that keysym will be true. If a key
|
|
22
|
+
* is not currently implicitly pressed (the key is not pressed OR the state
|
|
23
|
+
* of the key is explicitly known), it will not be defined.
|
|
24
|
+
*/
|
|
25
|
+
this._implicitlyPressed = {};
|
|
26
|
+
/**
|
|
27
|
+
* The last result of calling the onkeydown handler for each key, indexed
|
|
28
|
+
* by keysym. This is used to prevent/allow default actions for key events,
|
|
29
|
+
* even when the onkeydown handler cannot be called again because the key
|
|
30
|
+
* is (theoretically) still pressed.
|
|
31
|
+
*/
|
|
32
|
+
this._lastKeydownResult = {};
|
|
33
|
+
/**
|
|
34
|
+
* The keysym most recently associated with a given keycode when keydown
|
|
35
|
+
* fired. This object maps keycodes to keysyms.
|
|
36
|
+
*/
|
|
37
|
+
this._recentKeysym = {};
|
|
38
|
+
/**
|
|
39
|
+
* Timeout before key repeat starts.
|
|
40
|
+
*/
|
|
41
|
+
this._keyRepeatTimeout = null;
|
|
42
|
+
/**
|
|
43
|
+
* Interval which presses and releases the last key pressed while that
|
|
44
|
+
* key is still being held down.
|
|
45
|
+
*/
|
|
46
|
+
this._keyRepeatInterval = null;
|
|
47
|
+
this._events = [];
|
|
48
|
+
this._keyDownHandler = this._bindKeyDownListener.bind(this);
|
|
49
|
+
this._keyPressHandler = this._bindKeyPressListener.bind(this);
|
|
50
|
+
this._keyUpHandler = this._bindKeyUpListener.bind(this);
|
|
51
|
+
/**
|
|
52
|
+
* Fired whenever the user presses a key with the element associated
|
|
53
|
+
* with this keyboard in focus.
|
|
54
|
+
*
|
|
55
|
+
* @param key The key being pressed
|
|
56
|
+
*/
|
|
57
|
+
this.onKeyDown = null;
|
|
58
|
+
/**
|
|
59
|
+
* Fired whenever the user releases a key with the element associated
|
|
60
|
+
* with this keyboard in focus.
|
|
61
|
+
*
|
|
62
|
+
* @param key The key being released
|
|
63
|
+
*/
|
|
64
|
+
this.onKeyUp = null;
|
|
65
|
+
this._element = element;
|
|
66
|
+
this._keyboardId = WebXKeyboard._NEXT_ID++;
|
|
67
|
+
this._eventMarker = '_WEBX_KEYBOARD_HANDLED_BY_' + this._keyboardId;
|
|
68
|
+
this._handleQuirks();
|
|
69
|
+
this._bindListeners();
|
|
70
|
+
}
|
|
71
|
+
get pressed() {
|
|
72
|
+
return this._pressed;
|
|
73
|
+
}
|
|
74
|
+
dispose() {
|
|
75
|
+
this._unbindListeners();
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Set quirk flags depending on platform/browser, if such information is available
|
|
79
|
+
*/
|
|
80
|
+
_handleQuirks() {
|
|
81
|
+
if (navigator && navigator.platform) {
|
|
82
|
+
// All keyup events are unreliable on iOS (sadly)
|
|
83
|
+
if (navigator.platform.match(/ipad|iphone|ipod/i)) {
|
|
84
|
+
WebXKeyboard.quirks.keyupUnreliable = true;
|
|
85
|
+
}
|
|
86
|
+
// The Alt key on Mac is never used for keyboard shortcuts, and the
|
|
87
|
+
// Caps Lock key never dispatches keyup events
|
|
88
|
+
else if (navigator.platform.match(/^mac/i)) {
|
|
89
|
+
WebXKeyboard.quirks.altIsTypableOnly = true;
|
|
90
|
+
WebXKeyboard.quirks.capsLockKeyupUnreliable = true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
_addEvent(event) {
|
|
95
|
+
this._events.push(event);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Bind the keyboard listeners to the given element
|
|
99
|
+
*/
|
|
100
|
+
_bindListeners() {
|
|
101
|
+
const element = this._element;
|
|
102
|
+
element.addEventListener('keydown', this._keyDownHandler, true);
|
|
103
|
+
element.addEventListener('keypress', this._keyPressHandler, true);
|
|
104
|
+
element.addEventListener('keyup', this._keyUpHandler, true);
|
|
105
|
+
}
|
|
106
|
+
_unbindListeners() {
|
|
107
|
+
const element = this._element;
|
|
108
|
+
element.removeEventListener('keydown', this._keyDownHandler, true);
|
|
109
|
+
element.removeEventListener('keypress', this._keyPressHandler, true);
|
|
110
|
+
element.removeEventListener('keyup', this._keyUpHandler, true);
|
|
111
|
+
}
|
|
112
|
+
_bindKeyDownListener(event) {
|
|
113
|
+
// Only intercept if handler set
|
|
114
|
+
if (!this.onKeyDown) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
// Ignore events which have already been handled
|
|
118
|
+
if (!this._markEvent(event)) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
// Fix modifier states
|
|
122
|
+
const keydownEvent = new keyboard_1.WebXKeydownEvent(event.key, WebXKeyboard._getEventLocation(event));
|
|
123
|
+
if (keydownEvent.keysym == null) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
this._recentKeysym[event.key] = keydownEvent.keysym;
|
|
127
|
+
this._syncModifierStates(event, keydownEvent);
|
|
128
|
+
// Ignore (but do not prevent) the "composition" keycode sent by some
|
|
129
|
+
// browsers when an IME is in use (see: http://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html)
|
|
130
|
+
// if (keyCode === 229) {
|
|
131
|
+
// return;
|
|
132
|
+
// }
|
|
133
|
+
this._addEvent(keydownEvent);
|
|
134
|
+
// Interpret as many events as possible, prevent default if indicated
|
|
135
|
+
this._interpretEvents();
|
|
136
|
+
event.preventDefault();
|
|
137
|
+
event.stopPropagation();
|
|
138
|
+
}
|
|
139
|
+
_bindKeyPressListener(event) {
|
|
140
|
+
// Only intercept if handler set
|
|
141
|
+
if (!this.onKeyDown && !this.onKeyUp) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
// Ignore events which have already been handled
|
|
145
|
+
if (!this._markEvent(event)) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
// Fix modifier states
|
|
149
|
+
const keypressEvent = new keyboard_1.WebXKeyPressEvent(event.key, WebXKeyboard._getEventLocation(event));
|
|
150
|
+
if (keypressEvent.keysym == null) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
this._syncModifierStates(event, keypressEvent);
|
|
154
|
+
// Log event
|
|
155
|
+
this._addEvent(keypressEvent);
|
|
156
|
+
// Interpret as many events as possible, prevent default if indicated
|
|
157
|
+
this._interpretEvents();
|
|
158
|
+
event.preventDefault();
|
|
159
|
+
event.stopPropagation();
|
|
160
|
+
}
|
|
161
|
+
_bindKeyUpListener(event) {
|
|
162
|
+
// Only intercept if handler set
|
|
163
|
+
if (!this.onKeyUp) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
// Ignore events which have already been handled
|
|
167
|
+
if (!this._markEvent(event)) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
// Fix modifier states
|
|
172
|
+
const keyupEvent = new keyboard_1.WebXKeyUpEvent(event.key, WebXKeyboard._getEventLocation(event));
|
|
173
|
+
if (keyupEvent.keysym == null) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
// Fall back to the most recently pressed keysym associated with the
|
|
177
|
+
// keyCode if the inferred key doesn't seem to actually be pressed
|
|
178
|
+
if (!this.pressed[keyupEvent.keysym]) {
|
|
179
|
+
keyupEvent.keysym = this._recentKeysym[event.key] || keyupEvent.keysym;
|
|
180
|
+
}
|
|
181
|
+
// Fall back to the most recently pressed keysym associated with the
|
|
182
|
+
// keyCode if the inferred key doesn't seem to actually be pressed
|
|
183
|
+
if (!this._isKeyPressed(keyupEvent.keysym)) {
|
|
184
|
+
keyupEvent.keysym = this._recentKeysym[keyupEvent.keyCode] || keyupEvent.keysym;
|
|
185
|
+
}
|
|
186
|
+
this._syncModifierStates(event, keyupEvent);
|
|
187
|
+
// Log event, call for interpretation
|
|
188
|
+
this._events.push(keyupEvent);
|
|
189
|
+
this._interpretEvents();
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Returns the keyboard location of the key associated with the given
|
|
193
|
+
* keyboard event. The location differentiates key events which otherwise
|
|
194
|
+
* have the same keycode, such as left shift vs. right shift.
|
|
195
|
+
*
|
|
196
|
+
* @param event A JavaScript keyboard event, as received through the DOM via a "keydown", "keyup", or "keypress" handler.
|
|
197
|
+
*
|
|
198
|
+
* @returns {number}
|
|
199
|
+
* The location of the key event on the keyboard, as defined at:
|
|
200
|
+
* http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent
|
|
201
|
+
*/
|
|
202
|
+
static _getEventLocation(event) {
|
|
203
|
+
// Use standard location, if possible
|
|
204
|
+
if ('location' in event) {
|
|
205
|
+
return event.location;
|
|
206
|
+
}
|
|
207
|
+
// If no location is available, assume left side
|
|
208
|
+
return 0;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Attempts to mark the given Event as having been handled by this
|
|
212
|
+
* keyboard. If the Event has already been marked as handled,
|
|
213
|
+
* false is returned.
|
|
214
|
+
*
|
|
215
|
+
* @param event The Event to mark.
|
|
216
|
+
* @returns true if the given Event was successfully marked, false if the given
|
|
217
|
+
* Event was already marked.
|
|
218
|
+
*/
|
|
219
|
+
_markEvent(event) {
|
|
220
|
+
// Fail if event is already marked
|
|
221
|
+
if (event[this._eventMarker]) {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
// Mark event otherwise
|
|
225
|
+
event[this._eventMarker] = true;
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Reads through the event log, removing events from the head of the log
|
|
230
|
+
* when the corresponding true key presses are known (or as known as they
|
|
231
|
+
* can be).
|
|
232
|
+
*
|
|
233
|
+
*/
|
|
234
|
+
_interpretEvents() {
|
|
235
|
+
// Do not prevent default if no event could be interpreted
|
|
236
|
+
let handledEvent = this._interpretEvent();
|
|
237
|
+
if (!handledEvent) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
// Interpret as much as possible
|
|
241
|
+
// let lastEvent;
|
|
242
|
+
do {
|
|
243
|
+
// lastEvent = handledEvent;
|
|
244
|
+
handledEvent = this._interpretEvent();
|
|
245
|
+
} while (handledEvent !== null);
|
|
246
|
+
// Reset keyboard state if we cannot expect to receive any further
|
|
247
|
+
// keyup events
|
|
248
|
+
if (this._isStateImplicit()) {
|
|
249
|
+
this.reset();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Reads through the event log, interpreting the first event, if possible,
|
|
254
|
+
* and returning that event. If no events can be interpreted, due to a
|
|
255
|
+
* total lack of events or the need for more events, null is returned. Any
|
|
256
|
+
* interpreted events are automatically removed from the log.
|
|
257
|
+
*
|
|
258
|
+
* The first key event in the log, if it can be interpreted, or null
|
|
259
|
+
* otherwise.
|
|
260
|
+
*/
|
|
261
|
+
_interpretEvent() {
|
|
262
|
+
// Peek at first event in log
|
|
263
|
+
const first = this._events[0];
|
|
264
|
+
if (!first) {
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
// Keydown event
|
|
268
|
+
if (first instanceof keyboard_1.WebXKeydownEvent) {
|
|
269
|
+
let keysym = null;
|
|
270
|
+
let acceptedEvents = [];
|
|
271
|
+
// If event itself is reliable, no need to wait for other events
|
|
272
|
+
if (first.reliable) {
|
|
273
|
+
keysym = first.keysym;
|
|
274
|
+
acceptedEvents = this._events.splice(0, 1);
|
|
275
|
+
}
|
|
276
|
+
// If keydown is immediately followed by a keypress, use the indicated character
|
|
277
|
+
else if (this._events[1] instanceof keyboard_1.WebXKeyPressEvent) {
|
|
278
|
+
keysym = this._events[1].keysym;
|
|
279
|
+
acceptedEvents = this._events.splice(0, 2);
|
|
280
|
+
}
|
|
281
|
+
// If keydown is immediately followed by anything else, then no
|
|
282
|
+
// keypress can possibly occur to clarify this event, and we must
|
|
283
|
+
// handle it now
|
|
284
|
+
else if (this._events[1]) {
|
|
285
|
+
keysym = first.keysym;
|
|
286
|
+
acceptedEvents = this._events.splice(0, 1);
|
|
287
|
+
}
|
|
288
|
+
// Fire a key press if valid events were found
|
|
289
|
+
if (acceptedEvents.length > 0) {
|
|
290
|
+
if (keysym) {
|
|
291
|
+
// Fire event
|
|
292
|
+
this._releaseSimulatedAltgr(keysym);
|
|
293
|
+
const defaultPrevented = !this.press(keysym);
|
|
294
|
+
this._recentKeysym[first.key] = keysym;
|
|
295
|
+
// Release the key now if we cannot rely on the associated
|
|
296
|
+
// keyup event
|
|
297
|
+
if (!first.keyupReliable) {
|
|
298
|
+
this.release(keysym);
|
|
299
|
+
}
|
|
300
|
+
// Record whether default was prevented
|
|
301
|
+
for (const acceptedEvent of acceptedEvents) {
|
|
302
|
+
acceptedEvent.defaultPrevented = defaultPrevented;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return first;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
// Keyup event
|
|
309
|
+
else if (first instanceof keyboard_1.WebXKeyUpEvent && !WebXKeyboard.quirks.keyupUnreliable) {
|
|
310
|
+
// Release specific key if known
|
|
311
|
+
const keysym = first.keysym;
|
|
312
|
+
if (keysym) {
|
|
313
|
+
this.release(keysym);
|
|
314
|
+
delete this._recentKeysym[first.keyCode];
|
|
315
|
+
first.defaultPrevented = true;
|
|
316
|
+
}
|
|
317
|
+
// Otherwise, fall back to releasing all keys
|
|
318
|
+
else {
|
|
319
|
+
this.reset();
|
|
320
|
+
}
|
|
321
|
+
return this._events.shift();
|
|
322
|
+
}
|
|
323
|
+
// Ignore any other type of event (keypress by itself is invalid, and
|
|
324
|
+
// unreliable keyup events should simply be dumped)
|
|
325
|
+
else {
|
|
326
|
+
return this._events.shift();
|
|
327
|
+
}
|
|
328
|
+
// No event interpreted
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Releases Ctrl+Alt, if both are currently pressed and the given keysym
|
|
333
|
+
* looks like a key that may require AltGr.
|
|
334
|
+
*
|
|
335
|
+
* @param keysym The key that was just pressed.
|
|
336
|
+
*/
|
|
337
|
+
_releaseSimulatedAltgr(keysym) {
|
|
338
|
+
// Both Ctrl+Alt must be pressed if simulated AltGr is in use
|
|
339
|
+
if (!WebXKeyboard.modifiers.ctrl || !WebXKeyboard.modifiers.alt) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
// Assume [A-Z] never require AltGr
|
|
343
|
+
if (keysym >= 0x0041 && keysym <= 0x005A) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
// Assume [a-z] never require AltGr
|
|
347
|
+
if (keysym >= 0x0061 && keysym <= 0x007A) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
// Release Ctrl+Alt if the keysym is printable
|
|
351
|
+
if (keysym <= 0xFF || (keysym & 0xFF000000) === 0x01000000) {
|
|
352
|
+
this.release(0xFFE3); // Left ctrl
|
|
353
|
+
this.release(0xFFE4); // Right ctrl
|
|
354
|
+
this.release(0xFFE9); // Left alt
|
|
355
|
+
this.release(0xFFEA); // Right alt
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Returns whether all currently pressed keys were implicitly pressed. A
|
|
360
|
+
* key is implicitly pressed if its status was inferred indirectly from
|
|
361
|
+
* inspection of other key events.
|
|
362
|
+
*
|
|
363
|
+
* @returns {boolean}
|
|
364
|
+
* true if all currently pressed keys were implicitly pressed, false
|
|
365
|
+
* otherwise.
|
|
366
|
+
*/
|
|
367
|
+
_isStateImplicit() {
|
|
368
|
+
for (const keysym in this._pressed) {
|
|
369
|
+
if (!this._isImplicitlyPressed(parseInt(keysym))) {
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Check if a key is implicitly pressed
|
|
377
|
+
* @param keysym the keysym to check
|
|
378
|
+
*/
|
|
379
|
+
_isImplicitlyPressed(keysym) {
|
|
380
|
+
return this._implicitlyPressed[keysym];
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Given a keyboard event, updates the local modifier state and remote
|
|
384
|
+
* key state based on the modifier flags within the event. This function
|
|
385
|
+
* pays no attention to keycodes.
|
|
386
|
+
*
|
|
387
|
+
* @param event The keyboard event containing the flags to update.
|
|
388
|
+
*
|
|
389
|
+
* @param keyEvent Current best interpretation of the key event being processed.
|
|
390
|
+
*/
|
|
391
|
+
_syncModifierStates(event, keyEvent) {
|
|
392
|
+
// Get state
|
|
393
|
+
const state = WebXKeyboard.modifiers.fromKeyboardEvent(event);
|
|
394
|
+
// Resync state of alt
|
|
395
|
+
this._updateModifierState(WebXKeyboard.modifiers.alt, state.alt, [
|
|
396
|
+
0xFFE9,
|
|
397
|
+
0xFFEA,
|
|
398
|
+
0xFE03 // AltGr
|
|
399
|
+
], keyEvent);
|
|
400
|
+
// Resync state of shift
|
|
401
|
+
this._updateModifierState(WebXKeyboard.modifiers.shift, state.shift, [
|
|
402
|
+
0xFFE1,
|
|
403
|
+
0xFFE2 // Right shift
|
|
404
|
+
], keyEvent);
|
|
405
|
+
// Resync state of ctrl
|
|
406
|
+
this._updateModifierState(WebXKeyboard.modifiers.ctrl, state.ctrl, [
|
|
407
|
+
0xFFE3,
|
|
408
|
+
0xFFE4 // Right ctrl
|
|
409
|
+
], keyEvent);
|
|
410
|
+
// Resync state of meta
|
|
411
|
+
this._updateModifierState(WebXKeyboard.modifiers.meta, state.meta, [
|
|
412
|
+
0xFFE7,
|
|
413
|
+
0xFFE8 // Right meta
|
|
414
|
+
], keyEvent);
|
|
415
|
+
// Resync state of hyper
|
|
416
|
+
this._updateModifierState(WebXKeyboard.modifiers.hyper, state.hyper, [
|
|
417
|
+
0xFFEB,
|
|
418
|
+
0xFFEC // Right hyper
|
|
419
|
+
], keyEvent);
|
|
420
|
+
// Update state
|
|
421
|
+
WebXKeyboard.modifiers = state;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Given the remote and local state of a particular key, resynchronises the
|
|
425
|
+
* remote state of that key with the local state through pressing or
|
|
426
|
+
* releasing keysyms.
|
|
427
|
+
*
|
|
428
|
+
* @param remoteState Whether the key is currently pressed remotely.
|
|
429
|
+
* @param localState Whether the key is currently pressed locally. If the state
|
|
430
|
+
* of the key is not known, this may be undefined.
|
|
431
|
+
* @param keysyms The keysyms which represent the key being updated.
|
|
432
|
+
* @param keyEvent Best interpretation of the key event being processed.
|
|
433
|
+
*/
|
|
434
|
+
_updateModifierState(remoteState, localState, keysyms, keyEvent) {
|
|
435
|
+
let i;
|
|
436
|
+
// Do not trust changes in modifier state for events directly involving
|
|
437
|
+
// that modifier: (1) the flag may erroneously be cleared despite
|
|
438
|
+
// another version of the same key still being held and (2) the change
|
|
439
|
+
// in flag may be due to the current event being processed, thus
|
|
440
|
+
// updating things here is at best redundant and at worst incorrect
|
|
441
|
+
if (keysyms.indexOf(keyEvent.keysym) !== -1)
|
|
442
|
+
return;
|
|
443
|
+
// Release all related keys if modifier is implicitly released
|
|
444
|
+
if (remoteState && localState === false) {
|
|
445
|
+
for (i = 0; i < keysyms.length; i++) {
|
|
446
|
+
this.release(keysyms[i]);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
// Press if modifier is implicitly pressed
|
|
450
|
+
else if (!remoteState && localState) {
|
|
451
|
+
// Verify that modifier flag isn't already pressed or already set
|
|
452
|
+
// due to another version of the same key being held down
|
|
453
|
+
for (i = 0; i < keysyms.length; i++) {
|
|
454
|
+
if (this._pressed[keysyms[i]]) {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
// Mark as implicitly pressed only if there is other information
|
|
459
|
+
// within the key event relating to a different key. Some
|
|
460
|
+
// platforms, such as iOS, will send essentially empty key events
|
|
461
|
+
// for modifier keys, using only the modifier flags to signal the
|
|
462
|
+
// identity of the key.
|
|
463
|
+
const keysym = keysyms[0];
|
|
464
|
+
if (keyEvent.keysym) {
|
|
465
|
+
this._implicitlyPressed[keysym] = true;
|
|
466
|
+
}
|
|
467
|
+
this.press(keysym);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Handle keydown event
|
|
472
|
+
* @param keysym the key symbol
|
|
473
|
+
*/
|
|
474
|
+
_handleKeyDown(keysym) {
|
|
475
|
+
this.onKeyDown(keysym);
|
|
476
|
+
return true;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Clear the key repeat timers
|
|
480
|
+
*/
|
|
481
|
+
_clearKeyRepeatTimers() {
|
|
482
|
+
clearTimeout(this._keyRepeatTimeout);
|
|
483
|
+
clearInterval(this._keyRepeatInterval);
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Checks to see if a key is pressed
|
|
487
|
+
* @param keysym the key to check
|
|
488
|
+
*/
|
|
489
|
+
_isKeyPressed(keysym) {
|
|
490
|
+
return this._pressed[keysym];
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Resets the state of this keyboard
|
|
494
|
+
*/
|
|
495
|
+
reset() {
|
|
496
|
+
for (const keysym in this._pressed) {
|
|
497
|
+
this.release(parseInt(keysym));
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Presses and releases the keys necessary to tpe the given string of characters
|
|
502
|
+
* @param message the string to type
|
|
503
|
+
*/
|
|
504
|
+
type(message) {
|
|
505
|
+
// Press/release the key corresponding to each character in the string
|
|
506
|
+
for (let i = 0; i < message.length; i++) {
|
|
507
|
+
// Determine keysym of current character
|
|
508
|
+
const codepoint = message.codePointAt ? message.codePointAt(i) : message.charCodeAt(i);
|
|
509
|
+
const keysym = keyboard_1.WebXKeyboardUtils.keysymFromCharCode(codepoint);
|
|
510
|
+
// Press and release key for current character
|
|
511
|
+
this.press(keysym);
|
|
512
|
+
this.release(keysym);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Marks a key as pressed, firing the keydown event if registered. Key repeat for the pressed
|
|
517
|
+
* key will start after a delay if that key is not a modifier.
|
|
518
|
+
* The return value of this function depends on the return value of the keydown event handler, if any.
|
|
519
|
+
* @param keysym the keysym of the key to press
|
|
520
|
+
* @return {boolean} true if event should not be canceled, false otherwise.
|
|
521
|
+
*/
|
|
522
|
+
press(keysym) {
|
|
523
|
+
if (keysym) {
|
|
524
|
+
// Mark key as pressed
|
|
525
|
+
if (!this._isKeyPressed(keysym)) {
|
|
526
|
+
this._pressed[keysym] = true;
|
|
527
|
+
}
|
|
528
|
+
// Send key event
|
|
529
|
+
if (this.onKeyDown) {
|
|
530
|
+
const result = this._handleKeyDown(keysym);
|
|
531
|
+
this._lastKeydownResult[keysym] = result;
|
|
532
|
+
// Stop any current repeat
|
|
533
|
+
window.clearTimeout(this._keyRepeatTimeout);
|
|
534
|
+
window.clearInterval(this._keyRepeatInterval);
|
|
535
|
+
// Repeat after a delay as long as pressed
|
|
536
|
+
if (!keyboard_1.WebXKeyboardUtils.isKeyRepeatable(keysym))
|
|
537
|
+
this._keyRepeatTimeout = window.setTimeout(() => {
|
|
538
|
+
this._keyRepeatInterval = window.setInterval(() => {
|
|
539
|
+
this.onKeyUp(keysym);
|
|
540
|
+
this.onKeyDown(keysym);
|
|
541
|
+
}, 50);
|
|
542
|
+
}, 500);
|
|
543
|
+
return result;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Marks a key as released, firing the keyup event if registered
|
|
549
|
+
* @param keysym the keysym of the key to release.
|
|
550
|
+
*/
|
|
551
|
+
release(keysym) {
|
|
552
|
+
// Only release if pressed
|
|
553
|
+
if (this._isKeyPressed(keysym)) {
|
|
554
|
+
// Mark key as released
|
|
555
|
+
delete this._pressed[keysym];
|
|
556
|
+
delete this._implicitlyPressed[keysym];
|
|
557
|
+
// Stop repeat
|
|
558
|
+
this._clearKeyRepeatTimers();
|
|
559
|
+
// Send key event
|
|
560
|
+
if (keysym !== null && this.onKeyUp) {
|
|
561
|
+
this.onKeyUp(keysym);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
exports.WebXKeyboard = WebXKeyboard;
|
|
567
|
+
WebXKeyboard._NEXT_ID = 0;
|
|
568
|
+
/**
|
|
569
|
+
* All modifiers and their states.
|
|
570
|
+
*/
|
|
571
|
+
WebXKeyboard.modifiers = new keyboard_1.WebXKeyboardModifierState();
|
|
572
|
+
/**
|
|
573
|
+
* Set of known platform-specific or browser-specific quirks which must be
|
|
574
|
+
* accounted for to properly interpret key events, even if the only way to
|
|
575
|
+
* reliably detect that quirk is to platform/browser-sniff.
|
|
576
|
+
*/
|
|
577
|
+
WebXKeyboard.quirks = {
|
|
578
|
+
/**
|
|
579
|
+
* Whether keyup events are universally unreliable.
|
|
580
|
+
*/
|
|
581
|
+
keyupUnreliable: false,
|
|
582
|
+
/**
|
|
583
|
+
* Whether the Alt key is actually a modifier for typable keys and is
|
|
584
|
+
* thus never used for keyboard shortcuts.
|
|
585
|
+
*/
|
|
586
|
+
altIsTypableOnly: false,
|
|
587
|
+
/**
|
|
588
|
+
* Whether we can rely on receiving a keyup event for the Caps Lock
|
|
589
|
+
* key.
|
|
590
|
+
*/
|
|
591
|
+
capsLockKeyupUnreliable: false
|
|
592
|
+
};
|
|
593
|
+
//# sourceMappingURL=WebXKeyboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebXKeyboard.js","sourceRoot":"","sources":["../../src/input/WebXKeyboard.ts"],"names":[],"mappings":";;;AAAA,yCAOoB;AAEpB,MAAa,YAAY;IA8FvB;;;OAGG;IACH,YAAY,OAA+B;QAxD3C;;;;WAIG;QACK,aAAQ,GAAiC,EAAE,CAAC;QAEpD;;;;;;;WAOG;QACK,uBAAkB,GAAiC,EAAE,CAAC;QAE9D;;;;;WAKG;QACK,uBAAkB,GAAiC,EAAE,CAAC;QAE9D;;;WAGG;QACK,kBAAa,GAA8B,EAAE,CAAC;QAEtD;;WAEG;QACK,sBAAiB,GAAW,IAAI,CAAC;QAEzC;;;WAGG;QACK,uBAAkB,GAAW,IAAI,CAAC;QAElC,YAAO,GAAwB,EAAE,CAAC;QAElC,oBAAe,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvD,qBAAgB,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzD,kBAAa,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAumB3D;;;;;WAKG;QACI,cAAS,GAAuB,IAAI,CAAC;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