Files
lhns--steam-frame-nix/modules/steam-keyboard-patch/unpatch.js
T
Pierre Kisters 7d8e2f14cf Keyboard patch cleanup; arrow icons centered again
- drop cruft: v4 DispatchKeypress undo, unused VKM import and
  __vrkbdPatched flag, redundant VRKBD_DISPLAY env in the unit
- one wrap() helper for all replaced functions; key names for the
  stylesheet derived from the key definitions instead of repeated
- unpatch: restore every layout ever patched (also ones disabled since)
  and the remembered component class instead of walking the tree again
- helper: debounce re-injects after bursts of new JS contexts; resolve
  pending DevTools calls when the connection closes
- arrow icons vertically centered again (hint stays at the bottom edge)
- updated header comments
2026-09-27 15:43:29 +02:00

25 lines
1.0 KiB
JavaScript

// Reverts patch.js in Steam's SharedJSContext; evaluated by helper.mjs
// when it stops (service stopped, module disabled). Every patched function
// keeps its original as __vrkbdOrig. Safe to run when nothing is patched.
(() => {
if (!window.__vrkbdWr) return 'not patched';
const unwrap = (obj, name) => {
const f = obj?.[name];
if (f?.__vrkbdOrig) obj[name] = f.__vrkbdOrig;
};
for (const l of window.__vrkbdLayouts || []) unwrap(l, 'rgLayout');
unwrap(SteamClient.Input, 'ControllerKeyboardSendText');
unwrap(window.__vrkbdProto, 'TypeKeyInternal');
clearInterval(window.__vrkbdHoldTimer);
const inst = window.__vrkbdInst;
if (inst) {
delete inst.__vrkbd;
inst.setState({ standardLayout: window.__vrkbdWr(40222).r_() });
inst.forceUpdate();
}
for (const p of g_PopupManager.GetPopups?.() || []) p.window?.document.getElementById('vrkbd-style')?.remove();
for (const k of ['__vrkbdHoldTimer', '__vrkbdHeld', '__vrkbdInst', '__vrkbdProto', '__vrkbdLayouts']) delete window[k];
return 'unpatched';
})()