Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++

fix(ui): unstack the strict-cadence row and commit panel scrolls

Veyra Goal Agentd93864f69edb
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2465796f..38d86c3d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -872,6 +872,11 @@ if(VEYRA_FFMPEG_ROOT AND EXISTS "${VEYRA_FFMPEG_ROOT}/include/libavformat/avform
target_compile_features(veyra_slider_reset_tests PRIVATE cxx_std_20)
target_compile_options(veyra_slider_reset_tests PRIVATE /utf-8)
target_link_libraries(veyra_slider_reset_tests PRIVATE veyra_engine comctl32 comdlg32 shell32)
+ add_executable(veyra_settings_layout_tests tests/integration/SettingsPageLayoutTests.cpp apps/veyra/SettingsWindow.cpp)
+ target_compile_features(veyra_settings_layout_tests PRIVATE cxx_std_20)
+ target_compile_options(veyra_settings_layout_tests PRIVATE /utf-8)
+ target_compile_definitions(veyra_settings_layout_tests PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN)
+ target_link_libraries(veyra_settings_layout_tests PRIVATE veyra_engine comctl32 comdlg32 shell32)
if(VEYRA_ENABLE_REMOTEPLAY)
add_executable(veyra_ps5_hw_image_tests tests/integration/Ps5HardwareImageTests.cpp)
add_executable(veyra_ps5_quality_tests tests/integration/Ps5SourceQualityTests.cpp)
diff --git a/apps/veyra/SettingsWindow.cpp b/apps/veyra/SettingsWindow.cpp
index b8d47a0e..3284a9c6 100644
--- a/apps/veyra/SettingsWindow.cpp
+++ b/apps/veyra/SettingsWindow.cpp
@@ -57,14 +57,14 @@ void putText(int id,const wchar_t* value){setText(item(id),value);}
void check(int id,UINT value){if(send(id,BM_GETCHECK)!=value)send(id,BM_SETCHECK,value);}
UINT checked(int id){return UINT(send(id,BM_GETCHECK));}
int viewportHeight(){RECT r{};GetClientRect(body,&r);return std::max(1,MulDiv(r.bottom,96,veyra::ui::layoutDpi(window)));}
-void arrange();
+void arrange(bool commitScroll=false);
LRESULT CALLBACK bodyProc(HWND h,UINT msg,WPARAM wp,LPARAM lp){
if(msg==WM_ERASEBKGND)return 1;
if(msg==WM_PAINT){PaintBuffer paint(h);fillSurface(paint.dc,paint.rect,h);if(contentHeight>viewportHeight()){int thumb=std::max(dip(h,30),int(paint.rect.bottom*float(viewportHeight())/contentHeight));int y=int((paint.rect.bottom-thumb)*float(scroll)/std::max(1,contentHeight-viewportHeight()));RECT bar{paint.rect.right-dip(h,5),y,paint.rect.right-dip(h,2),y+thumb};roundRect(paint.dc,bar,line,dip(h,2));}return 0;}
if(msg==WM_CTLCOLORSTATIC||msg==WM_CTLCOLOREDIT||msg==WM_CTLCOLORLISTBOX||msg==WM_CTLCOLORBTN)return colors(msg,wp,lp);
if(msg==WM_COMMAND||msg==WM_HSCROLL||msg==WM_MOUSEWHEEL||msg==WM_VSCROLL||msg==WM_NOTIFY)return SendMessageW(window,msg,wp,lp);
if(msg==WM_LBUTTONDOWN){RECT r{};GetClientRect(h,&r);if(GET_X_LPARAM(lp)>=r.right-dip(h,12))SetCapture(h);}
- if((msg==WM_LBUTTONDOWN||msg==WM_MOUSEMOVE)&&GetCapture()==h){RECT r{};GetClientRect(h,&r);scroll=int(float(GET_Y_LPARAM(lp))/std::max(1L,r.bottom)*std::max(0,contentHeight-viewportHeight()));arrange();return 0;}
+ if((msg==WM_LBUTTONDOWN||msg==WM_MOUSEMOVE)&&GetCapture()==h){RECT r{};GetClientRect(h,&r);scroll=int(float(GET_Y_LPARAM(lp))/std::max(1L,r.bottom)*std::max(0,contentHeight-viewportHeight()));arrange(true);return 0;}
if(msg==WM_LBUTTONUP&&GetCapture()==h){ReleaseCapture();return 0;}
return DefWindowProcW(h,msg,wp,lp);
}
@@ -1191,7 +1191,7 @@ void layoutEnhancePage(int width){
}
}
-void arrange(){
+void arrange(bool commitScroll){
if(!window||!body)return;RECT r{};GetClientRect(window,&r);int width=MulDiv(r.right,96,veyra::ui::layoutDpi(window)),height=MulDiv(r.bottom,96,veyra::ui::layoutDpi(window));
const int sticky=128,viewport=std::max(1,height-sticky);contentHeight=0;
// The child still has its previous size until SetWindowPos below.
@@ -1211,6 +1211,9 @@ void arrange(){
}
int helpHeight=0;
if(smoothMotionHelpExpanded){auto dc=GetDC(window);auto old=SelectObject(dc,font);RECT textRect{0,0,dip(window,std::max(1,width-24)),0};DrawTextW(dc,smoothMotionHelp,-1,&textRect,DT_CALCRECT|DT_WORDBREAK|DT_NOPREFIX);SelectObject(dc,old);ReleaseDC(window,dc);helpHeight=MulDiv(textRect.bottom,96,layoutDpi(window))+16;}
+ // The Smooth Motion explainer unfolds between the frame-generation rows and
+ // the pacing rows, so everything below it moves down by the measured text
+ // height. The control keeps its own y; only the rows after it shift.
const auto helpOffset=[&](const Item& entry){const auto id=GetDlgCtrlID(entry.h);return entry.page==1&&(id==1114||id==205||id==1110||id==240||id==241||id==242||id==243||id==244||id==1147||id==1150)?helpHeight:0;};
for(auto& entry:items){if(GetDlgCtrlID(entry.h)==1120)entry.height=helpHeight;
if(entry.page==page&&!entry.hidden&&(GetDlgCtrlID(entry.h)!=1120||smoothMotionHelpExpanded)){wchar_t cls[32]{};GetClassNameW(entry.h,cls,32);contentHeight=std::max(contentHeight,entry.y+helpOffset(entry)+(_wcsicmp(cls,L"COMBOBOX")==0?36:entry.height)+12);}}
@@ -1218,9 +1221,27 @@ void arrange(){
scroll=std::clamp(scroll,0,std::max(0,contentHeight-viewport));
SetWindowPos(body,nullptr,0,dip(window,sticky),r.right,dip(window,viewport),SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW);
auto batch=BeginDeferWindowPos(int(items.size()));
- for(auto& entry:items){bool fixed=entry.page==-1,visible=!entry.hidden&&(entry.page==page||fixed)&&(GetDlgCtrlID(entry.h)!=1120||smoothMotionHelpExpanded);int w=entry.w<0?width-entry.x-12:entry.w;int y=fixed?(GetDlgCtrlID(entry.h)==400?0:(GetDlgCtrlID(entry.h)==211||GetDlgCtrlID(entry.h)==219)?86:42):entry.y+helpOffset(entry)-scroll;
- if(fixed){SetWindowPos(entry.h,nullptr,dip(window,entry.x),dip(window,y),dip(window,std::max(1,w)),dip(window,42),SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOREDRAW);continue;}batch=DeferWindowPos(batch,entry.h,nullptr,dip(window,entry.x),dip(window,y),dip(window,std::max(1,w)),dip(window,entry.height),SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOREDRAW|SWP_NOCOPYBITS|(visible?SWP_SHOWWINDOW:SWP_HIDEWINDOW));}
- EndDeferWindowPos(batch);RedrawWindow(body,nullptr,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);InvalidateRect(window,nullptr,FALSE);
+ for(auto& entry:items){
+ const int id=GetDlgCtrlID(entry.h);
+ const bool fixed=entry.page==-1;
+ const int w=entry.w<0?width-entry.x-12:entry.w;
+ const int y=fixed?(id==400?0:(id==211||id==219)?86:42):entry.y+helpOffset(entry)-scroll;
+ if(fixed){SetWindowPos(entry.h,nullptr,dip(window,entry.x),dip(window,y),dip(window,std::max(1,w)),dip(window,42),SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOREDRAW);continue;}
+ wchar_t cls[32]{};GetClassNameW(entry.h,cls,32);
+ const int height=_wcsicmp(cls,L"COMBOBOX")==0?36:entry.height;
+ // Rows that scrolled completely out of the viewport are hidden instead of
+ // being parked outside the clip region, so a wheel notch only repaints
+ // the rows that are actually on screen.
+ const bool visible=!entry.hidden&&entry.page==page&&(id!=1120||smoothMotionHelpExpanded)&&y+height>-4&&y<viewport+4;
+ batch=DeferWindowPos(batch,entry.h,nullptr,dip(window,entry.x),dip(window,y),dip(window,std::max(1,w)),dip(window,entry.height),SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOREDRAW|SWP_NOCOPYBITS|(visible?SWP_SHOWWINDOW:SWP_HIDEWINDOW));
+ }
+ EndDeferWindowPos(batch);
+ // The panel scrolls by moving child windows, so the window is only correct
+ // once every moved row has repainted. A scroll commits that here, inside the
+ // input message: a deferred repaint is what shows up as ghosted or
+ // duplicated rows while the wheel is spinning.
+ RedrawWindow(body,nullptr,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN|(commitScroll?RDW_UPDATENOW:0));
+ InvalidateRect(window,nullptr,FALSE);
}
HWND add(const wchar_t* cls,const wchar_t* text,int id,DWORD style,int group,int x,int y,int width,int height){auto h=CreateWindowExW(0,cls,text,WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|style,0,0,1,1,group==-1?window:body,reinterpret_cast<HMENU>(INT_PTR(id)),GetModuleHandleW(nullptr),nullptr);SendMessageW(h,WM_SETFONT,WPARAM(font),TRUE);themeControl(h);if(group!=-1)SetWindowSubclass(h,scrollOnly,950,0);items.push_back({h,group,x,y,width,height});return h;}
@@ -1307,7 +1328,7 @@ case WM_CREATE:{window=h;font=makeFont(h);items.clear();displayedBackendWarning.
combo(208,1,78,{L"DLSS 帧生成",L"Intel XeSS · 实验显示补帧 2X-4X"});
add(L"STATIC",L"补帧倍率",1112,0,1,12,122,-1,24);
combo(202,1,150,{L"关闭补帧",L"2X · 一张中间帧",L"3X · 两张中间帧",L"4X · 三张中间帧"});
- add(L"BUTTON",L"严格补帧节奏 · 赶不上期限的整组不生成(默认关闭,生成更多帧)",210,BS_AUTOCHECKBOX|WS_TABSTOP,1,12,190,-1,36);
+ add(L"BUTTON",L"严格补帧节奏(默认关闭)",210,BS_AUTOCHECKBOX|WS_TABSTOP,1,12,366,-1,36);
add(L"STATIC",L"运动估算",1113,0,1,12,234,-1,24);
combo(209,1,262,{L"NVIDIA NVOF 光流",L"AMD FidelityFX 光流 · 实验",L"GPU DIS 光流 · FAST 实验"});
add(L"BUTTON",L"AMD 性能档 · 光流宽高各减半",215,BS_AUTOCHECKBOX|WS_TABSTOP,1,12,306,-1,36);
@@ -1480,14 +1501,9 @@ case WM_CREATE:{window=h;font=makeFont(h);items.clear();displayedBackendWarning.
if(id==201)entry.y=176;
if(id>=730&&id<=732)entry.y=220;
if(id==207)entry.y=264;
+ // The capture/stream audio sync controls are created here but read as a
+ // separate audio page.
switch(id){
- case 1113:entry.y=50;break;case 209:entry.y=78;break;
-
- case 215:entry.y=122;break;case 204:entry.y=166;break;
- case 1111:entry.y=214;break;case 208:entry.y=242;break;
- case 1112:entry.y=286;break;case 202:entry.y=314;break;
- case 1114:entry.y=402;break;case 205:entry.y=430;break;
- case 1110:entry.y=474;break;
case 1115:entry.page=4;entry.y=12;break;
case 216:entry.page=4;entry.y=50;break;
case 1116:case 217:entry.page=4;entry.y=100;break;
@@ -1507,6 +1523,33 @@ case WM_CREATE:{window=h;font=makeFont(h);items.clear();displayedBackendWarning.
ghost(item(221));
SetPropW(item(221),L"veyra.tip",HANDLE(L"查看 NVIDIA App 的 AI 插帧开启方法。这里只提供说明,不修改驱动,也不限制叠加补帧。"));
add(L"STATIC",smoothMotionHelp,1120,SS_NOPREFIX,1,12,400,-1,1);
+
+ // Reading order for the frame-generation page, and the single source of
+ // truth for its geometry. Every row keeps the same 8 dip rhythm the other
+ // pages use; the strict-cadence switch owns the row directly under the
+ // multiplier selector (it used to be created at y=190, which placed it on
+ // top of the optical-flow combo *and* under the "补帧方式" label), and the
+ // Smooth Motion help moved to the end so expanding it can never overlap the
+ // controls above it.
+ // The Smooth Motion explainer sits directly under the frame-generation
+ // rows; expanding it shifts every row below by the measured text height
+ // (see the frame page help offset in arrange()).
+ for(auto& entry:items){
+ switch(GetDlgCtrlID(entry.h)){
+ case 1113:entry.y=50;break;case 209:entry.y=82;break;
+ case 215:entry.y=126;break;case 204:entry.y=170;break;
+ case 1111:entry.y=214;break;case 208:entry.y=246;break;
+ case 1112:entry.y=290;break;case 202:entry.y=322;break;
+ case 210:entry.y=370;break;
+ case 221:entry.y=418;break;case 1120:entry.y=462;break;
+ case 1114:entry.y=470;break;case 205:entry.y=502;break;
+ case 1110:entry.y=546;break;
+ case 240:entry.y=626;break;case 242:entry.y=666;break;
+ case 243:entry.y=710;break;
+ case 244:case 1147:entry.y=754;break;
+ case 1150:entry.y=790;break;
+ }
+ }
setText(item(1113),L"光流 · 运动估算");
setText(item(1115),L"采集 / 串流音频同步");
add(L"STATIC",L"调整实时输入的声音补偿,不改变补帧倍率。正值让声音更晚;自动模式由软件估算。",1118,0,4,12,148,-1,90);
@@ -1803,7 +1846,7 @@ __declspec(noinline) LRESULT settingsCommand(HWND h,UINT msg,WPARAM wp,LPARAM lp
}
if(msg==WM_COMMAND&&!populating&&((LOWORD(wp)==209&&HIWORD(wp)==CBN_SELCHANGE)||((LOWORD(wp)==215||LOWORD(wp)==210)&&HIWORD(wp)==BN_CLICKED))){liveField(LOWORD(wp));return 0;}
switch(msg){
-case WM_COMMAND:{const int id=LOWORD(wp);if(!populating&&((id>=202&&id<=205||id==207||id==208)&&HIWORD(wp)==CBN_SELCHANGE||(id>=700&&id<=732)&&HIWORD(wp)==BN_CLICKED)){liveField(id);return 0;}if((id==206||id==213||id==214)&&HIWORD(wp)==BN_CLICKED){const auto accepted=SendMessageW(GetParent(h),WM_APP+45,id,checked(206));message(accepted?(id==213?L"请在画面中左键拖动框选;Esc取消。":L"已请求更新NR剔除区。"):L"未能操作:请先打开画面,或清除已满的4个区域。");return 0;}if((id==200||id==201)&&HIWORD(wp)==BN_CLICKED){const bool accepted=SendMessageW(GetParent(h),WM_APP+44,id,checked(id))!=0;message(accepted?L"已请求开关;确认帧边界结果后生效。":L"总增强正在切换,请待当前事务完成。");return 0;}if(HIWORD(wp)==EN_SETFOCUS){for(auto& item:items)if(GetDlgCtrlID(item.h)==id&&item.page==page){RECT r{};GetClientRect(h,&r);int height=MulDiv(r.bottom,96,veyra::ui::layoutDpi(h))-128;if(item.y<scroll)scroll=item.y;if(item.y+item.height>scroll+height)scroll=item.y+item.height-height;arrange();break;}}if(!populating&&id>=100&&id<=111&&HIWORD(wp)==EN_CHANGE){liveField(id);return 0;}
+case WM_COMMAND:{const int id=LOWORD(wp);if(!populating&&((id>=202&&id<=205||id==207||id==208)&&HIWORD(wp)==CBN_SELCHANGE||(id>=700&&id<=732)&&HIWORD(wp)==BN_CLICKED)){liveField(id);return 0;}if((id==206||id==213||id==214)&&HIWORD(wp)==BN_CLICKED){const auto accepted=SendMessageW(GetParent(h),WM_APP+45,id,checked(206));message(accepted?(id==213?L"请在画面中左键拖动框选;Esc取消。":L"已请求更新NR剔除区。"):L"未能操作:请先打开画面,或清除已满的4个区域。");return 0;}if((id==200||id==201)&&HIWORD(wp)==BN_CLICKED){const bool accepted=SendMessageW(GetParent(h),WM_APP+44,id,checked(id))!=0;message(accepted?L"已请求开关;确认帧边界结果后生效。":L"总增强正在切换,请待当前事务完成。");return 0;}if(HIWORD(wp)==EN_SETFOCUS){for(auto& item:items)if(GetDlgCtrlID(item.h)==id&&item.page==page){RECT r{};GetClientRect(h,&r);int height=MulDiv(r.bottom,96,veyra::ui::layoutDpi(h))-128;if(item.y<scroll)scroll=item.y;if(item.y+item.height>scroll+height)scroll=item.y+item.height-height;arrange(true);break;}}if(!populating&&id>=100&&id<=111&&HIWORD(wp)==EN_CHANGE){liveField(id);return 0;}
if(!populating&&id>=100&&id<=111&&HIWORD(wp)==EN_KILLFOCUS){populate(enhancementEnabled?controller->snapshot().desired:configuredSettings);return 0;}
engine::EnhancementSettings s;
if(id==211){SetFocus(body);s={};if(submit(s)){editDrafts.clear();populate(s);}message(L"已还原内建默认。");}
@@ -1846,8 +1889,8 @@ case WM_CREATE:return createSettingsWindow(h,msg,wp,lp);
case WM_SIZE:arrange();return 0;
case WM_ERASEBKGND:return 1;
case WM_PAINT:{PaintBuffer paint(h);fillSurface(paint.dc,paint.rect,h);return 0;}
-case WM_VSCROLL:{switch(LOWORD(wp)){case SB_LINEUP:scroll-=40;break;case SB_LINEDOWN:scroll+=40;break;case SB_PAGEUP:scroll-=240;break;case SB_PAGEDOWN:scroll+=240;break;case SB_THUMBTRACK:{SCROLLINFO si{sizeof(si),SIF_TRACKPOS};GetScrollInfo(h,SB_VERT,&si);scroll=si.nTrackPos;break;}}arrange();return 0;}
-case WM_MOUSEWHEEL:scroll-=GET_WHEEL_DELTA_WPARAM(wp)/WHEEL_DELTA*36;arrange();return 0;
+case WM_VSCROLL:{switch(LOWORD(wp)){case SB_LINEUP:scroll-=40;break;case SB_LINEDOWN:scroll+=40;break;case SB_PAGEUP:scroll-=240;break;case SB_PAGEDOWN:scroll+=240;break;case SB_THUMBTRACK:{SCROLLINFO si{sizeof(si),SIF_TRACKPOS};GetScrollInfo(h,SB_VERT,&si);scroll=si.nTrackPos;break;}}arrange(true);return 0;}
+case WM_MOUSEWHEEL:scroll-=GET_WHEEL_DELTA_WPARAM(wp)/WHEEL_DELTA*36;arrange(true);return 0;
case WM_CTLCOLORSTATIC:case WM_CTLCOLOREDIT:case WM_CTLCOLORLISTBOX:case WM_CTLCOLORBTN:return colors(msg,wp,lp);
case WM_COMMAND:return settingsCommand(h,msg,wp,lp);
case WM_HSCROLL:{
@@ -1927,7 +1970,7 @@ void settingsColorScrollToTest(int id){
const int height=MulDiv(r.bottom,96,veyra::ui::layoutDpi(window))-128;
if(entry.y<scroll)scroll=entry.y;
if(entry.y+entry.height>scroll+height)scroll=entry.y+entry.height-height;
- arrange();
+ arrange(true);
veyra::log::info("color-ui",std::format("scroll-to id={} y={} height={} viewport={} scroll={} content={}",id,entry.y,entry.height,height,scroll,colorPageContentHeight));
return;
}
diff --git a/apps/veyra/ui/SettingHelp.h b/apps/veyra/ui/SettingHelp.h
index ce2df777..614dbdff 100644
--- a/apps/veyra/ui/SettingHelp.h
+++ b/apps/veyra/ui/SettingHelp.h
@@ -38,6 +38,7 @@ inline const wchar_t* settingHelp(int id){
case 208:return L"选择DLSS补帧或实验XeSS补帧。AMD FSR补帧已在1.4.0从界面移除(切回DLSS容易卡住、效果也一般):引擎后端保留,但面板不再提供,旧设置或旧预设里若存了FSR,打开时会自动切回DLSS并在日志里写明。XeSS的生成帧只存在于显示交换链,导出管线拿不到;导出时会自动改用DLSS补帧,显卡不支持则关闭补帧。";
case 508:return L"导出码率:只决定导出文件的大小与画质,不影响预览。自动=编码器恒定质量档(NVENC CONSTQP / 系统编码器质量模式)。H.264 一般 10-40 Mbps 够用,4K 或高动态建议 60-150;HEVC 同等画质可以取更低。";
case 209:return L"选择运动估算后端。NVOF、FidelityFX、GPU DIS负责看出物体怎么动。DIS是实验算法,走通用计算单元,可能和NR抢活干,不保证更快;选它不会换掉你的补帧方式,也不会解锁AMD NR。";
+ case 210:return L"补帧的准入节奏。关闭(默认)=1.4.0 的规则:这一组生成帧只要整组能赶上最后一张的期限就生成。开启=更严格:组里第一张赶不上自己的期限就整组不生成,节奏更整齐,但生成的帧更少。";
case 211:return L"把增强参数恢复为内建默认。调迷路了就走这里,画质参数立即回到出厂状态。";
case 213:return L"在画面上拖框添加NR剔除区,Esc取消。把不想被NR改的地方圈出来。";
case 214:return L"清空当前NR剔除框。只是撤掉围栏,不会删除视频。";
diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.md
index 0b7e1e67..01f26d13 100644
--- a/docs/CURRENT_STATUS.md
+++ b/docs/CURRENT_STATUS.md
@@ -1,5 +1,15 @@
# 当前项目状态 / Current Status
+## 1.4.4 test6:UI 修复重构建(2026-09-22)
+
+test5 反馈的两处 UI 问题已修复并重构建:`严格补帧节奏` 之前不在帧生成页的 final layout 里
+(保留创建坐标 `y=190`,与上下两行实测重叠 4/12 dip),现已按 8 dip 节奏独占 `y=370` 一行;
+面板滚动改为在输入消息内提交整帧重绘(`RDW_UPDATENOW`)+ 视口外行虚拟化,滚动瞬间抓屏与
+稳定帧差值 4263→0 像素。补帧调度逻辑未改。新增 `veyra_settings_layout_tests`;受影响
+UI 门槛全过。产物 `E:\项目\Veyra\test-packages\1.4.4\Veyra-1.4.4-test6`
+(`veyra.exe` SHA256 `92AC81B14AB050895B33FD2A822C179F65C4A42BD89C6C00772B89C5684D7121`)。
+**未推送、未发布。** 详见 [WORKLOG](WORKLOG.md) 顶部。
+
## 最新入口:统一修复计划(2026-09-22)
分支 `codex/fg-independent-repair-20260922`(存档 `checkpoint/pre-fg-independent-repair-20260922`)。
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 605fc92e..cf008392 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1,5 +1,41 @@
# Veyra 工作记录
+## 2026-09-22 1.4.4 test6:严格补帧节奏行重排、面板滚动提交重绘
+
+用户反馈 test5 两处 UI 问题:`严格补帧节奏` 与其他控件黏在一起/重叠;专业模式快速滚动出现白影、
+重叠。定位结果(不是观感问题,是坐标与重绘两个实打实的 bug):
+
+- `210` 只加进了创建列表,没有加进 1479 行那段“final layout”重排里,保留了创建时的
+ `y=190`;而重排后的光流质量 combo 占 `166..194`、`补帧方式` 标签占 `214..238`,
+ 于是它同时压住上下两行。实测(`veyra_settings_layout_tests`)确认重叠 4 dip / 12 dip。
+- `arrange()` 用 `SWP_NOREDRAW` 搬子窗口后只做异步 `RDW_INVALIDATE`,滚动那一刻的屏幕
+ 仍是旧位置像素。实测滚动 3 格后立即抓屏与稳定后抓屏差 **4263 像素**。
+
+修复:
+
+- 帧生成页几何改为单一来源(创建后一次性按 8 dip 节奏排布):`210` 落在 `补帧倍率`
+ 正下方 `y=370`,上下各 ≥8 dip;`内容节奏/帧同步/状态` 依次下移;`Smooth Motion` 展开
+ 说明回到被它推动的区块之前(`helpOffset` 只影响它下面的行),展开后不再压住任何控件。
+- `严格补帧节奏` 标签缩短为“严格补帧节奏(默认关闭)”,完整含义进 `settingHelp(210)`
+ 提示;按钮点击/回读行为未变(仍走 `liveField`)。
+- `arrange(bool commitScroll)`:滚动路径(滚轮、滚动条、拖拽滚动条、焦点自动滚入)改为
+ `RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_UPDATENOW`,在输入消息内提交整帧;同时把滚出视口的
+ 行改为隐藏(虚拟化),一次滚动只重绘可见行。窗口尺寸变化/切页仍走原来的异步失效,
+ 避免恢复此前修掉的缩放卡顿。补帧调度逻辑一行未动。
+
+验证:新增 `veyra_settings_layout_tests`(96/192 DPI 布局 + 展开态 + 点击提交 + 滚动抓屏比对),
+`exit=0`,滚动残影 4263→**0 像素**;`veyra_slider_reset_tests`、`veyra_control_paint_tests`、
+`veyra_ui_contract_tests`(384 用例)、`veyra_repair_contract_tests`(205 项) 全过。
+打包后 test6 exe 实跑 `--nr --smoke-repair-ui`(30 s,p001.mp4)日志
+`PASS native controls, drafts, master sync, SR extent, scroll viewport, fullscreen, daily controls`,`exit=0`。
+(`--smoke-repair-ui` 不带 `--nr` 时会在 `NR_off_click_works_with_invalid_draft` 停住;用未改动的
+test5 exe 复现同一结果,属该冒烟对初始 NR 状态的既有依赖,不是本轮回归。)
+
+产物:`E:\项目\Veyra\build\release-144-20260922\veyra.exe`(1.4.4,
+SHA256 `92AC81B14AB050895B33FD2A822C179F65C4A42BD89C6C00772B89C5684D7121`),
+测试包 `E:\项目\Veyra\test-packages\1.4.4\Veyra-1.4.4-test6`(121 文件,与 test5 逐文件核对,
+仅 `veyra.exe` 不同,运行库/清单身份未变)。**未推送、未发布。**
+
## 2026-09-22 帧同步重新设计:输出上限接回生成量,删掉测不出作用的模式选择器
存档 `checkpoint/pre-pacing-redesign-20260922`。实测确认三个模式无差异后重做:
diff --git a/tests/integration/SettingsPageLayoutTests.cpp b/tests/integration/SettingsPageLayoutTests.cpp
new file mode 100644
index 00000000..491548f9
--- /dev/null
+++ b/tests/integration/SettingsPageLayoutTests.cpp
@@ -0,0 +1,331 @@
+// Professional-inspector layout and scroll-commit checks (1.4.4 test packages).
+//
+// The inspector moves its child windows instead of using a native scroll bar,
+// so two failure modes are easy to ship without noticing:
+//
+// 1. two controls placed on the same band (a row that "sticks" to the control
+// above it, or a control drawn on top of another one), and
+// 2. a scroll that only repositions the child windows and leaves the previous
+// position's pixels on the screen until the next WM_PAINT arrives.
+//
+// The panel keeps single-instance file-scope state, so every case runs in its
+// own process. Running this binary without an argument re-executes itself once
+// per case and aggregates the result.
+#include "../../apps/veyra/SettingsWindow.h"
+#include "../../apps/veyra/ui/Theme.h"
+#include <algorithm>
+#include <iostream>
+#include <string>
+#include <vector>
+
+namespace {
+int failures=0;
+void check(bool ok,const std::string& what){std::cout<<(ok?"PASS ":"FAIL ")<<what<<'\n';if(!ok)++failures;}
+void note(const std::string& what){std::cout<<"INFO "<<what<<'\n';}
+
+void pump(){
+ MSG msg{};
+ while(PeekMessageW(&msg,nullptr,0,0,PM_REMOVE)){
+ if(msg.message==WM_QUIT)continue;
+ TranslateMessage(&msg);
+ DispatchMessageW(&msg);
+ }
+}
+void dpiAware(){
+ using SetContext=BOOL(WINAPI*)(DPI_AWARENESS_CONTEXT);
+ if(auto set=reinterpret_cast<SetContext>(GetProcAddress(GetModuleHandleW(L"user32.dll"),"SetProcessDpiAwarenessContext"))){
+ if(set(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2))return;
+ }
+ SetProcessDPIAware();
+}
+
+struct Band{int id=0;int left=0;int top=0;int right=0;int bottom=0;};
+std::string text(const Band& b){
+ return "id="+std::to_string(b.id)+" band=["+std::to_string(b.left)+","+std::to_string(b.top)+" → "+
+ std::to_string(b.right)+","+std::to_string(b.bottom)+"]";
+}
+bool overlaps(const Band& a,const Band& b){
+ return a.left<b.right&&b.left<a.right&&a.top<b.bottom&&b.top<a.bottom;
+}
+int verticalGap(const Band& above,const Band& below){return below.top-above.bottom;}
+
+// Page 1 ("frame generation / motion estimation") controls, in reading order.
+// The capture/stream audio sync controls (1115/216/1116/217) belong to the audio
+// page, and 1120 is the collapsible Smooth Motion help text.
+const int kFramePageIds[]={1103,1111,208,1112,202,210,1113,209,215,204,1114,205,1110,
+ 240,242,243,244,1147,1150,221,1120};
+constexpr int kMinimumGap=6; // dip between stacked controls
+constexpr int kComfortableGap=8; // dip required around the strict-cadence switch
+
+Band bandOf(HWND body,HWND control){
+ RECT r{};
+ GetWindowRect(control,&r);
+ POINT top{r.left,r.top};
+ ScreenToClient(body,&top);
+ const int dpi=int(veyra::ui::layoutDpi(body));
+ Band band{};
+ band.id=GetDlgCtrlID(control);
+ band.left=MulDiv(top.x,96,dpi);
+ band.top=MulDiv(top.y,96,dpi);
+ band.right=MulDiv(top.x+(r.right-r.left),96,dpi);
+ band.bottom=MulDiv(top.y+(r.bottom-r.top),96,dpi);
+ return band;
+}
+
+int runLayoutCase(int dpi){
+ veyra::ui::smokeLayoutDpi=UINT(dpi);
+ veyra::engine::EngineController engine;
+ veyra::engine::EnhancementSettings received{};
+ bool delivered=false;
+ HWND parent=CreateWindowExW(0,L"STATIC",L"Veyra settings layout probe",
+ WS_OVERLAPPEDWINDOW|WS_VISIBLE|WS_CLIPCHILDREN,-4000,-4000,
+ MulDiv(420,dpi,96),MulDiv(920,dpi,96),nullptr,nullptr,GetModuleHandleW(nullptr),nullptr);
+ auto panel=veyra::ui::createSettingsPanel(parent,engine,[&](auto settings){
+ // The engine bumps the revision when it applies settings; modelling that
+ // here is what lets the panel accept the applied value back.
+ received=settings;++received.revision;delivered=true;return true;
+ });
+ SetWindowPos(panel,nullptr,0,0,MulDiv(400,dpi,96),MulDiv(880,dpi,96),SWP_NOZORDER|SWP_SHOWWINDOW);
+ veyra::ui::settingsPage(1);
+ pump();
+ HWND body=GetParent(veyra::ui::settingsControlForTest(202));
+ check(body==GetParent(veyra::ui::settingsControlForTest(210)),"page-1 controls share the scrolling body");
+
+ auto collect=[&]{
+ std::vector<Band> out;
+ for(int id:kFramePageIds){
+ auto control=veyra::ui::settingsControlForTest(id);
+ // Rows below the fold are hidden by the virtualization step, but
+ // they are still positioned, so their geometry can be measured.
+ if(!control){note("layout skip id="+std::to_string(id)+" (missing)");continue;}
+ out.push_back(bandOf(body,control));
+ }
+ return out;
+ };
+ auto spacing=[&](const std::vector<Band>& measured,const std::string& stage){
+ for(size_t i=0;i<measured.size();++i){
+ for(size_t j=i+1;j<measured.size();++j){
+ if(overlaps(measured[i],measured[j])){
+ check(false,stage+": controls must not overlap: "+text(measured[i])+" vs "+text(measured[j]));
+ continue;
+ }
+ const bool stacked=measured[i].left<measured[j].right&&measured[j].left<measured[i].right;
+ if(!stacked)continue;
+ const Band& above=measured[i].top<=measured[j].top?measured[i]:measured[j];
+ const Band& below=above.id==measured[i].id?measured[j]:measured[i];
+ const int gap=verticalGap(above,below);
+ if(gap<kMinimumGap)
+ check(false,stage+": stacked controls sit "+std::to_string(gap)+" dip apart (minimum "+
+ std::to_string(kMinimumGap)+"): "+text(above)+" vs "+text(below));
+ }
+ }
+ };
+
+ const auto bands=collect();
+ for(const auto& band:bands)note("layout dpi="+std::to_string(dpi)+" "+text(band));
+ check(bands.size()==std::size(kFramePageIds),"every frame-page control was created");
+ spacing(bands,"collapsed");
+
+ // The Smooth Motion explainer unfolds between the frame-generation and
+ // pacing rows. Expanding it used to be able to bury a control under another
+ // one, so the same spacing rules apply to the unfolded page.
+ SendMessageW(veyra::ui::settingsControlForTest(221),BM_CLICK,0,0);
+ pump();
+ const auto expanded=collect();
+ const auto* help=[&]()->const Band*{
+ for(const auto& band:expanded)if(band.id==1120)return &band;
+ return nullptr;
+ }();
+ check(help&&help->bottom-help->top>0,"expanding the Smooth Motion explainer gives it a readable height");
+ spacing(expanded,"help expanded");
+
+ // The 1.4.4 report was about the switch glued to its neighbours, so hold
+ // that row to the comfortable spacing against whatever rows it has.
+ auto find=[&](int id)->const Band*{
+ for(const auto& band:bands)if(band.id==id)return &band;
+ return nullptr;
+ };
+ const auto* strict=find(210);
+ check(strict!=nullptr,"the strict-cadence switch is present on the frame page");
+ if(strict){
+ int above=INT_MIN,below=INT_MAX;
+ for(const auto& band:bands){
+ if(band.id==strict->id)continue;
+ if(band.left>=strict->right||strict->left>=band.right)continue;
+ if(band.bottom<=strict->top)above=std::max(above,band.bottom);
+ if(band.top>=strict->bottom)below=std::min(below,band.top);
+ }
+ check(strict->top-above>=kComfortableGap,
+ "strict-cadence switch keeps "+std::to_string(kComfortableGap)+" dip above (measured "+
+ std::to_string(strict->top-above)+")");
+ check(below-strict->bottom>=kComfortableGap,
+ "strict-cadence switch keeps "+std::to_string(kComfortableGap)+" dip below (measured "+
+ std::to_string(below-strict->bottom)+")");
+ }
+
+ // The switch must still be the real control: clicking it submits the
+ // strictness flag, and feeding the applied settings back (which is what the
+ // player does on its next timer tick) must let it be turned off again.
+ auto toggle=veyra::ui::settingsControlForTest(210);
+ SendMessageW(toggle,BM_CLICK,0,0);
+ check(delivered&&received.fgStrictAdmission,"clicking the switch still submits fgStrictAdmission=true");
+ veyra::ui::settingsEnabled(false,received);
+ delivered=false;
+ SendMessageW(toggle,BM_CLICK,0,0);
+ check(delivered&&!received.fgStrictAdmission,"clicking again submits fgStrictAdmission=false");
+
+ DestroyWindow(parent);
+ pump();
+ veyra::ui::smokeLayoutDpi=0;
+ std::cout<<"CASE dpi="<<dpi<<" failures="<<failures<<'\n';
+ return failures;
+}
+
+struct Capture{
+ int width=0,height=0;
+ std::vector<uint32_t> pixels;
+ bool valid=false;
+};
+bool grab(HWND window,Capture& out){
+ RECT r{};
+ if(!GetWindowRect(window,&r))return false;
+ const int width=r.right-r.left,height=r.bottom-r.top;
+ if(width<=0||height<=0)return false;
+ HDC screen=GetDC(nullptr);
+ if(!screen)return false;
+ HDC memory=CreateCompatibleDC(screen);
+ BITMAPINFO info{};
+ info.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
+ info.bmiHeader.biWidth=width;
+ info.bmiHeader.biHeight=-height;
+ info.bmiHeader.biPlanes=1;
+ info.bmiHeader.biBitCount=32;
+ info.bmiHeader.biCompression=BI_RGB;
+ void* bits=nullptr;
+ HBITMAP bitmap=CreateDIBSection(screen,&info,DIB_RGB_COLORS,&bits,nullptr,0);
+ HGDIOBJ previous=SelectObject(memory,bitmap);
+ const BOOL copied=BitBlt(memory,0,0,width,height,screen,r.left,r.top,SRCCOPY);
+ GdiFlush();
+ out.width=width;
+ out.height=height;
+ out.pixels.assign(static_cast<uint32_t*>(bits),static_cast<uint32_t*>(bits)+size_t(width)*height);
+ out.valid=copied!=FALSE;
+ SelectObject(memory,previous);
+ DeleteObject(bitmap);
+ DeleteDC(memory);
+ ReleaseDC(nullptr,screen);
+ return out.valid;
+}
+size_t pixelDiff(const Capture& a,const Capture& b){
+ if(a.width!=b.width||a.height!=b.height)return SIZE_MAX;
+ size_t differing=0;
+ for(size_t i=0;i<a.pixels.size();++i)
+ if((a.pixels[i]&0xffffffu)!=(b.pixels[i]&0xffffffu))++differing;
+ return differing;
+}
+double darkFraction(const Capture& capture){
+ size_t dark=0;
+ for(auto pixel:capture.pixels){
+ const auto red=pixel&255u,green=(pixel>>8)&255u,blue=(pixel>>16)&255u;
+ if(red<70&&green<70&&blue<70)++dark;
+ }
+ return capture.pixels.empty()?0.0:double(dark)/double(capture.pixels.size());
+}
+
+int runScrollCase(){
+ veyra::ui::smokeLayoutDpi=0;
+ dpiAware();
+ const UINT dpi=GetDpiForSystem();
+ MONITORINFO monitor{sizeof(monitor)};
+ GetMonitorInfoW(MonitorFromPoint({0,0},MONITOR_DEFAULTTOPRIMARY),&monitor);
+ const int workWidth=monitor.rcWork.right-monitor.rcWork.left;
+ const int workHeight=monitor.rcWork.bottom-monitor.rcWork.top;
+ const int width=std::min(MulDiv(440,int(dpi),96),workWidth-40);
+ const int height=std::min(MulDiv(920,int(dpi),96),workHeight-80);
+ veyra::engine::EngineController engine;
+ HWND parent=CreateWindowExW(WS_EX_TOPMOST,L"STATIC",L"Veyra settings scroll probe",
+ WS_POPUP|WS_VISIBLE,monitor.rcWork.left+20,monitor.rcWork.top+20,width,height,
+ nullptr,nullptr,GetModuleHandleW(nullptr),nullptr);
+ auto panel=veyra::ui::createSettingsPanel(parent,engine,[](auto){return true;});
+ SetWindowPos(panel,nullptr,0,0,width,height,SWP_NOZORDER|SWP_SHOWWINDOW);
+ veyra::ui::settingsPage(1);
+ SetWindowPos(parent,HWND_TOPMOST,monitor.rcWork.left+20,monitor.rcWork.top+20,width,height,SWP_SHOWWINDOW);
+ SetForegroundWindow(parent);
+ pump();
+ Sleep(200);
+ pump();
+ HWND body=GetParent(veyra::ui::settingsControlForTest(202));
+ Capture baseline{};
+ grab(body,baseline);
+ const double visible=darkFraction(baseline);
+ note("scroll probe dpi="+std::to_string(dpi)+" body="+std::to_string(baseline.width)+"x"+
+ std::to_string(baseline.height)+" dark="+std::to_string(visible));
+ if(!baseline.valid||visible<0.5){
+ note("scroll case skipped: the probe window is occluded or off screen "
+ "(dark fraction "+std::to_string(visible)+"); rerun with the desktop visible");
+ DestroyWindow(parent);
+ return 0;
+ }
+
+ // One wheel notch worth of scrolling. The handler must leave the window in
+ // its final state before it returns; a deferred repaint is exactly what the
+ // user sees as ghosting/duplicated controls while scrolling.
+ SendMessageW(panel,WM_MOUSEWHEEL,MAKEWPARAM(0,-WHEEL_DELTA*3),0);
+ Sleep(80); // let the compositor present, but do not
+ Capture immediate{}; // pump: a queued WM_PAINT must not rescue it
+ grab(body,immediate);
+ pump();
+ RedrawWindow(body,nullptr,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_UPDATENOW);
+ pump();
+ Sleep(60);
+ Capture settled{};
+ grab(body,settled);
+ const size_t stale=pixelDiff(immediate,settled);
+ check(stale==0,"a wheel scroll shows the settled frame before returning ("+std::to_string(stale)+" stale pixels)");
+ check(pixelDiff(baseline,settled)>0,"the wheel scroll moved the view");
+
+ DestroyWindow(parent);
+ pump();
+ std::cout<<"CASE scroll failures="<<failures<<'\n';
+ return failures;
+}
+
+int runSelf(const std::wstring& argument){
+ wchar_t path[MAX_PATH]{};
+ GetModuleFileNameW(nullptr,path,MAX_PATH);
+ std::wstring command=L"\""+std::wstring(path)+L"\" "+argument;
+ STARTUPINFOW startup{sizeof(startup)};
+ PROCESS_INFORMATION process{};
+ if(!CreateProcessW(nullptr,command.data(),nullptr,nullptr,FALSE,0,nullptr,nullptr,&startup,&process)){
+ std::wcout<<L"FAIL could not re-execute the layout probe for case "<<argument<<L"\n";
+ return 1;
+ }
+ WaitForSingleObject(process.hProcess,INFINITE);
+ DWORD code=0;
+ GetExitCodeProcess(process.hProcess,&code);
+ CloseHandle(process.hThread);
+ CloseHandle(process.hProcess);
+ return int(code);
+}
+}
+
+int wmain(int argc,wchar_t** argv){
+ Gdiplus::GdiplusStartupInput graphicsInput;
+ ULONG_PTR graphicsToken=0;
+ Gdiplus::GdiplusStartup(&graphicsToken,&graphicsInput,nullptr);
+ INITCOMMONCONTROLSEX controls{sizeof(controls),ICC_WIN95_CLASSES};
+ InitCommonControlsEx(&controls);
+ int result=0;
+ if(argc>1){
+ const std::wstring mode=argv[1];
+ if(mode==L"96")result=runLayoutCase(96);
+ else if(mode==L"192")result=runLayoutCase(192);
+ else if(mode==L"scroll")result=runScrollCase();
+ else{std::cout<<"FAIL unknown case\n";result=1;}
+ }else{
+ for(const wchar_t* mode:{L"96",L"192",L"scroll"})result+=runSelf(mode);
+ std::cout<<(result?"FAILED":"PASS")<<": settings page layout and scroll commit ("<<result<<" failures)\n";
+ }
+ Gdiplus::GdiplusShutdown(graphicsToken);
+ return result;
+}