Repository navigation
Conversation
1. Root cause: timer-based screen rotation detection in frameTimerTimeout() was removed in d5800f7, replaced by a ScreenSizeChanged callback that was later commented out, then a per-frame detection in updateImage() with performance and reliability issues; m_phoneScale was never recalculated after rotation causing incorrect display dimensions 2. Fix: restore periodic size check in frameTimerTimeout() that reads m_rfbCli->width/height and recalculates m_phoneScale on rotation change, matching the init logic in start(); simplify updateImage() to pure image update; change handleSizeChange() condition from greater-than to not-equal for bidirectional resize support 3. Impact: phone screen mirroring now correctly detects and handles both portrait-to-landscape and landscape-to-portrait rotations with proper scale recalculation Log: fix phone screen mirroring rotation detection Influence: 1. Test portrait-to-landscape rotation during phone screen mirroring 2. Test landscape-to-portrait rotation during phone screen mirroring 3. Verify no performance degradation during continuous mirroring fix: 恢复手机投屏的定时器旋转检测机制 1. 根因:frameTimerTimeout() 中基于定时器的屏幕旋转检测在 d5800f7 中被移除,改用 ScreenSizeChanged 回调后被注释, 后续在 updateImage() 中逐帧检测存在性能和可靠性问题; m_phoneScale 旋转后未重算导致显示尺寸不正确 2. 方案:在 frameTimerTimeout() 中恢复周期性尺寸检测,读取 m_rfbCli->width/height 并在旋转变化时重算 m_phoneScale, 与 start() 初始化逻辑一致;简化 updateImage() 为纯图像更新; handleSizeChange() 条件从大于改为不等于以支持双向 resize 3. 影响:手机投屏现在能正确检测并处理竖屏转横屏和横屏转竖屏, 并正确重算缩放比例 Log: 修复手机投屏旋转检测问题 Influence: 1. 测试手机投屏时竖屏转横屏的旋转切换 2. 测试手机投屏时横屏转竖屏的旋转切换 3. 验证持续投屏过程中无性能下降 PMS: BUG-314949
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: re2zero The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideRestores periodic framebuffer-based rotation detection in the timer callback, where orientation changes now recalculate scaling, clear stale image state, resize the rendering surface, and notify the window; removes the costlier per-frame detection and enables bidirectional window resizing. Sequence diagram for timer-based screen rotation handlingsequenceDiagram
participant Timer as frameTimerTimeout()
participant Viewer as VncViewer
participant Framebuffer as m_rfbCli
participant Window as ScreenMirroringWindow
Timer->>Viewer: frameTimerTimeout()
Viewer->>Framebuffer: read width and height
alt orientation changed
Viewer->>Viewer: recalculate m_phoneScale
Viewer->>Viewer: setSurfaceSize(size)
Viewer->>Viewer: emit sizeChanged(size)
Viewer-->>Window: sizeChanged(size)
Window->>Window: handleSizeChange(size)
Window->>Window: resize(w, h)
end
Viewer->>Viewer: updateImage(image)
Viewer->>Viewer: store m_image and update()
Flow diagram for bidirectional mirroring window resizeflowchart TD
A["handleSizeChange(size)"] --> B{size differs from current window?}
B -- Yes --> C[Reset m_expectSize]
C --> D["resize(w, h)"]
B -- No --> E[Store m_expectSize]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['无需修改'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: ['将 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: ['无需修改'] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: ['无需修改'] 💡 改进建议代码示例// 修正变量命名拼写错误
// vncviewer.cpp, frameTimerTimeout() 函数中
// 修改前:
// int curentMode = (m_rfbCli->width < m_rfbCli->height) ? PORTRAIT : LANDSCAPE;
// 修改后:
int currentMode = (m_rfbCli->width < m_rfbCli->height) ? PORTRAIT : LANDSCAPE;
if (currentMode != m_phoneMode) {
DLOG << "Screen rotation detected by timer - old mode: " << m_phoneMode << " new mode: " << currentMode;
m_phoneMode = currentMode;
// ... 后续逻辑不变
}本报告由 AI 代码审查工具自动生成 |
修复说明
问题
BUG-314949:移动端切换横屏但没有发消息到PC切换
手机投屏过程中,移动端切换横竖屏时 PC 端投屏画面未跟随旋转。
根因
frameTimerTimeout()中基于定时器的屏幕旋转检测逻辑在提交d5800f77中被移除,改用ScreenSizeChanged回调,但该回调随后被注释掉(系统 libvncclient 0.9.15 无此字段)updateImage()中添加了逐帧检测,但存在性能开销(每帧检测)和可靠性问题(依赖下一帧数据到达,存在时序窗口)m_phoneScale仅在初始化时计算一次,旋转后未重算,导致显示尺寸/比例错误handleSizeChange()中"只放大不缩小"的条件限制(>改为!=)修复方案
vncviewer.cpp-frameTimerTimeout():恢复定时器周期性尺寸检测,读取m_rfbCli->width/height与m_phoneMode比较,检测到旋转时重算m_phoneScale(与start()初始化逻辑一致),清除图像缓存,调用setSurfaceSize()并 emitsizeChangedvncviewer.cpp-updateImage():简化为纯图像更新,移除逐帧旋转检测逻辑(现由定时器处理)screenmirroringwindow.cpp-handleSizeChange():将条件从w > this->width() || h > this->height()改为w != this->width() || h != this->height(),支持双向 resize改动文件
src/lib/cooperation/core/gui/phone/vncviewer.cppsrc/lib/cooperation/core/gui/phone/screenmirroringwindow.cpp测试建议
PMS: BUG-314949
Summary by Sourcery
Restore timer-based rotation handling for phone screen mirroring and support bidirectional display resizing.
Bug Fixes:
Enhancements: