+21
-7
@@ -22,7 +22,6 @@ const { readLock } = require('../core/locks');
|
|||||||
const CaptureService = require('./capture');
|
const CaptureService = require('./capture');
|
||||||
const { TextIntelService } = require('./text-intel');
|
const { TextIntelService } = require('./text-intel');
|
||||||
const { keepProcessesResponsive } = require('./win-power');
|
const { keepProcessesResponsive } = require('./win-power');
|
||||||
const { zoomShortcutFromInputEvent } = require('./shortcut-utils');
|
|
||||||
const security = require('./security');
|
const security = require('./security');
|
||||||
const PACKAGE_JSON = require(path.join(__dirname, '..', 'package.json'));
|
const PACKAGE_JSON = require(path.join(__dirname, '..', 'package.json'));
|
||||||
|
|
||||||
@@ -114,12 +113,6 @@ function createWindow() {
|
|||||||
// away from it and every popup is denied, so no other document can run
|
// away from it and every popup is denied, so no other document can run
|
||||||
// with this window's preload bridge.
|
// with this window's preload bridge.
|
||||||
security.installWindowSecurity(mainWindow, 'main');
|
security.installWindowSecurity(mainWindow, 'main');
|
||||||
mainWindow.webContents.on('before-input-event', (event, input) => {
|
|
||||||
const kind = zoomShortcutFromInputEvent(input);
|
|
||||||
if (!kind) return;
|
|
||||||
event.preventDefault();
|
|
||||||
sendToRenderer('editor:zoom-shortcut', kind);
|
|
||||||
});
|
|
||||||
mainWindow.loadFile(path.join(__dirname, 'renderer', 'index.html'));
|
mainWindow.loadFile(path.join(__dirname, 'renderer', 'index.html'));
|
||||||
mainWindow.once('ready-to-show', () => {
|
mainWindow.once('ready-to-show', () => {
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
@@ -255,6 +248,19 @@ function createWindow() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const waitClickBackendReady = async () => {
|
||||||
|
for (let i = 0; i < 240; i++) {
|
||||||
|
const streamReady = Boolean(
|
||||||
|
capture.streamBackend
|
||||||
|
&& typeof capture.streamBackend.isActive === 'function'
|
||||||
|
&& capture.streamBackend.isActive(),
|
||||||
|
);
|
||||||
|
if (streamReady || capture.frameLoopRunning) return true;
|
||||||
|
await new Promise((res) => setTimeout(res, 50));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
// Third scenario: the real "Start recording" path. armRecording
|
// Third scenario: the real "Start recording" path. armRecording
|
||||||
// warms the recorder while the window is visible and only arms the
|
// warms the recorder while the window is visible and only arms the
|
||||||
// session once it hides; the first click *after* arming must get a
|
// session once it hides; the first click *after* arming must get a
|
||||||
@@ -275,6 +281,10 @@ function createWindow() {
|
|||||||
const warmupClicks = store.getGuide(armGuide.guideId).stepsOrder.length;
|
const warmupClicks = store.getGuide(armGuide.guideId).stepsOrder.length;
|
||||||
capture.onOsClick(Date.now(), toPhysical({ x: bounds.x + 100, y: bounds.y + 100 }), 'button-1');
|
capture.onOsClick(Date.now(), toPhysical({ x: bounds.x + 100, y: bounds.y + 100 }), 'button-1');
|
||||||
await waitArmed();
|
await waitArmed();
|
||||||
|
if (!await waitClickBackendReady()) {
|
||||||
|
throw new Error('arm selftest backend never became ready');
|
||||||
|
}
|
||||||
|
await new Promise((res) => setTimeout(res, 1500));
|
||||||
const armPoint = {
|
const armPoint = {
|
||||||
x: Math.round(bounds.x + bounds.width * 0.4),
|
x: Math.round(bounds.x + bounds.width * 0.4),
|
||||||
y: Math.round(bounds.y + bounds.height * 0.4),
|
y: Math.round(bounds.y + bounds.height * 0.4),
|
||||||
@@ -302,6 +312,10 @@ function createWindow() {
|
|||||||
capture.togglePause(false);
|
capture.togglePause(false);
|
||||||
await capture.startClickFrameBackend();
|
await capture.startClickFrameBackend();
|
||||||
await waitArmed();
|
await waitArmed();
|
||||||
|
if (!await waitClickBackendReady()) {
|
||||||
|
throw new Error('debounce selftest backend never became ready');
|
||||||
|
}
|
||||||
|
await new Promise((res) => setTimeout(res, 1500));
|
||||||
await new Promise((res) => setTimeout(res, 300));
|
await new Promise((res) => setTimeout(res, 300));
|
||||||
const dbPoint = {
|
const dbPoint = {
|
||||||
x: Math.round(bounds.x + bounds.width * 0.55),
|
x: Math.round(bounds.x + bounds.width * 0.55),
|
||||||
|
|||||||
Reference in New Issue
Block a user