Skip to content

Commit c8e5be2

Browse files
committed
chore: add comments and remove unused code
1 parent 4592269 commit c8e5be2

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

ui/src/components/WebRTCVideo.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ export default function WebRTCVideo() {
229229
if (rpcHidReady) {
230230
reportRelMouseEvent(dx, dy, buttons);
231231
} else {
232+
// kept for backward compatibility
232233
send("relMouseReport", { dx, dy, buttons });
233234
}
234235
setMouseMove({ x, y, buttons });
@@ -260,6 +261,7 @@ export default function WebRTCVideo() {
260261
if (rpcHidReady) {
261262
reportAbsMouseEvent(x, y, buttons);
262263
} else {
264+
// kept for backward compatibility
263265
send("absMouseReport", { x, y, buttons });
264266
}
265267
// We set that for the debug info bar

ui/src/hooks/useKeyboard.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,13 @@ export default function useKeyboard() {
5151
if (rpcHidReady) {
5252
console.debug("Sending keyboard report via HidRPC");
5353
reportKeyboardEvent(state.keys, state.modifier);
54+
setkeyPressReportApiAvailable(true);
5455
return;
5556
}
5657

5758
send("keyboardReport", { keys: state.keys, modifier: state.modifier }, (resp: JsonRpcResponse) => {
5859
if ("error" in resp) {
5960
console.error(`Failed to send keyboard report ${state}`, resp.error);
60-
} else {
61-
// If the device supports keyPressReport API, it will (also) return the keysDownState when we send
62-
// the keyboardReport
63-
const keysDownState = resp.result as KeysDownState;
64-
65-
if (keysDownState) {
66-
setKeysDownState(keysDownState); // treat the response as the canonical state
67-
setkeyPressReportApiAvailable(true); // if they returned a keysDownState, we ALSO know they also support keyPressReport
68-
} else {
69-
// older devices versions do not return the keyDownState
70-
// so we just pretend they accepted what we sent
71-
setKeysDownState(state);
72-
setkeyPressReportApiAvailable(false); // we ALSO know they do not support keyPressReport
73-
}
7461
}
7562
});
7663
},
@@ -79,7 +66,6 @@ export default function useKeyboard() {
7966
rpcHidReady,
8067
send,
8168
reportKeyboardEvent,
82-
setKeysDownState,
8369
setkeyPressReportApiAvailable,
8470
],
8571
);

0 commit comments

Comments
 (0)