Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++

feat(ui-mig): G2.4 drop open, AppShell shortcuts, power guard, export badge, toast motion

Veyra Goal Agent566d307c46be
diff --git a/apps/veyra-qml/main.cpp b/apps/veyra-qml/main.cpp
index 0fc53fe0..55861ad7 100644
--- a/apps/veyra-qml/main.cpp
+++ b/apps/veyra-qml/main.cpp
@@ -15,6 +15,7 @@
#include <QQmlContext>
#include <QQuickItem>
#include <QQuickWindow>
+#include <QKeyEvent>
#include <QTimer>
#include <QPointer>
#include <QVariantMap>
@@ -231,6 +232,9 @@ int main(int argc, char** argv) {
testOptions.insert(QStringLiteral("aspect"), args.at(++i).toDouble());
} else if (a == QLatin1String("--tip") && hasValue) {
testOptions.insert(QStringLiteral("tip"), args.at(++i));
+ } else if (a == QLatin1String("--export-out") && hasValue) {
+ // A review run's export target, so a real export starts without the dialog.
+ bridge.setExportPath(args.at(++i));
} else if (a == QLatin1String("--dock-pinned")) {
testOptions.insert(QStringLiteral("dockPinned"), true);
} else if (a == QLatin1String("--size") && hasValue) {
@@ -316,6 +320,32 @@ int main(int argc, char** argv) {
syncVideoGeometry(window, host);
syncVideoCovers(window, host);
};
+ // V held shows the original picture on the professional page (AppShell: the
+ // OriginalHold key, engine.comparison(1, false) until release). A Shortcut only
+ // sees the press, so the window's key events are watched here. Auto-repeat is
+ // ignored, and a focused text field keeps its V.
+ struct HoldOriginalFilter : QObject {
+ QQuickWindow* window; ui::QmlPlayerBridge* bridge; bool held = false;
+ HoldOriginalFilter(QQuickWindow* w, ui::QmlPlayerBridge* b) : window(w), bridge(b) {}
+ bool eventFilter(QObject*, QEvent* e) override {
+ const auto t = e->type();
+ if (t == QEvent::FocusOut && held) { held = false; bridge->holdOriginal(false); return false; }
+ if (t != QEvent::KeyPress && t != QEvent::KeyRelease) return false;
+ auto* k = static_cast<QKeyEvent*>(e);
+ if (k->key() != Qt::Key_V || k->isAutoRepeat() || k->modifiers() != Qt::NoModifier) return false;
+ const bool press = t == QEvent::KeyPress;
+ if (press) {
+ if (window->property("page").toString() != QLatin1String("pro")) return false;
+ if (auto* f = window->activeFocusItem(); f && f->inherits("QQuickTextInput")) return false;
+ if (auto* f = window->activeFocusItem(); f && f->inherits("QQuickTextEdit")) return false;
+ }
+ if (press == held) return false;
+ held = press;
+ bridge->holdOriginal(press);
+ return true;
+ }
+ };
+ window->installEventFilter(new HoldOriginalFilter(window, &bridge));
QObject::connect(window, &QQuickWindow::afterAnimating, &app, follow);
// The first frame may come before the page layout settles; one pass after the
// event loop starts covers a scene that then never animates.
diff --git a/apps/veyra/ui/AppShell.cpp b/apps/veyra/ui/AppShell.cpp
index facde914..9f5702e6 100644
--- a/apps/veyra/ui/AppShell.cpp
+++ b/apps/veyra/ui/AppShell.cpp
@@ -9,7 +9,7 @@
#include "WorkspaceTransition.h"
#include "UiSessionState.h"
#include "UiPreferenceStore.h"
-#include "PlaybackPowerGuard.h"
+#include "veyra/ui/PlaybackPowerGuard.h"
#include "CapturePanel.h"
#include "ScreenCapturePanel.h"
#ifdef VEYRA_ENABLE_REMOTEPLAY
diff --git a/docs/UI_FULL_GOAL_PLAN_2026-09-26.md b/docs/UI_FULL_GOAL_PLAN_2026-09-26.md
index ab229149..d54e5044 100644
--- a/docs/UI_FULL_GOAL_PLAN_2026-09-26.md
+++ b/docs/UI_FULL_GOAL_PLAN_2026-09-26.md
@@ -11,7 +11,7 @@
|---|---|---|---|
| G0 工具与基线 | 完成 | checkpoint/ui-mig-g0.7 | 设计参考 `design-ref/`、对比 `compare/`、动效曲线 `goal/g0.5/`、缓动测试 `veyra_qml_easing_tests`(构建目录 `build/qt-probe-20260926`)、门槛基线 `goal/g0.7/`(B 阶段性能对比用 `goal/g0.7/perf`) |
| G1 基础(缓动/背景/字体/图标/组件动效) | 完成 | checkpoint/ui-mig-g1.6 | G1.1–G1.6 完成(Qt 6.8.3:BezierSpline ≤10 段;CurveRenderer 不能用 fillItem;可变字体 600 须设 wght 轴;Popup 无 transform;视频子窗用 videoCover 挖区);动效探针 dock/page/switch/seg/menu/dialog;Quick Test 8/8;M28/M29 曲线未执行;下一步 G2 |
-| G2 外壳 | 进行中 | checkpoint/ui-mig-g2.3 | G2.1 dock 热区;G2.2 页面切换 sink/rise(探针同曲线);G2.3 视频窗随渲染帧同步(afterAnimating,去掉 16ms 计时器,矩形不变不调 SetWindowPos);下一步 G2.4 拖放/快捷键/电源/徽标/toast |
+| G2 外壳 | 进行中 | checkpoint/ui-mig-g2.4 | G2.1 dock 热区;G2.2 页面切换 sink/rise(探针同曲线);G2.3 视频窗随渲染帧同步;G2.4 拖放/快捷键/V 看原画/电源/导出徽标/toast(拖放后画面截图未执行:显示器休眠);下一步 G2.5 全屏独立控制条 |
| G3 四主屏 | 未开始 | | |
| B1 小项 + 桥接补齐 | 未开始 | | |
| B2 导出补齐(S2.5) | 未开始 | | |
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index e550be20..db4322e4 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -6661,3 +6661,15 @@ release. 5090 live acceptance, 15-second hitch and user flicker remain unresolve
- 实测(visible-scene.mp4):极简页 → 点专业模式,日志仅 open 时 1280x720 与切页 852x524 各一次 `present-sink: resized`;静止画面正常(hover-idle.png);弹层(--menu source / preset)在画面上方仍正确挖区(hover-menusrc.png、hover-menu.png)。
- 日志中 `audio-track decoder rejected stream=1 code=-22` 与改动前(22:02 起)一致,属该素材第二音轨,非本次引入。
- 未执行:拖拽改窗口尺寸的逐帧跟随录屏;PresentMon 对比(放 G2.5/W3)。
+- G2.4 拖放/快捷键/电源/徽标/toast(`checkpoint/ui-mig-g2.4`,证据 `goal/g2.4/`):
+ - 拖放:Main.qml `DropArea` → `veyra.openUrl`(非本地 URL 提示“只能打开本地文件”),与 AppShell WM_DROPFILES 一样在投放内直接打开。离开 home/set 时立即 `syncRect`,否则同一调用里 open 读到 0x0(修正后 pre-open 1280x536)。
+ - 新脚本 `tools/qt_probe/drop-file.ps1`:WinForms 源窗 DoDragDrop + 独立进程注入鼠标移动(同一 runspace 在拖放期间无法跑计时器),输出 drag-result.txt、PrintWindow 与屏幕两张截图;另有 -NoDrag 对照、-AfterKeys/-AfterPoint/-Kick 诊断开关。
+ - 实测:`drag result: Copy`,日志 `ui-drop E:/项目/Veyra/tests/1.4.2beta/visible-scene.mp4` → `pre-open 1280x536` → `source-file opened` → `present-sink window 1280x536` → `resized to 1280x720`。
+ - 快捷键(Main.qml Shortcut,对齐 AppShell):空格播放/暂停、F11/Alt+Enter 全屏、全屏时 Esc 退出、←→ ±10 秒、↑↓ 音量 ±0.05、Ctrl+O、Ctrl+E、全屏 Ctrl+L 锁定(锁定时 dock 不再下拉)、B/Z/X/T/Y 提示“字幕尚未接入(键)”——引擎无字幕,不做假控件。V 按住看原画:main.cpp 事件过滤器(仅专业页、非文本框、忽略自动重复、失焦释放)→ `engine.comparison(1/0)`。
+ - 电源:`PlaybackPowerGuard.h` 移到 `include/veyra/ui/`(Win32 目标同时编译通过),桥接每次 poll 按“文件播放中”更新;日志 playback-power acquired / 暂停 released。
+ - 导出徽标:dock 导出按钮右上角脉动 `.dot.warn`,仅 `veyra.exportRunning` 为真时显示;新增 `--export-out <path>` 测试开关。真实导出中截图 export/hover-dock-running.png 可见徽标。
+ - toast:对齐 pages.css .canvas-toast(top 12,from -8px/opacity 0,opacity .2s,位移 .45s spring,2600ms 收起,错误/成功两套配色),z 30 低于 dock。
+ - 键盘实测(keys/):hover-subB 顶部 toast;F11 2560x1440;Ctrl+L 锁定后顶边不出 dock、解锁后出;Esc 回 1280x800;日志 seek、ui-compare on/off、ui-fullscreen enabled/locked。
+ - 环境问题(2026-09-26 00:00 前后):拖放截图画面区为黑、之后 hover 不出 dock、motion-probe 无输出——HEAD(stash 后重建)同样复现,DWM 计时 `refreshes/s=1 composed/s=1`(tmp/.../dwm-vblank.ps1),判断为显示器休眠导致合成/帧驱动停摆,不是本次代码问题。曾尝试延迟 open(QML Timer / QTimer)排查,均已撤回。
+ - 未执行:拖放后画面截图(显示器休眠,待亮屏复拍);toast 动效逐帧探针;导出文件内容校验。
+
diff --git a/apps/veyra/ui/PlaybackPowerGuard.h b/include/veyra/ui/PlaybackPowerGuard.h
similarity index 100%
rename from apps/veyra/ui/PlaybackPowerGuard.h
rename to include/veyra/ui/PlaybackPowerGuard.h
diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.h
index 761013d4..04f46d82 100644
--- a/include/veyra/ui/QmlPlayerBridge.h
+++ b/include/veyra/ui/QmlPlayerBridge.h
@@ -25,6 +25,7 @@
// not offered until the engine side exists.
#include <QObject>
#include <QString>
+#include <QUrl>
#include <QVariantList>
#include <QVariantMap>
@@ -463,9 +464,18 @@ public:
Q_INVOKABLE void stopPlayback();
Q_INVOKABLE void seekTo(double seconds);
Q_INVOKABLE void seekBy(double seconds);
+ // V held down: the engine shows the unprocessed frame until release
+ // (AppShell holdOriginal -> engine.comparison(1, false)).
+ Q_INVOKABLE void holdOriginal(bool held);
+ // A dropped file (AppShell WM_DROPFILES): a local file URL goes to openPath.
+ Q_INVOKABLE void openUrl(const QUrl& url);
+ // UI events the shell logs (fullscreen, lock) under the given channel.
+ Q_INVOKABLE void logUi(const QString& channel, const QString& text);
Q_INVOKABLE void stepFrame(int direction);
Q_INVOKABLE void takeScreenshot();
Q_INVOKABLE void chooseExportPath();
+ // The export target without the dialog (the dialog's result, or --export-out in a test).
+ void setExportPath(const QString& path);
Q_INVOKABLE void startExport();
Q_INVOKABLE void cancelExport();
Q_INVOKABLE void pauseExport(bool paused);
diff --git a/qml/Veyra/Main.qml b/qml/Veyra/Main.qml
index 49b7b862..9a0e6871 100644
--- a/qml/Veyra/Main.qml
+++ b/qml/Veyra/Main.qml
@@ -74,6 +74,11 @@ Window {
const prev = shownPage
if (prev === page) return
leavingPage = Theme.reduced || prev === "" ? "" : prev
+ // Leaving a page without a picture (home, settings): an open may follow in
+ // the same call (openPath navigates, then opens) and the engine samples the
+ // host size once, so the rect is placed now, not 150 ms later. There is no
+ // picture on the old page to fade against.
+ if (prev === "home" || prev === "set") videoHost.syncRect()
if (leavingPage !== "") { leaveAnim.restart(); showTimer.restart() }
else showPage(false)
}
@@ -195,34 +200,92 @@ Window {
anchors.horizontalCenter: parent.horizontalCenter
currentPage: root.page
pinned: root.test.dockPinned === true
+ locked: root.fullLocked
forcedTip: root.test.tip !== undefined ? root.test.tip : ""
opened: pinned
onRequestPage: p => root.page = p
}
+ // Drag and drop opens the file (AppShell WM_DROPFILES).
+ DropArea {
+ anchors.fill: parent
+ onDropped: drop => {
+ if (!drop.hasUrls || drop.urls.length === 0) return
+ drop.accept(Qt.CopyAction)
+ veyra.openUrl(drop.urls[0])
+ }
+ }
+
+ // Keyboard, aligned with AppShell's message loop. Text fields keep their own
+ // keys (Qt's shortcut override), so typing in a field never seeks. V (hold for
+ // the original picture) needs its release as well; main.cpp handles it.
+ readonly property bool fullscreen: visibility === Window.FullScreen
+ property bool fullLocked: false
+ onFullscreenChanged: if (!fullscreen) fullLocked = false
+ function toggleFullscreen() {
+ fullLocked = false
+ visibility = fullscreen ? Window.Windowed : Window.FullScreen
+ veyra.logUi("ui-fullscreen", "enabled=" + fullscreen)
+ }
+ function subtitleKey(k) { toast.show("字幕尚未接入(" + k + ")", true) }
+ Shortcut { sequence: "Space"; onActivated: veyra.togglePlayPause() }
+ Shortcut { sequences: ["F11", "Alt+Return", "Alt+Enter"]; onActivated: root.toggleFullscreen() }
+ Shortcut { sequence: "Esc"; enabled: root.fullscreen; onActivated: root.toggleFullscreen() }
+ Shortcut { sequence: "Left"; onActivated: veyra.seekBy(-10) }
+ Shortcut { sequence: "Right"; onActivated: veyra.seekBy(10) }
+ Shortcut { sequence: "Up"; onActivated: veyra.volume = Math.min(1, veyra.volume + 0.05) }
+ Shortcut { sequence: "Down"; onActivated: veyra.volume = Math.max(0, veyra.volume - 0.05) }
+ Shortcut { sequence: "Ctrl+O"; onActivated: veyra.openFileDialog() }
+ Shortcut { sequence: "Ctrl+E"; onActivated: root.page = "exp" }
+ Shortcut {
+ sequence: "Ctrl+L"
+ enabled: root.fullscreen
+ onActivated: {
+ root.fullLocked = !root.fullLocked
+ if (root.fullLocked) dock.opened = false
+ toast.show(root.fullLocked ? "已锁定全屏 · Ctrl+L 解锁,Esc 退出全屏" : "已解锁全屏", false)
+ veyra.logUi("ui-fullscreen", "locked=" + root.fullLocked + " shortcut=Ctrl+L")
+ }
+ }
+ Shortcut { sequence: "B"; onActivated: root.subtitleKey("B") }
+ Shortcut { sequences: ["Z", "Shift+Z"]; onActivated: root.subtitleKey("Z") }
+ Shortcut { sequences: ["X", "Shift+X"]; onActivated: root.subtitleKey("X") }
+ Shortcut { sequence: "T"; onActivated: root.subtitleKey("T") }
+ Shortcut { sequence: "Y"; onActivated: root.subtitleKey("Y") }
+
// Toasts: a refused edit, a finished export, a failed open.
+ // pages.css .canvas-toast: top 12px, padding 7px 12px, from translate -8px and
+ // opacity 0; .on: opacity .2s, translate .45s --spring; hidden after 2600 ms.
Rectangle {
id: toast
+ // Under the dock (z 40): an opened dock stays usable over a toast.
+ z: 30
property string message: ""
property bool isError: false
+ property bool on: false
anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 24
- width: Math.min(toastText.implicitWidth + 28, root.width - 48)
- height: toastText.implicitHeight + 18
+ anchors.top: parent.top
+ anchors.topMargin: 12
+ // Over the picture: cut out of the video window.
+ objectName: "videoCover"
+ property real coverRadius: 9
+ width: Math.min(toastText.implicitWidth + 24 + 2, root.width - 48)
+ height: toastText.implicitHeight + 14 + 2
radius: 9
color: toast.isError ? "#2A1414" : "#132218"
border.width: 1
border.color: toast.isError ? Qt.rgba(1, 0.365, 0.365, 0.4) : Qt.rgba(0.239, 0.863, 0.518, 0.35)
- opacity: 0
+ opacity: on ? 1 : 0
visible: opacity > 0.01
- Behavior on opacity { NumberAnimation { duration: Theme.d(Theme.durNormal) } }
- function show(m, bad) { toast.message = m; toast.isError = bad; toast.opacity = 1; toastTimer.restart() }
- Timer { id: toastTimer; interval: 4200; onTriggered: toast.opacity = 0 }
+ transform: Translate { id: toastShift; y: toast.on ? 0 : -8
+ Behavior on y { NumberAnimation { duration: Theme.d(450); easing.bezierCurve: Theme.spring } } }
+ Behavior on opacity { NumberAnimation { duration: Theme.d(200) } }
+ function show(m, bad) { toast.message = m; toast.isError = bad; toast.on = true; toastTimer.restart() }
+ Timer { id: toastTimer; interval: 2600; onTriggered: toast.on = false }
Text {
id: toastText
anchors.centerIn: parent
- width: parent.width - 20
+ width: Math.min(implicitWidth, root.width - 72)
text: toast.message
color: toast.isError ? "#FFC9C9" : "#BDF3D2"
font.family: Theme.fontUi
diff --git a/qml/Veyra/TopDock.qml b/qml/Veyra/TopDock.qml
index b9dab5a1..20bcebaf 100644
--- a/qml/Veyra/TopDock.qml
+++ b/qml/Veyra/TopDock.qml
@@ -62,7 +62,9 @@ Item {
HoverHandler { onHoveredChanged: if (hovered) dockRoot.open() }
}
- function open() { retract.stop(); opened = true }
+ function open() { retract.stop(); if (!locked) opened = true }
+ // Fullscreen lock (Ctrl+L): the pointer no longer brings the dock down.
+ property bool locked: false
// Retract 450ms after the pointer leaves, exactly like closeDock().
Timer {
id: retract
@@ -201,6 +203,15 @@ Item {
font.pixelSize: 11 // 11.5px; pixelSize is an int (fractional sizes: G3)
}
}
+ // Export badge: a running export marks the export button
+ // with the design's pulsing .dot.warn; engine state only.
+ VDot {
+ visible: btn.modelData.id === "exp" && veyra.exportRunning
+ warn: true
+ x: btn.width - width - 3
+ y: 3
+ width: 6; height: 6; radius: 3
+ }
HoverHandler { id: btnHover; cursorShape: Qt.PointingHandCursor }
TapHandler { id: btnTap; onTapped: dockRoot.requestPage(btn.modelData.id) }
}
diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cpp
index aa07ff7a..ac13efe5 100644
--- a/src/ui/QmlPlayerBridge.cpp
+++ b/src/ui/QmlPlayerBridge.cpp
@@ -18,6 +18,7 @@
#include "veyra/Log.h"
#include "veyra/RuntimePaths.h"
+#include "veyra/ui/PlaybackPowerGuard.h"
#include "veyra/source/CaptureCardSource.h"
#include "veyra/source/ScreenCaptureSource.h"
@@ -54,6 +55,11 @@ struct QmlPlayerBridge::Impl {
// The window the engine presents into, and the last file the UI opened.
HWND videoWindow = nullptr;
std::wstring sourceLabel;
+
+ // Keeps the display and system awake while a video plays (AppShell rule: running,
+ // not failed, not a still image, transport Playing). Acquired and released on
+ // this GUI thread, as SetThreadExecutionState requires.
+ PlaybackPowerGuard power;
std::function<void()> preOpen;
// Export progress is mirror state: the engine reports an export through a
@@ -119,7 +125,11 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesyst
const bool had = impl_->haveSnapshot;
const uint64_t before = impl_->publishedRevision;
impl_->poll();
- if (!had || impl_->publishedRevision != before) emit snapshotChanged();
+ if (!had || impl_->publishedRevision != before) {
+ const auto& s = impl_->snapshot;
+ impl_->power.update(s.running && !s.failed && !s.image && s.transport == engine::TransportState::Playing);
+ emit snapshotChanged();
+ }
// An export in flight needs its own poll; it is a separate job and its
// snapshot is not part of the player snapshot.
if (impl_->exportSnapshot.active()) pollExport();
@@ -1108,6 +1118,23 @@ void QmlPlayerBridge::seekTo(double seconds) { impl_->engine.seek(seconds); }
void QmlPlayerBridge::seekBy(double seconds) {
impl_->engine.seek(std::max(0.0, impl_->snapshot.position + seconds));
}
+void QmlPlayerBridge::openUrl(const QUrl& url) {
+ if (!url.isLocalFile()) {
+ emit notice(tr("只能打开本地文件"), true);
+ return;
+ }
+ // Opened inside the drop, as AppShell's WM_DROPFILES does.
+ veyra::log::info("ui-drop", url.toLocalFile().toStdString());
+ openPath(QDir::toNativeSeparators(url.toLocalFile()));
+}
+void QmlPlayerBridge::logUi(const QString& channel, const QString& text) {
+ const std::string c = channel.toStdString();
+ veyra::log::info(c.c_str(), text.toStdString());
+}
+void QmlPlayerBridge::holdOriginal(bool held) {
+ impl_->engine.comparison(held ? 1 : 0, false);
+ veyra::log::info("ui-compare", held ? "hold original on" : "hold original off");
+}
void QmlPlayerBridge::stepFrame(int direction) {
// A frame step is a small seek. The engine owns the real frame duration, so
// this is honest about being approximate rather than pretending to be exact.
@@ -1126,6 +1153,10 @@ void QmlPlayerBridge::takeScreenshot() {
void QmlPlayerBridge::chooseExportPath() {
const QString path = QFileDialog::getSaveFileName(nullptr, tr("导出到"), QString(),
tr("MP4 视频 (*.mp4);;所有文件 (*)"));
+ setExportPath(path);
+}
+
+void QmlPlayerBridge::setExportPath(const QString& path) {
if (path.isEmpty()) return;
impl_->exportOutput = wideOf(path);
impl_->exportStatus = QFileInfo(path).fileName();
diff --git a/tools/qt_probe/drop-file.ps1 b/tools/qt_probe/drop-file.ps1
new file mode 100644
index 00000000..c4eab920
--- /dev/null
+++ b/tools/qt_probe/drop-file.ps1
@@ -0,0 +1,125 @@
+# Drags a file onto the app with a real OLE drag (the path Explorer uses): a small
+# source form starts DoDragDrop while injected mouse moves carry it to the target
+# point in the app window and release. Window-relative target point.
+param(
+ [string]$App = 'E:\项目\Veyra\tests\ui-qml-migration-20260925\qml-app',
+ [string]$Page = 'home',
+ [Parameter(Mandatory)] [string]$File,
+ [int]$X = 640, [int]$Y = 400,
+ [string]$Out = 'E:\项目\Veyra\logs\ui-qml-migration-20260925\drop',
+ [int]$WaitSeconds = 6, [int]$AfterMs = 3000,
+ # Move the pointer a little after the release, as a hand would.
+ [switch]$Wiggle,
+ [string]$AfterKeys = '',
+ [string]$AfterPoint = '',
+ [switch]$Kick,
+ # Control run: everything except the drag, to check the harness itself.
+ [switch]$NoDrag
+)
+Add-Type -AssemblyName System.Windows.Forms, System.Drawing
+Add-Type @"
+using System;using System.Runtime.InteropServices;
+public class DW {
+ [DllImport("user32.dll")] static extern bool EnumWindows(EnumProc f, IntPtr p);
+ [DllImport("user32.dll")] static extern uint GetWindowThreadProcessId(IntPtr h, out uint pid);
+ [DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr h);
+ [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr h, out RECT r);
+ [DllImport("user32.dll")] public static extern bool PrintWindow(IntPtr h, IntPtr dc, uint flags);
+ [DllImport("user32.dll")] public static extern bool SetCursorPos(int x, int y);
+ [DllImport("user32.dll")] public static extern bool IsHungAppWindow(IntPtr h);
+ [DllImport("user32.dll")] public static extern void keybd_event(byte vk, byte scan, uint f, IntPtr e);
+ [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr h);
+ [DllImport("user32.dll")] public static extern bool PostMessageW(IntPtr h, uint m, IntPtr w, IntPtr l);
+ [DllImport("user32.dll")] public static extern IntPtr SendMessageTimeoutW(IntPtr h, uint m, IntPtr w, IntPtr l, uint f, uint t, out IntPtr r);
+ [DllImport("user32.dll")] public static extern void mouse_event(uint f, int x, int y, int d, IntPtr e);
+ [DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr h, IntPtr after, int x, int y, int cx, int cy, uint f);
+ delegate bool EnumProc(IntPtr h, IntPtr p);
+ [StructLayout(LayoutKind.Sequential)] public struct RECT { public int Left, Top, Right, Bottom; }
+ public static IntPtr Largest(uint want) {
+ IntPtr best = IntPtr.Zero; long area = 0;
+ EnumWindows((h, p) => { uint pid; GetWindowThreadProcessId(h, out pid);
+ if (pid != want || !IsWindowVisible(h)) return true; RECT r; if (!GetWindowRect(h, out r)) return true;
+ long a = (long)(r.Right - r.Left) * (r.Bottom - r.Top); if (a > area) { area = a; best = h; } return true; }, IntPtr.Zero);
+ return best;
+ }
+}
+"@
+New-Item -ItemType Directory -Force $Out | Out-Null
+$p = Start-Process -FilePath (Join-Path $App 'veyra_qml_ui.exe') -ArgumentList @('--page', $Page) -PassThru
+Start-Sleep -Seconds $WaitSeconds
+$h = [DW]::Largest([uint32]$p.Id)
+if ($h -eq [IntPtr]::Zero) { "no window"; Stop-Process -Id $p.Id -Force; exit 1 }
+[DW]::SetWindowPos($h, [IntPtr](-1), 0, 0, 0, 0, 0x0003) | Out-Null
+$r = New-Object DW+RECT; [DW]::GetWindowRect($h, [ref]$r) | Out-Null
+$tx = $r.Left + $X; $ty = $r.Top + $Y
+
+$form = New-Object System.Windows.Forms.Form
+$form.StartPosition = 'Manual'; $form.Location = New-Object System.Drawing.Point(($r.Right + 20), ($r.Top + 20))
+$form.Size = New-Object System.Drawing.Size(160, 120); $form.TopMost = $true; $form.Text = 'drop source'
+$sx = $form.Location.X + 80; $sy = $form.Location.Y + 60
+# The pointer is moved by a second process: while DoDragDrop runs, this runspace is
+# busy, so no timer script block here could fire.
+$vw = [System.Windows.Forms.SystemInformation]::VirtualScreen
+$mover = @"
+Add-Type -Name M -Namespace N -MemberDefinition "[DllImport(""user32.dll"")] public static extern void mouse_event(uint f, int x, int y, int d, System.IntPtr e);"
+function Abs(`$x, `$y) { [N.M]::mouse_event(0xC001, [int]((`$x - $($vw.Left)) * 65535 / $($vw.Width - 1)), [int]((`$y - $($vw.Top)) * 65535 / $($vw.Height - 1)), 0, [IntPtr]::Zero) }
+Start-Sleep -Milliseconds 600
+Abs $sx $sy; Start-Sleep -Milliseconds 150
+[N.M]::mouse_event(2, 0, 0, 0, [IntPtr]::Zero); Start-Sleep -Milliseconds 300
+for (`$i = 1; `$i -le 20; `$i++) { Abs ($sx + ($tx - $sx) * `$i / 20) ($sy + ($ty - $sy) * `$i / 20); Start-Sleep -Milliseconds 40 }
+Start-Sleep -Milliseconds 300
+[N.M]::mouse_event(4, 0, 0, 0, [IntPtr]::Zero)
+if ($Wiggle) { Start-Sleep -Milliseconds 500; for (`$i = 1; `$i -le 10; `$i++) { Abs ($tx + `$i * 3) $ty; Start-Sleep -Milliseconds 50 } }
+"@
+$form.Add_Shown({
+ $form.Activate()
+ $moverFile = Join-Path $Out 'mover.ps1'
+ Set-Content -LiteralPath $moverFile -Value $mover -Encoding UTF8
+ Start-Process powershell -ArgumentList @('-NoProfile', '-File', $moverFile) -WindowStyle Hidden
+})
+# The mover presses the button over this form; the drag starts from that press.
+$form.Add_MouseDown({
+ $data = New-Object System.Windows.Forms.DataObject
+ $list = New-Object System.Collections.Specialized.StringCollection; [void]$list.Add($File)
+ $data.SetFileDropList($list)
+ $t0 = Get-Date
+ $res = $form.DoDragDrop($data, [System.Windows.Forms.DragDropEffects]::Copy)
+ Set-Content -LiteralPath (Join-Path $Out 'drag-result.txt') -Value ("drag result: $res after {0:N0} ms" -f ((Get-Date) - $t0).TotalMilliseconds)
+ $form.Close()
+})
+# The source keeps pumping messages while it waits, as Explorer does: the target
+# may still call into the data object after the drop, and an STA thread that only
+# sleeps leaves that cross-process COM call (and the app's GUI thread) blocked.
+function Pump([int]$ms) { $end = (Get-Date).AddMilliseconds($ms); while ((Get-Date) -lt $end) { [System.Windows.Forms.Application]::DoEvents(); Start-Sleep -Milliseconds 15 } }
+if (-not $NoDrag) { [System.Windows.Forms.Application]::Run($form) }
+Pump $AfterMs
+# Whether the app's GUI thread still answers after the drop.
+$res = [IntPtr]::Zero
+$ok = [DW]::SendMessageTimeoutW($h, 0, [IntPtr]::Zero, [IntPtr]::Zero, 2, 1000, [ref]$res)
+"gui thread responds=$($ok -ne [IntPtr]::Zero) hung=$([DW]::IsHungAppWindow($h))"
+if ($Kick) { [DW]::PostMessageW($h, 0, [IntPtr]::Zero, [IntPtr]::Zero) | Out-Null; "posted WM_NULL"; Pump 1500 }
+# Optional pointer position after the drop (window-relative "x,y"), e.g. the dock's
+# hot zone, to see whether the app still reacts once a drop was delivered.
+if ($AfterPoint -ne '') { $ax, $ay = $AfterPoint -split ','; [DW]::SetCursorPos($r.Left + [int]$ax, $r.Top + [int]$ay) | Out-Null; Pump 1500 }
+# Optional keys after the drop ("17+69" is Ctrl+E), to see whether the app still
+# handles input once a drop has been delivered.
+if ($AfterKeys -ne '') {
+ [DW]::SetForegroundWindow($h) | Out-Null; Start-Sleep -Milliseconds 200
+ $vks = $AfterKeys -split '\+' | ForEach-Object { [byte]$_ }
+ foreach ($v in $vks) { [DW]::keybd_event($v, 0, 0, [IntPtr]::Zero); Start-Sleep -Milliseconds 30 }
+ [array]::Reverse($vks); foreach ($v in $vks) { [DW]::keybd_event($v, 0, 2, [IntPtr]::Zero) }
+ Pump 1500
+}
+[DW]::GetWindowRect($h, [ref]$r) | Out-Null
+$w = $r.Right - $r.Left; $ht = $r.Bottom - $r.Top
+$bmp = New-Object System.Drawing.Bitmap $w, $ht; $g = [System.Drawing.Graphics]::FromImage($bmp)
+$dc = $g.GetHdc(); [DW]::PrintWindow($h, $dc, 2) | Out-Null; $g.ReleaseHdc($dc)
+$file = Join-Path $Out 'after-drop.png'; $bmp.Save($file, [System.Drawing.Imaging.ImageFormat]::Png); $g.Dispose(); $bmp.Dispose()
+"saved $file (${w}x${ht})"
+# The same area read from the screen: PrintWindow and the composed desktop can
+# disagree about a flip-model child window, so both are kept.
+$bmp = New-Object System.Drawing.Bitmap $w, $ht; $g = [System.Drawing.Graphics]::FromImage($bmp)
+$g.CopyFromScreen($r.Left, $r.Top, 0, 0, $bmp.Size)
+$file = Join-Path $Out 'after-drop-screen.png'; $bmp.Save($file, [System.Drawing.Imaging.ImageFormat]::Png); $g.Dispose(); $bmp.Dispose()
+"saved $file"
+Stop-Process -Id $p.Id -Force -ErrorAction SilentlyContinue
diff --git a/tools/qt_probe/hover-shot.ps1 b/tools/qt_probe/hover-shot.ps1
index ed378668..2b2b7746 100644
--- a/tools/qt_probe/hover-shot.ps1
+++ b/tools/qt_probe/hover-shot.ps1
@@ -8,7 +8,9 @@ param(
[string]$Clip = '',
[string]$Out = 'E:\项目\Veyra\logs\ui-qml-migration-20260925\hover',
[string]$Extra = '',
- # "x,y,name[,waitMs[,click]]" per step (click: a left click at the point), steps separated by ';', window-relative pixels. One
+ # "x,y,name[,waitMs[,action]]" per step, steps separated by ';', window-relative pixels.
+ # action: click (a left click at the point), or keys "k<vk>[+<vk>..]" tapped in order with
+ # modifiers held ("k17+76" is Ctrl+L), or "kd<vk>" / "ku<vk>" to press or release one key. One
# string: powershell -File does not split an array argument.
[string]$Steps = '640,4,top',
[int]$WaitSeconds = 8
@@ -24,6 +26,7 @@ public class HW {
[DllImport("user32.dll")] public static extern bool PrintWindow(IntPtr h, IntPtr dc, uint flags);
[DllImport("user32.dll")] public static extern bool SetCursorPos(int x, int y);
[DllImport("user32.dll")] public static extern void mouse_event(uint f, int x, int y, int d, IntPtr e);
+ [DllImport("user32.dll")] public static extern void keybd_event(byte vk, byte scan, uint f, IntPtr e);
[DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr h, IntPtr after, int x, int y, int cx, int cy, uint f);
[DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr h);
delegate bool EnumProc(IntPtr h, IntPtr p);
@@ -61,6 +64,13 @@ foreach ($s in ($Steps -split ';')) {
[HW]::GetWindowRect($h, [ref]$r) | Out-Null
[HW]::SetCursorPos($r.Left + [int]$x, $r.Top + [int]$y) | Out-Null
if ($click -eq 'click') { Start-Sleep -Milliseconds 150; [HW]::mouse_event(2, 0, 0, 0, [IntPtr]::Zero); [HW]::mouse_event(4, 0, 0, 0, [IntPtr]::Zero) }
+ elseif ($click -match '^kd(\d+)$') { [HW]::keybd_event([byte]$Matches[1], 0, 0, [IntPtr]::Zero) }
+ elseif ($click -match '^ku(\d+)$') { [HW]::keybd_event([byte]$Matches[1], 0, 2, [IntPtr]::Zero) }
+ elseif ($click -match '^k([\d+]+)$') {
+ $vks = $Matches[1] -split '\+' | ForEach-Object { [byte]$_ }
+ foreach ($v in $vks) { [HW]::keybd_event($v, 0, 0, [IntPtr]::Zero); Start-Sleep -Milliseconds 30 }
+ [array]::Reverse($vks); foreach ($v in $vks) { [HW]::keybd_event($v, 0, 2, [IntPtr]::Zero) }
+ }
Start-Sleep -Milliseconds ([int]$ms)
[HW]::GetWindowRect($h, [ref]$r) | Out-Null
$w = $r.Right - $r.Left; $ht = $r.Bottom - $r.Top