feat(sender): 串流窗口支持点击与拖拽控制
- video_window 增加 InputHandler 回调,WM_LBUTTONDOWN/MOUSEMOVE/LBUTTONUP/CAPTURECHANGED 映射为 0/2/1/3,移动事件按 60Hz 限流 - Paint 记录帧尺寸与实际绘制矩形,ClientToFrame 换算到画面像素并过滤黑边 - video_texture 通过方法通道转发 pointer 事件到 Dart,析构时清空回调 - bridge.dart 新增 onVideoPointer,main.dart 以 msg_type=0 触摸帧下发(压力 1000/0)
This commit is contained in:
1 parent
03a5853da7
commit
a102d10089
5 files changed
+166
-2
No files matched your search
@@ -838,12 +838,26 @@ class VideoTexturePlugin : public flutter::Plugin {
|
||||
// 用户点窗口关闭按钮或按 ESC:通知 Flutter 停止投屏。
|
||||
video_window_.SetCloseHandler([this]() { OnVideoWindowClosed(); });
|
||||
|
||||
// 画面里的鼠标操作(点击/拖拽)→ Flutter,再由 Dart 转成触摸控制帧下发。
|
||||
video_window_.SetInputHandler([this](int action, int x, int y) {
|
||||
if (channel_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
flutter::EncodableMap map;
|
||||
map[flutter::EncodableValue("action")] = flutter::EncodableValue(action);
|
||||
map[flutter::EncodableValue("x")] = flutter::EncodableValue(x);
|
||||
map[flutter::EncodableValue("y")] = flutter::EncodableValue(y);
|
||||
channel_->InvokeMethod("pointer",
|
||||
std::make_unique<flutter::EncodableValue>(map));
|
||||
});
|
||||
|
||||
worker_ = std::thread([this, shared_frames]() { RunWorker(shared_frames); });
|
||||
}
|
||||
|
||||
~VideoTexturePlugin() override {
|
||||
// 先摘掉回调,避免析构期间 DestroyWindow 触发 InvokeMethod。
|
||||
video_window_.SetCloseHandler(nullptr);
|
||||
video_window_.SetInputHandler(nullptr);
|
||||
video_window_.Close();
|
||||
stop_.store(true);
|
||||
if (worker_.joinable()) {
|
||||
|
||||
Reference in new issue
Block a user