Fix: repaint the remote desktop after a window resize
OnSize only refreshed the cached client rect, letterbox offsets and zoom factors; it never asked for a repaint. Windows invalidates a window only when the client area grows, so restoring a maximized viewer marks nothing invalid. Since the dialog stops erasing its background after the first frame and has no periodic repaint timer, the sole remaining repaint source is a change on the remote screen. A static remote desktop therefore kept the maximized picture - cropped, not following the window - until something moved on the far end. Call InvalidateRect(NULL, FALSE) at the end of OnSize whenever the client area is non-empty, so every size change (restore, fullscreen transitions and interactive resizing) recomputes the layout and repaints once. It is a no-op while the window is hidden; CHideScreenSpyDlg::OnSize calls the base handler, so it inherits the same behaviour. Verified on a Debug build against a live test client: the maximized client (1920x1009) renders 63/64 px side bars and the restored one (717x355) 43/43 px, matching ComputeAdaptiveLayout (renderW=631, offsetX=43). Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
49ba0c4850
commit
a628c19341
1 file changed
+8
@@ -4225,6 +4225,14 @@ void CScreenSpyDlg::OnSize(UINT nType, int cx, int cy)
|
||||
m_wZoom = m_CRect.Width() > 0 ? (double)m_BitmapInfor_Full->bmiHeader.biWidth / m_CRect.Width() : 1.0;
|
||||
m_hZoom = m_CRect.Height() > 0 ? (double)m_BitmapInfor_Full->bmiHeader.biHeight / m_CRect.Height() : 1.0;
|
||||
}
|
||||
|
||||
// 尺寸变化后必须主动请求重绘。系统只在客户区"变大"时给出整块无效区;
|
||||
// 最大化后还原(客户区变小)不会产生任何无效区,而本对话框显示首帧后
|
||||
// OnEraseBkgnd 不再擦背景,也没有周期性重绘定时器,唯一的另一个重绘源
|
||||
// 是远端画面变化(DrawNextScreenDiff -> WM_PAINT)。少了这句,还原后
|
||||
// 会保留最大化尺寸的画面(被裁切、不跟随窗口),直到远端画面发生变化。
|
||||
if (cx > 0 && cy > 0)
|
||||
InvalidateRect(NULL, FALSE);
|
||||
}
|
||||
|
||||
void CScreenSpyDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
|
||||
|
||||
Reference in new issue
Block a user