From d99122b25f4272355de24335900b923a89d63ee6 Mon Sep 17 00:00:00 2001 From: yuanyuanxiang <962914132@qq.com> Date: Wed, 26 Aug 2026 21:24:07 +0200 Subject: [PATCH] Fix: Window manager view check reads stale state after restore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The window manager's "view" action checks the window state against the ItemData.Data[2] field populated when the list was built. The right-click show/hide/maximize/minimize handlers updated only the list control's display text via SetItemText, leaving Data[2] stale. After restoring a minimized window, viewing still reported "该窗口已最小化" until the dialog was reopened. Sync Data[2] alongside SetItemText in all four handlers so the view check and the status-column sort both see the current state. Co-Authored-By: deepseek-v4-pro --- server/2015Remote/SystemDlg.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/2015Remote/SystemDlg.cpp b/server/2015Remote/SystemDlg.cpp index 3075172..93c480d 100644 --- a/server/2015Remote/SystemDlg.cpp +++ b/server/2015Remote/SystemDlg.cpp @@ -541,6 +541,7 @@ void CSystemDlg::OnWlistHide() lpMsgBuf[0]=CMD_WINDOW_TEST; //窗口处理数据头 DWORD hwnd = data->ID; //得到窗口的句柄一同发送 pListCtrl->SetItemText(nItem,2,"hidden"); //注意这时将列表中的显示状态为"隐藏" + data->Data[2] = "hidden"; // 同步 ItemData,避免查看/排序读到旧状态 //这样在删除列表条目时就不删除该项了 如果删除该项窗口句柄会丢失 就永远也不能显示了 memcpy(lpMsgBuf+1,&hwnd,sizeof(DWORD)); //得到窗口的句柄一同发送 DWORD dHow=SW_HIDE; //窗口处理参数 0 @@ -564,6 +565,7 @@ void CSystemDlg::OnWlistRecover() lpMsgBuf[0]= CMD_WINDOW_TEST; DWORD hwnd = data->ID; pListCtrl->SetItemText(nItem,2,"normal"); + data->Data[2] = "normal"; // 同步 ItemData,避免查看/排序读到旧状态 memcpy(lpMsgBuf+1,&hwnd,sizeof(DWORD)); DWORD dHow=SW_NORMAL; memcpy(lpMsgBuf+1+sizeof(hwnd),&dHow,sizeof(DWORD)); @@ -586,6 +588,7 @@ void CSystemDlg::OnWlistMax() lpMsgBuf[0]= CMD_WINDOW_TEST; DWORD hwnd = data->ID; pListCtrl->SetItemText(nItem,2,"maximized"); + data->Data[2] = "maximized"; // 同步 ItemData,避免查看/排序读到旧状态 memcpy(lpMsgBuf+1,&hwnd,sizeof(DWORD)); DWORD dHow=SW_MAXIMIZE; memcpy(lpMsgBuf+1+sizeof(hwnd),&dHow,sizeof(DWORD)); @@ -608,6 +611,7 @@ void CSystemDlg::OnWlistMin() lpMsgBuf[0]= CMD_WINDOW_TEST; DWORD hwnd = data->ID; pListCtrl->SetItemText(nItem,2,"minimized"); + data->Data[2] = "minimized"; // 同步 ItemData,避免查看/排序读到旧状态 memcpy(lpMsgBuf+1,&hwnd,sizeof(DWORD)); DWORD dHow=SW_MINIMIZE; memcpy(lpMsgBuf+1+sizeof(hwnd),&dHow,sizeof(DWORD));