|
| 1 | +import { initVirtualKey, setVirtualKeysProfiles } from "./virtualKey"; |
1 | 2 | import { estimateCoord, resetCoordEstimator } from "precise-client-coord";
|
2 | 3 |
|
3 | 4 | window.addEventListener("resize", resetCoordEstimator);
|
@@ -277,6 +278,10 @@ class Settings {
|
277 | 278 |
|
278 | 279 | this.toggle_energysaving(!!this.checks.get("energysaving").checked);
|
279 | 280 |
|
| 281 | + if (!this.checks.get("enable_virtual_keys").checked) { |
| 282 | + document.getElementById("vk-container").classList.add("hidden"); |
| 283 | + } |
| 284 | + |
280 | 285 | let client_name = settings["client_name"];
|
281 | 286 | if (client_name)
|
282 | 287 | this.client_name_input.value = client_name;
|
@@ -809,6 +814,10 @@ function handle_messages(
|
809 | 814 | else if ("ConfigError" in msg) {
|
810 | 815 | onConfigError(msg["ConfigError"]);
|
811 | 816 | }
|
| 817 | + else if ("VirtualKeysProfiles" in msg) { |
| 818 | + const profiles = JSON.parse(msg["VirtualKeysProfiles"] || '[]'); |
| 819 | + setVirtualKeysProfiles(profiles); |
| 820 | + } |
812 | 821 | }
|
813 | 822 |
|
814 | 823 | return;
|
@@ -894,6 +903,7 @@ function init() {
|
894 | 903 | ws.send('"GetCapturableList"');
|
895 | 904 | if (!settings.video_enabled()) webSocket.send('"PauseVideo"');
|
896 | 905 |
|
| 906 | + ws.send('"RequestVirtualKeysProfiles"'); |
897 | 907 | settings.send_server_config();
|
898 | 908 |
|
899 | 909 | document.onvisibilitychange = () => {
|
@@ -944,6 +954,7 @@ function init() {
|
944 | 954 | makeConnection();
|
945 | 955 |
|
946 | 956 | settings = new Settings();
|
| 957 | + initVirtualKey(); |
947 | 958 |
|
948 | 959 | document.body.addEventListener("contextmenu", (event) => {
|
949 | 960 | event.preventDefault();
|
|
0 commit comments