@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,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.WebXWindow = void 0;
|
|
13
|
+
const THREE = require("three");
|
|
14
|
+
const three_1 = require("three");
|
|
15
|
+
const utils_1 = require("../utils");
|
|
16
|
+
class WebXWindow {
|
|
17
|
+
constructor(configuration, textureFactory) {
|
|
18
|
+
this._width = 1;
|
|
19
|
+
this._height = 1;
|
|
20
|
+
this._lastWindowUpdateTimeMs = 0;
|
|
21
|
+
this._textureFactory = textureFactory;
|
|
22
|
+
this._colorIndex = WebXWindow._COLOR_INDEX++;
|
|
23
|
+
// this._material = new THREE.MeshBasicMaterial( { color: WebXColourGenerator.indexedColour(this._colorIndex) } );
|
|
24
|
+
this._material = new THREE.MeshBasicMaterial({ transparent: true });
|
|
25
|
+
this._material.side = THREE.BackSide;
|
|
26
|
+
this.visible = (0, utils_1.APP_CONFIG)().showWindowsBeforeImage;
|
|
27
|
+
const { id, x, y, z, width, height } = configuration;
|
|
28
|
+
this._id = id;
|
|
29
|
+
this._mesh = new THREE.Mesh(WebXWindow._PLANE_GEOMETRY, this._material);
|
|
30
|
+
this._x = x;
|
|
31
|
+
this._y = y;
|
|
32
|
+
this._z = z;
|
|
33
|
+
this._width = width;
|
|
34
|
+
this._height = height;
|
|
35
|
+
this._updateScale();
|
|
36
|
+
this._updatePosition();
|
|
37
|
+
}
|
|
38
|
+
get mesh() {
|
|
39
|
+
return this._mesh;
|
|
40
|
+
}
|
|
41
|
+
get colorIndex() {
|
|
42
|
+
return this._colorIndex;
|
|
43
|
+
}
|
|
44
|
+
get id() {
|
|
45
|
+
return this._id;
|
|
46
|
+
}
|
|
47
|
+
get visible() {
|
|
48
|
+
return this._material.visible;
|
|
49
|
+
}
|
|
50
|
+
set visible(visible) {
|
|
51
|
+
if (this._material.visible !== visible) {
|
|
52
|
+
this._material.visible = visible;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
get colorMap() {
|
|
56
|
+
return this._material.map;
|
|
57
|
+
}
|
|
58
|
+
set colorMap(colorMap) {
|
|
59
|
+
this._material.map = colorMap;
|
|
60
|
+
}
|
|
61
|
+
get alphaMap() {
|
|
62
|
+
return this._material.alphaMap;
|
|
63
|
+
}
|
|
64
|
+
set alphaMap(alphaMap) {
|
|
65
|
+
this._material.alphaMap = alphaMap;
|
|
66
|
+
}
|
|
67
|
+
get colorMapValid() {
|
|
68
|
+
return this.colorMap != null && this.colorMap.image.width === this._width && this.colorMap.image.height === this._height;
|
|
69
|
+
}
|
|
70
|
+
get depth() {
|
|
71
|
+
return this._depth;
|
|
72
|
+
}
|
|
73
|
+
get x() {
|
|
74
|
+
return this._x;
|
|
75
|
+
}
|
|
76
|
+
set x(value) {
|
|
77
|
+
this._x = value;
|
|
78
|
+
this._updatePosition();
|
|
79
|
+
}
|
|
80
|
+
get y() {
|
|
81
|
+
return this._y;
|
|
82
|
+
}
|
|
83
|
+
set y(value) {
|
|
84
|
+
this._y = value;
|
|
85
|
+
this._updatePosition();
|
|
86
|
+
}
|
|
87
|
+
get z() {
|
|
88
|
+
return this._z;
|
|
89
|
+
}
|
|
90
|
+
set z(value) {
|
|
91
|
+
this._z = value;
|
|
92
|
+
this._updatePosition();
|
|
93
|
+
}
|
|
94
|
+
get width() {
|
|
95
|
+
return this._width;
|
|
96
|
+
}
|
|
97
|
+
set width(value) {
|
|
98
|
+
this._width = value;
|
|
99
|
+
this._updateScale();
|
|
100
|
+
this._updatePosition();
|
|
101
|
+
}
|
|
102
|
+
get height() {
|
|
103
|
+
return this._height;
|
|
104
|
+
}
|
|
105
|
+
set height(value) {
|
|
106
|
+
this._height = value;
|
|
107
|
+
this._updateScale();
|
|
108
|
+
this._updatePosition();
|
|
109
|
+
}
|
|
110
|
+
get lastWindowUpdateTimeMs() {
|
|
111
|
+
return this._lastWindowUpdateTimeMs;
|
|
112
|
+
}
|
|
113
|
+
set lastWindowUpdateTimeMs(value) {
|
|
114
|
+
this._lastWindowUpdateTimeMs = value;
|
|
115
|
+
}
|
|
116
|
+
loadWindowImage() {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
const response = yield this._textureFactory.getWindowTexture(this._id);
|
|
119
|
+
this.updateTexture(response.depth, response.colorMap, response.alphaMap, true);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
setRectangle(x, y, z, width, height) {
|
|
123
|
+
this._x = x;
|
|
124
|
+
this._y = y;
|
|
125
|
+
this._z = z;
|
|
126
|
+
this._width = width;
|
|
127
|
+
this._height = height;
|
|
128
|
+
if (this.colorMap) {
|
|
129
|
+
this.colorMap.repeat.set(this._width / this.colorMap.image.width, this._height / this.colorMap.image.height);
|
|
130
|
+
if (this.alphaMap) {
|
|
131
|
+
this.alphaMap.repeat.set(this._width / this.alphaMap.image.width, this._height / this.alphaMap.image.height);
|
|
132
|
+
}
|
|
133
|
+
// Force reload of image of dimensions differ
|
|
134
|
+
if (this.colorMap.image.width !== this._width || this.colorMap.image.height !== this._height) {
|
|
135
|
+
this.loadWindowImage().then();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
this._updateScale();
|
|
139
|
+
this._updatePosition();
|
|
140
|
+
}
|
|
141
|
+
updateTexture(depth, colorMap, alphaMap, isFullWindow) {
|
|
142
|
+
this._depth = depth;
|
|
143
|
+
// Dispose of previous texture
|
|
144
|
+
if (colorMap != this.colorMap) {
|
|
145
|
+
this._disposeColorMap();
|
|
146
|
+
this.colorMap = colorMap;
|
|
147
|
+
}
|
|
148
|
+
if (colorMap) {
|
|
149
|
+
colorMap.minFilter = three_1.LinearFilter;
|
|
150
|
+
this.colorMap.repeat.set(this._width / this.colorMap.image.width, this._height / this.colorMap.image.height);
|
|
151
|
+
this.visible = true;
|
|
152
|
+
this._material.needsUpdate = true;
|
|
153
|
+
}
|
|
154
|
+
// Only update alpha if it has been sent
|
|
155
|
+
if (alphaMap) {
|
|
156
|
+
if (alphaMap != this.alphaMap) {
|
|
157
|
+
this._disposeAlphaMap();
|
|
158
|
+
this.alphaMap = alphaMap;
|
|
159
|
+
}
|
|
160
|
+
this.alphaMap.minFilter = three_1.LinearFilter;
|
|
161
|
+
this.alphaMap.repeat.set(this._width / this.alphaMap.image.width, this._height / this.alphaMap.image.height);
|
|
162
|
+
this._material.needsUpdate = true;
|
|
163
|
+
}
|
|
164
|
+
else if (depth == 24) {
|
|
165
|
+
this._disposeAlphaMap();
|
|
166
|
+
}
|
|
167
|
+
this._material.transparent = (this.alphaMap != null || depth === 32);
|
|
168
|
+
if (isFullWindow) {
|
|
169
|
+
if (this._lastWindowUpdateTimeMs === 0) {
|
|
170
|
+
this._lastWindowUpdateTimeMs = Date.now() + Math.random() * WebXWindow.WINDOW_REFRESH_TIME_MS;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
this._lastWindowUpdateTimeMs = Date.now();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
_updateScale() {
|
|
178
|
+
this._mesh.scale.set(this._width, this._height, 1);
|
|
179
|
+
}
|
|
180
|
+
_updatePosition() {
|
|
181
|
+
this._mesh.position.set(this._x + 0.5 * this._width, this._y + 0.5 * this._height, this._z);
|
|
182
|
+
}
|
|
183
|
+
dispose() {
|
|
184
|
+
this._disposeColorMap();
|
|
185
|
+
this._disposeAlphaMap();
|
|
186
|
+
this._material.dispose();
|
|
187
|
+
}
|
|
188
|
+
_disposeColorMap() {
|
|
189
|
+
if (this.colorMap) {
|
|
190
|
+
this.colorMap.dispose();
|
|
191
|
+
this.colorMap = null;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
_disposeAlphaMap() {
|
|
195
|
+
if (this.alphaMap) {
|
|
196
|
+
this.alphaMap.dispose();
|
|
197
|
+
this.alphaMap = null;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
exports.WebXWindow = WebXWindow;
|
|
202
|
+
WebXWindow.WINDOW_REFRESH_TIME_MS = 10000;
|
|
203
|
+
WebXWindow._PLANE_GEOMETRY = new THREE.PlaneGeometry(1.0, 1.0, 2, 2);
|
|
204
|
+
WebXWindow._COLOR_INDEX = 0;
|
|
205
|
+
//# sourceMappingURL=WebXWindow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebXWindow.js","sourceRoot":"","sources":["../../src/display/WebXWindow.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAA+B;AAE/B,iCAA8C;AAC9C,oCAAoC;AAEpC,MAAa,UAAU;IA0HrB,YAAY,aAA6F,EAAE,cAAkC;QA3GrI,WAAM,GAAW,CAAC,CAAC;QACnB,YA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WindowProperties {
|
|
5
|
+
constructor(configuration) {
|
|
6
|
+
this.width = 1;
|
|
7
|
+
this.height = 1;
|
|
8
|
+
const { id, x, y, width, height } = configuration;
|
|
9
|
+
this.id = id;
|
|
10
|
+
this.x = x;
|
|
11
|
+
this.y = y;
|
|
12
|
+
this.width = width;
|
|
13
|
+
this.height = height;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.WebXWindowProperties = WebXWindowProperties;
|
|
17
|
+
//# sourceMappingURL=WebXWindowProperties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebXWindowProperties.js","sourceRoot":"","sources":["../../src/display/WebXWindowProperties.ts"],"names":[],"mappings":";;;AAAA,MAAa,oBAAoB;IAO/B,YAAY,aAAkF;QAHvF,UAAK,GAAW,CAAC,CAAC;QAClB,WAAM,GAAW,CAAC,CAAC;QAGxB,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC;QAClD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAfD,oDAeC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./WebXCursor"), exports);
|
|
18
|
+
__exportStar(require("./WebXDisplay"), exports);
|
|
19
|
+
__exportStar(require("./WebXWindow"), exports);
|
|
20
|
+
__exportStar(require("./WebXWindowProperties"), exports);
|
|
21
|
+
__exportStar(require("./WebXTextureFactory"), exports);
|
|
22
|
+
__exportStar(require("./WebXSubImage"), exports);
|
|
23
|
+
__exportStar(require("./WebXCursorFactory"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/display/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,gDAA8B;AAC9B,+CAA6B;AAC7B,yDAAuC;AACvC,uDAAqC;AACrC,iDAA+B;AAC/B,sDAAoC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./display"), exports);
|
|
18
|
+
__exportStar(require("./input"), exports);
|
|
19
|
+
__exportStar(require("./instruction"), exports);
|
|
20
|
+
__exportStar(require("./message"), exports);
|
|
21
|
+
__exportStar(require("./tracer"), exports);
|
|
22
|
+
__exportStar(require("./tunnel"), exports);
|
|
23
|
+
__exportStar(require("./utils"), exports);
|
|
24
|
+
__exportStar(require("./WebXClient"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,0CAAwB;AACxB,gDAA8B;AAC9B,4CAA0B;AAC1B,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,+CAA6B"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { WebXKeyboardModifierState } from './keyboard';
|
|
2
|
+
export declare class WebXKeyboard {
|
|
3
|
+
private static _NEXT_ID;
|
|
4
|
+
/**
|
|
5
|
+
* All modifiers and their states.
|
|
6
|
+
*/
|
|
7
|
+
static modifiers: WebXKeyboardModifierState;
|
|
8
|
+
/**
|
|
9
|
+
* Set of known platform-specific or browser-specific quirks which must be
|
|
10
|
+
* accounted for to properly interpret key events, even if the only way to
|
|
11
|
+
* reliably detect that quirk is to platform/browser-sniff.
|
|
12
|
+
*/
|
|
13
|
+
static quirks: {
|
|
14
|
+
/**
|
|
15
|
+
* Whether keyup events are universally unreliable.
|
|
16
|
+
*/
|
|
17
|
+
keyupUnreliable: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the Alt key is actually a modifier for typable keys and is
|
|
20
|
+
* thus never used for keyboard shortcuts.
|
|
21
|
+
*/
|
|
22
|
+
altIsTypableOnly: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether we can rely on receiving a keyup event for the Caps Lock
|
|
25
|
+
* key.
|
|
26
|
+
*/
|
|
27
|
+
capsLockKeyupUnreliable: boolean;
|
|
28
|
+
};
|
|
29
|
+
private readonly _keyboardId;
|
|
30
|
+
private readonly _eventMarker;
|
|
31
|
+
/**
|
|
32
|
+
* The element to use to provide keyboard events
|
|
33
|
+
*/
|
|
34
|
+
private readonly _element;
|
|
35
|
+
/**
|
|
36
|
+
* The state of every key, indexed by keysym. If a particular key is
|
|
37
|
+
* pressed, the value of pressed for that keysym will be true. If a key
|
|
38
|
+
* is not currently pressed, it will not be defined.
|
|
39
|
+
*/
|
|
40
|
+
private _pressed;
|
|
41
|
+
/**
|
|
42
|
+
* The state of every key, indexed by keysym, for strictly those keys whose
|
|
43
|
+
* status has been indirectly determined through observation of other key
|
|
44
|
+
* events. If a particular key is implicitly pressed, the value of
|
|
45
|
+
* implicitlyPressed for that keysym will be true. If a key
|
|
46
|
+
* is not currently implicitly pressed (the key is not pressed OR the state
|
|
47
|
+
* of the key is explicitly known), it will not be defined.
|
|
48
|
+
*/
|
|
49
|
+
private _implicitlyPressed;
|
|
50
|
+
/**
|
|
51
|
+
* The last result of calling the onkeydown handler for each key, indexed
|
|
52
|
+
* by keysym. This is used to prevent/allow default actions for key events,
|
|
53
|
+
* even when the onkeydown handler cannot be called again because the key
|
|
54
|
+
* is (theoretically) still pressed.
|
|
55
|
+
*/
|
|
56
|
+
private _lastKeydownResult;
|
|
57
|
+
/**
|
|
58
|
+
* The keysym most recently associated with a given keycode when keydown
|
|
59
|
+
* fired. This object maps keycodes to keysyms.
|
|
60
|
+
*/
|
|
61
|
+
private _recentKeysym;
|
|
62
|
+
/**
|
|
63
|
+
* Timeout before key repeat starts.
|
|
64
|
+
*/
|
|
65
|
+
private _keyRepeatTimeout;
|
|
66
|
+
/**
|
|
67
|
+
* Interval which presses and releases the last key pressed while that
|
|
68
|
+
* key is still being held down.
|
|
69
|
+
*/
|
|
70
|
+
private _keyRepeatInterval;
|
|
71
|
+
private _events;
|
|
72
|
+
private _keyDownHandler;
|
|
73
|
+
private _keyPressHandler;
|
|
74
|
+
private _keyUpHandler;
|
|
75
|
+
get pressed(): {
|
|
76
|
+
[index: number]: boolean;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Create a new keyboard instance
|
|
80
|
+
* @param element the element to bind the keyboard to
|
|
81
|
+
*/
|
|
82
|
+
constructor(element: HTMLElement | Document);
|
|
83
|
+
dispose(): void;
|
|
84
|
+
/**
|
|
85
|
+
* Set quirk flags depending on platform/browser, if such information is available
|
|
86
|
+
*/
|
|
87
|
+
private _handleQuirks;
|
|
88
|
+
private _addEvent;
|
|
89
|
+
/**
|
|
90
|
+
* Bind the keyboard listeners to the given element
|
|
91
|
+
*/
|
|
92
|
+
private _bindListeners;
|
|
93
|
+
private _unbindListeners;
|
|
94
|
+
private _bindKeyDownListener;
|
|
95
|
+
private _bindKeyPressListener;
|
|
96
|
+
private _bindKeyUpListener;
|
|
97
|
+
/**
|
|
98
|
+
* Returns the keyboard location of the key associated with the given
|
|
99
|
+
* keyboard event. The location differentiates key events which otherwise
|
|
100
|
+
* have the same keycode, such as left shift vs. right shift.
|
|
101
|
+
*
|
|
102
|
+
* @param event A JavaScript keyboard event, as received through the DOM via a "keydown", "keyup", or "keypress" handler.
|
|
103
|
+
*
|
|
104
|
+
* @returns {number}
|
|
105
|
+
* The location of the key event on the keyboard, as defined at:
|
|
106
|
+
* http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent
|
|
107
|
+
*/
|
|
108
|
+
private static _getEventLocation;
|
|
109
|
+
/**
|
|
110
|
+
* Attempts to mark the given Event as having been handled by this
|
|
111
|
+
* keyboard. If the Event has already been marked as handled,
|
|
112
|
+
* false is returned.
|
|
113
|
+
*
|
|
114
|
+
* @param event The Event to mark.
|
|
115
|
+
* @returns true if the given Event was successfully marked, false if the given
|
|
116
|
+
* Event was already marked.
|
|
117
|
+
*/
|
|
118
|
+
private _markEvent;
|
|
119
|
+
/**
|
|
120
|
+
* Reads through the event log, removing events from the head of the log
|
|
121
|
+
* when the corresponding true key presses are known (or as known as they
|
|
122
|
+
* can be).
|
|
123
|
+
*
|
|
124
|
+
*/
|
|
125
|
+
private _interpretEvents;
|
|
126
|
+
/**
|
|
127
|
+
* Reads through the event log, interpreting the first event, if possible,
|
|
128
|
+
* and returning that event. If no events can be interpreted, due to a
|
|
129
|
+
* total lack of events or the need for more events, null is returned. Any
|
|
130
|
+
* interpreted events are automatically removed from the log.
|
|
131
|
+
*
|
|
132
|
+
* The first key event in the log, if it can be interpreted, or null
|
|
133
|
+
* otherwise.
|
|
134
|
+
*/
|
|
135
|
+
private _interpretEvent;
|
|
136
|
+
/**
|
|
137
|
+
* Releases Ctrl+Alt, if both are currently pressed and the given keysym
|
|
138
|
+
* looks like a key that may require AltGr.
|
|
139
|
+
*
|
|
140
|
+
* @param keysym The key that was just pressed.
|
|
141
|
+
*/
|
|
142
|
+
private _releaseSimulatedAltgr;
|
|
143
|
+
/**
|
|
144
|
+
* Returns whether all currently pressed keys were implicitly pressed. A
|
|
145
|
+
* key is implicitly pressed if its status was inferred indirectly from
|
|
146
|
+
* inspection of other key events.
|
|
147
|
+
*
|
|
148
|
+
* @returns {boolean}
|
|
149
|
+
* true if all currently pressed keys were implicitly pressed, false
|
|
150
|
+
* otherwise.
|
|
151
|
+
*/
|
|
152
|
+
private _isStateImplicit;
|
|
153
|
+
/**
|
|
154
|
+
* Check if a key is implicitly pressed
|
|
155
|
+
* @param keysym the keysym to check
|
|
156
|
+
*/
|
|
157
|
+
private _isImplicitlyPressed;
|
|
158
|
+
/**
|
|
159
|
+
* Given a keyboard event, updates the local modifier state and remote
|
|
160
|
+
* key state based on the modifier flags within the event. This function
|
|
161
|
+
* pays no attention to keycodes.
|
|
162
|
+
*
|
|
163
|
+
* @param event The keyboard event containing the flags to update.
|
|
164
|
+
*
|
|
165
|
+
* @param keyEvent Current best interpretation of the key event being processed.
|
|
166
|
+
*/
|
|
167
|
+
private _syncModifierStates;
|
|
168
|
+
/**
|
|
169
|
+
* Given the remote and local state of a particular key, resynchronises the
|
|
170
|
+
* remote state of that key with the local state through pressing or
|
|
171
|
+
* releasing keysyms.
|
|
172
|
+
*
|
|
173
|
+
* @param remoteState Whether the key is currently pressed remotely.
|
|
174
|
+
* @param localState Whether the key is currently pressed locally. If the state
|
|
175
|
+
* of the key is not known, this may be undefined.
|
|
176
|
+
* @param keysyms The keysyms which represent the key being updated.
|
|
177
|
+
* @param keyEvent Best interpretation of the key event being processed.
|
|
178
|
+
*/
|
|
179
|
+
private _updateModifierState;
|
|
180
|
+
/**
|
|
181
|
+
* Handle keydown event
|
|
182
|
+
* @param keysym the key symbol
|
|
183
|
+
*/
|
|
184
|
+
private _handleKeyDown;
|
|
185
|
+
/**
|
|
186
|
+
* Clear the key repeat timers
|
|
187
|
+
*/
|
|
188
|
+
private _clearKeyRepeatTimers;
|
|
189
|
+
/**
|
|
190
|
+
* Checks to see if a key is pressed
|
|
191
|
+
* @param keysym the key to check
|
|
192
|
+
*/
|
|
193
|
+
private _isKeyPressed;
|
|
194
|
+
/**
|
|
195
|
+
* Resets the state of this keyboard
|
|
196
|
+
*/
|
|
197
|
+
reset(): void;
|
|
198
|
+
/**
|
|
199
|
+
* Presses and releases the keys necessary to tpe the given string of characters
|
|
200
|
+
* @param message the string to type
|
|
201
|
+
*/
|
|
202
|
+
type(message: string): void;
|
|
203
|
+
/**
|
|
204
|
+
* Marks a key as pressed, firing the keydown event if registered. Key repeat for the pressed
|
|
205
|
+
* key will start after a delay if that key is not a modifier.
|
|
206
|
+
* The return value of this function depends on the return value of the keydown event handler, if any.
|
|
207
|
+
* @param keysym the keysym of the key to press
|
|
208
|
+
* @return {boolean} true if event should not be canceled, false otherwise.
|
|
209
|
+
*/
|
|
210
|
+
press(keysym: number): boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Marks a key as released, firing the keyup event if registered
|
|
213
|
+
* @param keysym the keysym of the key to release.
|
|
214
|
+
*/
|
|
215
|
+
release(keysym: number): void;
|
|
216
|
+
/**
|
|
217
|
+
* Fired whenever the user presses a key with the element associated
|
|
218
|
+
* with this keyboard in focus.
|
|
219
|
+
*
|
|
220
|
+
* @param key The key being pressed
|
|
221
|
+
*/
|
|
222
|
+
onKeyDown: (key: any) => void;
|
|
223
|
+
/**
|
|
224
|
+
* Fired whenever the user releases a key with the element associated
|
|
225
|
+
* with this keyboard in focus.
|
|
226
|
+
*
|
|
227
|
+
* @param key The key being released
|
|
228
|
+
*/
|
|
229
|
+
onKeyUp: (key: any) => void;
|
|
230
|
+
}
|