Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
28
host/actors/TouchChild.sys.mjs
Normal file
28
host/actors/TouchChild.sys.mjs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// Reuse Gecko's own responsive-design touch implementation. No application
|
||||
// gets privileged input methods; only physical mouse events are transformed.
|
||||
export class VulpesTouchChild extends JSWindowActorChild {
|
||||
handleEvent() {
|
||||
if (Services.cpmm.sharedData.get('vulpes:native-touch')) return;
|
||||
const allowed = Services.cpmm.sharedData.get('vulpes:host-contexts') || [];
|
||||
if (!allowed.includes(this.browsingContext.top.id) || this.simulator) return;
|
||||
const { require } = ChromeUtils.importESModule(
|
||||
'resource://devtools/shared/loader/Loader.sys.mjs',
|
||||
);
|
||||
const { TouchSimulator } = require('devtools/server/actors/emulation/touch-simulator');
|
||||
this.simulator = new TouchSimulator({ chromeEventHandler: this.contentWindow, emit() {} });
|
||||
this.simulator.start();
|
||||
this.contentWindow.addEventListener('contextmenu', (event) => event.preventDefault(), true);
|
||||
}
|
||||
receiveMessage(message) {
|
||||
if (message.name !== 'Vulpes:CancelTouch') throw new Error('METHOD_NOT_SUPPORTED');
|
||||
this.contentWindow.synthesizeTouchEvent('touchcancel', message.data, 0, {
|
||||
isAsyncEnabled: true,
|
||||
});
|
||||
return true;
|
||||
}
|
||||
didDestroy() {
|
||||
try {
|
||||
this.simulator?.stop();
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue