feat(sender): 串流窗口补齐键盘/右键/滚轮与双向剪贴板同步
- video_window 处理右/中键(WM_RBUTTON/MBUTTON)与滚轮(WM_MOUSEWHEEL), 并通过 ttstd/video 的 mouse / wheel 方法通道交给 Dart - 键盘走 WM_KEYDOWN/UP 报 Windows 虚拟键码,Dart 侧映射成 Android keycode; Esc 仍保留为关窗,Alt 组合键旁路转发不吞掉 - 右键→返回、中键→多任务(buttons 位 bit1/bit2),滚轮按「deltaY 正=向下滚」取反 - 本机剪贴板每 700ms 轮询比较后下发 msg_type=4,被控端上行内容写入本机剪贴板; 两端都记住最近一次同步的文本,避免来回回送 - 控制栏「发送剪贴板」改为读取本机剪贴板实时内容(原先发的是固定占位字符串)
This commit is contained in:
1 parent
5f9fe88e37
commit
85e53f64ca
6 files changed
+345
-2
No files matched your search
@@ -855,6 +855,52 @@ class VideoTexturePlugin : public flutter::Plugin {
|
||||
std::make_unique<flutter::EncodableValue>(map));
|
||||
});
|
||||
|
||||
// 右键/中键:button 1=右键 2=中键,Dart 侧映射成 Android 返回/多任务。
|
||||
video_window_.SetMouseButtonHandler(
|
||||
[this](int button, int action, int x, int y) {
|
||||
if (channel_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
flutter::EncodableMap map;
|
||||
map[flutter::EncodableValue("button")] =
|
||||
flutter::EncodableValue(button);
|
||||
map[flutter::EncodableValue("action")] =
|
||||
flutter::EncodableValue(action);
|
||||
map[flutter::EncodableValue("x")] = flutter::EncodableValue(x);
|
||||
map[flutter::EncodableValue("y")] = flutter::EncodableValue(y);
|
||||
channel_->InvokeMethod("mouse",
|
||||
std::make_unique<flutter::EncodableValue>(map));
|
||||
});
|
||||
|
||||
// 滚轮:没有指针坐标,被控端用屏幕中心兜底。
|
||||
video_window_.SetWheelHandler([this](int delta_x, int delta_y) {
|
||||
if (channel_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
flutter::EncodableMap map;
|
||||
map[flutter::EncodableValue("deltaX")] =
|
||||
flutter::EncodableValue(delta_x);
|
||||
map[flutter::EncodableValue("deltaY")] =
|
||||
flutter::EncodableValue(delta_y);
|
||||
channel_->InvokeMethod("wheel",
|
||||
std::make_unique<flutter::EncodableValue>(map));
|
||||
});
|
||||
|
||||
// 键盘:只报 Windows 虚拟键码,Android keycode 的映射留在 Dart 侧。
|
||||
video_window_.SetKeyboardHandler([this](int action, int vk,
|
||||
int modifiers) {
|
||||
if (channel_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
flutter::EncodableMap map;
|
||||
map[flutter::EncodableValue("action")] = flutter::EncodableValue(action);
|
||||
map[flutter::EncodableValue("vk")] = flutter::EncodableValue(vk);
|
||||
map[flutter::EncodableValue("modifiers")] =
|
||||
flutter::EncodableValue(modifiers);
|
||||
channel_->InvokeMethod("key",
|
||||
std::make_unique<flutter::EncodableValue>(map));
|
||||
});
|
||||
|
||||
worker_ = std::thread([this, shared_frames]() { RunWorker(shared_frames); });
|
||||
}
|
||||
|
||||
@@ -862,6 +908,9 @@ class VideoTexturePlugin : public flutter::Plugin {
|
||||
// 先摘掉回调,避免析构期间 DestroyWindow 触发 InvokeMethod。
|
||||
video_window_.SetCloseHandler(nullptr);
|
||||
video_window_.SetInputHandler(nullptr);
|
||||
video_window_.SetMouseButtonHandler(nullptr);
|
||||
video_window_.SetWheelHandler(nullptr);
|
||||
video_window_.SetKeyboardHandler(nullptr);
|
||||
video_window_.Close();
|
||||
stop_.store(true);
|
||||
if (worker_.joinable()) {
|
||||
|
||||
Reference in new issue
Block a user