дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 03:05:40 +02:00
On macOS, while an editable element has focus and a third-party input method (reproduced with WeChat's WeType) is active, WebKit can deliver a tap as pointerup, mouseup, pointerdown, mousedown (WebKit bug 219670). The tap's click is lost, and because the engine still considers the button down, the next tap starts with a bare mousedown and no pointerdown. Taps on tree rows, tabs and tool window buttons needed a second tap. A press stamped no later than the pointerup just before it is a reordered tap: the shim finishes it with a synthetic pointerup, mouseup and click (and dblclick for a double) after the page's handlers ran, and dispatches the skipped pointerdown when a primary mouse press arrives with no pointer down. The next tap's own click is kept. Installed on macOS only; untrusted events and other pointer types are ignored. Verified in a WKWebView with WeType, alternating taps on two targets: main 19/20 taps clicked their target, with this change 20/20, every press ran the pointerdown handlers and setPointerCapture worked; with the ABC layout the shim dispatches nothing. Refs #760, #724 Co-authored-by: ntbang0901 <[email protected]>
88 рядки
3.3 KiB
TypeScript
88 рядки
3.3 KiB
TypeScript
import React from "react";
|
|
import ReactDOM from "react-dom/client";
|
|
import "./styles/global.css";
|
|
import { Workbench } from "./workbench/Workbench";
|
|
import { activateSecondaryWindow, activateWorkbench } from "./workbench/activate";
|
|
import {
|
|
activateComparisonWindowFeatures,
|
|
activateDeploymentWindowFeatures,
|
|
activateFeatures,
|
|
activateSettingsWindowFeatures,
|
|
ComparisonWindow,
|
|
DeploymentWindow,
|
|
SettingsWindow,
|
|
} from "./features";
|
|
import { auxiliaryWindow } from "./platform/auxWindow";
|
|
import { installRepeatedDoubleClick } from "./platform/doubleClick";
|
|
import { installErrorLogging } from "./platform/errorLog";
|
|
import { guessOs } from "./platform/platformInfo";
|
|
import { installReorderedTapClick } from "./platform/reordered-tap-click";
|
|
import { installKeyboardDispatcher } from "./platform/keymap";
|
|
import { installPointerFocus } from "./platform/pointerFocus";
|
|
import { isTauri } from "./platform/ipc";
|
|
import { hideSplash } from "./platform/splash";
|
|
import { prefetchLazyComponents } from "./ui";
|
|
import { installWindowDrag } from "./workbench/window-drag";
|
|
|
|
if (import.meta.env.DEV && isTauri()) {
|
|
// The Tauri MCP bridge returns eval results via `window.__TAURI__` on Windows/Linux
|
|
// (macOS evaluates natively). Dev only, so release builds keep withGlobalTauri off.
|
|
const [{ invoke }, { emit }] = await Promise.all([import("@tauri-apps/api/core"), import("@tauri-apps/api/event")]);
|
|
(window as unknown as { __TAURI__?: unknown }).__TAURI__ ??= { core: { invoke }, event: { emit } };
|
|
}
|
|
|
|
installRepeatedDoubleClick();
|
|
if (guessOs() === "macos") installReorderedTapClick();
|
|
installWindowDrag();
|
|
installPointerFocus();
|
|
installErrorLogging();
|
|
|
|
// Auxiliary windows (Settings `settings-<parent>`, comparisons `comparison-<parent>-<n>`, Sync with
|
|
// Deployed `deployment-<parent>`) load this page too.
|
|
const aux = auxiliaryWindow();
|
|
|
|
if (aux?.kind === "settings") {
|
|
activateSecondaryWindow();
|
|
activateSettingsWindowFeatures(aux.parent);
|
|
} else if (aux?.kind === "comparison") {
|
|
activateSecondaryWindow();
|
|
activateComparisonWindowFeatures(aux.parent);
|
|
installKeyboardDispatcher();
|
|
} else if (aux?.kind === "deployment") {
|
|
activateSecondaryWindow();
|
|
activateDeploymentWindowFeatures(aux.parent);
|
|
} else {
|
|
activateWorkbench();
|
|
// `vite build --mode perf` is a production bundle for the performance harness (`perf/`).
|
|
const perfBuild = import.meta.env.MODE === "perf";
|
|
if ((import.meta.env.DEV || perfBuild) && !isTauri()) {
|
|
const { registerDevSamples } = await import("./workbench/devSamples");
|
|
registerDevSamples();
|
|
}
|
|
if (import.meta.env.DEV || perfBuild) {
|
|
const { installPerfProbe } = await import("./workbench/perfProbe");
|
|
installPerfProbe();
|
|
}
|
|
// Order matters: features (e.g. the terminal) install capture-phase key handlers
|
|
// that must run before the global dispatcher.
|
|
activateFeatures();
|
|
installKeyboardDispatcher();
|
|
}
|
|
|
|
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
|
|
<React.StrictMode>
|
|
{aux?.kind === "settings" ? (
|
|
<SettingsWindow />
|
|
) : aux?.kind === "comparison" ? (
|
|
<ComparisonWindow />
|
|
) : aux?.kind === "deployment" ? (
|
|
<DeploymentWindow />
|
|
) : (
|
|
<Workbench />
|
|
)}
|
|
</React.StrictMode>,
|
|
);
|
|
hideSplash();
|
|
// Views split out of the start-up bundle load in the background once the UI is up.
|
|
if (!aux) prefetchLazyComponents();
|