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
@@ -27,6 +27,14 @@ class VideoWindow {
|
||||
// 画面内鼠标操作回调,坐标已换算成画面像素(0..frame_width-1)。
|
||||
// action:0=按下 1=抬起 2=移动 3=取消,语义与协议 TouchEvent.action 一致。
|
||||
using InputHandler = std::function<void(int action, int x, int y)>;
|
||||
// 右键/中键回调。button:1=右键 2=中键;action:0=按下 1=抬起;
|
||||
// 坐标已换算成画面像素(黑边上的点击会被丢弃)。
|
||||
using MouseButtonHandler = std::function<void(int button, int action, int x, int y)>;
|
||||
// 滚轮回调。deltaY 正=向下滚(手指上滑),与协议 WheelEvent 的约定一致。
|
||||
using WheelHandler = std::function<void(int deltaX, int deltaY)>;
|
||||
// 键盘回调。action:0=按下 1=抬起;vk 是 Windows 虚拟键码(由 Dart 侧映射成
|
||||
// Android keycode);modifiers:bit0=ctrl bit1=alt bit2=shift bit3=meta。
|
||||
using KeyboardHandler = std::function<void(int action, int vk, int modifiers)>;
|
||||
|
||||
VideoWindow();
|
||||
~VideoWindow();
|
||||
@@ -48,6 +56,15 @@ class VideoWindow {
|
||||
// 设置/清除画面鼠标回调;传 nullptr 清除。
|
||||
void SetInputHandler(InputHandler handler);
|
||||
|
||||
// 设置/清除右键/中键回调;传 nullptr 清除。
|
||||
void SetMouseButtonHandler(MouseButtonHandler handler);
|
||||
|
||||
// 设置/清除滚轮回调;传 nullptr 清除。
|
||||
void SetWheelHandler(WheelHandler handler);
|
||||
|
||||
// 设置/清除键盘回调;传 nullptr 清除。
|
||||
void SetKeyboardHandler(KeyboardHandler handler);
|
||||
|
||||
bool IsOpen() const { return open_.load(); }
|
||||
|
||||
private:
|
||||
@@ -62,6 +79,10 @@ class VideoWindow {
|
||||
// 客户区坐标 -> 画面像素;返回 false 表示点在黑边上或还没有画面。
|
||||
bool ClientToFrame(POINT point, int* x, int* y) const;
|
||||
void DispatchPointerAt(int action, POINT point);
|
||||
void DispatchMouseButtonAt(int button, int action, POINT point);
|
||||
void DispatchKey(int action, int vk);
|
||||
// 当前修饰键状态(按协议位定义拼装)。
|
||||
int CurrentModifiers() const;
|
||||
// 离屏缓冲:整帧画完再一次性贴到窗口,避免「已填黑、还没拉伸」的中间态被合成。
|
||||
void EnsureBackBuffer(HDC reference, int width, int height);
|
||||
void ReleaseBackBuffer();
|
||||
@@ -72,6 +93,9 @@ class VideoWindow {
|
||||
FrameProvider provider_;
|
||||
CloseHandler close_handler_;
|
||||
InputHandler input_handler_;
|
||||
MouseButtonHandler mouse_button_handler_;
|
||||
WheelHandler wheel_handler_;
|
||||
KeyboardHandler keyboard_handler_;
|
||||
|
||||
// 双缓冲用的内存 DC 与位图,尺寸跟随客户区。只在窗口线程读写。
|
||||
HDC back_dc_ = nullptr;
|
||||
|
||||
Reference in new issue
Block a user