win提交

This commit is contained in:
Developer
2026-06-22 03:50:59 +08:00
parent 8786abd59e
commit f7520b17b2
32 changed files with 2179 additions and 1431 deletions

View File

@@ -27,11 +27,48 @@ class FlutterWindow : public Win32Window {
// The project to run.
flutter::DartProject project_;
// The Flutter instance hosted by this window.
// The Flutter instance hosted in this window.
std::unique_ptr<flutter::FlutterViewController> flutter_controller_;
// Windows platform MethodChannel for theme control.
std::unique_ptr<flutter::MethodChannel<>> platform_channel_;
// 窗口控制 MethodChannel窗口大小预设菜单等
std::unique_ptr<flutter::MethodChannel<>> window_control_channel_;
// 弹出原生窗口大小预设菜单TrackPopupMenuEx
// 返回 true 表示用户选择了某个尺寸false 表示用户取消了菜单
bool ShowWindowSizeMenu(HWND hwnd);
// Subclass ID for the Flutter child window (WM_NCHITTEST → HTTRANSPARENT)
static const UINT_PTR kChildSubclassId = 12345;
// Subclass callback: forward title-bar hit-test to parent window so the
// parent can return HTCAPTION and Windows performs native modal dragging.
static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam,
UINT_PTR subclass_id,
DWORD_PTR ref_data);
// ============================================================
// 原生拖拽状态SC_MOVE 模态循环期间绕过插件链 + 子窗口消息拦截
//
// 根因(经 v1~v8 验证):
// 1. 手动 SetWindowPos 拖拽不触发 DWM "live drag" 优化
// 2. 完全禁用 Mica 能解决卡顿v8 验证),但临时禁用 Micav4~v7失败
// 3. v4~v7 失败的原因EnterSizeMove 遗漏了 SetWindowCompositionAttribute
// (ACCENT_DISABLED) 调用——这是 flutter_acrylic 的 setEffect(disabled)
// 能立即禁用 Mica 的关键。仅靠 DwmSetWindowAttribute 是异步的,不生效。
//
// 修复v9
// - WM_NCLBUTTONDOWN(HTCAPTION) 时调用 EnterSizeMove 禁用 Mica
// (现在包含 SetWindowCompositionAttribute(ACCENT_DISABLED),能立即生效)
// - SWP_FRAMECHANGED 强制 DWM 同步应用变更
// - DefWindowProc 进入 SC_MOVE 模态循环
// - DefWindowProc 返回后调用 ExitSizeMove 恢复 Mica + SWP_FRAMECHANGED
// - 模态循环期间绕过插件链 + 子窗口消息拦截v8
// ============================================================
static bool is_in_native_drag_;
};
#endif // RUNNER_FLUTTER_WINDOW_H_