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): use real desktop acrylic and repair player controls
Veyra Goal Agent97ccd1962f2d
diff --git a/apps/veyra/SettingsWindow.cpp b/apps/veyra/SettingsWindow.cppindex 6279c5d8..ecdd138e 100644--- a/apps/veyra/SettingsWindow.cpp+++ b/apps/veyra/SettingsWindow.cpp@@ -7,83 +7,113 @@#include <array>namespace veyra::ui {namespace {-HWND window=nullptr;engine::EngineController* controller=nullptr;HFONT font=nullptr;-std::function<void(engine::EnhancementSettings)> apply;-engine::PresetStore store(std::filesystem::path(VEYRA_PROJECT_ROOT)/"runtime_local/user-presets.v1");bool loaded=false,dirty=false,populating=false,enhancementEnabled=true;int page=0,scroll=0,contentHeight=0;uint64_t displayedRevision=0;+HWND window=nullptr,body=nullptr;engine::EngineController* controller=nullptr;HFONT font=nullptr;+std::function<bool(engine::EnhancementSettings)> apply;+engine::PresetStore store(std::filesystem::path(VEYRA_PROJECT_ROOT)/"runtime_local/user-presets.v1");bool loaded=false,dirty=false,populating=false,enhancementEnabled=true;int page=0,scroll=0,contentHeight=0;uint64_t displayedRevision=0;engine::EnhancementSettings configuredSettings;struct Item{HWND h;int page,x,y,w,height;};std::vector<Item> items;+HWND item(int id){for(auto& entry:items)if(GetDlgCtrlID(entry.h)==id)return entry.h;return nullptr;}+LRESULT send(int id,UINT message,WPARAM w=0,LPARAM l=0){return SendMessageW(item(id),message,w,l);}+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,GetDpiForWindow(window)));}+void arrange();+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_LBUTTONUP&&GetCapture()==h){ReleaseCapture();return 0;}+ return DefWindowProcW(h,msg,wp,lp);+}+const wchar_t* labels[]={L"模型强度",L"局部明暗",L"局部结构",L"肤质 · 未证实",L"风格 · 实验",L"自动遮罩 · 实验",L"UI修正 · 未证实",L"总变化强度",L"暗化变化",L"亮化变化",L"色彩变化",L"明度变化"};void loadStore(){if(!loaded){store.load();loaded=true;}}-void message(const std::wstring& text){SetDlgItemTextW(window,401,text.c_str());}-void populate(engine::EnhancementSettings s){populating=true;float v[]={s.model.intensity,s.model.tone,s.model.structure,s.model.skin,float(s.model.style),float(s.model.autoMask),float(s.model.uiCorrection),s.residual.total,s.residual.darken,s.residual.brighten,s.residual.color,s.residual.luminance};for(int i=0;i<12;++i){std::wostringstream o;o<<std::setprecision(7)<<v[i];SetDlgItemTextW(window,100+i,o.str().c_str());SendDlgItemMessageW(window,600+i,TBM_SETPOS,TRUE,LPARAM(v[i]*(i>=4&&i<=6?1:100)));}CheckDlgButton(window,200,s.nr?BST_CHECKED:BST_UNCHECKED);CheckDlgButton(window,201,s.sr?BST_CHECKED:BST_UNCHECKED);SendDlgItemMessageW(window,202,CB_SETCURSEL,s.multiplier-1,0);SendDlgItemMessageW(window,203,CB_SETCURSEL,int(s.nrPolicy),0);SendDlgItemMessageW(window,204,CB_SETCURSEL,int(s.flow),0);SendDlgItemMessageW(window,205,CB_SETCURSEL,int(s.content),0);displayedRevision=s.revision;populating=false;dirty=false;}-bool read(engine::EnhancementSettings& s){s=controller->snapshot().desired;float v[12]{};for(int i=0;i<12;++i){wchar_t b[64]{};GetDlgItemTextW(window,100+i,b,64);wchar_t* end=nullptr;v[i]=wcstof(b,&end);if(end==b||*end||!std::isfinite(v[i])){message(L"请输入完整的有限数值;未提交设置");return false;}}+void message(const std::wstring& text){putText(401,text.c_str());}+bool submit(engine::EnhancementSettings s){if(!apply(s)){dirty=true;message(L"总增强正在切换;草稿保留,请稍后应用。");return false;}dirty=false;return true;}+void populate(engine::EnhancementSettings s){populating=true;float v[]={s.model.intensity,s.model.tone,s.model.structure,s.model.skin,float(s.model.style),float(s.model.autoMask),float(s.model.uiCorrection),s.residual.total,s.residual.darken,s.residual.brighten,s.residual.color,s.residual.luminance};for(int i=0;i<12;++i){std::wostringstream o;o<<std::setprecision(7)<<v[i];putText(100+i,o.str().c_str());send(600+i,TBM_SETPOS,TRUE,LPARAM(v[i]*(i>=4&&i<=6?1:100)));}check(200,s.nr?BST_CHECKED:BST_UNCHECKED);check(201,s.sr?BST_CHECKED:BST_UNCHECKED);send(202,CB_SETCURSEL,s.multiplier-1,0);send(203,CB_SETCURSEL,int(s.nrPolicy),0);send(204,CB_SETCURSEL,int(s.flow),0);send(205,CB_SETCURSEL,int(s.content),0);displayedRevision=s.revision;populating=false;dirty=false;}+bool read(engine::EnhancementSettings& s){s=enhancementEnabled?controller->snapshot().desired:configuredSettings;float v[12]{};for(int i=0;i<12;++i){wchar_t b[64]{};GetWindowTextW(item(100+i),b,64);wchar_t* end=nullptr;v[i]=wcstof(b,&end);if(end==b||*end||!std::isfinite(v[i])){message(L"请输入完整的有限数值;未提交设置");return false;}}for(int i=4;i<7;++i)if(v[i]!=std::floor(v[i])||v[i]<0||v[i]>(i==4?2:1)){message(L"风格/遮罩/UI修正必须为整数");return false;}- s.model={v[0],v[1],v[2],v[3],int(v[4]),int(v[5]),int(v[6])};s.residual={v[7],v[8],v[9],v[10],v[11]};s.nr=IsDlgButtonChecked(window,200)==BST_CHECKED;s.sr=IsDlgButtonChecked(window,201)==BST_CHECKED;s.multiplier=uint32_t(SendDlgItemMessageW(window,202,CB_GETCURSEL,0,0)+1);s.nrPolicy=static_cast<pipeline::NrSizePolicy>(SendDlgItemMessageW(window,203,CB_GETCURSEL,0,0));s.flow=static_cast<engine::FlowQuality>(SendDlgItemMessageW(window,204,CB_GETCURSEL,0,0));s.content=static_cast<engine::ContentRate>(SendDlgItemMessageW(window,205,CB_GETCURSEL,0,0));if(!s.validate().empty()){message(L"参数越界,未提交。悬停数值框查看允许范围。");return false;}return true;}+ s.model={v[0],v[1],v[2],v[3],int(v[4]),int(v[5]),int(v[6])};s.residual={v[7],v[8],v[9],v[10],v[11]};if(enhancementEnabled){s.nr=checked(200)==BST_CHECKED;s.sr=checked(201)==BST_CHECKED;}s.multiplier=uint32_t(send(202,CB_GETCURSEL,0,0)+1);s.nrPolicy=static_cast<pipeline::NrSizePolicy>(send(203,CB_GETCURSEL,0,0));s.flow=static_cast<engine::FlowQuality>(send(204,CB_GETCURSEL,0,0));s.content=static_cast<engine::ContentRate>(send(205,CB_GETCURSEL,0,0));if(!s.validate().empty()){message(L"参数越界,未提交。悬停数值框查看允许范围。");return false;}return true;}-void refreshPresets(){auto list=GetDlgItem(window,300);SendMessageW(list,CB_RESETCONTENT,0,0);for(auto& p:store.entries())SendMessageW(list,CB_ADDSTRING,0,reinterpret_cast<LPARAM>(p.name.c_str()));if(!store.entries().empty())SendMessageW(list,CB_SETCURSEL,0,0);PostMessageW(GetParent(window),WM_APP+42,0,0);}-void arrange(){if(!window)return;RECT r{};GetClientRect(window,&r);int width=MulDiv(r.right,96,GetDpiForWindow(window)),height=MulDiv(r.bottom,96,GetDpiForWindow(window));const int sticky=88,viewport=std::max(1,height-sticky);contentHeight=0;for(auto& item:items)if(item.page==page)contentHeight=std::max(contentHeight,item.y+(GetDlgCtrlID(item.h)>=202&&GetDlgCtrlID(item.h)<=205?36:item.height)+12);scroll=std::clamp(scroll,0,std::max(0,contentHeight-viewport));- auto batch=BeginDeferWindowPos(int(items.size()));for(auto& item:items){bool fixed=item.page==-1;bool visible=item.page==page||fixed;int w=item.w<0?width-item.x-12:item.w;int y=fixed?(GetDlgCtrlID(item.h)==400?0:42):item.y-scroll+sticky;int itemHeight=fixed?42:item.height;batch=DeferWindowPos(batch,item.h,fixed?HWND_TOP:nullptr,dip(window,item.x),dip(window,y),dip(window,std::max(1,w)),dip(window,itemHeight),SWP_NOACTIVATE|(fixed?0:SWP_NOZORDER)|(visible?SWP_SHOWWINDOW:SWP_HIDEWINDOW));if(!fixed){auto clip=CreateRectRgn(0,dip(window,std::max(0,sticky-y)),dip(window,std::max(1,w)),dip(window,std::max(0,std::min(itemHeight,height-y))));SetWindowRgn(item.h,clip,FALSE);}}EndDeferWindowPos(batch);InvalidateRect(window,nullptr,FALSE);+void refreshPresets(){auto list=item(300);SendMessageW(list,CB_RESETCONTENT,0,0);for(auto& p:store.entries())SendMessageW(list,CB_ADDSTRING,0,reinterpret_cast<LPARAM>(p.name.c_str()));if(!store.entries().empty())SendMessageW(list,CB_SETCURSEL,0,0);PostMessageW(GetParent(window),WM_APP+42,0,0);}+void arrange(){+ if(!window||!body)return;RECT r{};GetClientRect(window,&r);int width=MulDiv(r.right,96,GetDpiForWindow(window)),height=MulDiv(r.bottom,96,GetDpiForWindow(window));+ const int sticky=88,viewport=std::max(1,height-sticky);contentHeight=0;+ for(auto& entry:items)if(entry.page==page){wchar_t cls[32]{};GetClassNameW(entry.h,cls,32);contentHeight=std::max(contentHeight,entry.y+(_wcsicmp(cls,L"COMBOBOX")==0?36:entry.height)+12);}+ 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.page==page||fixed;int w=entry.w<0?width-entry.x-12:entry.w;int y=fixed?(GetDlgCtrlID(entry.h)==400?0:42):entry.y-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);}-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|style,0,0,1,1,window,reinterpret_cast<HMENU>(INT_PTR(id)),GetModuleHandleW(nullptr),nullptr);SendMessageW(h,WM_SETFONT,WPARAM(font),TRUE);themeControl(h);items.push_back({h,group,x,y,width,height});return h;}++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);items.push_back({h,group,x,y,width,height});return h;}void button(const wchar_t* title,int id,int group,int x,int y,int width=-1){add(L"BUTTON",title,id,BS_PUSHBUTTON|WS_TABSTOP,group,x,y,width,36);}void combo(int id,int group,int y,std::initializer_list<const wchar_t*> names){auto h=add(L"COMBOBOX",L"",id,CBS_DROPDOWNLIST|WS_VSCROLL|WS_TABSTOP,group,12,y,-1,200);for(auto name:names)SendMessageW(h,CB_ADDSTRING,0,LPARAM(name));}LRESULT CALLBACK proc(HWND h,UINT msg,WPARAM wp,LPARAM lp){switch(msg){case WM_CREATE:{window=h;font=makeFont(h);items.clear();+ WNDCLASSW bodyClass{};bodyClass.lpfnWndProc=bodyProc;bodyClass.hInstance=GetModuleHandleW(nullptr);bodyClass.lpszClassName=L"VeyraInspectorBody";bodyClass.hCursor=LoadCursorW(nullptr,IDC_ARROW);RegisterClassW(&bodyClass);+ body=CreateWindowExW(WS_EX_CONTROLPARENT,bodyClass.lpszClassName,L"滚动参数",WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS,0,88,300,300,h,nullptr,bodyClass.hInstance,nullptr);add(L"BUTTON",L"DLSS5 NR 增强",200,BS_AUTOCHECKBOX|WS_TABSTOP,0,12,12,-1,36);- add(L"BUTTON",L"SR 输出4K底图",201,BS_AUTOCHECKBOX|WS_TABSTOP,0,12,56,-1,36);+ add(L"BUTTON",L"DLSS 超分辨率 · 4K",201,BS_AUTOCHECKBOX|WS_TABSTOP,0,12,56,-1,36);combo(203,0,104,{L"实时NR · 约1080内部处理",L"原生NR · 高性能成本"});add(L"STATIC",L"模型参数",1100,0,0,12,146,-1,24);- for(int i=0;i<12;++i){const int y=174+i*62+(i>=7?32:0);add(L"STATIC",labels[i],1000+i,0,0,12,y,176,28);add(L"EDIT",L"",100+i,ES_AUTOHSCROLL|WS_TABSTOP|ES_RIGHT,0,202,y,-1,28);const wchar_t* ranges[]={L"范围:0–1",L"范围:0–1",L"范围:0–1",L"-1表示默认;其余范围0–2(效果未证实)",L"整数0、1、2(实验)",L"整数0或1(实验)",L"整数0或1(效果未证实)",L"范围:0–2",L"范围:0–2",L"范围:0–2",L"范围:0–2",L"范围:0–2"};SetPropW(GetDlgItem(h,100+i),L"veyra.tip",HANDLE(ranges[i]));auto slider=add(TRACKBAR_CLASSW,L"",600+i,TBS_HORZ|TBS_NOTICKS|WS_TABSTOP,0,12,y+32,-1,16);SendMessageW(slider,TBM_SETRANGE,TRUE,MAKELPARAM(i==3?-100:0,i>=4&&i<=6?(i==4?2:1):i<3?100:200));}+ for(int i=0;i<12;++i){const int y=174+i*62+(i>=7?32:0);add(L"STATIC",labels[i],1000+i,0,0,12,y,176,28);add(L"EDIT",L"",100+i,ES_AUTOHSCROLL|WS_TABSTOP|ES_RIGHT,0,202,y,-1,28);const wchar_t* ranges[]={L"范围:0–1",L"范围:0–1",L"范围:0–1",L"-1表示默认;其余范围0–2(效果未证实)",L"整数0、1、2(实验)",L"整数0或1(实验)",L"整数0或1(效果未证实)",L"范围:0–2",L"范围:0–2",L"范围:0–2",L"范围:0–2",L"范围:0–2"};SetPropW(item(100+i),L"veyra.tip",HANDLE(ranges[i]));auto slider=add(TRACKBAR_CLASSW,L"",600+i,TBS_HORZ|TBS_NOTICKS|WS_TABSTOP,0,12,y+32,-1,16);SendMessageW(slider,TBM_SETRANGE,TRUE,MAKELPARAM(i==3?-100:0,i>=4&&i<=6?(i==4?2:1):i<3?100:200));}add(L"STATIC",L"增强变化量",1101,0,0,12,606,-1,24);add(L"STATIC",L"肤质 / 风格 / 遮罩 / UI键为本地实验参数。未验证的效果不会标成可用能力。",1102,0,0,12,956,-1,70);- button(L"应用整套设置",210,0,12,1034);marked(GetDlgItem(h,210));button(L"恢复内建默认",211,0,12,1078);+ button(L"应用整套设置",210,0,12,1034);marked(item(210));button(L"恢复内建默认",211,0,12,1078);add(L"STATIC",L"补帧与运动估算",1103,0,1,12,12,-1,30);combo(202,1,52,{L"关闭补帧",L"DLSSG 2X",L"DLSSG 3X · 需硬件支持",L"DLSSG 4X · 需硬件支持"});combo(204,1,104,{L"光流 · 性能",L"光流 · 平衡",L"光流 · 质量"});combo(205,1,156,{L"采用源时间戳",L"自动识别内容节奏",L"识别30fps内容节奏",L"识别50fps内容节奏",L"识别60fps内容节奏"});add(L"STATIC",L"运动为估算输入。倍率不代表实际显示帧率。比较时只展示真实帧;采集补帧需要等待下一张源帧。",1104,0,1,12,210,-1,100);- button(L"应用补帧与当前参数",212,1,12,326);marked(GetDlgItem(h,212));- add(L"STATIC",L"用户预设",1105,0,2,12,12,-1,30);combo(300,2,56,{});add(L"EDIT",L"新预设",301,ES_AUTOHSCROLL|WS_TABSTOP,2,12,108,-1,36);SendDlgItemMessageW(h,301,EM_SETLIMITTEXT,48,0);+ button(L"应用补帧与当前参数",212,1,12,326);marked(item(212));+ add(L"STATIC",L"用户预设",1105,0,2,12,12,-1,30);combo(300,2,56,{});add(L"EDIT",L"新预设",301,ES_AUTOHSCROLL|WS_TABSTOP,2,12,108,-1,36);send(301,EM_SETLIMITTEXT,48,0);const wchar_t* names[]={L"载入所选预设",L"新建内建默认预设",L"保存当前参数为新预设",L"重命名所选",L"删除所选",L"设为启动增强默认"};for(int i=0;i<6;++i)button(names[i],310+i,2,12,164+i*44);add(L"STATIC",L"启动界面始终为日常模式。默认预设只决定增强参数;预设文件损坏时保留原文件。",1106,0,2,12,438,-1,82);- add(L"STATIC",L"原生画质导出",1107,0,3,12,12,-1,32);combo(500,3,60,{L"H.264 · MP4",L"HEVC · MP4"});SendDlgItemMessageW(h,500,CB_SETCURSEL,0,0);+ add(L"STATIC",L"原生画质导出",1107,0,3,12,12,-1,32);combo(500,3,60,{L"H.264 · MP4",L"HEVC · MP4"});send(500,CB_SETCURSEL,0,0);add(L"STATIC",L"冻结启动时整套参数;NR按原生尺寸处理。保留兼容音轨。VFR不改写为CFR;字幕不烧录。",1108,0,3,12,108,-1,94);- button(L"选择位置并导出视频",501,3,12,212);marked(GetDlgItem(h,501));button(L"保存当前图片 / 视频帧",502,3,12,256);+ button(L"选择位置并导出视频",501,3,12,212);marked(item(501));button(L"保存当前图片 / 视频帧",502,3,12,256);button(L"暂停 / 继续导出",503,3,12,310);button(L"取消导出",504,3,12,354);- add(L"BUTTON",L"优先观看 · 降低导出占用",505,BS_AUTOCHECKBOX|WS_TABSTOP,3,12,406,-1,36);CheckDlgButton(h,505,BST_CHECKED);+ add(L"BUTTON",L"优先观看 · 降低导出占用",505,BS_AUTOCHECKBOX|WS_TABSTOP,3,12,406,-1,36);check(505,BST_CHECKED);add(L"STATIC",L"",506,0,3,12,458,-1,120);add(L"STATIC",L"",507,0,3,12,588,-1,80);add(L"STATIC",L"",400,0,-1,12,900,-1,92);add(L"STATIC",L"",401,0,-1,12,996,-1,86);loadStore();refreshPresets();populate(controller->snapshot().desired);message(store.error());SetTimer(h,1,250,nullptr);arrange();return 0;}case WM_SIZE:arrange();return 0;-case WM_PAINT:{PAINTSTRUCT ps{};auto dc=BeginPaint(h,&ps);RECT r{};GetClientRect(h,&r);FillRect(dc,&r,panelBrush());int height=MulDiv(r.bottom,96,GetDpiForWindow(h));if(contentHeight>height){float ratio=float(height)/contentHeight;int thumb=std::max(dip(h,30),int(r.bottom*ratio));int y=int((r.bottom-thumb)*float(scroll)/std::max(1,contentHeight-height));RECT bar{r.right-dip(h,5),y,r.right-dip(h,2),y+thumb};roundRect(dc,bar,line,dip(h,2));}EndPaint(h,&ps);return 0;}-case WM_LBUTTONDOWN:case WM_MOUSEMOVE:if(msg==WM_LBUTTONDOWN&&GET_X_LPARAM(lp)<([](HWND w){RECT r{};GetClientRect(w,&r);return r.right;})(h)-dip(h,12))break;if(msg==WM_LBUTTONDOWN)SetCapture(h);if(GetCapture()==h){RECT r{};GetClientRect(h,&r);int height=MulDiv(r.bottom,96,GetDpiForWindow(h));scroll=int(float(GET_Y_LPARAM(lp))/std::max(1L,r.bottom)*std::max(0,contentHeight-height));arrange();return 0;}break;-case WM_LBUTTONUP:if(GetCapture()==h)ReleaseCapture();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*90;arrange();return 0;case WM_CTLCOLORSTATIC:case WM_CTLCOLOREDIT:case WM_CTLCOLORLISTBOX:case WM_CTLCOLORBTN:return colors(msg,wp,lp);-case WM_COMMAND:{const int id=LOWORD(wp);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,GetDpiForWindow(h))-88;if(item.y<scroll)scroll=item.y;if(item.y+item.height>scroll+height)scroll=item.y+item.height-height;arrange();break;}}if(!populating&&(HIWORD(wp)==EN_CHANGE&&id>=100&&id<=111||HIWORD(wp)==CBN_SELCHANGE&&id>=202&&id<=205||id==200||id==201)){dirty=true;message(L"参数草稿尚未应用。无效草稿保留;切换面板不会提交。");}- engine::EnhancementSettings s;wchar_t name[128]{};GetDlgItemTextW(h,301,name,128);const auto index=size_t(SendDlgItemMessageW(h,300,CB_GETCURSEL,0,0));bool ok=true;- if(id==210||id==212){KillTimer(h,2);if(read(s)){apply(s);dirty=false;message(L"设置已请求;在真实帧边界确认已应用后生效");}}- else if(id==211){s={};populate(s);apply(s);message(L"已请求恢复内建默认;用户预设保留");}- else if(id==310&&index<store.entries().size()){s=store.entries()[index].settings;populate(s);apply(s);}+case WM_COMMAND:{const int id=LOWORD(wp);if((id==200||id==201)&&HIWORD(wp)==BN_CLICKED){KillTimer(h,2);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,GetDpiForWindow(h))-88;if(item.y<scroll)scroll=item.y;if(item.y+item.height>scroll+height)scroll=item.y+item.height-height;arrange();break;}}if(!populating&&(HIWORD(wp)==EN_CHANGE&&id>=100&&id<=111||HIWORD(wp)==CBN_SELCHANGE&&id>=202&&id<=205)){dirty=true;message(L"参数草稿尚未应用。无效草稿保留;切换面板不会提交。");}+ engine::EnhancementSettings s;wchar_t name[128]{};GetWindowTextW(item(301),name,128);const auto index=size_t(send(300,CB_GETCURSEL,0,0));bool ok=true;+ if(id==210||id==212){KillTimer(h,2);if(read(s)&&submit(s)){message(L"设置已请求;在真实帧边界确认已应用后生效");}}+ else if(id==211){s={};if(submit(s)){populate(s);message(L"已请求恢复内建默认;用户预设保留");}}+ else if(id==310&&index<store.entries().size()){s=store.entries()[index].settings;if(submit(s))populate(s);}else if(id==311){ok=store.put(name,{});refreshPresets();}else if(id==312){if(read(s))ok=store.put(name,s);refreshPresets();}else if(id==313){ok=store.rename(index,name);refreshPresets();}else if(id==314&&index<store.entries().size()){if(MessageBoxW(h,(L"删除预设“"+store.entries()[index].name+L"”?当前画质不受影响。").c_str(),L"删除预设",MB_YESNO|MB_ICONQUESTION)==IDYES){ok=store.erase(index);refreshPresets();}}else if(id==315)ok=store.setDefault(index);- else if(id>=501&&id<=505)SendMessageW(GetParent(h),WM_APP+41,id,id==501?SendDlgItemMessageW(h,500,CB_GETCURSEL,0,0):id==505?IsDlgButtonChecked(h,505):0);+ else if(id>=501&&id<=505)SendMessageW(GetParent(h),WM_APP+41,id,id==501?send(500,CB_GETCURSEL,0,0):id==505?checked(505):0);if(!ok)message(store.error());return 0;}-case WM_HSCROLL:{int id=GetDlgCtrlID(reinterpret_cast<HWND>(lp));if(id>=600&&id<612){int index=id-600;float v=float(SendMessageW(reinterpret_cast<HWND>(lp),TBM_GETPOS,0,0))/(index>=4&&index<=6?1:100);if(index==3&&v<0)v=-1;std::wostringstream o;o<<std::setprecision(4)<<v;SetDlgItemTextW(h,100+index,o.str().c_str());SetTimer(h,2,120,nullptr);}return 0;}-case WM_TIMER:{if(wp==2){KillTimer(h,2);engine::EnhancementSettings setting;if(read(setting)){apply(setting);dirty=false;message(enhancementEnabled?L"已请求参数;帧边界确认生效":L"增强关闭中:已保存待启用参数");}return 0;}auto s=controller->snapshot();if(enhancementEnabled&&!dirty&&displayedRevision!=s.desired.revision)populate(s.desired);std::wostringstream o;o<<L"期望版本 "<<s.desired.revision<<L" / 已应用 "<<s.applied.revision<<(s.applying?L" · 应用中":L"")<<L"\n强度 "<<s.applied.model.intensity<<L" · 变化量 "<<s.applied.residual.total<<L" · 倍率 "<<s.applied.multiplier<<L"X";setText(GetDlgItem(h,400),o.str());return 0;}-case WM_DESTROY:KillTimer(h,1);KillTimer(h,2);DeleteObject(font);window=nullptr;items.clear();return 0;+case WM_HSCROLL:{int id=GetDlgCtrlID(reinterpret_cast<HWND>(lp));if(id>=600&&id<612){int index=id-600;float v=float(SendMessageW(reinterpret_cast<HWND>(lp),TBM_GETPOS,0,0))/(index>=4&&index<=6?1:100);if(index==3&&v<0)v=-1;std::wostringstream o;o<<std::setprecision(4)<<v;putText(100+index,o.str().c_str());SetTimer(h,2,120,nullptr);}return 0;}+case WM_TIMER:{if(wp==2){KillTimer(h,2);engine::EnhancementSettings setting;if(read(setting)&&submit(setting)){message(enhancementEnabled?L"已请求参数;帧边界确认生效":L"增强关闭中:已保存待启用参数");}return 0;}auto s=controller->snapshot();if(enhancementEnabled&&!dirty&&displayedRevision!=s.desired.revision)populate(s.desired);check(200,enhancementEnabled&&s.desired.nr?BST_CHECKED:BST_UNCHECKED);check(201,enhancementEnabled&&s.desired.sr?BST_CHECKED:BST_UNCHECKED);std::wostringstream o;if(!s.running&&!s.frames&&s.transport!=engine::TransportState::Opening)o<<L"未打开媒体 · 设置待启用\n";else o<<L"期望版本 "<<s.desired.revision<<L" / 已应用 "<<s.applied.revision<<(s.applying?L" · 应用中":L"")<<L"\n强度 "<<s.applied.model.intensity<<L" · 变化量 "<<s.applied.residual.total<<L" · 倍率 "<<s.applied.multiplier<<L"X";setText(item(400),o.str());return 0;}+case WM_DESTROY:KillTimer(h,1);KillTimer(h,2);DeleteObject(font);window=nullptr;body=nullptr;items.clear();return 0;}return DefWindowProcW(h,msg,wp,lp);}}engine::EnhancementSettings defaultSettings(){loadStore();return store.defaultSettings();}+HWND settingsControlForTest(int id){return item(id);}std::vector<std::wstring> presetNames(){loadStore();std::vector<std::wstring> out;for(auto& p:store.entries())out.push_back(p.name);return out;}bool presetAt(size_t index,engine::EnhancementSettings& out){loadStore();if(index>=store.entries().size())return false;out=store.entries()[index].settings;return true;}-HWND createSettingsPanel(HWND parent,engine::EngineController& engine,std::function<void(engine::EnhancementSettings)> callback){controller=&engine;apply=std::move(callback);WNDCLASSW wc{};wc.lpfnWndProc=proc;wc.hInstance=GetModuleHandleW(nullptr);wc.lpszClassName=L"VeyraInspector";wc.hbrBackground=panelBrush();wc.hCursor=LoadCursorW(nullptr,IDC_ARROW);RegisterClassW(&wc);return CreateWindowExW(WS_EX_CONTROLPARENT,wc.lpszClassName,L"专业参数",WS_CHILD|WS_CLIPCHILDREN,0,0,328,500,parent,nullptr,wc.hInstance,nullptr);}+HWND createSettingsPanel(HWND parent,engine::EngineController& engine,std::function<bool(engine::EnhancementSettings)> callback){controller=&engine;apply=std::move(callback);WNDCLASSW wc{};wc.lpfnWndProc=proc;wc.hInstance=GetModuleHandleW(nullptr);wc.lpszClassName=L"VeyraInspector";wc.hbrBackground=panelBrush();wc.hCursor=LoadCursorW(nullptr,IDC_ARROW);RegisterClassW(&wc);return CreateWindowExW(WS_EX_CONTROLPARENT,wc.lpszClassName,L"专业参数",WS_CHILD|WS_CLIPCHILDREN,0,0,328,500,parent,nullptr,wc.hInstance,nullptr);}void settingsVisibility(bool visible){if(window&&!visible)KillTimer(window,2);}void settingsPage(int value){if(window)KillTimer(window,2);page=std::clamp(value,0,3);scroll=0;arrange();}-void settingsEnabled(bool enabled,const engine::EnhancementSettings& configured){enhancementEnabled=enabled;if(window&&!enabled&&!dirty)populate(configured);if(window&&!enabled)message(L"增强已关闭。修改只保存待启用配置;开启后整套应用。");}+void settingsEnabled(bool enabled,const engine::EnhancementSettings& configured){enhancementEnabled=enabled;configuredSettings=configured;if(window&&!enabled&&!dirty&&displayedRevision!=configured.revision)populate(configured);if(window){auto desired=controller->snapshot().desired;check(200,enabled&&desired.nr?BST_CHECKED:BST_UNCHECKED);check(201,enabled&&desired.sr?BST_CHECKED:BST_UNCHECKED);if(!enabled)message(L"增强已关闭。数值修改保存待启用配置;点击 NR / 超分可直接开启。");}}void settingsDpi(){if(!window)return;auto old=font;font=makeFont(window);for(auto& item:items)SendMessageW(item.h,WM_SETFONT,WPARAM(font),TRUE);DeleteObject(old);arrange();}-void exportPanelStatus(const engine::ExportJobSnapshot& job,bool canExport,bool canSave){if(!window)return;setText(GetDlgItem(window,506),job.state==engine::ExportState::Idle?L"尚无导出任务":job.message+L"\n"+std::to_wstring(int(job.progress*100))+L"% · 源帧 "+std::to_wstring(job.sourceFrames)+L" / 编码 "+std::to_wstring(job.encoded)+L"\n生成 "+std::to_wstring(job.generated)+L" / CFR占位 "+std::to_wstring(job.holds)+L"\n作业 "+std::to_wstring(job.jobId)+L" · 冻结版本 "+std::to_wstring(job.frozenRevision));setText(GetDlgItem(window,507),job.output.empty()?L"目标由保存窗口选择":L"输出:"+std::filesystem::path(job.output).filename().wstring());EnableWindow(GetDlgItem(window,501),canExport&&!job.active());EnableWindow(GetDlgItem(window,502),canSave);EnableWindow(GetDlgItem(window,503),job.state==engine::ExportState::Running||job.state==engine::ExportState::Paused);EnableWindow(GetDlgItem(window,504),job.active());}+void exportPanelStatus(const engine::ExportJobSnapshot& job,bool canExport,bool canSave){if(!window)return;setText(item(506),job.state==engine::ExportState::Idle?L"尚无导出任务":job.message+L"\n"+std::to_wstring(int(job.progress*100))+L"% · 源帧 "+std::to_wstring(job.sourceFrames)+L" / 编码 "+std::to_wstring(job.encoded)+L"\n生成 "+std::to_wstring(job.generated)+L" / CFR占位 "+std::to_wstring(job.holds)+L"\n作业 "+std::to_wstring(job.jobId)+L" · 冻结版本 "+std::to_wstring(job.frozenRevision));setText(item(507),job.output.empty()?L"目标由保存窗口选择":L"输出:"+std::filesystem::path(job.output).filename().wstring());EnableWindow(item(501),canExport&&!job.active());EnableWindow(item(502),canSave);EnableWindow(item(503),job.state==engine::ExportState::Running||job.state==engine::ExportState::Paused);EnableWindow(item(504),job.active());}}diff --git a/apps/veyra/SettingsWindow.h b/apps/veyra/SettingsWindow.hindex af20cd71..34bb0ef8 100644--- a/apps/veyra/SettingsWindow.h+++ b/apps/veyra/SettingsWindow.h@@ -6,8 +6,9 @@ namespace veyra::ui {engine::EnhancementSettings defaultSettings();std::vector<std::wstring> presetNames();bool presetAt(size_t,engine::EnhancementSettings&);-HWND createSettingsPanel(HWND,engine::EngineController&,std::function<void(engine::EnhancementSettings)>);+HWND createSettingsPanel(HWND,engine::EngineController&,std::function<bool(engine::EnhancementSettings)>);void settingsEnabled(bool,const engine::EnhancementSettings&);void settingsVisibility(bool);void settingsPage(int);void settingsDpi();void exportPanelStatus(const engine::ExportJobSnapshot&,bool canExport,bool canSave);+HWND settingsControlForTest(int);}diff --git a/apps/veyra/TelemetryWindow.cpp b/apps/veyra/TelemetryWindow.cppindex e26ea6d9..ba8d88f7 100644--- a/apps/veyra/TelemetryWindow.cpp+++ b/apps/veyra/TelemetryWindow.cpp@@ -21,6 +21,8 @@ void refresh(){auto s=engine->snapshot();const wchar_t* names[]={L"上传/颜色void arrange(){RECT r{};GetClientRect(window,&r);int width=MulDiv(r.right,96,GetDpiForWindow(window)),height=MulDiv(r.bottom,96,GetDpiForWindow(window));auto pos=[&](int id,int x,int y,int w,int h){MoveWindow(GetDlgItem(window,id),dip(window,x),dip(window,y),dip(window,std::max(1,w)),dip(window,std::max(1,h)),TRUE);};bool wide=width>=700;pos(6,width-56,8,40,32);pos(7,16,10,width-80,32);pos(1,16,52,wide?width/2-24:width-32,wide?height-116:height/2-68);pos(2,wide?width/2+8:16,wide?96:height/2+36,wide?width/2-24:width-32,wide?height-160:height/2-100);pos(3,wide?width/2+8:16,wide?52:height/2-8,wide?width/2-24:width-32,36);pos(4,16,height-52,width/2-24,36);pos(5,width/2+8,height-52,width/2-24,36);}LRESULT CALLBACK proc(HWND h,UINT m,WPARAM w,LPARAM l){switch(m){case WM_CREATE:{preview.clear();window=h;font=makeFont(h,13);auto add=[&](const wchar_t* c,const wchar_t* t,int id,DWORD style){auto child=CreateWindowExW(0,c,t,WS_CHILD|WS_VISIBLE|style,0,0,1,1,h,reinterpret_cast<HMENU>(INT_PTR(id)),GetModuleHandleW(nullptr),nullptr);SendMessageW(child,WM_SETFONT,reinterpret_cast<WPARAM>(font),TRUE);themeControl(child);};add(L"EDIT",L"",1,ES_MULTILINE|ES_READONLY|WS_VSCROLL|WS_TABSTOP);add(L"BUTTON",L"查看 / 刷新脱敏预览",3,BS_PUSHBUTTON|WS_TABSTOP);add(L"EDIT",L"点击上方按钮查看诊断。复制只会复制这里预览过的脱敏文字。",2,ES_MULTILINE|ES_READONLY|WS_VSCROLL|WS_TABSTOP);add(L"BUTTON",L"复制已预览内容",4,BS_PUSHBUTTON|WS_TABSTOP);add(L"BUTTON",L"打开本应用日志目录",5,BS_PUSHBUTTON|WS_TABSTOP);add(L"BUTTON",L"关闭诊断",6,BS_PUSHBUTTON|WS_TABSTOP);icon(GetDlgItem(h,6),Icon::Close);add(L"STATIC",L"性能与诊断 / 播放会话",7,0);SetTimer(h,1,250,nullptr);arrange();refresh();return 0;}+case WM_ERASEBKGND:return 1;+case WM_PAINT:{PaintBuffer paint(h);fillSurface(paint.dc,paint.rect,h);return 0;}case WM_SIZE:arrange();return 0;case WM_CTLCOLORSTATIC:case WM_CTLCOLOREDIT:case WM_CTLCOLORLISTBOX:case WM_CTLCOLORBTN:return colors(m,w,l);diff --git a/apps/veyra/ui/AppShell.cpp b/apps/veyra/ui/AppShell.cppindex 1fd36d60..325b0d3b 100644--- a/apps/veyra/ui/AppShell.cpp+++ b/apps/veyra/ui/AppShell.cpp@@ -2,6 +2,7 @@#include "../SettingsWindow.h"#include "Theme.h"#include "WorkspaceChrome.h"+#include "WorkspaceTransition.h"#include "UiSessionState.h"#include "UiPreferenceStore.h"#include "CapturePanel.h"@@ -26,7 +27,7 @@#include "veyra/engine/Subtitles.h"namespace {constexpr DWORD ShellStyle=WS_POPUP|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU|WS_CLIPCHILDREN;-enum {Open=101,Play,Stop,Save,Nr,Sr,Fg,Seek,Info,Capture,Export,Realtime,Recent,Multiplier,Settings,OriginalHold,CompareToggle,Split,Reference,Fullscreen,ModeSwitch=220,Master,DailyPreset,Volume,Mute,Subtitle,SubtitleLoad,SubtitleSize,ImageOpen,InspectorDrawer,TabEnhance,TabFg,TabPresets,TabExport,JobProgress,Details,Brand,MediaTitle,TimeLabel,EmptyTitle,EmptyHint,ProRailVideo,ProRailCapture,WindowMin,WindowMax,WindowClose,VideoSurface=1000};+enum {Open=101,Play,Stop,Save,Nr,Sr,Fg,Seek,Info,Capture,Export,Realtime,Recent,Multiplier,Settings,OriginalHold,CompareToggle,Split,Reference,Fullscreen,ModeSwitch=220,Master,DailyPreset,Volume,Mute,Subtitle,SubtitleLoad,SubtitleSize,ImageOpen,InspectorDrawer,TabEnhance,TabFg,TabPresets,TabExport,JobProgress,Details,Brand,MediaTitle,TimeLabel,EmptyTitle,EmptyHint,ProRailVideo,ProRailCapture,WindowMin,WindowMax,WindowClose,More,VideoSurface=1000};veyra::engine::EngineController engine;veyra::engine::ExportJobManager exportJob;veyra::ui::UiSessionState uiState;@@ -37,11 +38,24 @@ std::wstring smokeView;bool smokeViewApplied=false;std::wstring smokeDualOutput;bool smokeEmpty=false;DWORD modeGdiStart=0,modeHandlesStart=0;SIZE_T modePrivateStart=0;bool smokeDual=false,smokeDualPause=false,smokeMaster=false,smokeMasterReject=false,smokeAudio=false,smokeJob=false,smokeJobCancel=false,smokeJobExit=false;int dualStep=0,masterStep=0,audioStep=0,jobStep=0;double pausedPosition=-1,jobPosition=0;uint64_t pausedFrames=0;ULONGLONG jobPauseTick=0;HANDLE workerMapping=nullptr;void switchMode();void selectInspector(int);void refreshDailyPresets();-void applySettings(veyra::engine::EnhancementSettings s){uiState.configured=s;if(uiState.enhanced)engine.requestSettings(s);else veyra::log::info("ui-settings","enhancement off: draft saved for explicit enable");}+bool applySettings(veyra::engine::EnhancementSettings s){if(masterPendingRevision)return false;uiState.configured=s;if(uiState.enhanced)engine.requestSettings(s);else veyra::log::info("ui-settings","enhancement off: draft saved for explicit enable");veyra::ui::settingsEnabled(uiState.enhanced,uiState.configured);return true;}struct ToolbarItem{HWND hwnd;int width;};std::vector<ToolbarItem> toolbar;bool full=false,holdOriginal=false,referenceBase=false;int compareMode=0;float compareSplit=.5f;WINDOWPLACEMENT windowPlacement{sizeof(windowPlacement)};-HWND mainWindow=nullptr,video=nullptr,statusBar=nullptr,seekBar=nullptr;+HWND mainWindow=nullptr,video=nullptr,statusBar=nullptr,seekBar=nullptr,playbackBar=nullptr;+veyra::ui::WorkspaceTransition transition;veyra::ui::GlassBackdrop backdrop;+bool fullControls=true,menuOpen=false;ULONGLONG pointerTick=0,dashboardTick=0;+void layout();+void endTransition(){transition.finish();KillTimer(mainWindow,2);if(video)RemovePropW(video,L"Veyra.ResizeDeferUntil");}+veyra::ui::ChromeLayout chromeLayout(int w,int h){+ using namespace veyra::ui;ChromeLayout target(w,h,uiState.mode==Mode::Professional,uiState.drawer,uiPreferences.inspectorWidth);+ if(!transition.running){if(target.pro&&uiState.diagnostics){target.viewHeight-=132;target.bottom-=132;}return target;}+ ChromeLayout daily(w,h,false,false),pro(w,h,true,uiState.drawer,uiPreferences.inspectorWidth);if(uiState.diagnostics){pro.viewHeight-=132;pro.bottom-=132;}+ target=pro;target.left=transition.mix(daily.left,pro.left);target.top=transition.mix(daily.top,pro.top);target.viewWidth=transition.mix(daily.viewWidth,pro.viewWidth);target.viewHeight=transition.mix(daily.viewHeight,pro.viewHeight);target.bottom=transition.mix(daily.bottom,pro.bottom);target.right=transition.mix(w+20,pro.right);return target;+}+LRESULT CALLBACK barProc(HWND h,UINT m,WPARAM w,LPARAM l){if(m==WM_ERASEBKGND)return 1;if(m==WM_PAINT){veyra::ui::PaintBuffer paint(h);veyra::ui::fillSurface(paint.dc,paint.rect,h);return 0;}return DefWindowProcW(h,m,w,l);}+void pointerActivity(){if(!full)return;pointerTick=GetTickCount64();if(!fullControls){fullControls=true;layout();}SetCursor(LoadCursorW(nullptr,IDC_ARROW));}+std::wstring currentFile,autoInput;bool paused=false,dragging=false,closing=false;int smokeSeconds=0;ULONGLONG startTick=0;int resultCode=0;std::wstring exportOutput;unsigned exportFrames=0;unsigned cancelAfterMs=0;bool exportHevc=false;veyra::engine::PlayerOptions initialOptions;std::vector<veyra::engine::SubtitleCue> subtitles;HWND subtitleLabel=nullptr;@@ -49,9 +63,11 @@ HFONT font=nullptr,emptyFont=nullptr;bool smokeRollback=false,smokeRollbackFlow=void openFile(const std::wstring&);void layout();void updateComparison(){engine.comparison(holdOriginal?1:compareMode,referenceBase,compareSplit);}-void toggleFullscreen(){full=!full;if(full){GetWindowPlacement(mainWindow,&windowPlacement);SetWindowLongPtrW(mainWindow,GWL_STYLE,WS_POPUP|WS_VISIBLE);MONITORINFO mi{sizeof(mi)};GetMonitorInfoW(MonitorFromWindow(mainWindow,MONITOR_DEFAULTTONEAREST),&mi);SetWindowPos(mainWindow,HWND_TOP,mi.rcMonitor.left,mi.rcMonitor.top,mi.rcMonitor.right-mi.rcMonitor.left,mi.rcMonitor.bottom-mi.rcMonitor.top,SWP_FRAMECHANGED);}else{SetWindowLongPtrW(mainWindow,GWL_STYLE,ShellStyle|WS_VISIBLE);MONITORINFO mi{sizeof(mi)};GetMonitorInfoW(MonitorFromRect(&windowPlacement.rcNormalPosition,MONITOR_DEFAULTTONEAREST),&mi);auto& r=windowPlacement.rcNormalPosition;if(r.right<mi.rcWork.left||r.left>mi.rcWork.right||r.bottom<mi.rcWork.top||r.top>mi.rcWork.bottom){OffsetRect(&r,mi.rcWork.left-r.left,mi.rcWork.top-r.top);}SetWindowPlacement(mainWindow,&windowPlacement);SetWindowPos(mainWindow,nullptr,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);}SetWindowTextW(GetDlgItem(mainWindow,Fullscreen),full?L"退出全屏":L"全屏 F11");layout();}+void toggleFullscreen(){endTransition();full=!full;DWORD corner=full?1:2;DwmSetWindowAttribute(mainWindow,33,&corner,sizeof(corner));fullControls=true;pointerTick=GetTickCount64();if(full){GetWindowPlacement(mainWindow,&windowPlacement);SetWindowLongPtrW(mainWindow,GWL_STYLE,WS_POPUP|WS_VISIBLE|WS_CLIPCHILDREN);MONITORINFO mi{sizeof(mi)};GetMonitorInfoW(MonitorFromWindow(mainWindow,MONITOR_DEFAULTTONEAREST),&mi);SetWindowPos(mainWindow,HWND_TOP,mi.rcMonitor.left,mi.rcMonitor.top,mi.rcMonitor.right-mi.rcMonitor.left,mi.rcMonitor.bottom-mi.rcMonitor.top,SWP_FRAMECHANGED);}else{SetWindowLongPtrW(mainWindow,GWL_STYLE,ShellStyle|WS_VISIBLE);MONITORINFO mi{sizeof(mi)};GetMonitorInfoW(MonitorFromRect(&windowPlacement.rcNormalPosition,MONITOR_DEFAULTTONEAREST),&mi);auto& r=windowPlacement.rcNormalPosition;if(r.right<mi.rcWork.left||r.left>mi.rcWork.right||r.bottom<mi.rcWork.top||r.top>mi.rcWork.bottom){OffsetRect(&r,mi.rcWork.left-r.left,mi.rcWork.top-r.top);}SetWindowPlacement(mainWindow,&windowPlacement);SetWindowPos(mainWindow,nullptr,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);}SetWindowTextW(GetDlgItem(mainWindow,Fullscreen),full?L"退出全屏":L"全屏 F11");SetCursor(LoadCursorW(nullptr,IDC_ARROW));layout();veyra::log::info("ui-fullscreen",std::format("enabled={} video-only viewport; transport auto-hides",full));}LRESULT CALLBACK interaction(HWND h,UINT m,WPARAM w,LPARAM l,UINT_PTR id,DWORD_PTR){- if(id==VideoSurface&&m==WM_PAINT){PAINTSTRUCT ps{};HDC dc=BeginPaint(h,&ps);RECT r{};GetClientRect(h,&r);FillRect(dc,&r,veyra::ui::bgBrush());EndPaint(h,&ps);return 0;}+ if(id==VideoSurface&&m==WM_SETCURSOR&&full&&!fullControls){SetCursor(nullptr);return TRUE;}+ if(id==VideoSurface&&m==WM_ERASEBKGND)return 1;+ if(id==VideoSurface&&m==WM_PAINT){veyra::ui::PaintBuffer paint(h);veyra::ui::opaqueBlack(paint.dc,paint.rect);return 0;}if(id==OriginalHold){if(m==WM_LBUTTONDOWN){holdOriginal=true;SetCapture(h);updateComparison();return 0;}if(m==WM_LBUTTONUP||m==WM_CAPTURECHANGED){holdOriginal=false;if(GetCapture()==h)ReleaseCapture();updateComparison();return 0;}}if(id==VideoSurface&&compareMode==2&&(m==WM_LBUTTONDOWN||m==WM_MOUSEMOVE)&&(m==WM_LBUTTONDOWN||(w&MK_LBUTTON))){if(m==WM_LBUTTONDOWN)SetCapture(h);RECT r{};GetClientRect(h,&r);auto extent=engine.snapshot().metrics.resolution.output;float contentWidth=float(r.right);if(extent.width&&extent.height)contentWidth=std::min(float(r.right),float(r.bottom)*extent.width/extent.height);float left=(r.right-contentWidth)/2;compareSplit=std::clamp((float(GET_X_LPARAM(l))-left)/std::max(1.0f,contentWidth),0.0f,1.0f);updateComparison();return 0;}if(id==VideoSurface&&m==WM_LBUTTONUP&&GetCapture()==h){ReleaseCapture();return 0;}@@ -71,53 +87,78 @@ void switchMode(){const auto start=std::chrono::steady_clock::now();const auto before=engine.snapshot();const auto host=video;if(uiState.mode==veyra::ui::Mode::Daily){uiState.mode=veyra::ui::Mode::Professional;compareMode=uiState.preferredComparison;}else{uiState.mode=veyra::ui::Mode::Daily;uiState.preferredComparison=compareMode;compareMode=0;holdOriginal=false;if(GetCapture())ReleaseCapture();}- updateComparison();if(auto focused=GetFocus();focused&&IsChild(inspector,focused))SetFocus(GetDlgItem(mainWindow,ModeSwitch));SetWindowTextW(GetDlgItem(mainWindow,ModeSwitch),uiState.mode==veyra::ui::Mode::Daily?L"切换专业模式 →":L"← 返回日常模式");layout();+ updateComparison();if(auto focused=GetFocus();focused&&IsChild(inspector,focused))SetFocus(GetDlgItem(mainWindow,ModeSwitch));SetWindowTextW(GetDlgItem(mainWindow,ModeSwitch),uiState.mode==veyra::ui::Mode::Daily?L"专业模式 →":L"← 返回日常模式");transition.start(uiState.mode==veyra::ui::Mode::Professional,GetTickCount64());if(full)endTransition();else{SetPropW(video,L"Veyra.ResizeDeferUntil",HANDLE(uintptr_t(GetTickCount64()+390)));SetTimer(mainWindow,2,16,nullptr);}layout();veyra::log::info("ui-transition",std::format("started target={} durationMs=240 from={}",uiState.mode==veyra::ui::Mode::Professional,transition.from));const auto after=engine.snapshot();veyra::log::info("ui-mode",std::format("professional={} hostSame={} sessionSame={} revisionSame={} positionBefore={} positionAfter={} commandMs={:.3f}",uiState.mode==veyra::ui::Mode::Professional,host==video,before.sessionId==after.sessionId,before.desired.revision==after.desired.revision,before.position,after.position,std::chrono::duration<double,std::milli>(std::chrono::steady_clock::now()-start).count()));}-void layout(){if(!mainWindow||!video)return;const auto layoutBegin=std::chrono::steady_clock::now();using namespace veyra::ui;RECT r{};GetClientRect(mainWindow,&r);int w=MulDiv(r.right,96,GetDpiForWindow(mainWindow)),h=MulDiv(r.bottom,96,GetDpiForWindow(mainWindow));const bool pro=uiState.mode==Mode::Professional;setText(GetDlgItem(mainWindow,Brand),pro?L"V":L"V E Y R A");ChromeLayout g(w,h,pro,uiState.drawer,uiPreferences.inspectorWidth);if(pro&&uiState.diagnostics){g.viewHeight-=132;g.bottom-=132;}auto batch=BeginDeferWindowPos(72);- auto pos=[&](HWND c,int x,int y,int width,int height,bool show=true){if(!c)return;if(!show&&c!=subtitleLabel){batch=DeferWindowPos(batch,c,nullptr,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_HIDEWINDOW);return;}batch=DeferWindowPos(batch,c,nullptr,dip(mainWindow,x),dip(mainWindow,y),dip(mainWindow,std::max(1,width)),dip(mainWindow,std::max(1,height)),SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW|SWP_NOCOPYBITS|(show?SWP_SHOWWINDOW:SWP_HIDEWINDOW));};+void layout(){+ if(!mainWindow||!video)return;const auto layoutBegin=std::chrono::steady_clock::now();using namespace veyra::ui;+ RECT r{};GetClientRect(mainWindow,&r);int w=MulDiv(r.right,96,GetDpiForWindow(mainWindow)),h=MulDiv(r.bottom,96,GetDpiForWindow(mainWindow));+ const bool pro=uiState.mode==Mode::Professional;auto g=chromeLayout(w,h);auto target=engine.snapshot();+ auto pane=[&](int x,int y,int width,int height,int radius,BYTE tint){return GlassPane{{dip(mainWindow,x),dip(mainWindow,y),dip(mainWindow,x+width),dip(mainWindow,y+height)},dip(mainWindow,radius),tint};};+ std::vector<GlassPane> panes;+ if(full){if(fullControls)panes.push_back(pane(0,h-88,w,88,1,142));}+ else if(g.pro){panes.push_back(pane(4,4,64,h-8,22,24));panes.push_back(pane(g.left,g.bottom,g.viewWidth,h-g.bottom-20,20,32));if(g.panelWidth){panes.push_back(pane(g.right,g.top,g.panelWidth,g.viewHeight,20,30));panes.push_back(pane(g.right,g.bottom,g.panelWidth,h-g.bottom-20,20,40));}}+ else{panes.push_back(pane(0,h-88,w,88,1,32));}+ backdrop.render(r.right,r.bottom,g.pro,full,panes);auto batch=BeginDeferWindowPos(80);+ auto pos=[&](HWND c,int x,int y,int width,int height,bool show=true){if(!c)return;UINT flags=SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW|SWP_NOCOPYBITS|(show?SWP_SHOWWINDOW:SWP_HIDEWINDOW);if(!show&&c!=subtitleLabel){batch=DeferWindowPos(batch,c,nullptr,0,0,0,0,flags|SWP_NOMOVE|SWP_NOSIZE);return;}batch=DeferWindowPos(batch,c,nullptr,dip(mainWindow,x),dip(mainWindow,y),dip(mainWindow,std::max(1,width)),dip(mainWindow,std::max(1,height)),flags);};auto put=[&](int id,int x,int y,int width,int height=36,bool show=true){pos(GetDlgItem(mainWindow,id),x,y,width,height,show);};- for(auto item:toolbar){int id=GetDlgCtrlID(item.hwnd);if(id!=Open&&id!=Capture&&id!=Recent&&id!=Play&&id!=Stop&&id!=Fullscreen&&id!=OriginalHold&&id!=Split&&id!=CompareToggle&&id!=Reference&&id!=Info)pos(item.hwnd,0,0,1,1,false);}- auto target=engine.snapshot();- const bool rightVisible=pro&&g.panelWidth>0;veyra::ui::settingsVisibility(rightVisible&&!full);+ for(auto entry:toolbar){int id=GetDlgCtrlID(entry.hwnd);if(id!=Open&&id!=Capture&&id!=Recent&&id!=Play&&id!=Stop&&id!=Fullscreen&&id!=OriginalHold&&id!=Split&&id!=CompareToggle&&id!=Reference&&id!=Info)pos(entry.hwnd,0,0,1,1,false);}+ const bool rightVisible=(pro||transition.running)&&g.panelWidth>0&&!full;settingsVisibility(rightVisible&&pro);pos(video,full?0:g.left,full?0:g.top,full?w:g.viewWidth,full?h:g.viewHeight,!(pro&&showDiagnostics&&!full));- SetWindowRgn(video,full?nullptr:CreateRoundRectRgn(0,0,dip(mainWindow,g.viewWidth),dip(mainWindow,g.viewHeight),dip(mainWindow,pro?32:4),dip(mainWindow,pro?32:4)),FALSE);- put(Brand,pro?8:g.left,pro?12:24,pro?52:116,32,!full);surface(GetDlgItem(mainWindow,Brand),pro?RGB(16,17,18):cinema);- put(Open,g.left+138,22,104,36,!full&&!pro);put(Capture,g.left+250,22,94,36,!full&&!pro);put(Recent,g.left+354,22,90,36,!full&&!pro&&w>=1000);- put(ModeSwitch,w-292,14,160,32,!full);surface(GetDlgItem(mainWindow,ModeSwitch),pro?background:cinema);marked(GetDlgItem(mainWindow,ModeSwitch),false);- put(WindowMin,w-124,14,32,32,!full);put(WindowMax,w-88,14,32,32,!full);put(WindowClose,w-52,14,32,32,!full);- for(int id:{WindowMin,WindowMax,WindowClose})surface(GetDlgItem(mainWindow,id),pro?background:cinema);+ SetWindowRgn(video,full||!pro?nullptr:CreateRoundRectRgn(0,0,dip(mainWindow,g.viewWidth),dip(mainWindow,g.viewHeight),dip(mainWindow,30),dip(mainWindow,30)),FALSE);+ put(Brand,8,12,52,32,!full&&pro);setText(GetDlgItem(mainWindow,Brand),L"V");surface(GetDlgItem(mainWindow,Brand),RGB(16,17,18));+ put(Capture,0,0,1,1,false);put(Recent,0,0,1,1,false);+ put(WindowMin,w-124,14,32,32,!full&&pro);put(WindowMax,w-88,14,32,32,!full&&pro);put(WindowClose,w-52,14,32,32,!full&&pro);+ for(int id:{WindowMin,WindowMax,WindowClose})surface(GetDlgItem(mainWindow,id),background);put(InspectorDrawer,w-384,14,76,32,!full&&pro&&w<960);- put(Master,pro?g.left+(w<960?120:190):g.left+g.viewWidth-250,pro?14:66,116,32,!full);put(DailyPreset,pro?g.left+318:g.left+g.viewWidth-128,pro?14:66,pro?172:128,200,!full&&(w>=1080||!pro));- for(int id:{Open,Capture,Recent,Master,DailyPreset})surface(GetDlgItem(mainWindow,id),pro?background:cinema);+ put(Master,g.left+(w<960?120:190),14,116,32,!full&&pro);put(DailyPreset,g.left+318,14,172,200,!full&&pro&&w>=1080);put(ProRailVideo,12,92,44,44,!full&&pro);put(ProRailCapture,12,148,44,44,!full&&pro);put(ImageOpen,12,204,44,44,!full&&pro);for(int id:{ProRailVideo,ProRailCapture,ImageOpen})surface(GetDlgItem(mainWindow,id),RGB(16,17,18));- for(int i=0;i<4;++i)put(TabEnhance+i,g.right+12+i*((g.panelWidth-24)/4),g.top+12,(g.panelWidth-24)/4,32,!full&&rightVisible);- pos(inspector,g.right+12,g.top+56,g.panelWidth-24,g.viewHeight-68,!full&&rightVisible);- int barTop=pro?g.bottom:g.top+g.viewHeight;int tx=g.left+16,tw=g.viewWidth-32;- pos(seekBar,pro?tx:g.left,pro?barTop+4:barTop-6,pro?tw:g.viewWidth,12,!full&&!target.capture&&!target.image);surface(seekBar,pro?panel:cinemaPanel);- put(TimeLabel,tx,barTop+11,tw,20,!full);surface(GetDlgItem(mainWindow,TimeLabel),pro?panel:cinemaPanel);- put(MediaTitle,tx+4,barTop+40,std::max(80,tw/2-96),30,!full);surface(GetDlgItem(mainWindow,MediaTitle),pro?panel:cinemaPanel);- put(Play,tx+tw/2-22,barTop+33,44,44,!full);put(Stop,tx+tw/2-68,barTop+37,36,36,!full&&tw>=560);- put(Mute,tx+tw-242,barTop+37,36,36,!full&&tw>=650);put(Volume,tx+tw-206,barTop+46,82,18,!full&&tw>=650);- put(Subtitle,tx+tw-104,barTop+37,40,36,!full);put(Fullscreen,full?w-58:tx+tw-48,full?14:barTop+37,40,36,true);- for(int id:{Play,Stop,Mute,Volume,Subtitle,Fullscreen})surface(GetDlgItem(mainWindow,id),pro?panel:cinemaPanel);- put(OriginalHold,tx,barTop+160,96,32,!full&&pro);put(Split,tx+102,barTop+160,92,32,!full&&pro);put(CompareToggle,tx+200,barTop+160,96,32,!full&&pro&&tw>=600);put(Reference,tx+(tw>=600?302:200),barTop+160,std::min(172,tw-(tw>=600?302:200)-88),180,!full&&pro&&tw>=500);- put(Details,tx+tw-76,barTop+160,76,32,!full&&pro);put(Info,12,h-66,44,44,!full&&pro);- pos(metricLabel,tx,barTop+212,tw,120,!full&&pro&&uiState.diagnostics);- pos(statusBar,g.left,g.top+8,g.viewWidth,44,false);pos(diagnosticPanel,g.left,g.top,g.viewWidth,h-g.top-20,!full&&pro&&showDiagnostics);- const bool empty=currentFile.empty();put(EmptyTitle,g.left+24,g.top+g.viewHeight/2-40,g.viewWidth-48,48,!full&&empty);put(EmptyHint,g.left+24,g.top+g.viewHeight/2+14,g.viewWidth-48,68,!full&&empty);+ for(int i=0;i<4;++i)put(TabEnhance+i,g.right+12+i*((g.panelWidth-24)/4),g.top+12,(g.panelWidth-24)/4,32,rightVisible);+ pos(inspector,g.right+12,g.top+56,g.panelWidth-24,g.viewHeight-68,rightVisible);+ const bool transport=!full||fullControls;int barTop=full?h-88:g.bottom;int tx=full?16:g.left+16,tw=full?w-32:g.viewWidth-32;+ pos(playbackBar,0,h-88,w,88,full&&fullControls);+ pos(seekBar,full?0:pro?tx:g.left,barTop-5,full?w:pro?tw:g.viewWidth,12,transport&&!target.capture&&!target.image&&!(pro&&showDiagnostics&&!full));surface(seekBar,pro&&!full?panel:cinemaPanel);+ put(TimeLabel,tx,barTop+10,tw-8,20,transport);put(MediaTitle,tx+(!pro&&!full?44:0),barTop+38,std::max(80,tw/2-120),28,transport);+ put(Open,tx,barTop+34,36,36,!full&&!pro);icon(GetDlgItem(mainWindow,Open),Icon::Video,false);+ put(Play,tx+tw/2-22,barTop+32,44,44,transport);put(Stop,tx+tw/2-65,barTop+36,32,36,transport&&tw>=900);+ int trailing=(!pro&&!full)?174:0;+ put(Mute,tx+tw-238-trailing,barTop+36,32,36,transport&&tw>=980);put(Volume,tx+tw-200-trailing,barTop+46,76,18,transport&&tw>=980);+ put(Subtitle,tx+tw-116-trailing,barTop+36,36,36,transport&&tw>=740);put(More,tx+tw-78-trailing,barTop+36,36,36,transport);+ put(Fullscreen,tx+tw-40-trailing,barTop+36,36,36,transport);+ put(ModeSwitch,pro?w-292:w-168,pro?14:barTop+36,pro?160:156,32,!full);surface(GetDlgItem(mainWindow,ModeSwitch),pro?background:cinemaPanel);+ for(int id:{Open,Play,Stop,Mute,Volume,Subtitle,More,Fullscreen,TimeLabel,MediaTitle})surface(GetDlgItem(mainWindow,id),pro&&!full?panel:cinemaPanel);+ put(OriginalHold,tx,barTop+160,96,32,!full&&pro);put(Split,tx+102,barTop+160,92,32,!full&&pro);put(CompareToggle,tx+200,barTop+160,96,32,!full&&pro&&tw>=600);+ put(Reference,tx+(tw>=600?302:200),barTop+160,std::min(172,tw-(tw>=600?302:200)-88),180,!full&&pro&&tw>=500);+ put(Details,tx+tw-76,barTop+160,76,32,!full&&pro);put(Info,12,h-66,44,44,!full&&pro);pos(metricLabel,tx,barTop+212,tw,120,!full&&pro&&uiState.diagnostics);+ pos(statusBar,0,0,1,1,false);pos(diagnosticPanel,g.left,g.top,g.viewWidth,h-g.top-20,!full&&pro&&showDiagnostics);+ const bool empty=currentFile.empty();put(EmptyTitle,0,0,1,1,false);put(EmptyHint,0,0,1,1,false);for(int id:{EmptyTitle,EmptyHint})surface(GetDlgItem(mainWindow,id),background);- pos(subtitleLabel,full?20:g.left+20,full?h-118:g.top+g.viewHeight-118,full?w-40:g.viewWidth-40,108,uiState.subtitles&&GetWindowTextLengthW(subtitleLabel)>0);- put(JobProgress,g.left+16,g.top+14,std::min(320,g.viewWidth-32),32,exportJob.poll().state!=veyra::engine::ExportState::Idle&&!full);- const auto layoutQueued=std::chrono::steady_clock::now();EndDeferWindowPos(batch);const auto layoutCommitted=std::chrono::steady_clock::now();if(empty&&!full){for(int id:{EmptyTitle,EmptyHint})SetWindowPos(GetDlgItem(mainWindow,id),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);}if(diagnosticPanel&&showDiagnostics&&pro&&!full)SetWindowPos(diagnosticPanel,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);SetWindowPos(subtitleLabel,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);if(rightVisible&&!full)SetWindowPos(inspector,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);SetWindowPos(GetDlgItem(mainWindow,Fullscreen),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);if(diagnosticPanel&&showDiagnostics&&pro&&!full)SetWindowPos(diagnosticPanel,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);if(auto focused=GetFocus();focused&&IsChild(mainWindow,focused)&&!IsWindowVisible(focused))SetFocus(mainWindow);RedrawWindow(mainWindow,nullptr,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);if(smokeDual)veyra::log::info("ui-layout-timing",std::format("queueMs={:.3f} commitMs={:.3f} zorderMs={:.3f}",std::chrono::duration<double,std::milli>(layoutQueued-layoutBegin).count(),std::chrono::duration<double,std::milli>(layoutCommitted-layoutQueued).count(),std::chrono::duration<double,std::milli>(std::chrono::steady_clock::now()-layoutCommitted).count()));+ pos(subtitleLabel,full?20:g.left+20,full?h-(fullControls?202:118):g.top+g.viewHeight-118,full?w-40:g.viewWidth-40,108,uiState.subtitles&&GetWindowTextLengthW(subtitleLabel)>0);+ put(JobProgress,tx,barTop+10,std::min(300,tw),24,exportJob.poll().state!=veyra::engine::ExportState::Idle&&!full);+ EndDeferWindowPos(batch);+ auto front=[&](HWND child){if(child&&IsWindowVisible(child))SetWindowPos(child,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOREDRAW);};+ front(playbackBar);for(int id:{Open,Play,Stop,Mute,Volume,Subtitle,More,Fullscreen,TimeLabel,MediaTitle,ModeSwitch,JobProgress,EmptyTitle,EmptyHint})front(GetDlgItem(mainWindow,id));front(inspector);front(subtitleLabel);if(showDiagnostics&&pro&&!full)front(diagnosticPanel);+ if(auto focused=GetFocus();focused&&IsChild(mainWindow,focused)&&!IsWindowVisible(focused))SetFocus(mainWindow);+ RedrawWindow(mainWindow,nullptr,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);+ if(smokeDual)veyra::log::info("ui-layout-timing",std::format("frameMs={:.3f} animation={}",std::chrono::duration<double,std::milli>(std::chrono::steady_clock::now()-layoutBegin).count(),transition.running));}-void subtitleMenu(){HMENU menu=CreatePopupMenu();AppendMenuW(menu,MF_STRING|(uiState.subtitles?MF_CHECKED:0),Subtitle,L"显示字幕");AppendMenuW(menu,MF_STRING,SubtitleLoad,L"载入外部 SRT…");AppendMenuW(menu,MF_STRING,SubtitleSize,L"切换字幕字号");RECT r{};GetWindowRect(GetDlgItem(mainWindow,Subtitle),&r);TrackPopupMenu(menu,TPM_LEFTALIGN|TPM_BOTTOMALIGN,r.left,r.top,0,mainWindow,nullptr);DestroyMenu(menu);}+void moreMenu(){+ using namespace veyra::ui;HMENU menu=CreatePopupMenu();auto s=engine.snapshot();+ AppendMenuW(menu,MF_STRING,Open,L"打开视频 / 图片…");AppendMenuW(menu,MF_STRING,Capture,L"连接采集卡…");AppendMenuW(menu,MF_STRING,Recent,L"最近打开");AppendMenuW(menu,MF_SEPARATOR,0,nullptr);+ AppendMenuW(menu,MF_STRING|(uiState.enhanced?MF_CHECKED:0),Master,L"总增强");AppendMenuW(menu,MF_STRING|(s.desired.sr?MF_CHECKED:0),Sr,L"DLSS 超分辨率 · 4K");+ AppendMenuW(menu,MF_STRING,ModeSwitch,uiState.mode==Mode::Daily?L"展开专业模式":L"收起专业模式");AppendMenuW(menu,MF_SEPARATOR,0,nullptr);AppendMenuW(menu,MF_STRING,WindowMin,L"最小化");AppendMenuW(menu,MF_STRING,WindowClose,L"退出播放器");+ RECT r{};GetWindowRect(GetDlgItem(mainWindow,More),&r);menuOpen=true;int command=int(TrackPopupMenu(menu,TPM_RETURNCMD|TPM_BOTTOMALIGN,r.left,r.top,0,mainWindow,nullptr));menuOpen=false;DestroyMenu(menu);+ if(command==Sr)SendMessageW(mainWindow,WM_APP+44,201,s.desired.sr?BST_UNCHECKED:BST_CHECKED);else if(command)SendMessageW(mainWindow,WM_COMMAND,command,0);pointerActivity();+}++void subtitleMenu(){HMENU menu=CreatePopupMenu();AppendMenuW(menu,MF_STRING|(uiState.subtitles?MF_CHECKED:0),Subtitle,L"显示字幕");AppendMenuW(menu,MF_STRING,SubtitleLoad,L"载入外部 SRT…");AppendMenuW(menu,MF_STRING,SubtitleSize,L"切换字幕字号");RECT r{};GetWindowRect(GetDlgItem(mainWindow,Subtitle),&r);menuOpen=true;TrackPopupMenu(menu,TPM_LEFTALIGN|TPM_BOTTOMALIGN,r.left,r.top,0,mainWindow,nullptr);menuOpen=false;DestroyMenu(menu);pointerActivity();}void startVideoExport(bool hevc){auto s=engine.snapshot();if(currentFile.empty()||s.capture||s.image||!s.frames||s.applying||s.failed||exportJob.poll().active())return;wchar_t name[32768]{};OPENFILENAMEW d{sizeof(d)};d.hwndOwner=mainWindow;d.lpstrFile=name;d.nMaxFile=32768;d.lpstrFilter=L"MP4视频\0*.mp4\0";d.lpstrDefExt=L"mp4";d.Flags=OFN_EXPLORER|OFN_NOCHANGEDIR|OFN_PATHMUSTEXIST|OFN_OVERWRITEPROMPT;if(GetSaveFileNameW(&d)){exportJob.start(currentFile,name,s.applied,hevc);jobPaused=false;layout();}}+#include "UiRepairChecks.h"LRESULT CALLBACK proc(HWND hwnd,UINT msg,WPARAM wp,LPARAM lp){switch(msg){-case WM_CREATE:{mainWindow=hwnd;font=veyra::ui::makeFont(hwnd);veyra::ui::titleTheme(hwnd);uiState.configured=initialOptions.snapshot();+case WM_CREATE:{mainWindow=hwnd;backdrop.attach(hwnd);font=veyra::ui::makeFont(hwnd);veyra::ui::titleTheme(hwnd);uiState.configured=initialOptions.snapshot();control(L"BUTTON",L"打开视频",Open,BS_PUSHBUTTON,10,10,150,30);control(L"BUTTON",L"播放",Play,BS_PUSHBUTTON,168,10,68,30);control(L"BUTTON",L"停止",Stop,BS_PUSHBUTTON,244,10,62,30);control(L"BUTTON",L"保存图片",Save,BS_PUSHBUTTON,314,10,95,30);control(L"BUTTON",L"DLSS5 NR",Nr,BS_AUTOCHECKBOX,425,10,110,30);control(L"BUTTON",L"SR 4K",Sr,BS_AUTOCHECKBOX,518,10,78,30);control(L"BUTTON",L"补帧",Fg,BS_AUTOCHECKBOX,600,10,78,30);CheckDlgButton(hwnd,Nr,BST_CHECKED);control(L"BUTTON",L"采集",Capture,BS_PUSHBUTTON,690,10,75,30);control(L"BUTTON",L"导出视频",Export,BS_PUSHBUTTON,773,10,103,30);control(L"BUTTON",L"性能/诊断",Info,BS_PUSHBUTTON,884,10,100,30);@@ -128,6 +169,9 @@ control(L"BUTTON",L"参数与预设",Settings,BS_PUSHBUTTON,1225,10,100,30);auto original=control(L"BUTTON",L"按住原图 V",OriginalHold,BS_PUSHBUTTON,0,0,110,30);SetWindowSubclass(original,interaction,OriginalHold,0);control(L"BUTTON",L"原图/增强切换",CompareToggle,BS_PUSHBUTTON,0,0,120,30);control(L"BUTTON",L"分屏拖动",Split,BS_PUSHBUTTON,0,0,95,30);auto ref=control(L"COMBOBOX",L"",Reference,CBS_DROPDOWNLIST,0,0,170,180);for(auto label:{L"对比:输入原画",L"对比:增强前底图"})SendMessageW(ref,CB_ADDSTRING,0,reinterpret_cast<LPARAM>(label));SendMessageW(ref,CB_SETCURSEL,0,0);control(L"BUTTON",L"全屏",Fullscreen,BS_PUSHBUTTON,0,0,108,30);+control(L"BUTTON",L"设置与来源",More,BS_PUSHBUTTON,0,0,36,36);veyra::ui::icon(GetDlgItem(hwnd,More),veyra::ui::Icon::Settings);+WNDCLASSW barClass{};barClass.lpfnWndProc=barProc;barClass.hInstance=GetModuleHandleW(nullptr);barClass.lpszClassName=L"VeyraPlaybackBar";barClass.hCursor=LoadCursorW(nullptr,IDC_ARROW);RegisterClassW(&barClass);+playbackBar=CreateWindowExW(0,barClass.lpszClassName,L"播放控制条",WS_CHILD|WS_CLIPSIBLINGS,0,0,1,1,hwnd,nullptr,barClass.hInstance,nullptr);subtitleLabel=veyra::ui::createSubtitleOverlay(hwnd);video=control(L"STATIC",L"",VideoSurface,SS_BLACKRECT|SS_NOTIFY,8,52,1100,610);seekBar=control(TRACKBAR_CLASSW,L"",Seek,TBS_HORZ,8,675,1100,24);SendMessageW(seekBar,TBM_SETRANGE,TRUE,MAKELPARAM(0,10000));statusBar=control(L"STATIC",L"打开本地视频或PNG/JPEG。本地实验运行时,非NVIDIA官方产品。",0,SS_LEFT,12,708,1080,36);SetWindowSubclass(video,interaction,VideoSurface,0);@@ -150,9 +194,13 @@ for(int id:{Open,Capture,Recent,WindowMin,WindowMax,WindowClose,Stop,Mute,Subtitinspector=veyra::ui::createSettingsPanel(hwnd,engine,applySettings);selectInspector(uiPreferences.inspector);refreshDailyPresets();SendDlgItemMessageW(hwnd,Volume,TBM_SETPOS,TRUE,LPARAM(uiPreferences.volume*100));veyra::ui::marked(GetDlgItem(hwnd,Play));tooltips=CreateWindowExW(WS_EX_TOPMOST,TOOLTIPS_CLASSW,nullptr,WS_POPUP|TTS_ALWAYSTIP|TTS_NOPREFIX,0,0,0,0,hwnd,nullptr,GetModuleHandleW(nullptr),nullptr);SendMessageW(tooltips,TTM_SETMAXTIPWIDTH,0,360);EnumChildWindows(hwnd,[](HWND child,LPARAM context)->BOOL{auto tip=reinterpret_cast<HWND>(context);wchar_t cls[32]{};GetClassNameW(child,cls,32);if(_wcsicmp(cls,L"BUTTON")==0||_wcsicmp(cls,L"EDIT")==0||_wcsicmp(cls,L"COMBOBOX")==0){TOOLINFOW info{sizeof(info)};info.uFlags=TTF_IDISHWND|TTF_SUBCLASS;info.hwnd=GetAncestor(child,GA_ROOT);info.uId=UINT_PTR(child);info.lpszText=LPSTR_TEXTCALLBACKW;SendMessageW(tip,TTM_ADDTOOLW,0,LPARAM(&info));}return TRUE;},LPARAM(tooltips));if(smokeSeconds>0)startTick=GetTickCount64();diagnosticPanel=veyra::ui::createTelemetryPanel(hwnd,engine);DragAcceptFiles(hwnd,TRUE);SetTimer(hwnd,1,100,nullptr);layout();return 0;}-case WM_NCCALCSIZE:if(wp&&!full)return 0;break;-case WM_NCHITTEST:{LRESULT hit=DefWindowProcW(hwnd,msg,wp,lp);if(hit==HTCLIENT&&!full){POINT p{GET_X_LPARAM(lp),GET_Y_LPARAM(lp)};ScreenToClient(hwnd,&p);RECT r{};GetClientRect(hwnd,&r);int edge=veyra::ui::dip(hwnd,7);bool left=p.x<edge,right=p.x>=r.right-edge,top=p.y<edge,bottom=p.y>=r.bottom-edge;if(top&&left)return HTTOPLEFT;if(top&&right)return HTTOPRIGHT;if(bottom&&left)return HTBOTTOMLEFT;if(bottom&&right)return HTBOTTOMRIGHT;if(left)return HTLEFT;if(right)return HTRIGHT;if(top)return HTTOP;if(bottom)return HTBOTTOM;if(p.y<veyra::ui::dip(hwnd,54))return HTCAPTION;}return hit;}-case WM_PAINT:{PAINTSTRUCT ps{};HDC dc=BeginPaint(hwnd,&ps);RECT r{};GetClientRect(hwnd,&r);veyra::ui::ChromeLayout g(MulDiv(r.right,96,GetDpiForWindow(hwnd)),MulDiv(r.bottom,96,GetDpiForWindow(hwnd)),uiState.mode==veyra::ui::Mode::Professional,uiState.drawer,uiPreferences.inspectorWidth);if(g.pro&&uiState.diagnostics){g.viewHeight-=132;g.bottom-=132;}veyra::ui::paintChrome(hwnd,dc,g,engine.snapshot(),full);if(inspectorResizing){int x=veyra::ui::dip(hwnd,g.w-proposedInspectorWidth-27);auto pen=CreatePen(PS_SOLID,1,veyra::ui::accent);auto old=SelectObject(dc,pen);MoveToEx(dc,x,veyra::ui::dip(hwnd,68),nullptr);LineTo(dc,x,r.bottom-veyra::ui::dip(hwnd,20));SelectObject(dc,old);DeleteObject(pen);}EndPaint(hwnd,&ps);return 0;}+case WM_NCCALCSIZE:if(wp)return 0;break;+case WM_NCACTIVATE:return DefWindowProcW(hwnd,msg,wp,-1);+case WM_NCPAINT:return 0;+case WM_ERASEBKGND:return 1;+case WM_NCHITTEST:{LRESULT hit=DefWindowProcW(hwnd,msg,wp,lp);if(hit==HTCLIENT&&!full){POINT p{GET_X_LPARAM(lp),GET_Y_LPARAM(lp)};ScreenToClient(hwnd,&p);RECT r{};GetClientRect(hwnd,&r);int edge=veyra::ui::dip(hwnd,7);bool left=p.x<edge,right=p.x>=r.right-edge,top=p.y<edge,bottom=p.y>=r.bottom-edge;if(top&&left)return HTTOPLEFT;if(top&&right)return HTTOPRIGHT;if(bottom&&left)return HTBOTTOMLEFT;if(bottom&&right)return HTBOTTOMRIGHT;if(left)return HTLEFT;if(right)return HTRIGHT;if(top)return HTTOP;if(bottom)return HTBOTTOM;if((uiState.mode==veyra::ui::Mode::Professional&&p.y<veyra::ui::dip(hwnd,54))||(uiState.mode==veyra::ui::Mode::Daily&&p.y>r.bottom-veyra::ui::dip(hwnd,88)))return HTCAPTION;}return hit;}+case WM_PAINT:{veyra::ui::PaintBuffer paint(hwnd);auto g=chromeLayout(MulDiv(paint.rect.right,96,GetDpiForWindow(hwnd)),MulDiv(paint.rect.bottom,96,GetDpiForWindow(hwnd)));veyra::ui::paintChrome(hwnd,paint.dc,g,engine.snapshot(),full);return 0;}+case WM_LBUTTONDOWN:{if(uiState.mode==veyra::ui::Mode::Professional&&!full){RECT r{};GetClientRect(hwnd,&r);int w=MulDiv(r.right,96,GetDpiForWindow(hwnd)),x=MulDiv(GET_X_LPARAM(lp),96,GetDpiForWindow(hwnd));if(w>=1180&&abs(x-(w-uiPreferences.inspectorWidth-27))<8){inspectorResizing=true;proposedInspectorWidth=uiPreferences.inspectorWidth;SetCapture(hwnd);return 0;}}break;}case WM_MOUSEMOVE:if(inspectorResizing){RECT r{};GetClientRect(hwnd,&r);proposedInspectorWidth=std::clamp(MulDiv(r.right-GET_X_LPARAM(lp),96,GetDpiForWindow(hwnd))-27,296,420);InvalidateRect(hwnd,nullptr,FALSE);return 0;}break;case WM_LBUTTONUP:if(inspectorResizing){inspectorResizing=false;ReleaseCapture();uiPreferences.inspectorWidth=proposedInspectorWidth;layout();return 0;}break;@@ -160,15 +208,18 @@ case WM_CAPTURECHANGED:if(inspectorResizing){inspectorResizing=false;InvalidateRcase WM_NOTIFY:{auto header=reinterpret_cast<NMHDR*>(lp);if(header->code==TTN_GETDISPINFOW){auto info=reinterpret_cast<NMTTDISPINFOW*>(lp);HWND child=reinterpret_cast<HWND>(header->idFrom);if(auto tip=GetPropW(child,L"veyra.tip"))info->lpszText=reinterpret_cast<wchar_t*>(tip);else{static wchar_t value[512];GetWindowTextW(child,value,512);info->lpszText=value;}return 0;}break;}case WM_GETMINMAXINFO:{auto info=reinterpret_cast<MINMAXINFO*>(lp);info->ptMinTrackSize={veyra::ui::dip(hwnd,720),veyra::ui::dip(hwnd,540)};return 0;}case WM_CTLCOLORSTATIC:case WM_CTLCOLOREDIT:case WM_CTLCOLORBTN:case WM_CTLCOLORLISTBOX:return veyra::ui::colors(msg,wp,lp);+case WM_APP+44:{if(masterPendingRevision)return 0;auto setting=uiState.enhanced?engine.snapshot().desired:uiState.configured;const bool enabled=lp==BST_CHECKED;if(wp==200)setting.nr=enabled;else if(wp==201)setting.sr=enabled;else return 0;+ const bool enablesMaster=enabled&&!uiState.enhanced;if(enablesMaster){masterPreviousEnabled=false;uiState.enhanced=true;}applySettings(setting);if(auto pending=engine.snapshot();enablesMaster&&pending.running){masterPendingRevision=pending.desired.revision;masterPendingSession=pending.sessionId;}veyra::log::info("ui-feature",std::format("click={} enabled={} requestedRevision={} draft-independent=true",wp==200?"NR":"SR",enabled,engine.snapshot().desired.revision));return 1;}case WM_APP+43:showDiagnostics=false;layout();return 0;case WM_APP+42:refreshDailyPresets();return 0;case WM_APP+41:switch(wp){case 501:startVideoExport(lp!=0);break;case 502:{auto path=fileDialog(true);if(!path.empty())engine.saveFrame(path);break;}case 503:jobPaused=!jobPaused;exportJob.pause(jobPaused);break;case 504:exportJob.cancel();break;case 505:preferWatching=lp==BST_CHECKED;break;}return 0;-case WM_SIZE:if(wp!=SIZE_MINIMIZED)layout();return 0;+case WM_SIZE:if(wp!=SIZE_MINIMIZED){endTransition();layout();}return 0;case WM_DROPFILES:{wchar_t file[32768]{};DragQueryFileW(reinterpret_cast<HDROP>(wp),0,file,32768);DragFinish(reinterpret_cast<HDROP>(wp));openFile(file);layout();return 0;}case WM_COMMAND:switch(LOWORD(wp)){case Open:case ProRailVideo:case ImageOpen:openFile(fileDialog(false));layout();break;+case More:moreMenu();break;case ModeSwitch:switchMode();break;-case WindowMin:ShowWindow(hwnd,SW_MINIMIZE);break;case WindowMax:ShowWindow(hwnd,IsZoomed(hwnd)?SW_RESTORE:SW_MAXIMIZE);break;case WindowClose:SendMessageW(hwnd,WM_CLOSE,0,0);break;+case WindowMin:ShowWindow(hwnd,SW_MINIMIZE);break;case WindowMax:toggleFullscreen();break;case WindowClose:SendMessageW(hwnd,WM_CLOSE,0,0);break;case Master:if(masterPendingRevision)break;masterPreviousEnabled=uiState.enhanced;if(uiState.enhanced)uiState.configured=engine.snapshot().desired;uiState.enhanced=!uiState.enhanced;veyra::ui::settingsEnabled(uiState.enhanced,uiState.configured);engine.requestSettings(uiState.effective());if(auto pending=engine.snapshot();pending.running){masterPendingRevision=pending.desired.revision;masterPendingSession=pending.sessionId;}break;case DailyPreset:if(HIWORD(wp)==CBN_SELCHANGE){veyra::engine::EnhancementSettings setting;auto index=SendDlgItemMessageW(hwnd,DailyPreset,CB_GETCURSEL,0,0);if(index>0&&veyra::ui::presetAt(size_t(index-1),setting))applySettings(setting);}break;case InspectorDrawer:uiState.drawer=!uiState.drawer;layout();break;@@ -205,15 +256,19 @@ case WM_HSCROLL:if(reinterpret_cast<HWND>(lp)==GetDlgItem(hwnd,Volume)){engine.scase WM_KEYDOWN:if(wp==VK_SPACE){SendMessageW(hwnd,WM_COMMAND,Play,0);return 0;}if(wp==VK_F11){toggleFullscreen();return 0;}if(wp==VK_ESCAPE&&full){toggleFullscreen();return 0;}if(wp=='V'&&uiState.mode==veyra::ui::Mode::Professional){holdOriginal=true;updateComparison();return 0;}break;case WM_KEYUP:if(wp=='V'){holdOriginal=false;updateComparison();return 0;}break;case WM_SYSKEYDOWN:if(wp==VK_RETURN&&(lp&(1LL<<29))){toggleFullscreen();return 0;}break;+case WM_THEMECHANGED:veyra::ui::glassTextTheme().reset();[[fallthrough]];+case WM_DWMCOMPOSITIONCHANGED:backdrop.configure();RedrawWindow(hwnd,nullptr,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);return 0;case WM_ACTIVATEAPP:if(!wp){holdOriginal=false;updateComparison();}break;case WM_DPICHANGED:{auto rect=reinterpret_cast<RECT*>(lp);if(!full)SetWindowPos(hwnd,nullptr,rect->left,rect->top,rect->right-rect->left,rect->bottom-rect->top,SWP_NOZORDER|SWP_NOACTIVATE);auto oldFont=font;font=CreateFontW(-MulDiv(15,HIWORD(wp),96),0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,0,0,CLEARTYPE_QUALITY,0,L"Microsoft YaHei UI");EnumChildWindows(hwnd,[](HWND c,LPARAM f)->BOOL{SendMessageW(c,WM_SETFONT,WPARAM(f),TRUE);return TRUE;},LPARAM(font));DeleteObject(oldFont);DeleteObject(emptyFont);emptyFont=veyra::ui::makeFont(hwnd,26);SendDlgItemMessageW(hwnd,EmptyTitle,WM_SETFONT,WPARAM(emptyFont),TRUE);veyra::ui::settingsDpi();veyra::ui::telemetryDpi();layout();return 0;}-case WM_TIMER:{if(closing){if(engine.idle()&&!exportJob.poll().active()){KillTimer(hwnd,1);DestroyWindow(hwnd);}return 0;}if(!autoInput.empty()){auto file=autoInput;autoInput.clear();openFile(file);startTick=GetTickCount64();}if(smokeControls&&startTick){const auto elapsed=GetTickCount64()-startTick;+case WM_TIMER:{if(wp==2){transition.sample(GetTickCount64());if(!transition.running){endTransition();veyra::log::info("ui-transition","completed; final layout and swapchain resize released");}layout();return 0;}+if(full&&fullControls&&!menuOpen&&!GetCapture()&&GetTickCount64()-pointerTick>1600){POINT p{};GetCursorPos(&p);ScreenToClient(hwnd,&p);RECT r{};GetClientRect(hwnd,&r);if(p.y<r.bottom-veyra::ui::dip(hwnd,88)||p.x<0||p.x>=r.right||p.y>=r.bottom){fullControls=false;layout();if(GetForegroundWindow()==hwnd)SetCursor(nullptr);veyra::log::info("ui-fullscreen","controls hidden; video and subtitles only");}}+if(closing){if(engine.idle()&&!exportJob.poll().active()){KillTimer(hwnd,1);DestroyWindow(hwnd);}return 0;}if(!autoInput.empty()){auto file=autoInput;autoInput.clear();openFile(file);startTick=GetTickCount64();}if(smokeControls&&startTick){const auto elapsed=GetTickCount64()-startTick;if(smokeStep==0&&elapsed>2200){engine.pause(true);smokeStep=1;}if(smokeStep==1&&elapsed>2600){engine.seek(1.0);smokeStep=2;}if(smokeStep==2&&elapsed>3200){engine.pause(false);smokeStep=3;}if(smokeStep==3&&elapsed>4100&&!smokeSave.empty()){engine.saveFrame(smokeSave);smokeStep=4;}-}auto s=engine.snapshot();CheckDlgButton(hwnd,Nr,s.desired.nr?BST_CHECKED:BST_UNCHECKED);CheckDlgButton(hwnd,Sr,s.desired.sr?BST_CHECKED:BST_UNCHECKED);CheckDlgButton(hwnd,Fg,s.desired.multiplier>1?BST_CHECKED:BST_UNCHECKED);CheckDlgButton(hwnd,Realtime,s.desired.nrPolicy==veyra::pipeline::NrSizePolicy::Realtime?BST_CHECKED:BST_UNCHECKED);if(s.desired.multiplier>1)SendDlgItemMessageW(hwnd,Multiplier,CB_SETCURSEL,s.desired.multiplier-2,0);const auto subtitleText=uiState.subtitles&&!(showDiagnostics&&uiState.mode==veyra::ui::Mode::Professional&&!full)?veyra::engine::subtitleAt(subtitles,s.position):L"";veyra::ui::updateSubtitleOverlay(subtitleLabel,subtitleText,subtitlePixels);+}auto s=engine.snapshot();const auto subtitleText=uiState.subtitles&&!(showDiagnostics&&uiState.mode==veyra::ui::Mode::Professional&&!full)?veyra::engine::subtitleAt(subtitles,s.position):L"";veyra::ui::updateSubtitleOverlay(subtitleLabel,subtitleText,subtitlePixels);auto text=s.capture?std::format(L"{}\r\n输入 {:.1f} / 已处理 {:.1f}fps | 回调至Present返回p95 {:.1f}ms(非总延迟)| 丢弃 {} | 有效生成 {}",s.status,s.captureFps,s.fps,s.captureAgeP95Ms,s.captureDropped,s.generated):std::format(L"{}\r\n{:.1f} / {:.1f}秒 已处理 {:.1f}fps 提交迟到 {:+.1f}ms 源帧 {} / 有效生成 {}",s.status,s.position,s.duration,s.fps,s.lateMs,s.frames,s.generated);if(compareMode||holdOriginal)text+=L"\r\n真实帧对比:两侧同一源帧;此模式不展示生成帧。";const auto problem=veyra::Logger::instance().latestProblem();if(!problem.empty()){int n=MultiByteToWideChar(CP_UTF8,0,problem.data(),int(problem.size()),nullptr,0);std::wstring detail(n,0);MultiByteToWideChar(CP_UTF8,0,problem.data(),int(problem.size()),detail.data(),n);text+=L"\r\n最近问题:"+detail.substr(0,100)+L"(详见诊断)";}@@ -225,15 +280,15 @@ setText(GetDlgItem(hwnd,Master),masterPendingRevision?L"正在应用…":uiStateveyra::ui::icon(GetDlgItem(hwnd,Play),s.transport==veyra::engine::TransportState::Playing?veyra::ui::Icon::Pause:veyra::ui::Icon::Play);veyra::ui::icon(GetDlgItem(hwnd,Mute),s.muted?veyra::ui::Icon::Muted:veyra::ui::Icon::Volume);setText(GetDlgItem(hwnd,Play),s.transport==veyra::engine::TransportState::Paused||s.transport==veyra::engine::TransportState::Ended||!s.running?L"▶":L"Ⅱ");setText(GetDlgItem(hwnd,Mute),!s.audioAvailable?L"无音轨":s.muted?L"静音":L"音量");EnableWindow(GetDlgItem(hwnd,Volume),s.audioAvailable);EnableWindow(GetDlgItem(hwnd,Mute),s.audioAvailable);-EnableWindow(seekBar,s.running&&!s.capture&&!s.image&&s.duration>0);ShowWindow(seekBar,!full&&!s.capture&&!s.image&&!(showDiagnostics&&uiState.mode==veyra::ui::Mode::Professional)?SW_SHOW:SW_HIDE);EnableWindow(GetDlgItem(hwnd,Play),!currentFile.empty()&&!s.capture&&!s.image);EnableWindow(GetDlgItem(hwnd,Stop),s.running);+EnableWindow(seekBar,s.running&&!s.capture&&!s.image&&s.duration>0);ShowWindow(seekBar,(!full||fullControls)&&!s.capture&&!s.image&&!(showDiagnostics&&uiState.mode==veyra::ui::Mode::Professional&&!full)?SW_SHOW:SW_HIDE);EnableWindow(GetDlgItem(hwnd,Play),!currentFile.empty()&&!s.capture&&!s.image);EnableWindow(GetDlgItem(hwnd,Stop),s.running);setText(GetDlgItem(hwnd,MediaTitle),currentFile.empty()?L"尚未打开媒体":s.capture?L"采集卡 · LIVE":std::filesystem::path(currentFile).filename().wstring());auto stamp=[](double v){int seconds=std::max(0,int(v));return std::format(L"{:02}:{:02}:{:02}",seconds/3600,seconds/60%60,seconds%60);};setText(GetDlgItem(hwnd,TimeLabel),s.capture?L"LIVE · 采集卡实时输入":s.image?L"静态图片":stamp(s.position)+L" / "+stamp(s.duration)+(s.transport==veyra::engine::TransportState::Opening?L" · 正在打开…":s.failed?L" · 发生错误,详见专业诊断":L""));std::wstring metric=std::format(L"源帧处理 {:.1f} fps · 有效生成 {} · 实际提交 {}\n提交迟到 p95 {:.1f} ms · GPU / CPU 时间分别统计\n{}\n实际扫描率与光子延迟:未测",s.fps,s.generated,s.metrics.submitted,s.lateP95Ms,s.status);setText(metricLabel,metric);-if(uiState.mode==Mode::Professional){RECT client{};GetClientRect(hwnd,&client);RECT dashboard{0,client.bottom-dip(hwnd,232),client.right,client.bottom};InvalidateRect(hwnd,&dashboard,FALSE);}+if(uiState.mode==Mode::Professional&&!full&&!transition.running&&GetTickCount64()-dashboardTick>=250){dashboardTick=GetTickCount64();RECT client{};GetClientRect(hwnd,&client);RECT dashboard{0,client.bottom-dip(hwnd,232),client.right,client.bottom};InvalidateRect(hwnd,&dashboard,FALSE);}exportJob.watching(preferWatching&&s.running&&s.transport==veyra::engine::TransportState::Playing);auto job=exportJob.poll();exportPanelStatus(job,!currentFile.empty()&&!s.capture&&!s.image&&s.frames>0&&!s.applying,s.running&&s.frames>0);setText(GetDlgItem(hwnd,JobProgress),job.message+std::format(L" {}% · 查看",int(job.progress*100)));ShowWindow(GetDlgItem(hwnd,JobProgress),job.state==veyra::engine::ExportState::Idle||full?SW_HIDE:SW_SHOW);-setText(GetDlgItem(hwnd,EmptyTitle),s.failed?L"播放已停止":L"开始观看");setText(GetDlgItem(hwnd,EmptyHint),s.failed?s.status:L"打开本地视频,或连接采集卡\n精细调整与原生导出在专业模式中");ShowWindow(GetDlgItem(hwnd,EmptyTitle),(currentFile.empty()||s.failed)&&!full?SW_SHOW:SW_HIDE);ShowWindow(GetDlgItem(hwnd,EmptyHint),(currentFile.empty()||s.failed)&&!full?SW_SHOW:SW_HIDE);-if(!dragging&&s.duration>0)SendMessageW(seekBar,TBM_SETPOS,TRUE,LPARAM(s.position/s.duration*10000));+setText(GetDlgItem(hwnd,EmptyTitle),s.failed?L"播放已停止":L"开始观看");setText(GetDlgItem(hwnd,EmptyHint),s.failed?s.status:L"打开本地视频,或连接采集卡\n精细调整与原生导出在专业模式中");ShowWindow(GetDlgItem(hwnd,EmptyTitle),SW_HIDE);ShowWindow(GetDlgItem(hwnd,EmptyHint),SW_HIDE);+if(!dragging&&s.duration>0){int position=int(s.position/s.duration*10000);if(SendMessageW(seekBar,TBM_GETPOS,0,0)!=position)SendMessageW(seekBar,TBM_SETPOS,TRUE,position);}if(!smokeViewApplied&&!smokeView.empty()&&(s.frames>0||smokeEmpty)){smokeViewApplied=true;if(smokeView==L"small")SetWindowPos(hwnd,nullptr,0,0,800,600,SWP_NOMOVE|SWP_NOZORDER);if(smokeView!=L"daily"&&smokeView!=L"empty"&&uiState.mode==veyra::ui::Mode::Daily)switchMode();if(smokeView==L"export")selectInspector(3);if(smokeView==L"diagnostics"){showDiagnostics=true;layout();}if(smokeView==L"fullscreen")toggleFullscreen();}if(smokeDualPause&&pausedPosition<0&&s.frames>20){engine.pause(true);pausedPosition=s.position;pausedFrames=s.frames;}if(smokeDual&&startTick&&s.frames>10&&dualStep<40&&GetTickCount64()-startTick>ULONGLONG(1500+dualStep*200)){if(dualStep==4){modeGdiStart=GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS);GetProcessHandleCount(GetCurrentProcess(),&modeHandlesStart);PROCESS_MEMORY_COUNTERS_EX pm{};pm.cb=sizeof(pm);GetProcessMemoryInfo(GetCurrentProcess(),reinterpret_cast<PROCESS_MEMORY_COUNTERS*>(&pm),sizeof(pm));modePrivateStart=pm.PrivateUsage;}switchMode();@@ -262,9 +317,10 @@ if(settingsStep==0&&s.frames>20){auto change=s.desired;change.model.intensity=.6if(settingsStep==1&&s.applied.model.intensity==.6f&&elapsed>3300){auto change=s.desired;change.sr=true;engine.requestSettings(change);settingsStep=2;}if(settingsStep==2&&s.applied.sr&&elapsed>4500){auto invalid=s.desired;invalid.model.intensity=2;const bool rejected=!engine.requestSettings(invalid);veyra::log::info("settings-test",std::format("invalid-rejected={} position={} revision={} settingsStep={}",rejected,s.position,s.applied.revision,settingsStep));settingsStep=rejected?3:-1;}}-if(smokeSeconds>0&&startTick&&GetTickCount64()-startTick>ULONGLONG(smokeSeconds)*1000){veyra::log::info("app",std::format("smoke frames={} generated={} failed={} latenessMs={:.2f} absLatenessP95Ms={:.2f} controlsStep={} capture={} processedFps={:.2f} callbackFps={:.2f} captureDropped={} callbackToPresentReturnP95Ms={:.3f} schedulingWaitP95Ms={:.3f} processCpuP95Ms={:.3f} presentCpuP95Ms={:.3f} nrEvaluated={} nvofExecuted={}",s.frames,s.generated,s.failed,s.lateMs,s.lateP95Ms,smokeStep,s.capture,s.fps,s.captureFps,s.captureDropped,s.captureAgeP95Ms,s.schedulingWaitP95Ms,s.processCpuP95Ms,s.presentCpuP95Ms,s.nrEvaluated,s.nvofExecuted));resultCode=(s.frames>0||smokeEmpty)&&!s.failed&&(!smokeSettings||settingsStep==3)&&(!smokeRollback||settingsStep==3)&&(!smokeUi||uiStep==8)&&(!smokeDual||dualStep==40)&&(!smokeMaster||masterStep==3)&&(!smokeAudio||audioStep==4)&&(!(smokeJob||smokeJobCancel)||jobStep==4)?0:1;PostMessageW(hwnd,WM_CLOSE,0,0);}return 0;}-case WM_CLOSE:if(!closing&&smokeSeconds<=0&&exportJob.poll().active()&&MessageBoxW(hwnd,L"导出尚未完成。取消导出并退出?\n选择“否”返回播放器继续导出。",L"退出 Veyra",MB_YESNO|MB_DEFBUTTON2|MB_ICONQUESTION)!=IDYES)return 0;if(!closing&&smokeSeconds<=0){auto snapshot=engine.snapshot();WINDOWPLACEMENT placement{sizeof(placement)};if(full)placement=windowPlacement;else GetWindowPlacement(hwnd,&placement);auto r=placement.rcNormalPosition;uiPreferences.width=MulDiv(r.right-r.left,96,GetDpiForWindow(hwnd));uiPreferences.height=MulDiv(r.bottom-r.top,96,GetDpiForWindow(hwnd));uiPreferences.x=r.left;uiPreferences.y=r.top;uiPreferences.positioned=true;uiPreferences.volume=snapshot.volume;uiPreferences.muted=snapshot.muted;uiPreferences.subtitles=uiState.subtitles;uiPreferences.subtitleSize=subtitlePixels;uiPreferences.inspector=uiState.inspector;const bool confirmed=snapshot.frames>0&&!snapshot.applying&&!snapshot.failed;if(!preferences.save(uiPreferences,haveSuccessful?&lastSuccessful:nullptr))veyra::log::warn("ui-preferences","preferences not saved; corrupt original preserved");}exportJob.cancel();closing=true;engine.stop();SetWindowTextW(statusBar,L"正在释放当前任务资源…");return 0;-case WM_DESTROY:DeleteObject(font);DeleteObject(emptyFont);PostQuitMessage(resultCode);return 0;+tickRepairChecks(hwnd,s);+if(smokeSeconds>0&&startTick&&GetTickCount64()-startTick>ULONGLONG(smokeSeconds)*1000){veyra::log::info("app",std::format("smoke frames={} generated={} failed={} latenessMs={:.2f} absLatenessP95Ms={:.2f} controlsStep={} capture={} processedFps={:.2f} callbackFps={:.2f} captureDropped={} callbackToPresentReturnP95Ms={:.3f} schedulingWaitP95Ms={:.3f} processCpuP95Ms={:.3f} presentCpuP95Ms={:.3f} nrEvaluated={} nvofExecuted={}",s.frames,s.generated,s.failed,s.lateMs,s.lateP95Ms,smokeStep,s.capture,s.fps,s.captureFps,s.captureDropped,s.captureAgeP95Ms,s.schedulingWaitP95Ms,s.processCpuP95Ms,s.presentCpuP95Ms,s.nrEvaluated,s.nvofExecuted));resultCode=(s.frames>0||smokeEmpty)&&!s.failed&&(!smokeRepair||repairStep==10)&&(!smokeSettings||settingsStep==3)&&(!smokeRollback||settingsStep==3)&&(!smokeUi||uiStep==8)&&(!smokeDual||dualStep==40)&&(!smokeMaster||masterStep==3)&&(!smokeAudio||audioStep==4)&&(!(smokeJob||smokeJobCancel)||jobStep==4)?0:1;PostMessageW(hwnd,WM_CLOSE,0,0);}return 0;}+case WM_CLOSE:endTransition();if(!closing&&smokeSeconds<=0&&exportJob.poll().active()&&MessageBoxW(hwnd,L"导出尚未完成。取消导出并退出?\n选择“否”返回播放器继续导出。",L"退出 Veyra",MB_YESNO|MB_DEFBUTTON2|MB_ICONQUESTION)!=IDYES)return 0;if(!closing&&smokeSeconds<=0){auto snapshot=engine.snapshot();WINDOWPLACEMENT placement{sizeof(placement)};if(full)placement=windowPlacement;else GetWindowPlacement(hwnd,&placement);auto r=placement.rcNormalPosition;uiPreferences.width=MulDiv(r.right-r.left,96,GetDpiForWindow(hwnd));uiPreferences.height=MulDiv(r.bottom-r.top,96,GetDpiForWindow(hwnd));uiPreferences.x=r.left;uiPreferences.y=r.top;uiPreferences.positioned=true;uiPreferences.volume=snapshot.volume;uiPreferences.muted=snapshot.muted;uiPreferences.subtitles=uiState.subtitles;uiPreferences.subtitleSize=subtitlePixels;uiPreferences.inspector=uiState.inspector;const bool confirmed=snapshot.frames>0&&!snapshot.applying&&!snapshot.failed;if(!preferences.save(uiPreferences,haveSuccessful?&lastSuccessful:nullptr))veyra::log::warn("ui-preferences","preferences not saved; corrupt original preserved");}exportJob.cancel();closing=true;engine.stop();SetWindowTextW(statusBar,L"正在释放当前任务资源…");return 0;+case WM_DESTROY:backdrop.detach();DeleteObject(font);DeleteObject(emptyFont);PostQuitMessage(resultCode);return 0;}return DefWindowProcW(hwnd,msg,wp,lp);}}int runVeyraApp(HINSTANCE instance,int show){@@ -274,13 +330,13 @@ CoInitializeEx(nullptr,COINIT_APARTMENTTHREADED);std::filesystem::create_directories(std::filesystem::path(VEYRA_PROJECT_ROOT)/"logs");wchar_t logOverride[32768]{};GetEnvironmentVariableW(L"VEYRA_LOG_FILE",logOverride,32768);veyra::Logger::instance().openFile(logOverride[0]?std::wstring(logOverride):(std::filesystem::path(VEYRA_PROJECT_ROOT)/"logs/veyra-app.log").wstring());initialOptions=veyra::engine::PlayerOptions::from(veyra::ui::defaultSettings());-int argc=0;auto argv=CommandLineToArgvW(GetCommandLineW(),&argc);for(int i=1;i<argc;++i){const std::wstring arg=argv[i];if(arg==L"--export-worker"&&i+1<argc)workerMapping=reinterpret_cast<HANDLE>(_wcstoui64(argv[++i],nullptr,10));else if(arg==L"--smoke-view"&&i+1<argc)smokeView=argv[++i];else if(arg==L"--smoke-empty")smokeEmpty=true;else if(arg==L"--smoke-dual")smokeDual=true;else if(arg==L"--smoke-dual-pause"){smokeDual=smokeDualPause=true;}else if(arg==L"--smoke-master-reject")smokeMaster=smokeMasterReject=true;else if(arg==L"--smoke-master")smokeMaster=true;else if(arg==L"--smoke-audio")smokeAudio=true;else if(arg==L"--smoke-job-cancel")smokeJobCancel=true;else if(arg==L"--smoke-job-exit")smokeJobExit=true;else if(arg==L"--smoke-job")smokeJob=true;else if(arg==L"--smoke-dual-export"&&i+1<argc)smokeDualOutput=argv[++i];else if(arg==L"--smoke-seconds"&&i+1<argc)smokeSeconds=std::clamp(_wtoi(argv[++i]),1,240);else if(arg==L"--export-out"&&i+1<argc)exportOutput=argv[++i];else if(arg==L"--max-frames"&&i+1<argc)exportFrames=std::max(1,_wtoi(argv[++i]));else if(arg==L"--cancel-after-ms"&&i+1<argc)cancelAfterMs=std::clamp(_wtoi(argv[++i]),1,240000);else if(arg==L"--hevc")exportHevc=true;else if(arg==L"--smoke-rollback-flow"){smokeRollback=true;smokeRollbackFlow=true;}else if(arg==L"--smoke-rollback")smokeRollback=true;else if(arg==L"--smoke-ui")smokeUi=true;else if(arg==L"--no-fg")initialOptions.fg=false;else if(arg==L"--smoke-settings")smokeSettings=true;else if(arg==L"--smoke-controls")smokeControls=true;else if(arg==L"--smoke-save"&&i+1<argc)smokeSave=argv[++i];else if(arg==L"--native")initialOptions.realtime=false;else if(arg==L"--realtime")initialOptions.realtime=true;else if(arg==L"--fg")initialOptions.fg=true;else if(arg==L"--fg-multiplier"&&i+1<argc){initialOptions.fgMultiplier=std::clamp(_wtoi(argv[++i]),2,4);initialOptions.fg=true;}else if(arg==L"--sr")initialOptions.sr=true;else if(arg==L"--no-nr")initialOptions.nr=false;else if(arg==L"--nr")initialOptions.nr=true;else if(arg==L"--no-sr")initialOptions.sr=false;else autoInput=arg;}LocalFree(argv);+int argc=0;auto argv=CommandLineToArgvW(GetCommandLineW(),&argc);for(int i=1;i<argc;++i){const std::wstring arg=argv[i];if(arg==L"--export-worker"&&i+1<argc)workerMapping=reinterpret_cast<HANDLE>(_wcstoui64(argv[++i],nullptr,10));else if(arg==L"--smoke-view"&&i+1<argc)smokeView=argv[++i];else if(arg==L"--smoke-repair-ui")smokeRepair=true;else if(arg==L"--smoke-repair-ui-reject")smokeRepair=smokeRepairReject=true;else if(arg==L"--smoke-empty")smokeEmpty=true;else if(arg==L"--smoke-dual")smokeDual=true;else if(arg==L"--smoke-dual-pause"){smokeDual=smokeDualPause=true;}else if(arg==L"--smoke-master-reject")smokeMaster=smokeMasterReject=true;else if(arg==L"--smoke-master")smokeMaster=true;else if(arg==L"--smoke-audio")smokeAudio=true;else if(arg==L"--smoke-job-cancel")smokeJobCancel=true;else if(arg==L"--smoke-job-exit")smokeJobExit=true;else if(arg==L"--smoke-job")smokeJob=true;else if(arg==L"--smoke-dual-export"&&i+1<argc)smokeDualOutput=argv[++i];else if(arg==L"--smoke-seconds"&&i+1<argc)smokeSeconds=std::clamp(_wtoi(argv[++i]),1,240);else if(arg==L"--export-out"&&i+1<argc)exportOutput=argv[++i];else if(arg==L"--max-frames"&&i+1<argc)exportFrames=std::max(1,_wtoi(argv[++i]));else if(arg==L"--cancel-after-ms"&&i+1<argc)cancelAfterMs=std::clamp(_wtoi(argv[++i]),1,240000);else if(arg==L"--hevc")exportHevc=true;else if(arg==L"--smoke-rollback-flow"){smokeRollback=true;smokeRollbackFlow=true;}else if(arg==L"--smoke-rollback")smokeRollback=true;else if(arg==L"--smoke-ui")smokeUi=true;else if(arg==L"--no-fg")initialOptions.fg=false;else if(arg==L"--smoke-settings")smokeSettings=true;else if(arg==L"--smoke-controls")smokeControls=true;else if(arg==L"--smoke-save"&&i+1<argc)smokeSave=argv[++i];else if(arg==L"--native")initialOptions.realtime=false;else if(arg==L"--realtime")initialOptions.realtime=true;else if(arg==L"--fg")initialOptions.fg=true;else if(arg==L"--fg-multiplier"&&i+1<argc){initialOptions.fgMultiplier=std::clamp(_wtoi(argv[++i]),2,4);initialOptions.fg=true;}else if(arg==L"--sr")initialOptions.sr=true;else if(arg==L"--no-nr")initialOptions.nr=false;else if(arg==L"--nr")initialOptions.nr=true;else if(arg==L"--no-sr")initialOptions.sr=false;else autoInput=arg;}LocalFree(argv);if(workerMapping){const int code=veyra::engine::runExportWorker(workerMapping);CoUninitialize();return code;}if(smokeSeconds<=0&&exportOutput.empty()){uiPreferences=preferences.load();initialOptions=veyra::engine::PlayerOptions::from(preferences.startup(initialOptions.snapshot()));engine.setVolume(uiPreferences.volume,uiPreferences.muted);uiState.subtitles=uiPreferences.subtitles;subtitlePixels=uiPreferences.subtitleSize;}engine.requestSettings(initialOptions.snapshot());if(!exportOutput.empty()){std::atomic<bool> cancel{false},finished{false};std::thread cancelTimer;if(cancelAfterMs)cancelTimer=std::thread([&]{const auto start=GetTickCount64();while(!finished&&GetTickCount64()-start<cancelAfterMs)std::this_thread::sleep_for(std::chrono::milliseconds(5));if(!finished)cancel=true;});bool ok=veyra::engine::exportVideo(autoInput,exportOutput,initialOptions,exportHevc,cancel,[](double,const std::wstring& s){OutputDebugStringW(s.c_str());},exportFrames);finished=true;if(cancelTimer.joinable())cancelTimer.join();veyra::log::info("app",std::format("export result={}",ok));CoUninitialize();return ok?0:cancel?3:1;}WNDCLASSEXW wc{sizeof(wc)};wc.hInstance=instance;wc.lpfnWndProc=proc;wc.lpszClassName=L"VeyraApp";wc.hCursor=LoadCursorW(nullptr,IDC_ARROW);wc.hbrBackground=veyra::ui::bgBrush();RegisterClassExW(&wc);-auto hwnd=CreateWindowExW(0,wc.lpszClassName,L"Veyra — 本地实验版",ShellStyle,CW_USEDEFAULT,CW_USEDEFAULT,std::min(MulDiv(uiPreferences.width,GetDpiForSystem(),96),GetSystemMetrics(SM_CXSCREEN)),std::min(MulDiv(uiPreferences.height,GetDpiForSystem(),96),GetSystemMetrics(SM_CYSCREEN)-40),nullptr,nullptr,instance,nullptr);if(!hwnd)return 1;if(uiPreferences.positioned&&smokeSeconds<=0){RECT target{uiPreferences.x,uiPreferences.y,uiPreferences.x+MulDiv(uiPreferences.width,GetDpiForSystem(),96),uiPreferences.y+MulDiv(uiPreferences.height,GetDpiForSystem(),96)};MONITORINFO mi{sizeof(mi)};GetMonitorInfoW(MonitorFromRect(&target,MONITOR_DEFAULTTONEAREST),&mi);int width=std::min(target.right-target.left,mi.rcWork.right-mi.rcWork.left),height=std::min(target.bottom-target.top,mi.rcWork.bottom-mi.rcWork.top);SetWindowPos(hwnd,nullptr,std::clamp(target.left,mi.rcWork.left,mi.rcWork.right-width),std::clamp(target.top,mi.rcWork.top,mi.rcWork.bottom-height),width,height,SWP_NOZORDER|SWP_NOACTIVATE);}CheckDlgButton(hwnd,Nr,initialOptions.nr?BST_CHECKED:BST_UNCHECKED);CheckDlgButton(hwnd,Sr,initialOptions.sr?BST_CHECKED:BST_UNCHECKED);CheckDlgButton(hwnd,Fg,initialOptions.fg?BST_CHECKED:BST_UNCHECKED);CheckDlgButton(hwnd,Realtime,initialOptions.realtime?BST_CHECKED:BST_UNCHECKED);ShowWindow(hwnd,show);MSG msg{};while(GetMessageW(&msg,nullptr,0,0)>0){if(GetAncestor(msg.hwnd,GA_ROOT)==hwnd&&(msg.message==WM_KEYDOWN||msg.message==WM_KEYUP||msg.message==WM_SYSKEYDOWN)){+auto hwnd=CreateWindowExW(0,wc.lpszClassName,L"Veyra — 本地实验版",ShellStyle,CW_USEDEFAULT,CW_USEDEFAULT,std::min(MulDiv(uiPreferences.width,GetDpiForSystem(),96),GetSystemMetrics(SM_CXSCREEN)),std::min(MulDiv(uiPreferences.height,GetDpiForSystem(),96),GetSystemMetrics(SM_CYSCREEN)-40),nullptr,nullptr,instance,nullptr);if(!hwnd)return 1;if(uiPreferences.positioned&&smokeSeconds<=0){RECT target{uiPreferences.x,uiPreferences.y,uiPreferences.x+MulDiv(uiPreferences.width,GetDpiForSystem(),96),uiPreferences.y+MulDiv(uiPreferences.height,GetDpiForSystem(),96)};MONITORINFO mi{sizeof(mi)};GetMonitorInfoW(MonitorFromRect(&target,MONITOR_DEFAULTTONEAREST),&mi);int width=std::min(target.right-target.left,mi.rcWork.right-mi.rcWork.left),height=std::min(target.bottom-target.top,mi.rcWork.bottom-mi.rcWork.top);SetWindowPos(hwnd,nullptr,std::clamp(target.left,mi.rcWork.left,mi.rcWork.right-width),std::clamp(target.top,mi.rcWork.top,mi.rcWork.bottom-height),width,height,SWP_NOZORDER|SWP_NOACTIVATE);}CheckDlgButton(hwnd,Nr,initialOptions.nr?BST_CHECKED:BST_UNCHECKED);CheckDlgButton(hwnd,Sr,initialOptions.sr?BST_CHECKED:BST_UNCHECKED);CheckDlgButton(hwnd,Fg,initialOptions.fg?BST_CHECKED:BST_UNCHECKED);CheckDlgButton(hwnd,Realtime,initialOptions.realtime?BST_CHECKED:BST_UNCHECKED);ShowWindow(hwnd,show);MSG msg{};while(GetMessageW(&msg,nullptr,0,0)>0){if(full&&GetAncestor(msg.hwnd,GA_ROOT)==hwnd&&(msg.message==WM_MOUSEMOVE||msg.message==WM_LBUTTONDOWN||msg.message==WM_KEYDOWN)){static POINT previous{-9999,-9999};POINT now{};GetCursorPos(&now);if(msg.message!=WM_MOUSEMOVE||now.x!=previous.x||now.y!=previous.y)pointerActivity();previous=now;}if(GetAncestor(msg.hwnd,GA_ROOT)==hwnd&&(msg.message==WM_KEYDOWN||msg.message==WM_KEYUP||msg.message==WM_SYSKEYDOWN)){wchar_t focusedClass[32]{};GetClassNameW(GetFocus(),focusedClass,32);const bool editing=_wcsicmp(focusedClass,L"Edit")==0||_wcsicmp(focusedClass,L"ComboBox")==0;if(!editing&&msg.message==WM_KEYDOWN&&(GetKeyState(VK_CONTROL)&0x8000)&&msg.wParam=='O'){SendMessageW(hwnd,WM_COMMAND,Open,0);continue;}if(!editing&&msg.message==WM_KEYDOWN&&(GetKeyState(VK_CONTROL)&0x8000)&&msg.wParam=='E'){if(uiState.mode==veyra::ui::Mode::Daily)switchMode();selectInspector(3);continue;}diff --git a/apps/veyra/ui/GlassMaterial.h b/apps/veyra/ui/GlassMaterial.hnew file mode 100644index 00000000..a706256c--- /dev/null+++ b/apps/veyra/ui/GlassMaterial.h@@ -0,0 +1,56 @@+#pragma once+#include <windows.h>+#include <dwmapi.h>+#include <gdiplus.h>+#include <algorithm>+#include <cstdint>+#include <vector>+#include <memory>+#include <format>+#include "veyra/Log.h"+namespace veyra::ui {+// Explicit premultiplied BGRA is required for DWM glass. Compatible GDI+// bitmaps lose alpha and turn transparent controls into solid rectangles.+class AlphaRaster {+ HBITMAP bitmap_=nullptr;HGDIOBJ previous_=nullptr;+public:+ HDC dc=nullptr;uint32_t* pixels=nullptr;int width=0,height=0;+ AlphaRaster()=default;+ AlphaRaster(const AlphaRaster&)=delete;+ ~AlphaRaster(){clear();}+ void clear(){if(dc&&previous_)SelectObject(dc,previous_);if(bitmap_)DeleteObject(bitmap_);if(dc)DeleteDC(dc);dc=nullptr;bitmap_=nullptr;previous_=nullptr;pixels=nullptr;}+ bool create(HDC target,int w,int h){clear();width=std::max(1,w);height=std::max(1,h);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;dc=CreateCompatibleDC(target);bitmap_=CreateDIBSection(target,&info,DIB_RGB_COLORS,reinterpret_cast<void**>(&pixels),nullptr,0);if(!dc||!bitmap_){clear();return false;}previous_=SelectObject(dc,bitmap_);if(!previous_||previous_==HGDI_ERROR){previous_=nullptr;clear();return false;}std::fill_n(pixels,size_t(width)*height,0);return true;}+};+class AlphaGraphics {+ std::unique_ptr<Gdiplus::Bitmap> bitmap_;+ std::unique_ptr<Gdiplus::Graphics> graphics_;+public:+ explicit AlphaGraphics(HDC dc){DIBSECTION dib{};if(GetObjectW(GetCurrentObject(dc,OBJ_BITMAP),sizeof(dib),&dib)==sizeof(dib)&&dib.dsBm.bmBits&&dib.dsBm.bmBitsPixel==32){GdiFlush();bitmap_=std::make_unique<Gdiplus::Bitmap>(dib.dsBm.bmWidth,dib.dsBm.bmHeight,dib.dsBm.bmWidthBytes,PixelFormat32bppPARGB,static_cast<BYTE*>(dib.dsBm.bmBits));graphics_=std::make_unique<Gdiplus::Graphics>(bitmap_.get());}else graphics_=std::make_unique<Gdiplus::Graphics>(dc);}+ Gdiplus::Graphics& get(){return *graphics_;}+};+inline void opaqueBlack(HDC dc,RECT r){AlphaGraphics paint(dc);auto& g=paint.get();g.SetCompositingMode(Gdiplus::CompositingModeSourceCopy);Gdiplus::SolidBrush black(Gdiplus::Color(255,0,0,0));g.FillRectangle(&black,Gdiplus::Rect(r.left,r.top,r.right-r.left,r.bottom-r.top));}+struct GlassPane {+ RECT rect{};int radius=20;BYTE tint=36;+ bool operator==(const GlassPane& other)const{return EqualRect(&rect,&other.rect)&&radius==other.radius&&tint==other.tint;}+};+class GlassBackdrop {+ HWND window_=nullptr;bool active_=false,full_=false;int width_=0,height_=0;+ std::vector<GlassPane> panes_;+ static void path(Gdiplus::GraphicsPath& p,const RECT& r,int radius){const float d=float(std::min({radius*2,int(r.right-r.left-1),int(r.bottom-r.top-1)}));float x=float(r.left),y=float(r.top),w=float(r.right-r.left-1),h=float(r.bottom-r.top-1);p.AddArc(x,y,d,d,180,90);p.AddArc(x+w-d,y,d,d,270,90);p.AddArc(x+w-d,y+h-d,d,d,0,90);p.AddArc(x,y+h-d,d,d,90,90);p.CloseFigure();}+public:+ uint64_t revision=0;+ void configure(){if(!window_)return;BOOL dark=TRUE;DwmSetWindowAttribute(window_,20,&dark,sizeof(dark));const DWORD material=full_?1:3;const auto hr=DwmSetWindowAttribute(window_,38,&material,sizeof(material));MARGINS margins{full_?0:-1,0,0,0};const auto frame=DwmExtendFrameIntoClientArea(window_,&margins);active_=!full_&&SUCCEEDED(hr)&&SUCCEEDED(frame);veyra::log::info("ui-glass",std::format("system=DesktopAcrylic backdropHr=0x{:08X} frameHr=0x{:08X} apiAccepted={} fullscreen={} video=opaque",uint32_t(hr),uint32_t(frame),active_,full_));}+ void attach(HWND window){window_=window;SetPropW(window,L"Veyra.GlassBackdrop",this);configure();}+ void detach(){if(window_)RemovePropW(window_,L"Veyra.GlassBackdrop");window_=nullptr;}+ bool render(int width,int height,bool,bool full,const std::vector<GlassPane>& panes){if(full_!=full){full_=full;configure();}if(width==width_&&height==height_&&panes_==panes)return true;width_=width;height_=height;panes_=panes;++revision;return true;}+ bool copy(HDC target,HWND child,RECT area)const{+ if(!window_)return false;POINT origin{};MapWindowPoints(child,window_,&origin,1);AlphaGraphics paint(target);auto& g=paint.get();g.SetCompositingMode(Gdiplus::CompositingModeSourceCopy);g.SetClip(Gdiplus::Rect(area.left,area.top,area.right-area.left,area.bottom-area.top));+ Gdiplus::SolidBrush base(Gdiplus::Color(active_?26:255,10,13,17));g.FillRectangle(&base,Gdiplus::Rect(area.left,area.top,area.right-area.left,area.bottom-area.top));if(full_)return true;+ g.SetCompositingMode(Gdiplus::CompositingModeSourceOver);g.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);g.TranslateTransform(float(-origin.x),float(-origin.y));RECT rootArea=area;OffsetRect(&rootArea,origin.x,origin.y);+ for(const auto& pane:panes_){RECT overlap{};if(!IntersectRect(&overlap,&rootArea,&pane.rect)||pane.rect.right-pane.rect.left<3||pane.rect.bottom-pane.rect.top<3)continue;Gdiplus::GraphicsPath outline;path(outline,pane.rect,pane.radius);Gdiplus::SolidBrush tint(Gdiplus::Color(active_?pane.tint:BYTE(255),30,33,38));g.FillPath(&tint,&outline);Gdiplus::Pen rim(Gdiplus::Color(30,229,236,243),1);g.DrawPath(&rim,&outline);}+ return true;+ }+};+inline GlassBackdrop* glassBackdrop(HWND child){return reinterpret_cast<GlassBackdrop*>(GetPropW(GetAncestor(child,GA_ROOT),L"Veyra.GlassBackdrop"));}+inline bool copyGlass(HDC dc,RECT rect,HWND child){auto p=glassBackdrop(child);return p&&p->copy(dc,child,rect);}+}diff --git a/apps/veyra/ui/Theme.h b/apps/veyra/ui/Theme.hindex 984b364f..a9e7c945 100644--- a/apps/veyra/ui/Theme.h+++ b/apps/veyra/ui/Theme.h@@ -7,29 +7,62 @@#include <ocidl.h>#include <gdiplus.h>#include <algorithm>+#include <cmath>#include <string>+#include "GlassMaterial.h"#pragma comment(lib,"uxtheme.lib")#pragma comment(lib,"dwmapi.lib")#pragma comment(lib,"gdiplus.lib")#include <dwmapi.h>namespace veyra::ui {-inline constexpr COLORREF background=RGB(9,10,11),panel=RGB(27,28,30),raised=RGB(40,41,43),line=RGB(58,60,63),textColor=RGB(236,238,240),secondary=RGB(151,157,164),accent=RGB(230,122,49),cinema=RGB(32,48,62),cinemaPanel=RGB(23,34,43);+inline constexpr COLORREF background=RGB(9,10,11),panel=RGB(27,28,30),raised=RGB(40,41,43),line=RGB(58,60,63),textColor=RGB(236,238,240),secondary=RGB(192,196,202),accent=RGB(230,122,49),cinema=RGB(32,48,62),cinemaPanel=RGB(23,34,43);inline HBRUSH bgBrush(){static auto b=CreateSolidBrush(background);return b;}inline HBRUSH panelBrush(){static auto b=CreateSolidBrush(panel);return b;}inline HBRUSH raisedBrush(){static auto b=CreateSolidBrush(raised);return b;}inline int dip(HWND h,int v){return MulDiv(v,GetDpiForWindow(h),96);}inline HFONT makeFont(HWND h,int size=14,int weight=FW_NORMAL){return CreateFontW(-dip(h,size),0,0,0,weight,0,0,0,DEFAULT_CHARSET,0,0,CLEARTYPE_QUALITY,0,L"Microsoft YaHei UI");}-inline void titleTheme(HWND h){BOOL enabled=TRUE;DwmSetWindowAttribute(h,20,&enabled,sizeof(enabled));DWORD corner=2;DwmSetWindowAttribute(h,33,&corner,sizeof(corner));}+inline void titleTheme(HWND h){BOOL enabled=TRUE;DwmSetWindowAttribute(h,20,&enabled,sizeof(enabled));DWORD corner=2;DwmSetWindowAttribute(h,33,&corner,sizeof(corner));COLORREF border=0xfffffffe;DwmSetWindowAttribute(h,34,&border,sizeof(border));}+// Compose controls and dashboard in memory; never expose the erase/fill pass.+class PaintBuffer {+ HWND window_;HDC target_;AlphaRaster raster_;PAINTSTRUCT ps_{};+public:+ RECT rect{};HDC dc;+ explicit PaintBuffer(HWND window):window_(window){target_=BeginPaint(window_,&ps_);GetClientRect(window_,&rect);dc=raster_.create(target_,rect.right,rect.bottom)?raster_.dc:target_;}+ ~PaintBuffer(){if(dc==raster_.dc){GdiFlush();const auto& r=ps_.rcPaint;BitBlt(target_,r.left,r.top,r.right-r.left,r.bottom-r.top,dc,r.left,r.top,SRCCOPY);}EndPaint(window_,&ps_);}+};+struct GlassTextTheme {+ HTHEME value=nullptr;bool opened=false;+ void reset(){if(value)CloseThemeData(value);value=nullptr;opened=false;}+ HTHEME get(){if(!opened){value=OpenThemeData(nullptr,L"CompositedWindow::Window");opened=true;}return value;}+ ~GlassTextTheme(){reset();}+};+inline GlassTextTheme& glassTextTheme(){static GlassTextTheme theme;return theme;}+inline int glassText(HDC dc,const wchar_t* text,int count,RECT* rect,UINT flags){+ DTTOPTS options{sizeof(options)};options.dwFlags=DTT_COMPOSITED|DTT_TEXTCOLOR;options.crText=GetTextColor(dc);+ auto theme=glassTextTheme().get();if(theme&&SUCCEEDED(DrawThemeTextEx(theme,dc,0,0,text,count,flags,rect,&options)))return rect->bottom-rect->top;+ // Theme services may be unavailable. Use a coverage mask, never raw GDI+ // text directly on the alpha surface (GDI would erase its alpha channel).+ AlphaRaster ink;if(!ink.create(dc,rect->right-rect->left,rect->bottom-rect->top))return 0;+ auto old=SelectObject(ink.dc,GetCurrentObject(dc,OBJ_FONT));SetTextColor(ink.dc,RGB(255,255,255));SetBkMode(ink.dc,TRANSPARENT);RECT local{0,0,ink.width,ink.height};int result=DrawTextW(ink.dc,text,count,&local,flags);SelectObject(ink.dc,old);GdiFlush();auto color=GetTextColor(dc);+ for(size_t i=0;i<size_t(ink.width)*ink.height;++i){auto pixel=ink.pixels[i];auto alpha=std::max({pixel&255,(pixel>>8)&255,(pixel>>16)&255});ink.pixels[i]=(alpha<<24)|(GetRValue(color)*alpha/255<<16)|(GetGValue(color)*alpha/255<<8)|GetBValue(color)*alpha/255;}+ AlphaGraphics drawing(dc);Gdiplus::Bitmap bitmap(ink.width,ink.height,ink.width*4,PixelFormat32bppPARGB,reinterpret_cast<BYTE*>(ink.pixels));drawing.get().DrawImage(&bitmap,int(rect->left),int(rect->top));return result;+}inline COLORREF surface(HWND h){auto prop=GetPropW(h,L"veyra.surface");return prop?COLORREF(uintptr_t(prop)-1):panel;}-inline void surface(HWND h,COLORREF c){SetPropW(h,L"veyra.surface",HANDLE(uintptr_t(c)+1));InvalidateRect(h,nullptr,FALSE);}+inline void surface(HWND h,COLORREF c){if(surface(h)==c)return;SetPropW(h,L"veyra.surface",HANDLE(uintptr_t(c)+1));InvalidateRect(h,nullptr,FALSE);}inline Gdiplus::Color color(COLORREF c,BYTE a=255){return Gdiplus::Color(a,GetRValue(c),GetGValue(c),GetBValue(c));}inline void rounded(Gdiplus::GraphicsPath& p,Gdiplus::RectF r,float radius){float d=std::min({radius*2,r.Width,r.Height});p.AddArc(r.X,r.Y,d,d,180,90);p.AddArc(r.GetRight()-d,r.Y,d,d,270,90);p.AddArc(r.GetRight()-d,r.GetBottom()-d,d,d,0,90);p.AddArc(r.X,r.GetBottom()-d,d,d,90,90);p.CloseFigure();}-inline void roundRect(HDC dc,RECT r,COLORREF c,int radius){Gdiplus::Graphics g(dc);g.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);Gdiplus::GraphicsPath path;rounded(path,{float(r.left),float(r.top),float(r.right-r.left-1),float(r.bottom-r.top-1)},float(radius));Gdiplus::SolidBrush brush(color(c));g.FillPath(&brush,&path);}-inline void fillSurface(HDC dc,RECT r,HWND h){auto b=CreateSolidBrush(surface(h));FillRect(dc,&r,b);DeleteObject(b);}-inline LRESULT colors(UINT msg,WPARAM w,LPARAM l=0){HDC dc=reinterpret_cast<HDC>(w);HWND h=reinterpret_cast<HWND>(l);COLORREF bg=msg==WM_CTLCOLOREDIT?raised:surface(h);SetTextColor(dc,msg==WM_CTLCOLOREDIT?textColor:secondary);SetBkColor(dc,bg);SetBkMode(dc,TRANSPARENT);SetDCBrushColor(dc,bg);return reinterpret_cast<LRESULT>(GetStockObject(DC_BRUSH));}-enum class Icon { None,Play,Pause,Stop,Volume,Muted,Fullscreen,Video,Capture,Image,Subtitle,Minimize,Maximize,Close,Back };-inline void icon(HWND h,Icon icon,bool caption=false){SetPropW(h,L"veyra.icon",HANDLE(INT_PTR(icon)));if(caption)SetPropW(h,L"veyra.caption",HANDLE(1));else RemovePropW(h,L"veyra.caption");InvalidateRect(h,nullptr,FALSE);}-inline void drawIcon(HDC dc,Icon icon,float x,float y,float size,COLORREF c){using namespace Gdiplus;Graphics g(dc);g.SetSmoothingMode(SmoothingModeAntiAlias);Pen pen(color(c),std::max(1.4f,size/13));pen.SetStartCap(LineCapRound);pen.SetEndCap(LineCapRound);SolidBrush brush(color(c));const float a=size/2;auto line=[&](float x1,float y1,float x2,float y2){g.DrawLine(&pen,x+x1*a,y+y1*a,x+x2*a,y+y2*a);};+inline void roundRect(HDC dc,RECT r,COLORREF c,int radius){AlphaGraphics drawing(dc);auto& g=drawing.get();g.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);Gdiplus::GraphicsPath path;rounded(path,{float(r.left),float(r.top),float(r.right-r.left-1),float(r.bottom-r.top-1)},float(radius));Gdiplus::SolidBrush brush(color(c));g.FillPath(&brush,&path);}+inline void fillSurface(HDC dc,RECT r,HWND h){if(copyGlass(dc,r,h))return;auto b=CreateSolidBrush(surface(h));FillRect(dc,&r,b);DeleteObject(b);}+inline void translucentRound(HDC dc,RECT r,BYTE alpha,int radius){AlphaGraphics drawing(dc);auto& g=drawing.get();g.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);Gdiplus::GraphicsPath path;rounded(path,{float(r.left),float(r.top),float(r.right-r.left-1),float(r.bottom-r.top-1)},float(radius));Gdiplus::SolidBrush tint(Gdiplus::Color(alpha,228,235,242));g.FillPath(&tint,&path);}+inline LRESULT colors(UINT msg,WPARAM w,LPARAM l=0){HDC dc=reinterpret_cast<HDC>(w);HWND h=reinterpret_cast<HWND>(l);wchar_t cls[32]{};GetClassNameW(h,cls,32);const bool edit=_wcsicmp(cls,L"EDIT")==0;COLORREF bg=edit?raised:surface(h);SetTextColor(dc,edit?textColor:secondary);SetBkColor(dc,bg);SetBkMode(dc,TRANSPARENT);if(edit&&GetPropW(h,L"Veyra.EditPrint")){SetBkColor(dc,RGB(0,0,0));return reinterpret_cast<LRESULT>(GetStockObject(BLACK_BRUSH));}SetDCBrushColor(dc,bg);return reinterpret_cast<LRESULT>(GetStockObject(DC_BRUSH));}+inline LRESULT CALLBACK labelPaint(HWND h,UINT m,WPARAM w,LPARAM l,UINT_PTR,DWORD_PTR){+ if(m==WM_ERASEBKGND)return 1;+ if(m==WM_PAINT){PaintBuffer paint(h);fillSurface(paint.dc,paint.rect,h);wchar_t text[4096]{};GetWindowTextW(h,text,4096);auto old=SelectObject(paint.dc,HFONT(SendMessageW(h,WM_GETFONT,0,0)));SetBkMode(paint.dc,TRANSPARENT);SetTextColor(paint.dc,IsWindowEnabled(h)?secondary:RGB(120,125,132));auto style=GetWindowLongPtrW(h,GWL_STYLE);auto type=style&SS_TYPEMASK;UINT flags=(style&SS_NOPREFIX)?DT_NOPREFIX:0;flags|=type==SS_CENTER?DT_CENTER:type==SS_RIGHT?DT_RIGHT:DT_LEFT;if(style&SS_CENTERIMAGE)flags|=DT_SINGLELINE|DT_VCENTER;else if(type==SS_SIMPLE||type==SS_LEFTNOWORDWRAP)flags|=DT_SINGLELINE;else flags|=DT_WORDBREAK;if(style&SS_ENDELLIPSIS)flags|=DT_END_ELLIPSIS;glassText(paint.dc,text,-1,&paint.rect,flags);SelectObject(paint.dc,old);return 0;}+ auto result=DefSubclassProc(h,m,w,l);if(m==WM_SETTEXT||m==WM_ENABLE||m==WM_SETFONT)InvalidateRect(h,nullptr,FALSE);return result;+}+enum class Icon { None,Play,Pause,Stop,Volume,Muted,Fullscreen,Video,Capture,Image,Subtitle,Minimize,Maximize,Close,Back,Settings };+inline void icon(HWND h,Icon icon,bool caption=false){if(INT_PTR(GetPropW(h,L"veyra.icon"))==INT_PTR(icon)&&(GetPropW(h,L"veyra.caption")!=nullptr)==caption)return;SetPropW(h,L"veyra.icon",HANDLE(INT_PTR(icon)));if(caption)SetPropW(h,L"veyra.caption",HANDLE(1));else RemovePropW(h,L"veyra.caption");InvalidateRect(h,nullptr,FALSE);}+inline void drawIcon(HDC dc,Icon icon,float x,float y,float size,COLORREF c){using namespace Gdiplus;AlphaGraphics drawing(dc);auto& g=drawing.get();g.SetSmoothingMode(SmoothingModeAntiAlias);Pen pen(color(c),std::max(1.4f,size/13));pen.SetStartCap(LineCapRound);pen.SetEndCap(LineCapRound);SolidBrush brush(color(c));const float a=size/2;auto line=[&](float x1,float y1,float x2,float y2){g.DrawLine(&pen,x+x1*a,y+y1*a,x+x2*a,y+y2*a);};switch(icon){case Icon::Play:{PointF p[]={{x-a*.45f,y-a*.8f},{x+a*.85f,y},{x-a*.45f,y+a*.8f}};g.FillPolygon(&brush,p,3);break;}case Icon::Pause:g.FillRectangle(&brush,x-a*.55f,y-a*.7f,a*.35f,a*1.4f);g.FillRectangle(&brush,x+a*.2f,y-a*.7f,a*.35f,a*1.4f);break;case Icon::Stop:g.FillRectangle(&brush,x-a*.55f,y-a*.55f,a*1.1f,a*1.1f);break;case Icon::Volume:case Icon::Muted:{PointF p[]={{x-a*.9f,y-a*.28f},{x-a*.5f,y-a*.28f},{x,y-a*.7f},{x,y+a*.7f},{x-a*.5f,y+a*.28f},{x-a*.9f,y+a*.28f}};g.DrawPolygon(&pen,p,6);if(icon==Icon::Muted){line(.35f,-.4f,.85f,.4f);line(.35f,.4f,.85f,-.4f);}else{g.DrawArc(&pen,x-a*.4f,y-a*.6f,a*1.2f,a*1.2f,-60,120);g.DrawArc(&pen,x-a*.7f,y-a*.95f,a*1.9f,a*1.9f,-60,120);}break;}@@ -39,36 +72,49 @@ inline void drawIcon(HDC dc,Icon icon,float x,float y,float size,COLORREF c){usicase Icon::Image:g.DrawRectangle(&pen,x-a*.85f,y-a*.7f,a*1.7f,a*1.4f);line(-.6f,.4f,-.1f,-.2f);line(-.1f,-.2f,.3f,.2f);line(.3f,.2f,.65f,-.1f);g.FillEllipse(&brush,x+a*.25f,y-a*.5f,a*.24f,a*.24f);break;case Icon::Subtitle:g.DrawRectangle(&pen,x-a*.9f,y-a*.6f,a*1.8f,a*1.2f);line(-.6f,.2f,-.1f,.2f);line(.15f,.2f,.6f,.2f);break;case Icon::Minimize:line(-.6f,0,.6f,0);break;case Icon::Maximize:g.DrawRectangle(&pen,x-a*.55f,y-a*.55f,a*1.1f,a*1.1f);break;- case Icon::Close:line(-.5f,-.5f,.5f,.5f);line(-.5f,.5f,.5f,-.5f);break;case Icon::Back:line(.2f,-.6f,-.5f,0);line(-.5f,0,.2f,.6f);break;default:break;}+ case Icon::Close:line(-.5f,-.5f,.5f,.5f);line(-.5f,.5f,.5f,-.5f);break;case Icon::Back:line(.2f,-.6f,-.5f,0);line(-.5f,0,.2f,.6f);break;case Icon::Settings:g.DrawEllipse(&pen,x-a*.55f,y-a*.55f,a*1.1f,a*1.1f);for(int i=0;i<8;++i){float angle=float(i)*3.14159265f/4;line(cosf(angle)*.6f,sinf(angle)*.6f,cosf(angle)*.9f,sinf(angle)*.9f);}break;default:break;}}inline LRESULT CALLBACK buttonPaint(HWND h,UINT m,WPARAM w,LPARAM l,UINT_PTR,DWORD_PTR){if(m==WM_ERASEBKGND)return 1;if(m==WM_MOUSEMOVE){if(!GetPropW(h,L"veyra.hover")){SetPropW(h,L"veyra.hover",HANDLE(1));TRACKMOUSEEVENT t{sizeof(t),TME_LEAVE,h,0};TrackMouseEvent(&t);InvalidateRect(h,nullptr,FALSE);}}if(m==WM_MOUSELEAVE){RemovePropW(h,L"veyra.hover");InvalidateRect(h,nullptr,FALSE);}- if(m==WM_PAINT){PAINTSTRUCT ps{};HDC dc=BeginPaint(h,&ps);RECT r{};GetClientRect(h,&r);fillSurface(dc,r,h);+ if(m==WM_PAINT){PaintBuffer paint(h);HDC dc=paint.dc;RECT r=paint.rect;fillSurface(dc,r,h);const bool marked=GetPropW(h,L"veyra.accent")!=nullptr,selected=GetPropW(h,L"veyra.selected")!=nullptr,hover=GetPropW(h,L"veyra.hover")!=nullptr,down=SendMessageW(h,BM_GETSTATE,0,0)&BST_PUSHED,check=SendMessageW(h,BM_GETCHECK,0,0)==BST_CHECKED,ghost=GetPropW(h,L"veyra.ghost")!=nullptr;const auto ico=static_cast<Icon>(INT_PTR(GetPropW(h,L"veyra.icon")));bool caption=GetPropW(h,L"veyra.caption")!=nullptr;- COLORREF fill=marked?accent:(down||selected?line:hover?raised:surface(h));if(!ghost||hover||selected||marked)roundRect(dc,r,fill,ico==Icon::Play||ico==Icon::Pause?std::min(r.right,r.bottom)/2:dip(h,8));+ COLORREF fill=marked?accent:(down||selected?line:hover?raised:surface(h));if(glassBackdrop(h)&&!marked){if(down||selected||hover)translucentRound(dc,r,down?42:selected?31:18,dip(h,8));}else if(!ghost||hover||selected||marked)roundRect(dc,r,fill,ico==Icon::Play||ico==Icon::Pause?std::min(r.right,r.bottom)/2:dip(h,8));wchar_t value[512]{};GetWindowTextW(h,value,512);auto f=reinterpret_cast<HFONT>(SendMessageW(h,WM_GETFONT,0,0));auto old=SelectObject(dc,f);SetBkMode(dc,TRANSPARENT);COLORREF ink=!IsWindowEnabled(h)?RGB(90,96,103):marked?RGB(24,31,36):selected?textColor:hover?textColor:secondary;SetTextColor(dc,ink);- if(ico!=Icon::None){drawIcon(dc,ico,caption?float(dip(h,18)):r.right/2.f,r.bottom/2.f,float(dip(h,ico==Icon::Play||ico==Icon::Pause?22:17)),ink);if(caption){r.left=dip(h,34);DrawTextW(dc,value,-1,&r,DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);}}- else if((GetWindowLongPtrW(h,GWL_STYLE)&BS_TYPEMASK)==BS_AUTOCHECKBOX){RECT toggle{r.right-dip(h,40),r.bottom/2-dip(h,8),r.right-dip(h,10),r.bottom/2+dip(h,8)};roundRect(dc,toggle,check?accent:line,dip(h,8));RECT knob{toggle.left+dip(h,check?16:3),toggle.top+dip(h,3),toggle.left+dip(h,check?26:13),toggle.top+dip(h,13)};roundRect(dc,knob,check?panel:secondary,dip(h,5));r.left=dip(h,12);r.right-=dip(h,46);DrawTextW(dc,value,-1,&r,DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);}else DrawTextW(dc,value,-1,&r,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);- if(GetFocus()==h){RECT outline{};GetClientRect(h,&outline);InflateRect(&outline,-3,-3);DrawFocusRect(dc,&outline);}SelectObject(dc,old);EndPaint(h,&ps);return 0;}+ if(ico!=Icon::None){drawIcon(dc,ico,caption?float(dip(h,18)):r.right/2.f,r.bottom/2.f,float(dip(h,ico==Icon::Play||ico==Icon::Pause?22:17)),ink);if(caption){r.left=dip(h,34);glassText(dc,value,-1,&r,DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);}}+ else if((GetWindowLongPtrW(h,GWL_STYLE)&BS_TYPEMASK)==BS_AUTOCHECKBOX){RECT toggle{r.right-dip(h,40),r.bottom/2-dip(h,8),r.right-dip(h,10),r.bottom/2+dip(h,8)};roundRect(dc,toggle,check?accent:line,dip(h,8));RECT knob{toggle.left+dip(h,check?16:3),toggle.top+dip(h,3),toggle.left+dip(h,check?26:13),toggle.top+dip(h,13)};roundRect(dc,knob,check?panel:secondary,dip(h,5));r.left=dip(h,12);r.right-=dip(h,46);glassText(dc,value,-1,&r,DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);}else glassText(dc,value,-1,&r,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);+ if(GetFocus()==h&&!(SendMessageW(h,WM_QUERYUISTATE,0,0)&UISF_HIDEFOCUS)){RECT outline{};GetClientRect(h,&outline);InflateRect(&outline,-3,-3);AlphaGraphics focusDrawing(dc);auto& focus=focusDrawing.get();focus.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);Gdiplus::GraphicsPath path;rounded(path,{float(outline.left),float(outline.top),float(outline.right-outline.left),float(outline.bottom-outline.top)},float(dip(h,6)));Gdiplus::Pen stroke(color(accent,145),1);focus.DrawPath(&stroke,&path);}SelectObject(dc,old);return 0;}if(m==WM_ENABLE||m==WM_SETFOCUS||m==WM_KILLFOCUS||m==BM_SETCHECK||m==WM_SETTEXT||m==BM_SETSTATE){auto result=DefSubclassProc(h,m,w,l);InvalidateRect(h,nullptr,FALSE);return result;}return DefSubclassProc(h,m,w,l);}inline LRESULT CALLBACK comboPaint(HWND h,UINT m,WPARAM w,LPARAM l,UINT_PTR,DWORD_PTR){- if(m==WM_ERASEBKGND)return 1;if(m==WM_PAINT){PAINTSTRUCT ps{};HDC dc=BeginPaint(h,&ps);RECT r{};GetClientRect(h,&r);fillSurface(dc,r,h);roundRect(dc,r,raised,dip(h,7));int index=int(SendMessageW(h,CB_GETCURSEL,0,0));wchar_t value[512]{};if(index>=0&&SendMessageW(h,CB_GETLBTEXTLEN,index,0)<512)SendMessageW(h,CB_GETLBTEXT,index,LPARAM(value));auto old=SelectObject(dc,HFONT(SendMessageW(h,WM_GETFONT,0,0)));SetBkMode(dc,TRANSPARENT);SetTextColor(dc,IsWindowEnabled(h)?secondary:RGB(85,88,92));RECT label=r;label.left+=dip(h,12);label.right-=dip(h,26);DrawTextW(dc,value,-1,&label,DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);auto pen=CreatePen(PS_SOLID,dip(h,1),secondary);auto op=SelectObject(dc,pen);int x=r.right-dip(h,15),y=r.bottom/2;MoveToEx(dc,x-dip(h,3),y-dip(h,1),nullptr);LineTo(dc,x,y+dip(h,2));LineTo(dc,x+dip(h,3),y-dip(h,1));SelectObject(dc,op);DeleteObject(pen);SelectObject(dc,old);EndPaint(h,&ps);return 0;}+ if(m==WM_ERASEBKGND)return 1;if(m==WM_PAINT){PaintBuffer paint(h);HDC dc=paint.dc;RECT r=paint.rect;fillSurface(dc,r,h);if(glassBackdrop(h))translucentRound(dc,r,16,dip(h,7));else roundRect(dc,r,raised,dip(h,7));int index=int(SendMessageW(h,CB_GETCURSEL,0,0));wchar_t value[512]{};if(index>=0&&SendMessageW(h,CB_GETLBTEXTLEN,index,0)<512)SendMessageW(h,CB_GETLBTEXT,index,LPARAM(value));auto old=SelectObject(dc,HFONT(SendMessageW(h,WM_GETFONT,0,0)));SetBkMode(dc,TRANSPARENT);SetTextColor(dc,IsWindowEnabled(h)?secondary:RGB(85,88,92));RECT label=r;label.left+=dip(h,12);label.right-=dip(h,26);glassText(dc,value,-1,&label,DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);{AlphaGraphics drawing(dc);auto& g=drawing.get();g.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);Gdiplus::Pen pen(color(secondary),float(dip(h,1)));float x=float(r.right-dip(h,15)),y=r.bottom/2.f;g.DrawLine(&pen,x-dip(h,3),y-dip(h,1),x,y+dip(h,2));g.DrawLine(&pen,x,y+dip(h,2),x+dip(h,3),y-dip(h,1));}SelectObject(dc,old);return 0;}auto result=DefSubclassProc(h,m,w,l);if(m==CB_SETCURSEL||m==WM_SETFOCUS||m==WM_KILLFOCUS||m==WM_ENABLE)InvalidateRect(h,nullptr,FALSE);return result;}inline LRESULT CALLBACK trackPaint(HWND h,UINT m,WPARAM w,LPARAM l,UINT_PTR,DWORD_PTR){if(m==WM_ERASEBKGND)return 1;- if(m==WM_PAINT){PAINTSTRUCT ps{};HDC dc=BeginPaint(h,&ps);RECT r{};GetClientRect(h,&r);fillSurface(dc,r,h);int minimum=int(SendMessageW(h,TBM_GETRANGEMIN,0,0)),maximum=int(SendMessageW(h,TBM_GETRANGEMAX,0,0));float progress=float(SendMessageW(h,TBM_GETPOS,0,0)-minimum)/std::max(1,maximum-minimum);int margin=dip(h,6),y=r.bottom/2,x=margin+int((r.right-margin*2)*progress);RECT rail{margin,y-dip(h,1),r.right-margin,y+dip(h,2)},fill=rail;fill.right=x;roundRect(dc,rail,line,dip(h,2));roundRect(dc,fill,IsWindowEnabled(h)?accent:secondary,dip(h,2));RECT dot{x-dip(h,5),y-dip(h,5),x+dip(h,5),y+dip(h,5)};roundRect(dc,dot,IsWindowEnabled(h)?accent:line,dip(h,5));InflateRect(&dot,-dip(h,2),-dip(h,2));roundRect(dc,dot,surface(h),dip(h,3));EndPaint(h,&ps);return 0;}+ if(m==WM_PAINT){PaintBuffer paint(h);HDC dc=paint.dc;RECT r=paint.rect;fillSurface(dc,r,h);int minimum=int(SendMessageW(h,TBM_GETRANGEMIN,0,0)),maximum=int(SendMessageW(h,TBM_GETRANGEMAX,0,0));float progress=float(SendMessageW(h,TBM_GETPOS,0,0)-minimum)/std::max(1,maximum-minimum);int margin=dip(h,6),y=r.bottom/2,x=margin+int((r.right-margin*2)*progress);RECT rail{margin,y-dip(h,1),r.right-margin,y+dip(h,2)},fill=rail;fill.right=x;roundRect(dc,rail,line,dip(h,2));roundRect(dc,fill,IsWindowEnabled(h)?accent:secondary,dip(h,2));RECT dot{x-dip(h,5),y-dip(h,5),x+dip(h,5),y+dip(h,5)};roundRect(dc,dot,IsWindowEnabled(h)?accent:line,dip(h,5));InflateRect(&dot,-dip(h,2),-dip(h,2));roundRect(dc,dot,surface(h),dip(h,3));return 0;}if(m==WM_LBUTTONDOWN||m==WM_MOUSEMOVE&&GetCapture()==h||m==WM_LBUTTONUP&&GetCapture()==h){if(!IsWindowEnabled(h))return 0;if(m==WM_LBUTTONDOWN)SetCapture(h);RECT r{};GetClientRect(h,&r);int minimum=int(SendMessageW(h,TBM_GETRANGEMIN,0,0)),maximum=int(SendMessageW(h,TBM_GETRANGEMAX,0,0));float fraction=std::clamp(float(GET_X_LPARAM(l)-dip(h,6))/std::max(1L,r.right-dip(h,12)),0.0f,1.0f);int value=minimum+int(fraction*(maximum-minimum));SendMessageW(h,TBM_SETPOS,TRUE,value);SendMessageW(GetParent(h),WM_HSCROLL,MAKEWPARAM(m==WM_LBUTTONUP?TB_THUMBPOSITION:TB_THUMBTRACK,value),LPARAM(h));if(m==WM_LBUTTONUP)ReleaseCapture();return 0;}auto result=DefSubclassProc(h,m,w,l);if(m==TBM_SETPOS||m==WM_ENABLE||m==WM_SIZE)InvalidateRect(h,nullptr,FALSE);return result;}-inline void themeControl(HWND h){wchar_t cls[32]{};GetClassNameW(h,cls,32);SetWindowTheme(h,L"DarkMode_Explorer",nullptr);if(_wcsicmp(cls,L"BUTTON")==0)SetWindowSubclass(h,buttonPaint,900,0);else if(_wcsicmp(cls,L"COMBOBOX")==0){SetWindowLongPtrW(h,GWL_EXSTYLE,GetWindowLongPtrW(h,GWL_EXSTYLE)&~WS_EX_CLIENTEDGE);SetWindowSubclass(h,comboPaint,901,0);SendMessageW(h,CB_SETITEMHEIGHT,WPARAM(-1),dip(h,30));}else if(_wcsicmp(cls,TRACKBAR_CLASSW)==0)SetWindowSubclass(h,trackPaint,902,0);}+// Keep the native EDIT model (selection, IME, scrolling, accessibility), but+// composite its printed glyphs onto the same alpha surface as its parent.+inline LRESULT CALLBACK editGlassPaint(HWND h,UINT m,WPARAM w,LPARAM l,UINT_PTR,DWORD_PTR){+ if(!glassBackdrop(h))return DefSubclassProc(h,m,w,l);+ if(m==WM_ERASEBKGND)return 1;+ if(m==WM_KEYDOWN&&w=='A'&&(GetKeyState(VK_CONTROL)&0x8000)){SendMessageW(h,EM_SETSEL,0,-1);return 0;}+ if(m==WM_PAINT){PaintBuffer paint(h);fillSurface(paint.dc,paint.rect,h);AlphaRaster ink;+ if(ink.create(paint.dc,paint.rect.right,paint.rect.bottom)){SetPropW(h,L"Veyra.EditPrint",HANDLE(1));DefSubclassProc(h,WM_PRINTCLIENT,WPARAM(ink.dc),PRF_CLIENT);RemovePropW(h,L"Veyra.EditPrint");GdiFlush();+ for(size_t i=0;i<size_t(ink.width)*ink.height;++i){auto p=ink.pixels[i];auto maximum=std::max({p&255,(p>>8)&255,(p>>16)&255});auto alpha=std::min(255u,maximum*255/240);ink.pixels[i]=(p&0xffffff)|(alpha<<24);}+ AlphaGraphics drawing(paint.dc);Gdiplus::Bitmap bitmap(ink.width,ink.height,ink.width*4,PixelFormat32bppPARGB,reinterpret_cast<BYTE*>(ink.pixels));drawing.get().DrawImage(&bitmap,0,0);+ }return 0;}+ auto result=DefSubclassProc(h,m,w,l);if(m==WM_SETTEXT||m==WM_CHAR||m==WM_KEYDOWN||m==WM_LBUTTONDOWN||m==WM_LBUTTONUP||m==WM_MOUSEMOVE&&(w&MK_LBUTTON)||m==WM_HSCROLL||m==WM_VSCROLL||m==EM_SETSEL||m==WM_SETFOCUS||m==WM_KILLFOCUS||m==WM_PASTE||m==WM_CUT||m==WM_CLEAR||m==WM_UNDO||m==EM_UNDO||m==EM_REPLACESEL||m==EM_SCROLL||m==EM_LINESCROLL||m==WM_MOUSEWHEEL||m==WM_IME_COMPOSITION||m==WM_IME_ENDCOMPOSITION||m==WM_SIZE||m==WM_SETFONT||m==WM_ENABLE)InvalidateRect(h,nullptr,FALSE);return result;+}+inline void themeControl(HWND h){wchar_t cls[32]{};GetClassNameW(h,cls,32);SetWindowTheme(h,L"DarkMode_Explorer",nullptr);if(_wcsicmp(cls,L"BUTTON")==0)SetWindowSubclass(h,buttonPaint,900,0);else if(_wcsicmp(cls,L"COMBOBOX")==0){SetWindowLongPtrW(h,GWL_EXSTYLE,GetWindowLongPtrW(h,GWL_EXSTYLE)&~WS_EX_CLIENTEDGE);SetWindowSubclass(h,comboPaint,901,0);SendMessageW(h,CB_SETITEMHEIGHT,WPARAM(-1),dip(h,30));}else if(_wcsicmp(cls,TRACKBAR_CLASSW)==0)SetWindowSubclass(h,trackPaint,902,0);else if(_wcsicmp(cls,L"EDIT")==0)SetWindowSubclass(h,editGlassPaint,903,0);else if(_wcsicmp(cls,L"STATIC")==0){auto type=GetWindowLongPtrW(h,GWL_STYLE)&SS_TYPEMASK;if(type==SS_LEFT||type==SS_CENTER||type==SS_RIGHT||type==SS_SIMPLE||type==SS_LEFTNOWORDWRAP)SetWindowSubclass(h,labelPaint,904,0);}}inline void marked(HWND h,bool on=true){if(on)SetPropW(h,L"veyra.accent",HANDLE(1));else RemovePropW(h,L"veyra.accent");InvalidateRect(h,nullptr,FALSE);}inline void ghost(HWND h,bool on=true){if(on)SetPropW(h,L"veyra.ghost",HANDLE(1));else RemovePropW(h,L"veyra.ghost");InvalidateRect(h,nullptr,FALSE);}-inline void selected(HWND h,bool on){if(on)SetPropW(h,L"veyra.selected",HANDLE(1));else RemovePropW(h,L"veyra.selected");InvalidateRect(h,nullptr,FALSE);}+inline void selected(HWND h,bool on){if((GetPropW(h,L"veyra.selected")!=nullptr)==on)return;if(on)SetPropW(h,L"veyra.selected",HANDLE(1));else RemovePropW(h,L"veyra.selected");InvalidateRect(h,nullptr,FALSE);}inline void setText(HWND h,const std::wstring& value){wchar_t old[4096]{};GetWindowTextW(h,old,4096);if(value!=old)SetWindowTextW(h,value.c_str());}}diff --git a/apps/veyra/ui/UiRepairChecks.h b/apps/veyra/ui/UiRepairChecks.hnew file mode 100644index 00000000..2f40ae10--- /dev/null+++ b/apps/veyra/ui/UiRepairChecks.h@@ -0,0 +1,32 @@+// Native integration checks, run only with --smoke-repair-ui[-reject].+// BM_CLICK deliberately traverses the same child/control/parent handlers as UI input.+bool smokeRepair=false,smokeRepairReject=false;int repairStep=0;ULONGLONG repairTick=0,repairSettledTick=0;uint64_t repairRevision=0;+void tickRepairChecks(HWND hwnd,const veyra::engine::PlayerSnapshot& s){+ using namespace veyra;using namespace veyra::ui;+ if(!smokeRepair||repairStep<0||repairStep==10||!s.frames||s.applying||masterPendingRevision||transition.running)return;+ auto checkControl=[&](int id){return SendMessageW(settingsControlForTest(id),BM_GETCHECK,0,0)==BST_CHECKED;};+ auto require=[&](bool ok,const char* message){log::info("ui-repair-test",std::format("{}={}",message,ok));if(!ok)repairStep=-1;return ok;};+ auto click=[&](int id){SendMessageW(settingsControlForTest(id),BM_CLICK,0,0);repairTick=GetTickCount64();repairRevision=engine.snapshot().desired.revision;};+ if(repairStep>0&&GetTickCount64()-repairTick<500)return; // allow both UI state timers to observe rollback+ wchar_t draft[32]{};GetWindowTextW(settingsControlForTest(100),draft,32);+ switch(repairStep){+ case 0:if(uiState.mode==Mode::Daily){switchMode();return;}selectInspector(0);SetWindowTextW(settingsControlForTest(100),L"NaN");click(200);repairStep=1;break;+ case 1:if(smokeRepairReject){if(!s.rejectedRevision)return;+ // Rollback can rebuild the GPU graph for longer than the click delay.+ // Start the bounded UI timer allowance after the backend has settled.+ auto observe=[&]{log::info("ui-repair-observe",std::format("rollback appliedNR={} desiredNR={} checkboxNR={} draftPreserved={}",s.applied.nr,s.desired.nr,checkControl(200),std::wstring(draft)==L"NaN"));};+ if(!repairSettledTick){repairSettledTick=GetTickCount64();observe();return;}+ if(GetTickCount64()-repairSettledTick<500)return;observe();if(require(s.applied.nr&&checkControl(200)&&std::wstring(draft)==L"NaN","rejected_NR_checkbox_rollback_keeps_draft"))repairStep=10;break;}+ if(s.applied.revision!=repairRevision)return;if(!require(!s.applied.nr&&!checkControl(200)&&std::wstring(draft)==L"NaN","NR_off_click_works_with_invalid_draft"))break;click(200);repairStep=2;break;+ case 2:if(s.applied.revision!=repairRevision)return;if(!require(s.applied.nr&&checkControl(200)&&std::wstring(draft)==L"NaN","NR_on_click_works_with_invalid_draft"))break;click(201);repairStep=3;break;+ case 3:if(s.applied.revision!=repairRevision)return;{auto expected=pipeline::ResolutionPlan::make(s.metrics.resolution.source,true,pipeline::NrSizePolicy::Native,true).output;if(!require(s.applied.sr&&checkControl(201)&&s.metrics.resolution.output==expected&&std::wstring(draft)==L"NaN","SR_click_applies_aspect_preserving_output"))break;+ log::info("ui-repair-test",std::format("output={}x{} NR-evaluated={}",expected.width,expected.height,s.nrEvaluated));if(!smokeSave.empty())engine.saveFrame(smokeSave);SendMessageW(hwnd,WM_COMMAND,Master,0);{const auto pending=engine.snapshot().desired.revision;SetWindowTextW(settingsControlForTest(100),L"0.4");SendMessageW(settingsControlForTest(210),BM_CLICK,0,0);if(!require(engine.snapshot().desired.revision==pending,"master_pending_blocks_overlapping_numeric_submit"))break;SetWindowTextW(settingsControlForTest(100),L"NaN");}repairTick=GetTickCount64();repairStep=4;break;}+ case 4:if(!require(!uiState.enhanced&&!s.applied.nr&&!s.applied.sr&&!checkControl(200)&&!checkControl(201),"master_off_syncs_independent_switches"))break;click(200);repairStep=5;break;+ case 5:if(s.applied.revision!=repairRevision)return;if(!require(uiState.enhanced&&s.applied.nr&&checkControl(200)&&std::wstring(draft)==L"NaN","NR_click_enables_master_and_preserves_draft"))break;{+ auto body=GetParent(settingsControlForTest(100));RECT br{},hr{};GetWindowRect(body,&br);GetWindowRect(settingsControlForTest(400),&hr);SendMessageW(inspector,WM_MOUSEWHEEL,MAKEWPARAM(0,-WHEEL_DELTA*6),0);if(!require(body!=inspector&&br.top>=hr.bottom&&GetParent(body)==inspector,"scroll_controls_clipped_by_separate_viewport"))break;+ showDiagnostics=true;layout();toggleFullscreen();repairTick=GetTickCount64();repairStep=6;break;}+ case 6:{RECT vr{},wr{};GetWindowRect(video,&vr);GetWindowRect(hwnd,&wr);MONITORINFO mi{sizeof(mi)};GetMonitorInfoW(MonitorFromWindow(hwnd,MONITOR_DEFAULTTONEAREST),&mi);+ if(!require(full&&EqualRect(&vr,&mi.rcMonitor)&&EqualRect(&wr,&mi.rcMonitor)&&!IsWindowVisible(inspector)&&(s.image||IsWindowVisible(seekBar)),"fullscreen_covers_monitor_and_diagnostics_keeps_seek"))break;+ toggleFullscreen();showDiagnostics=false;layout();repairStep=10;log::info("ui-repair-test","PASS native controls, drafts, master sync, SR extent, scroll viewport, fullscreen");break;}+ }+}diff --git a/apps/veyra/ui/WorkspaceChrome.h b/apps/veyra/ui/WorkspaceChrome.hindex 0c7c87e6..1fc24d7e 100644--- a/apps/veyra/ui/WorkspaceChrome.h+++ b/apps/veyra/ui/WorkspaceChrome.h@@ -8,28 +8,17 @@ struct ChromeLayout {bool pro,drawer;ChromeLayout(int width,int height,bool professional,bool showDrawer,int inspectorWidth=320):w(width),h(height),pro(professional),drawer(showDrawer){panelWidth=pro?(w>=1180?std::clamp(inspectorWidth,296,420):w>=960?296:showDrawer?296:0):0;- left=pro?(w>=960?84:68):(w>=1000?64:24);top=pro?68:(h>=720?104:76);+ left=pro?(w>=960?84:68):0;top=pro?68:0;right=w-panelWidth-20;viewWidth=pro?((w>=960||showDrawer)?right-left-14:w-left-20):w-left*2;- viewHeight=pro?std::max(160,h-306):std::max(180,std::min(int(viewWidth*9.0/16),h-top-138));- bottom=top+viewHeight+14;+ viewHeight=pro?std::max(160,h-306):h-88;+ bottom=top+viewHeight+(pro?14:0);}};-inline void chromeText(HDC dc,HWND window,std::wstring value,int x,int y,int w,int h,int size,COLORREF c,int weight=FW_NORMAL,UINT flags=DT_LEFT|DT_SINGLELINE|DT_VCENTER){auto font=makeFont(window,size,weight);auto old=SelectObject(dc,font);SetTextColor(dc,c);SetBkMode(dc,TRANSPARENT);RECT r{dip(window,x),dip(window,y),dip(window,x+w),dip(window,y+h)};DrawTextW(dc,value.c_str(),-1,&r,flags|DT_END_ELLIPSIS);SelectObject(dc,old);DeleteObject(font);}+inline void chromeText(HDC dc,HWND window,std::wstring value,int x,int y,int w,int h,int size,COLORREF c,int weight=FW_NORMAL,UINT flags=DT_LEFT|DT_SINGLELINE|DT_VCENTER){auto font=makeFont(window,size,weight);auto old=SelectObject(dc,font);SetTextColor(dc,c);SetBkMode(dc,TRANSPARENT);RECT r{dip(window,x),dip(window,y),dip(window,x+w),dip(window,y+h)};glassText(dc,value.c_str(),-1,&r,flags|DT_END_ELLIPSIS);SelectObject(dc,old);DeleteObject(font);}inline void paintChrome(HWND window,HDC dc,const ChromeLayout& l,const engine::PlayerSnapshot& s,bool full){- RECT client{};GetClientRect(window,&client);if(full){FillRect(dc,&client,bgBrush());return;}- auto rect=[&](int x,int y,int w,int h){return RECT{dip(window,x),dip(window,y),dip(window,x+w),dip(window,y+h)};};- using namespace Gdiplus;Graphics g(dc);g.SetSmoothingMode(SmoothingModeAntiAlias);- if(!l.pro){LinearGradientBrush bg(Point(0,0),Point(0,client.bottom),color(cinema),color(RGB(20,31,41)));g.FillRectangle(&bg,0,0,client.right,client.bottom);- // Restrained ambient shadow below the single cinema surface.- for(int i=18;i>0;--i){auto r=rect(l.left-i/2,l.top+i/2,l.viewWidth+i,l.viewHeight+88+i/2);GraphicsPath p;rounded(p,{float(r.left),float(r.top),float(r.right-r.left),float(r.bottom-r.top)},float(dip(window,5)));SolidBrush shadow(Color(BYTE(3),0,0,0));g.FillPath(&shadow,&p);}- roundRect(dc,rect(l.left,l.top,l.viewWidth,l.viewHeight+88),cinemaPanel,dip(window,5));- chromeText(dc,window,L"V E Y R A",l.left,l.h-46,160,24,12,RGB(118,133,144),FW_MEDIUM);- chromeText(dc,window,L"本地增强播放器",l.w-238,l.h-46,174,24,12,RGB(118,133,144));- }else{- FillRect(dc,&client,bgBrush());roundRect(dc,rect(4,4,64,l.h-8),RGB(16,17,18),dip(window,22));- roundRect(dc,rect(l.left,l.top,l.viewWidth,l.viewHeight),panel,dip(window,20));- roundRect(dc,rect(l.left,l.bottom,l.viewWidth,l.h-l.bottom-20),panel,dip(window,20));- if(l.panelWidth){roundRect(dc,rect(l.right,l.top,l.panelWidth,l.viewHeight),panel,dip(window,20));roundRect(dc,rect(l.right,l.bottom,l.panelWidth,l.h-l.bottom-20),panel,dip(window,20));}+ RECT client{};GetClientRect(window,&client);if(!copyGlass(dc,client,window))FillRect(dc,&client,bgBrush());if(full)return;+ using namespace Gdiplus;AlphaGraphics drawing(dc);auto& g=drawing.get();g.SetSmoothingMode(SmoothingModeAntiAlias);+ if(l.pro){chromeText(dc,window,L"专业工作台",l.left,18,180,24,13,secondary);const auto& resolution=s.metrics.resolution;auto extent=[](uint32_t w,uint32_t h){return w&&h?std::format(L"{} × {}",w,h):std::wstring(L"—");};diff --git a/apps/veyra/ui/WorkspaceTransition.h b/apps/veyra/ui/WorkspaceTransition.hnew file mode 100644index 00000000..5ae0ac07--- /dev/null+++ b/apps/veyra/ui/WorkspaceTransition.h@@ -0,0 +1,15 @@+#pragma once+#include <algorithm>+#include <cmath>+#include <cstdint>+namespace veyra::ui {+// A single reversible animation, never a queue of layout operations.+struct WorkspaceTransition {+ float value=0,from=0,to=0;uint64_t started=0;bool running=false;+ static constexpr uint64_t duration=240;+ float sample(uint64_t now){if(!running)return value;float t=std::clamp(float(now-started)/duration,0.f,1.f);float eased=t*t*(3-2*t);value=from+(to-from)*eased;if(t>=1){value=to;running=false;}return value;}+ void start(bool professional,uint64_t now){sample(now);from=value;to=professional?1.f:0.f;started=now;running=from!=to;}+ void finish(){value=to;running=false;}+ int mix(int a,int b)const{return int(std::lround(a+(b-a)*value));}+};+}diff --git a/docs/DELIVERY_STATUS.md b/docs/DELIVERY_STATUS.mdindex d7446b37..0c3107ea 100644--- a/docs/DELIVERY_STATUS.md+++ b/docs/DELIVERY_STATUS.md@@ -1,3 +1,17 @@+# 2026-09-08 UI修复v3:真实桌面毛玻璃++已删除应用内彩色渐变,控制区采用Windows Desktop Acrylic,透出下方桌面或其他窗口的模糊颜色;视频区域不透明、空闲纯黑。同步修复窗口白边、视频全屏、专业NR/SR开关、数值草稿/回滚、滚动裁剪、日常底部布局与240ms展开动画。独立采集对话框仍为普通深色。++基线`b6b251d`,最终EXE SHA256 `B1892C51E8AFC27D7223E271D48D93107C34CAA96BC4014DFF6F45FDE0D7BF74`。build16成功;专项11命令PASS/81.001秒,UI全套15命令PASS/141.187秒,Repair18项PASS/子进程70.478秒,当前4K合同23项PASS/13.751秒。均为每次300秒以内,历史累计保留。40次切换P95 8.191ms/max9.963,442次提交epoch1,GDI12/handles721稳定。真实红蓝背窗、视频字幕、输入/粘贴、全屏及滚动已检查;独立只读复核通过本轮范围。++全项目仍Phase7/needs_review;本轮保护delivery gate保留FAIL(旧23帧断言,当前12源帧2X含尾部CFR占位输出24帧),不修改保护门禁或用补测冒充阶段通过。实卡、真实IME候选、多屏DPI、长稳及公开分发未验收。没有开启采集流或公开上传,没有再次执行历史的一次性关机请求。++完整文件、命令、RTX Create/Evaluate日志、失败和截图:[UI修复v3报告](UI_REPAIR_V3_DELIVERY_2026-09-08.md);[只读复核](REVIEW_UI_REPAIR_V3_2026-09-08.md);[操作指南](USER_GUIDE.md)。下一条唯一任务:用户通过`Veyra.cmd`验收当前UI和原合同中的实卡体验。++---++以下保留历史记录,旧的“当前版本/通过状态”不代表本轮:+# 2026-09-08 双模式UI本机软件交付已实现批准的UI0–UI9:默认日常影院界面、专业四区工作台、共享视频宿主与无重开切换、完整参数/预设、真实音量和透明字幕、后台冻结设置导出、诊断/全屏/小窗口。最初普通Win32排布在用户反馈后重新实现。diff --git a/docs/REVIEW_UI_REPAIR_V3_2026-09-08.md b/docs/REVIEW_UI_REPAIR_V3_2026-09-08.mdnew file mode 100644index 00000000..0a8a13e2--- /dev/null+++ b/docs/REVIEW_UI_REPAIR_V3_2026-09-08.md@@ -0,0 +1,20 @@+# UI 修复 v3 独立只读复核 — 2026-09-08++Reviewer:`/root/review_ui_v3`(独立上下文,只读)。主Agent实现和运行测试,Reviewer没有修改文件或再次执行GPU测试;下列结论来自实际只读审查回复,不能当作第二次独立运行。++最终结论:**本轮限定修复审查通过,未发现未关闭的 P0/P1/P2。**++- 核对build16与两组结果的EXE哈希一致:`B1892C51E8AFC27D7223E271D48D93107C34CAA96BC4014DFF6F45FDE0D7BF74`。+- 原生专项11条命令通过,81.001秒;UI全套15条命令通过,141.187秒。+- 回滚测试只修正观察起点,断言未变;日志证实草稿始终保留,复选框随后同步。+- 40次切换P95 8.191ms、最大9.963ms;442次提交、epoch保持1,GDI和句柄稳定。暂停、后台导出及取消通过。+- 实际查看build14红/蓝截图:控制区随背窗变色、空闲视频保持黑色;video-red中画面及字幕清晰。截图不冒充独立运行。+- 代码确认视频空闲A=255黑色,未发现把玻璃画入视频像素的路径;DIB/DC/GDI+释放顺序正确,诊断父背景已统一。++审查中修复:诊断父面板原先实色、HTHEME没有失效处理及raw-GDI文字回退破坏alpha、EDIT重绘缺少粘贴/滚动/IME消息。后续已核对主题reset与coverage-mask回退闭合,没有新的阻断P0/P1/P2。++build15 `bfc72bf...`失败保留:回滚结束仅34ms后读取复选框,早于250ms UI timer。build16把有界等待起点放在后台回滚完成之后,原断言不变;最终独立字段日志证实checkbox先旧值、约547ms后正确,draft一直保留。++结论限于本轮UI、材质、开关、草稿和SR修复。真实IME候选、实卡及长稳未获证明;旧保护gate的FAIL保留。Reviewer最终回复之后,主Agent又完成Repair18项、原生4K当前合同23项与最终原生截图;这三项是主Agent补充证据,不谎称Reviewer另行执行或复查。++完整日志、失败记录、命令和限制:[交付报告](UI_REPAIR_V3_DELIVERY_2026-09-08.md)。diff --git a/docs/UI_REPAIR_V3_DELIVERY_2026-09-08.md b/docs/UI_REPAIR_V3_DELIVERY_2026-09-08.mdnew file mode 100644index 00000000..f80f8903--- /dev/null+++ b/docs/UI_REPAIR_V3_DELIVERY_2026-09-08.md@@ -0,0 +1,107 @@+# UI 修复 v3 与真实桌面毛玻璃 — 2026-09-08++本轮从本地提交 `b6b251d` 修复用户逐项复现的问题,最终采用 Windows Desktop Acrylic。此前应用内彩色渐变不符合用户要求,已删除。控制区真实透出下方桌面或其他窗口的模糊色彩,视频区不透明,未打开媒体时纯黑。++当前仍在 Phase 7 / 全局 `needs_review`。本报告是限定范围的 UI 软件修复证据,不改变旧阶段记录;用户实卡、长稳和公开分发尚未通过。最新构建 `logs/ui-repair-v3/build16.log` exit0,EXE SHA256 `B1892C51E8AFC27D7223E271D48D93107C34CAA96BC4014DFF6F45FDE0D7BF74`。++## 实际改动++- 窗口:移除自定义边缘点击时的系统白框;播放器全屏铺满显示器,隐藏专业面板,底部控制条和鼠标约1.6秒无操作后隐藏,移动唤回;退出恢复原窗口。+- 日常模式:视频占满上方,仅保留底部播放、进度、来源、字幕、音量和模式入口;精细参数及导出保留在专业模式。+- 切换:240毫秒展开/收起,可中途反向;保留同一个视频宿主、来源和设置版本,延迟中间尺寸的 swapchain 重建。+- 专业面板:固定状态区与滚动参数使用独立父窗口裁剪;控件统一缓冲绘制,状态文字仅在变化时更新,仪表低频刷新。+- NR / SR:专业开关立即发起独立事务,不被无效数值草稿阻挡;开启单项可以同时恢复总增强,失败回滚;总增强事务进行时保留重叠参数草稿。+- SR尺寸:共用按比例、偶数尺寸的3840×2160边界规划,4:3得到2880×2160;图片保存和视频导出共用规则。修复“保存SR图后立刻关增强”会丢保存请求的时序。+- 材质:通过 DWM 系统材质合成桌面背景,前景使用显式 premultiplied BGRA DIB。文字、图标、滑杆、按钮与原生 EDIT 不再各自铺不透明黑底。原生输入、选择、滚动和 IME 消息继续交给系统编辑控件。+- 空画面不放标题、提示或彩色背景。视频像素不参与桌面模糊;全屏关闭桌面材质。诊断父面板也采用同一背景。独立采集设置对话框仍是普通深色。++Desktop Acrylic 使用 `DWMWA_SYSTEMBACKDROP_TYPE=DWMSBT_TRANSIENTWINDOW`,而非仅采样壁纸的 Mica;透明客户区使用正确 alpha。最低支持 Windows 11 build22621,系统透明/高对比度策略可能使其回退。软件不改变系统设置,也不读取桌面像素。[微软材质说明](https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type)、[自定义窗口 alpha 绘制说明](https://learn.microsoft.com/en-us/windows/win32/dwm/customframe)。++## 修改文件++| 文件 | 用途 |+| --- | --- |+| `apps/veyra/ui/AppShell.cpp` | 窗口边框、全屏、布局、事务衔接及材质接入 |+| `apps/veyra/ui/GlassMaterial.h` | DWM Desktop Acrylic、alpha DIB 与卡片材质 |+| `apps/veyra/ui/Theme.h` | 透明控件、文字回退、编辑框输入和绘制 |+| `apps/veyra/ui/WorkspaceChrome.h` | 仪表及工作台文字绘制 |+| `apps/veyra/ui/WorkspaceTransition.h` | 可反向模式展开动画 |+| `apps/veyra/SettingsWindow.cpp/.h` | 滚动裁剪、开关和数值草稿、应用反馈 |+| `apps/veyra/TelemetryWindow.cpp` | 诊断父背景一致性 |+| `include/veyra/pipeline/ResolutionPlan.h` | 按比例 SR 输出尺寸 |+| `src/engine/EngineController.cpp` | 图像保存与设置请求的原子取用顺序 |+| `src/engine/VideoExportJob.cpp` | 导出使用共享尺寸规划 |+| `src/engine/VideoPresenter.cpp` | 动画期间缓冲尺寸及视口映射 |+| `apps/veyra/ui/UiRepairChecks.h`、`tests/unit/UiContractTests.cpp` | 原生事件、事务、布局和尺寸检查 |+| `scripts/acceptance/ui-repair-v3.ps1`、`scripts/acceptance/ui-dual-mode.ps1` | 每次300秒以内的验收入口 |+| `tests/integration/DesktopBackdropFixture.cpp` | 180秒自动退出的独立红蓝背窗视觉测试 |+| `docs/USER_GUIDE.md`、本报告、复核报告、`docs/WORKLOG.md`、`docs/DELIVERY_STATUS.md`、`loop/STATE.json`、`loop/EVIDENCE.md`、`loop/JOURNAL.md` | 操作、真实证据与恢复点 |++## 构建与测试++实际运行命令(每次调用上限300秒):++```powershell+powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/build.ps1 -Root . -Preset x64-release+powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/acceptance/ui-repair-v3.ps1 -Root .+powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/acceptance/ui-dual-mode.ps1 -Root . -Case all+```++专项最终结果:`logs/ui-repair-v3/3fb66a3472264eb4abc1fc61917839a8/result.json`,11项PASS,81.001秒。真实触发原生 NR/SR BM_CLICK、NaN草稿保留、主增强冲突保护、保存2880×2160图像、窗口裁剪/全屏,以及2880×2160视频导出并解码。使用本机 RTX5070 与固定 NVIDIA runtime;不是仅编译。++运行日志包括:`snippet CreateFeature id=18 result=0x1 (NVSDK_NGX_Result_Success)`、NR/FG Evaluate `result=0x1`,SR输出2880×2160,`image-save saved extent=2880x2160 revision=6`。拒绝路径明确为 `settings-test` 注入“test-only reject NR-disable transaction ... no driver failure”,不是实际驱动报错。++双模式最终回归:`logs/ui-dual-mode/13e2d933fe66477797a71b32612af303/result.json`,15子检查PASS,141.187秒;包括设置/状态、播放及暂停时各40次切换、增强总开关与失败回滚、实际音量增益/静音、冻结参数的后台导出并解码、取消作业及无孤儿进程退出。++| 最终build16场景 | 40次切换P95 | 最大值 |+| --- | --- | --- |+| 播放 | 8.191ms | 9.963ms |+| 暂停 | 8.633ms | 9.173ms |+| 同时导出 | 8.481ms | 8.506ms |++播放切换期间442次实际提交,epoch始终1、最大提交间隔18.1116ms,无Feature创建、历史reset或重开源。GDI12→12、handles721→721、PrivateBytes1729171456→1729171456。以上指软件提交与UI命令耗时,不冒充显示扫描率或完整动画帧率。++Repair v2全套:`logs/repair-v2/joint-f3c40457ea02481c87dfce0739f51c74/result.json`,18项PASS,子进程计时合计70.478秒;保留历史累计558.1472326秒,不把累计时间当单次上限。原生4K当前合同补测:`logs/ui-dual-mode/4k-719b7f3002fa42b88abbad8ba0262137/result.json`,23项PASS,13.751秒。二者仍使用同一个最终EXE,命令如下:++```powershell+powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/acceptance/repair-v2.ps1 -Root . -Case all+powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/acceptance/ui-4k-regression.ps1 -Root .+```++独立只读复核通过本轮限定修复,详见 [复核记录](REVIEW_UI_REPAIR_V3_2026-09-08.md)。++## 真实视觉证据++使用本项目独立测试窗口作为播放器背后的真实桌面内容。它每30秒在红蓝之间变化,180秒退出;Veyra 不读取它的图像。++- `logs/ui-repair-v3/desktop-red-final.jpg` 与 `desktop-blue-final.jpg`:同一空闲播放器,控制区随真实背窗红蓝变化、模糊棋盘边缘,视频区域保持黑色。+- `logs/ui-repair-v3/video-red-final.jpg`:真实合成视频正常呈现,双语字幕清晰,未染上面板材质。+- 上述三张来自 build14;最终 build16 保留相同材质主路径,随后只补主题失效回退、编辑重绘消息及测试观察时序。build14的40次切换PASS:P95 7.860ms / max10.280ms,GDI12→12、handles721→721。+- 原生数值框实际键盘输入0.75、Shift+End选择和光标已检查。真实中文IME候选组合过程尚未验证,不将Unicode输入当IME验收。++最终build16实际窗口还检查了日常底部布局、F11进入/退出、控制条及鼠标自动隐藏、专业展开、Ctrl+A和数值0.75输入/复制/粘贴、参数滚动和诊断背景;日志 `logs/ui-repair-v3/final-visual.app.log`。截图:++- `logs/ui-repair-v3/acrylic-daily-final.jpg`+- `logs/ui-repair-v3/acrylic-professional-final.jpg`+- `logs/ui-repair-v3/acrylic-fullscreen-hidden-final.jpg`+- `logs/ui-repair-v3/acrylic-scroll-final.jpg`+- `logs/ui-repair-v3/acrylic-diagnostics-final.jpg`++全屏DWM日志实际为 `apiAccepted=false fullscreen=true video=opaque`,退出后恢复 `apiAccepted=true fullscreen=false`。预览为200秒自动退出的合成媒体测试,不写入用户默认配置。++## 失败记录与修复依据++1. build1/2、build9曾因旧Veyra占用EXE导致链接失败;正常结束空闲预览后重新构建成功。早期混用不同父窗口的 DeferWindowPos 导致参数缺失,已拆分父窗口批次。+2. 首次v3图像保存回归失败:保存请求与设置切换之间存在竞态,已在同一锁中取出请求,先保存当前真实输出,再应用新设置。后续专项保存尺寸验证通过。+3. `logs/ui-dual-mode/3844e92179114c289d7a076a22dcf2c8/result.json` 整轮保留FAIL;前六个场景通过,后台导出因冷启动耗时未在原14秒窗口内完成。仅导出/取消/退出作业场景改为30秒,并使用30秒合成音视频;所有断言及单次300秒上限不变。此前补测export/cancel/exit均通过。+4. 应用内模拟玻璃被用户拒绝;它的切换P95 22.117ms也超过16ms门槛(`f342c983cfe24d83b282daa04719e9a9` FAIL)。该实现已删除,改为系统桌面合成,没有放宽性能阈值。+5. build12 GDI+ LONG参数重载歧义编译失败,修正显式Rect参数后build13成功。build14移除定时器重新显示空提示的残留路径。+6. 只读复核发现缓存HTHEME失效后raw-GDI文字破坏alpha;build15增加 WM_THEMECHANGED 失效处理和覆盖率mask回退,并补原生编辑的粘贴/撤销/滚动/IME重绘。+7. `logs/ui-repair-v3/bfc72bf143ad42a2aa4e6c185e038432/result.json` 保留FAIL。回滚重建耗时约1.4秒,旧测试从点击计时500ms,在回滚结束后仅约34ms就检查250ms定时器更新的复选框。build16改为回滚完成后有界等待500ms,不改变断言。最终日志实际捕获 `appliedNR=true desiredNR=true checkboxNR=false draftPreserved=true`,随后 `checkboxNR=true draftPreserved=true`,证明旧失败是观察时序,未覆盖草稿。+8. 本轮受保护合并gate:`logs/delivery/04388a82e2424d4a8f8832daa4db83db/result.json` 36.690秒后在旧23帧断言FAIL。当前CFR合同12源帧2X含尾帧占位为24帧;build8当前合同补测 `logs/ui-dual-mode/4k-ececc320b3744d409757c49585976c58/result.json` 23检查PASS/14.417秒(H264/HEVC原生4K、120fps、0.2秒、AAC、解码)。保护脚本及断言未改,补测不替代Phase gate通过。++## 边界与下一步++本轮未开启采集流,实卡视频/音频/断连/体感延迟仍由用户验收;真实多屏DPI、长稳、物理扫描率、完整SR4K+4X性能和IME候选未通过本轮证明。全局状态仍 `needs_review`,专有二进制公开分发仍 `distribution_blocked`。根目录/运行目录NR与addon SHA256均匹配指定身份,7个保护文件hash未变,用户删除的测试视频仍未恢复。++下一条唯一任务:用户从 `Veyra.cmd` 启动,验收这版真实毛玻璃与播放器交互,再按原合同做实卡体验验收。只做本地Git存档;本次交互修复不执行历史的一次性关机请求。diff --git a/docs/USER_GUIDE.md b/docs/USER_GUIDE.mdindex f29174f2..f95a6fe2 100644--- a/docs/USER_GUIDE.md+++ b/docs/USER_GUIDE.md@@ -4,22 +4,24 @@## 两种界面-启动始终进入日常模式。深蓝影院界面提供打开视频、最近文件、采集卡入口、增强总开关、预设选择、进度、播放、音量、字幕和全屏。右上角“切换专业模式”进入黑色工作台:左侧图标栏切换来源,右侧四个标签集中增强、补帧、预设和导出;下方显示真实处理尺寸和最近NR阶段耗时。+启动始终进入日常模式。上方全部留给视频,底部一条控制栏提供打开、进度、播放、音量、字幕和全屏;齿轮菜单里提供采集卡、最近文件、增强总开关和超分。底部右侧“切换专业模式”展开专业工作台:左侧图标栏切换来源,右侧四个标签集中增强、补帧、预设和导出;下方显示真实处理尺寸和最近NR阶段耗时。专业模式顶部提供预设快捷选择。-两种模式保留同一个视频宿主和播放会话,不重新打开文件,不套用另一套画质参数。专业模式的对比状态会记住,但日常模式恢复正常增强显示。小窗口通过“参数”按钮打开右侧抽屉。+展开和收起采用240毫秒动画,连续反向点击从当前展开位置返回。两种模式保留同一个视频宿主和播放会话,不重新打开文件,不套用另一套画质参数。专业模式的对比状态会记住,但日常模式恢复正常增强显示。小窗口通过“参数”按钮打开右侧抽屉。窗口空白处可拖动,边缘可调整尺寸;日常模式底部齿轮菜单也提供最小化和退出。-增强总开关关闭时真正旁路NR、SR与补帧,开启后恢复配置。关闭期间在专业面板调整参数,只保存待启用配置。界面显示“正在应用”时,以右栏已应用版本为准;失败会恢复实际状态。+增强总开关关闭时真正旁路NR、SR与补帧,开启后恢复配置。关闭期间修改数值只保存待启用配置;直接开启专业NR或超分开关,也会开启总增强。NR和超分开关点击后立即请求生效,无需再点“应用整套设置”,数值草稿不会阻挡它们。界面显示“正在应用”时,以右栏已应用版本为准;失败会恢复实际状态。总增强正在切换时,新的整套参数提交暂不执行,草稿保留。++控制区使用 Windows 11 Desktop Acrylic:可透出窗口下方桌面或其他软件的模糊颜色,文字和按钮单独绘制。没有固定彩色渐变,也不会截取桌面再贴回界面。视频区始终不透明,没有打开媒体时纯黑;全屏关闭桌面材质,保留视频、字幕和可隐藏控制条。系统关闭透明效果、使用高对比度或不支持 Desktop Acrylic 时,会采用系统/实色回退,不会自动更改你的 Windows 设置。独立采集设置窗口仍为普通深色界面。## 播放和参数1. 点“打开视频”或拖入 H.264/HEVC 视频;PNG/JPEG图片自动进入专业模式。Ctrl+O打开文件。空格在视频/主窗口焦点下播放、暂停;输入框保留正常输入。-2. “SR 4K”把底图超分至4K;“实时NR档”保留该4K底图,约1080p内部NR的变化由GPU回填。状态显示输入、底图、NR、光流、FG与输出实际尺寸。+2. “DLSS 超分辨率 · 4K”将底图按比例放大到3840×2160范围,尺寸取偶数。16:9输出3840×2160;4:3输出2880×2160;已达到边界的画面跳过SR,避免拉伸。播放、图片保存和视频导出共用此尺寸规则。“实时NR档”保留该底图,约1080p内部NR的变化由GPU回填。状态显示输入、底图、NR、光流、FG与输出实际尺寸。3. 取消“实时NR档”可选原生NR,性能成本更高,不承诺原生4K60。“补帧”配合2X/3X/4X选择,倍率表示每对源帧的总时间格数;无效生成或reset不会计作有效补帧。4. 专业模式“增强”提供7项NR参数及5项变化量参数。可滚动查看,悬停数值框查看范围;数值框修改后点“应用整套设置”,滑杆采用120毫秒去抖。期望与已应用版本固定显示,真实帧边界整套应用,失败回滚;切换面板会保留草稿并取消尚未发出的延迟提交。参数修改不重新打开视频或归零进度。修改尺寸/光流会有有界资源重建。5. 肤质结构、风格、自动遮罩、画面内UI修正属于实验参数。当前合成样本未观察到肤质/UI修正的像素变化,不能保证实际效果;风格和自动遮罩已观察到变化。6. 预设支持新建、复制当前、重命名、删除、设默认、恢复内建默认,保存在 `runtime_local/user-presets.v1`。配置损坏会保留原文件并报错,不静默覆盖。7. 光流三档为性能/平衡/质量;界面记录实际应用档。30/50/60模式用于识别内容节奏,不会把源时间轴重采样成指定帧率。静止画面不能确认较低内容帧率。-8. 进度条定位,Space播放/暂停;F11、Alt+Enter、视频区域双击或全屏按钮切换,Esc退出全屏。设备丢失会停止并报错,重新打开源恢复,不是无缝恢复。+8. 进度条定位,Space播放/暂停;F11、Alt+Enter、视频区域双击或全屏按钮切换,Esc退出全屏。全屏只展示铺满显示器的视频和字幕,控制条覆盖在底部;鼠标离开控制条并静止约1.6秒后,操作条与鼠标隐藏,移动鼠标会唤回。参数面板在全屏隐藏,退出恢复原窗口与模式。设备丢失会停止并报错,重新打开源恢复,不是无缝恢复。## 对比、性能与诊断@@ -42,10 +44,10 @@## 采集卡与边界-点“采集”选择真实视频设备、实际格式和HDMI音频输入。先NR开、FG关检查视频声音,再选补帧倍率。补帧需要等待下一源帧,不能消除采集卡固有延迟。当前修复版本的实卡验收由用户完成,本轮未占用采集卡。+日常模式点底部齿轮→“连接采集卡”,专业模式点左侧采集图标,选择真实视频设备、实际格式和HDMI音频输入。先NR开、FG关检查视频声音,再选补帧倍率。补帧需要等待下一源帧,不能消除采集卡固有延迟。当前修复版本的实卡验收由用户完成,本轮未占用采集卡。仅Windows x64/NVIDIA/SDR,偶数尺寸最高3840×2160;HDR不支持。Depth provider未实现,当前为NVOF motion + confidence门控,不等同游戏原生深度/运动向量。短测不证明长期稳定、所有采集卡兼容或画质优于其他产品。实际屏幕扫描/光子延迟、多屏物理DPI穿越尚未测量。专有runtime分发权未解决,不打包、上传或发布DLL/SDK。窗口尺寸、位置、音量、字幕等保存在独立UI偏好中;只保存成功应用的画质。损坏的原配置保留,不静默覆盖。程序每次重启仍默认日常模式。-双模式结果见 `docs/UI_DUAL_MODE_DELIVERY_2026-09-08.md`,底层既有修复见 `docs/REPAIR_V2_DELIVERY_2026-09-08.md`。测试限制为每次最多300秒,历史累计时间仅作报告。+本轮界面修复见 `docs/UI_REPAIR_V3_DELIVERY_2026-09-08.md`,历史双模式结果见 `docs/UI_DUAL_MODE_DELIVERY_2026-09-08.md`,底层既有修复见 `docs/REPAIR_V2_DELIVERY_2026-09-08.md`。测试限制为每次最多300秒,历史累计时间仅作报告。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex 2464f853..b271701e 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,3 +1,17 @@+# 2026-09-08 UI修复v3:真实桌面毛玻璃++已删除应用内彩色渐变,控制区采用Windows Desktop Acrylic,透出下方桌面或其他窗口的模糊颜色;视频区域不透明、空闲纯黑。同步修复窗口白边、视频全屏、专业NR/SR开关、数值草稿/回滚、滚动裁剪、日常底部布局与240ms展开动画。独立采集对话框仍为普通深色。++基线`b6b251d`,最终EXE SHA256 `B1892C51E8AFC27D7223E271D48D93107C34CAA96BC4014DFF6F45FDE0D7BF74`。build16成功;专项11命令PASS/81.001秒,UI全套15命令PASS/141.187秒,Repair18项PASS/子进程70.478秒,当前4K合同23项PASS/13.751秒。均为每次300秒以内,历史累计保留。40次切换P95 8.191ms/max9.963,442次提交epoch1,GDI12/handles721稳定。真实红蓝背窗、视频字幕、输入/粘贴、全屏及滚动已检查;独立只读复核通过本轮范围。++全项目仍Phase7/needs_review;本轮保护delivery gate保留FAIL(旧23帧断言,当前12源帧2X含尾部CFR占位输出24帧),不修改保护门禁或用补测冒充阶段通过。实卡、真实IME候选、多屏DPI、长稳及公开分发未验收。没有开启采集流或公开上传,没有再次执行历史的一次性关机请求。++完整文件、命令、RTX Create/Evaluate日志、失败和截图:[UI修复v3报告](UI_REPAIR_V3_DELIVERY_2026-09-08.md);[只读复核](REVIEW_UI_REPAIR_V3_2026-09-08.md);[操作指南](USER_GUIDE.md)。下一条唯一任务:用户通过`Veyra.cmd`验收当前UI和原合同中的实卡体验。++---++以下保留历史记录,旧的“当前版本/通过状态”不代表本轮:+# 2026-09-08 双模式UI本机软件交付已实现批准的UI0–UI9:默认日常影院界面、专业四区工作台、共享视频宿主与无重开切换、完整参数/预设、真实音量和透明字幕、后台冻结设置导出、诊断/全屏/小窗口。最初普通Win32排布在用户反馈后重新实现。diff --git a/include/veyra/pipeline/ResolutionPlan.h b/include/veyra/pipeline/ResolutionPlan.hindex 0d3184bb..24049ab4 100644--- a/include/veyra/pipeline/ResolutionPlan.h+++ b/include/veyra/pipeline/ResolutionPlan.h@@ -15,7 +15,8 @@ struct ResolutionPlan {uint64_t settingsRevision=0;static ResolutionPlan make(Extent source,bool sr,NrSizePolicy policy,bool exporting,uint64_t revision=0) {if(!source.valid())throw std::invalid_argument("invalid SDR source extent");- ResolutionPlan p; p.source=source;p.base=sr?Extent{3840,2160}:source;+ ResolutionPlan p; p.source=source;p.base=source;+ if(sr){const double scale=std::min(3840.0/source.width,2160.0/source.height);p.base={std::max(2u,uint32_t(source.width*scale+1e-6)&~1u),std::max(2u,uint32_t(source.height*scale+1e-6)&~1u)};}p.srApplied=sr&&p.base!=source;p.nr=p.base;if(!exporting&&policy==NrSizePolicy::Realtime) {const double scale=std::min({1.0,1920.0/p.base.width,1080.0/p.base.height});diff --git a/loop/EVIDENCE.md b/loop/EVIDENCE.mdindex c61c0064..3a943e15 100644--- a/loop/EVIDENCE.md+++ b/loop/EVIDENCE.md@@ -375,3 +375,9 @@ Protected gate logs/delivery/39c5c9d100234c92beaf7eb5d5cab1c0/result.json remainVisual checks via native UI: same EXE daily-current.jpg/professional-current.jpg in logs/ui-dual-mode/visual-candidate, transparent bilingual subtitles, complete four-card Pro repaint. Other visual states from prior same-UI candidate include capture setup only, export, diagnostics, 800x600 drawer, 2560x1440 fullscreen, and edit focus. Earlier subtitle/layout/mode-latency failures retained and repaired. Readonly review_dual_mode reviewed code and evidence; exact final conclusion in docs/REVIEW_UI_DUAL_MODE_2026-09-08.md. Historical Phase fields are not UI proof. User authorized normal shutdown after local task completion; final checkpoint and shutdown dispatch recorded separately.Next: user visual/capture audio/latency acceptance. Report docs/UI_DUAL_MODE_DELIVERY_2026-09-08.md.+++## 2026-09-08 UI repair v3 final software record+Baseline b6b251d; build16 exit0, EXE B1892C51E8AFC27D7223E271D48D93107C34CAA96BC4014DFF6F45FDE0D7BF74. Native logs/ui-repair-v3/3fb66a3472264eb4abc1fc61917839a8/result.json:11 commands PASS/81.0014012s. UI logs/ui-dual-mode/13e2d933fe66477797a71b32612af303/result.json:15 commands PASS/141.1874955s. Repair logs/repair-v2/joint-f3c40457ea02481c87dfce0739f51c74/result.json:18 cases PASS/70.4781915s subprocess sum; cumulative558.1472326s retained. Current4K logs/ui-dual-mode/4k-719b7f3002fa42b88abbad8ba0262137/result.json:23 checks PASS/13.7508573s. Every invocation <=300s. Actual RTX Feature18 Create/Evaluate0x1 and actual SR PNG/video dimensions/decode recorded. Switch40 P958.191ms/max9.963ms;442 submissions/epoch1/maxgap18.1116ms;GDI12 andhandles721 stable. Independent readonly review_ui_v3 PASS scoped fixes; see docs/REVIEW_UI_REPAIR_V3_2026-09-08.md.+True DWM red/blue desktop proof in desktop-red-final.jpg/desktop-blue-final.jpg (build14 material main path unchanged); actual finalbuild16 Daily/Pro/scroll/diagnostic/fullscreen-hidden screenshots in logs/ui-repair-v3/acrylic-*-final.jpg; Ctrl+A/0.75 input/copy/paste verified. Video and subtitles remain opaque/sharp, empty video black. Removed simulated application artwork. Native reject bfc72 FAIL preserved; corrected observer begins500ms after backend rollback; final log independently shows checkboxfalse->true with draft always preserved. Earlier export cold-start timeout and old-gradient performance failures preserved in report.+Protected delivery04388 FAIL legacy23 assertion; protected7 unchanged and fixed root/stagedNR/addon match. Old global Phase7 needs_review retained; no capture, public package/push or shutdown. Next: user visual/capture acceptance. Full report docs/UI_REPAIR_V3_DELIVERY_2026-09-08.md.diff --git a/loop/JOURNAL.md b/loop/JOURNAL.mdindex b698b0cb..17d03de4 100644--- a/loop/JOURNAL.md+++ b/loop/JOURNAL.md@@ -1297,3 +1297,21 @@ Protected gate logs/delivery/39c5c9d100234c92beaf7eb5d5cab1c0/result.json remainVisual checks via native UI: same EXE daily-current.jpg/professional-current.jpg in logs/ui-dual-mode/visual-candidate, transparent bilingual subtitles, complete four-card Pro repaint. Other visual states from prior same-UI candidate include capture setup only, export, diagnostics, 800x600 drawer, 2560x1440 fullscreen, and edit focus. Earlier subtitle/layout/mode-latency failures retained and repaired. Readonly review_dual_mode reviewed code and evidence; exact final conclusion in docs/REVIEW_UI_DUAL_MODE_2026-09-08.md. Historical Phase fields are not UI proof. User authorized normal shutdown after local task completion; final checkpoint and shutdown dispatch recorded separately.Next: user visual/capture audio/latency acceptance. Report docs/UI_DUAL_MODE_DELIVERY_2026-09-08.md.++## 2026-09-08 UI repair v3 started from user repros+Baseline b6b251d clean. User reproduced active border, fullscreen semantics, dashboard flicker, non-immediate Pro NR/SR switches and sticky scroll overlap; requests media-first Daily bottom controls, animated Pro unfold and frosted material. Previous scoped visual verdict is not proof against these real defects. Plan: repair nonclient/fullscreen interaction, isolate scroll body, buffered/limited dirty-region drawing, immediate feature transactions, animated same-host layout with bounded swapchain resize deferral, and glass treatment; validate actual native interactions plus bounded regression and fresh readonly review. Root/staged NR and addon identities match; no protected gate/runtime/capture changes. Old one-time shutdown request completed in prior delivery; no new shutdown scheduled for this interactive repair turn.++## 2026-09-08 UI repair v3 resumed after accidental Escape+User explicitly says the cat pressed Escape and authorizes continuation. Candidate build7 passed all 11 scoped subprocess checks in80.5687244s; NR/SR clicks, rollback with invalid drafts, shared aspect plan, save/settings atomic ordering and master pending guards independently reviewed. Actual native Daily/Pro/scroll/fullscreen hide/wake screenshots inspected. Remaining: fullscreen square corners/quiet keyboard focus finish, final mode/4K/repair regressions, native edge and animation observations, documentation/checkpoint. No shutdown requested for this resumed interactive repair.++## 2026-09-08 Material correction from user screenshots+User rejects the dark rectangular control/text fills and requests the stronger translucent frosted material of reference4. Replace independent opaque backgrounds with one cached application-artwork backdrop, Gaussian-blurred material panes and region-matched child painting; preserve native edit input/IME using cached matching pattern brushes. No video/desktop readback or gameplay processing changes. Previous build8 tests retained; new material build requires visual, interaction and animation/resource checks before final checkpoint.++## 2026-09-08 True desktop glass correction and resume+User explicitly requires desktop/other-window colors through the chrome, with opaque video and pure black when empty; the previous application-artwork gradient was rejected and is removed. After a second physical Escape interruption the user said continue. Build12 failed on LONG/int GDI+ overloads; build13 compiled and actual desktop colors were visible. Build14 removed a leftover timer that redisplayed the empty hint at the wrong position. Independent 180-second red/blue desktop fixture proved DWM background changes in the chrome while the empty viewport stays black; screenshots desktop-red-final.jpg/desktop-blue-final.jpg in logs/ui-repair-v3. Actual synthetic video and bilingual subtitles remain sharp over the red backdrop (video-red-final.jpg). Build14 switch40 PASS in14.8636812s, commandP95=7.860ms/max10.280ms, GDI12->12/handles721->721. Reviewer identified stale theme handle/unsafe raw-GDI fallback and incomplete EDIT invalidation; fixed theme reset/alpha-mask text fallback and native paste/cut/undo/scroll/IME invalidation. Build15 compiled; final native integration checks running. No OS settings changed; actual appearance still obeys Windows transparency policy. Global Phase7 needs_review and protected legacy23-frame gate failure unchanged. No shutdown, capture stream or publication in this interactive repair.+++## 2026-09-08 UI repair v3 final software record+Baseline b6b251d; build16 exit0, EXE B1892C51E8AFC27D7223E271D48D93107C34CAA96BC4014DFF6F45FDE0D7BF74. Native logs/ui-repair-v3/3fb66a3472264eb4abc1fc61917839a8/result.json:11 commands PASS/81.0014012s. UI logs/ui-dual-mode/13e2d933fe66477797a71b32612af303/result.json:15 commands PASS/141.1874955s. Repair logs/repair-v2/joint-f3c40457ea02481c87dfce0739f51c74/result.json:18 cases PASS/70.4781915s subprocess sum; cumulative558.1472326s retained. Current4K logs/ui-dual-mode/4k-719b7f3002fa42b88abbad8ba0262137/result.json:23 checks PASS/13.7508573s. Every invocation <=300s. Actual RTX Feature18 Create/Evaluate0x1 and actual SR PNG/video dimensions/decode recorded. Switch40 P958.191ms/max9.963ms;442 submissions/epoch1/maxgap18.1116ms;GDI12 andhandles721 stable. Independent readonly review_ui_v3 PASS scoped fixes; see docs/REVIEW_UI_REPAIR_V3_2026-09-08.md.+True DWM red/blue desktop proof in desktop-red-final.jpg/desktop-blue-final.jpg (build14 material main path unchanged); actual finalbuild16 Daily/Pro/scroll/diagnostic/fullscreen-hidden screenshots in logs/ui-repair-v3/acrylic-*-final.jpg; Ctrl+A/0.75 input/copy/paste verified. Video and subtitles remain opaque/sharp, empty video black. Removed simulated application artwork. Native reject bfc72 FAIL preserved; corrected observer begins500ms after backend rollback; final log independently shows checkboxfalse->true with draft always preserved. Earlier export cold-start timeout and old-gradient performance failures preserved in report.+Protected delivery04388 FAIL legacy23 assertion; protected7 unchanged and fixed root/stagedNR/addon match. Old global Phase7 needs_review retained; no capture, public package/push or shutdown. Next: user visual/capture acceptance. Full report docs/UI_REPAIR_V3_DELIVERY_2026-09-08.md.diff --git a/loop/STATE.json b/loop/STATE.jsonindex 810992f1..29f653f9 100644--- a/loop/STATE.json+++ b/loop/STATE.json@@ -100,7 +100,7 @@"Current USB2 1080p50 physical throughput passed; user perceived latency/audio/actual FG display cadence still need confirmation.","Public proprietary runtime distribution rights unresolved; local delivery only."],- "nextAction": "User accepts current EXE on capture hardware; see docs/REPAIR_V2_DELIVERY_2026-09-08.md for measured performance limits.",+ "nextAction": "User accepts current UI and capture experience; see docs/UI_REPAIR_V3_DELIVERY_2026-09-08.md. Old Phase records are not new gate proof.","updatedAt": "2026-09-07T13:20:00Z","deliveryPlan": "docs/ACTIVE_DELIVERY_PLAN.md","captureAcceptance": "throughput_short_test_passed_user_latency_audio_pending",@@ -178,6 +178,41 @@"long stability","all SR4K+4X realtime combinations","proprietary distribution blocked"+ ],+ "currentRepairReport": "docs/UI_REPAIR_V3_DELIVERY_2026-09-08.md"+ },+ "uiRepairV3": {+ "status": "local_software_checks_passed_user_acceptance_pending",+ "baselineCommit": "b6b251d",+ "exeSha256": "B1892C51E8AFC27D7223E271D48D93107C34CAA96BC4014DFF6F45FDE0D7BF74",+ "report": "docs/UI_REPAIR_V3_DELIVERY_2026-09-08.md",+ "review": "docs/REVIEW_UI_REPAIR_V3_2026-09-08.md",+ "softwareEvidence": [+ "logs/ui-repair-v3/3fb66a3472264eb4abc1fc61917839a8/result.json",+ "logs/ui-dual-mode/13e2d933fe66477797a71b32612af303/result.json",+ "logs/repair-v2/joint-f3c40457ea02481c87dfce0739f51c74/result.json",+ "logs/ui-dual-mode/4k-719b7f3002fa42b88abbad8ba0262137/result.json"+ ],+ "updatedAt": "2026-09-08T03:16:19.278371+00:00",+ "testLimitScope": "per_invocation",+ "testLimitSeconds": 300,+ "desktopMaterial": "Windows Desktop Acrylic; actual independent red/blue behind-window proof; empty video opaque black",+ "protectedDeliveryGate": {+ "status": "failed_obsolete_23_frame_assertion",+ "evidence": "logs/delivery/04388a82e2424d4a8f8832daa4db83db/result.json",+ "modified": false,+ "doesNotAdvanceOldPhase": true+ },+ "nextAction": "User accepts true desktop glass and player interactions via Veyra.cmd, then physical capture video/audio/latency under existing contract",+ "remainingLimits": [+ "user visual acceptance",+ "physical capture video/audio/disconnect",+ "physical scanout/photon latency",+ "physical multi-monitor DPI",+ "long stability",+ "actual IME candidate composition",+ "system transparency/high-contrast policy fallback",+ "proprietary distribution blocked"]}}diff --git a/scripts/acceptance/ui-dual-mode.ps1 b/scripts/acceptance/ui-dual-mode.ps1index a9c56326..4878c67c 100644--- a/scripts/acceptance/ui-dual-mode.ps1+++ b/scripts/acceptance/ui-dual-mode.ps1@@ -38,10 +38,15 @@ try {$input=$clipif($name -in @('audio','export','canceljob','exitjob')){$input=Join-Path $runDir ($name+'-audio.mp4')- Run-Check ($name+'-fixture') (Get-Command ffmpeg).Source ('-nostdin -v error -i "'+$clip+'" -f lavfi -i "sine=frequency=440:sample_rate=48000:duration=9" -t 9 -c:v copy -c:a aac "'+$input+'"')+ $fixtureSeconds=if($name -eq 'audio'){9}else{30}+ Run-Check ($name+'-fixture') (Get-Command ffmpeg).Source ('-nostdin -v error -stream_loop 3 -i "'+$clip+'" -f lavfi -i "sine=frequency=440:sample_rate=48000:duration='+$fixtureSeconds+'" -t '+$fixtureSeconds+' -c:v copy -c:a aac "'+$input+'"')}if($name -eq 'masterreject'){$env:VEYRA_TEST_REJECT_NR_DISABLE='1'}else{$env:VEYRA_TEST_REJECT_NR_DISABLE=$oldReject}- Run-Check $name $exe ('--smoke-seconds 14 --nr --no-sr --no-fg '+$flags+' "'+$input+'"')+ # Two independent GPU contexts can take several seconds to initialize cold.+ # Keep foreground media playing through worker pause/resume; assertions and+ # the entire invocation's 300-second ceiling remain unchanged.+ $smokeSeconds=if($name -in @('export','canceljob','exitjob')){30}else{14}+ Run-Check $name $exe ('--smoke-seconds '+$smokeSeconds+' --nr --no-sr --no-fg '+$flags+' "'+$input+'"')$log=Get-Content -LiteralPath $env:VEYRA_LOG_FILE -Rawif($name -eq 'switch'){$lines=@($log -split '\r?\n');$first=[Array]::FindIndex($lines,[Predicate[string]]{param($line) $line.Contains('[ui-mode]')});$last=[Array]::FindLastIndex($lines,[Predicate[string]]{param($line) $line.Contains('[ui-mode]')});$interval=($lines[$first..$last] -join "`n")diff --git a/scripts/acceptance/ui-repair-v3.ps1 b/scripts/acceptance/ui-repair-v3.ps1new file mode 100644index 00000000..28eaf564--- /dev/null+++ b/scripts/acceptance/ui-repair-v3.ps1@@ -0,0 +1,49 @@+[CmdletBinding()]+param([string]$Root=(Join-Path $PSScriptRoot '../..'),[ValidateRange(1,300)][int]$MaxRuntimeSeconds=300)+Set-StrictMode -Version Latest+$ErrorActionPreference='Stop'+$Root=(Resolve-Path -LiteralPath $Root).Path+$timer=[Diagnostics.Stopwatch]::StartNew()+$dir=Join-Path $Root ('logs/ui-repair-v3/'+[guid]::NewGuid().ToString('N'))+New-Item -ItemType Directory -Path $dir|Out-Null+$bin=Join-Path $Root 'out/build/x64-release'+$checks=[Collections.Generic.List[object]]::new()+$oldLog=$env:VEYRA_LOG_FILE;$oldReject=$env:VEYRA_TEST_REJECT_NR_DISABLE+function Run([string]$name,[string]$exe,[string]$arguments){+ $left=$MaxRuntimeSeconds-$timer.Elapsed.TotalSeconds;if($left -lt 1){throw 'Per-invocation limit reached'}+ $env:VEYRA_LOG_FILE=Join-Path $dir ($name+'.app.log');$p=$null+ try{$p=Start-Process -FilePath $exe -ArgumentList $arguments -WorkingDirectory $Root -WindowStyle Hidden -PassThru -RedirectStandardOutput (Join-Path $dir ($name+'.stdout.log')) -RedirectStandardError (Join-Path $dir ($name+'.stderr.log'));$handle=$p.Handle+ if(-not $p.WaitForExit([int]($left*1000))){throw "$name timeout"};$code=$p.ExitCode;$checks.Add(@{name=$name;exit=$code;command=$exe+' '+$arguments});if($code -ne 0){throw "$name exit $code"}+ }finally{if($p -and -not $p.HasExited){& "$env:SystemRoot/System32/taskkill.exe" /PID $p.Id /T /F|Out-Null;$p.WaitForExit()}}+}+$passed=$false;$failure=''+try{+ Run 'contracts' (Join-Path $bin 'veyra_ui_contract_tests.exe') ('"'+(Join-Path $dir 'preferences')+'"')+ $ffmpeg=(Get-Command ffmpeg).Source;$ffprobe=(Get-Command ffprobe).Source+ $image=Join-Path $dir 'aspect-4x3.png';$clip=Join-Path $dir 'aspect-4x3.mp4'+ Run 'image-fixture' $ffmpeg ('-nostdin -v error -f lavfi -i testsrc2=size=1448x1086:rate=30 -frames:v 1 "'+$image+'"')+ Run 'video-fixture' $ffmpeg ('-nostdin -v error -f lavfi -i testsrc2=size=1448x1086:rate=30 -t 20 -c:v libx264 -preset ultrafast -crf 20 -pix_fmt yuv420p "'+$clip+'"')+ foreach($case in @('image','video','reject')){+ $env:VEYRA_TEST_REJECT_NR_DISABLE=if($case -eq 'reject'){'1'}else{$null}+ $input=if($case -eq 'video'){$clip}else{$image};$flag=if($case -eq 'reject'){'--smoke-repair-ui-reject'}else{'--smoke-repair-ui'}+ Run $case (Join-Path $bin 'veyra.exe') ('--smoke-seconds 25 --nr --no-sr --no-fg '+$flag+' --smoke-save "'+(Join-Path $dir ($case+'-sr.png'))+'" "'+$input+'"')+ $log=Get-Content -LiteralPath (Join-Path $dir ($case+'.app.log')) -Raw+ if($log -match '\[ui-repair-test\].*=false' -or $log -notmatch '\[ui-repair-test\]'){throw "$case native click evidence missing or failed"}+ if($case -ne 'reject'){+ if($log -notmatch 'PASS native controls' -or $log -notmatch 'output=2880x2160'){throw "$case incomplete"}+ Run ($case+'-saved-probe') $ffprobe ('-v error -show_streams -of json "'+(Join-Path $dir ($case+'-sr.png'))+'"')+ $probe=Get-Content (Join-Path $dir ($case+'-saved-probe.stdout.log')) -Raw|ConvertFrom-Json+ if($probe.streams[0].width -ne 2880 -or $probe.streams[0].height -ne 2160){throw "$case saved extent wrong"}+ }+ }+ $env:VEYRA_TEST_REJECT_NR_DISABLE=$null+ $out=Join-Path $dir 'export-4x3.mp4'+ Run 'export' (Join-Path $bin 'veyra.exe') ('--export-out "'+$out+'" --max-frames 12 --sr --no-nr --no-fg "'+$clip+'"')+ Run 'export-decode' $ffmpeg ('-nostdin -v error -i "'+$out+'" -f null -')+ Run 'export-probe' $ffprobe ('-v error -show_streams -of json "'+$out+'"')+ $probe=Get-Content (Join-Path $dir 'export-probe.stdout.log') -Raw|ConvertFrom-Json+ if($probe.streams[0].width -ne 2880 -or $probe.streams[0].height -ne 2160 -or [int]$probe.streams[0].nb_frames -ne 12){throw 'SR export dimensions/count mismatch'}+ $passed=$true+}catch{$failure=$_.Exception.Message;Write-Host $failure}+finally{$env:VEYRA_LOG_FILE=$oldLog;$env:VEYRA_TEST_REJECT_NR_DISABLE=$oldReject;$timer.Stop();[ordered]@{passed=$passed;seconds=$timer.Elapsed.TotalSeconds;limitSeconds=$MaxRuntimeSeconds;exeSha256=(Get-FileHash (Join-Path $bin 'veyra.exe')).Hash;checks=$checks;failure=$failure}|ConvertTo-Json -Depth 8|Set-Content (Join-Path $dir 'result.json');Write-Host "UI v3 evidence=$dir passed=$passed"}+if($passed){exit 0}else{exit 1}diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex 1922047f..6f09749f 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -90,7 +90,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options){pipeline::EnhanceGraphDesc gd;gd.sourceWidth=width;gd.sourceHeight=height;const auto resolution=pipeline::ResolutionPlan::make({width,height},options.sr,options.realtime?pipeline::NrSizePolicy::Realtime:pipeline::NrSizePolicy::Native,isImage,1);gd.workWidth=resolution.base.width;gd.workHeight=resolution.base.height;gd.nrWidth=resolution.nr.width;gd.nrHeight=resolution.nr.height;- gd.enableSr=options.sr&&(width!=3840||height!=2160);gd.enableNr=options.nr;gd.enableFg=options.fg;gd.fgMultiplier=options.fgMultiplier;gd.enableNvofStandalone=options.nr;+ gd.enableSr=resolution.srApplied;gd.enableNr=options.nr;gd.enableFg=options.fg;gd.fgMultiplier=options.fgMultiplier;gd.enableNvofStandalone=options.nr;gd.noFeatures=false;gd.model=options.settings.model;gd.residual=options.settings.residual;gd.settingsRevision=options.settings.revision;gd.flowQuality=options.settings.flow;gd.contentRate=options.settings.content;gd.runtimeAbsPath=std::filesystem::path(VEYRA_PROJECT_ROOT).wstring()+L"\\runtime_local\\nvidia";if(!graph.initialize(gd)||!presenter.open(ctx,window,graph)||!graph.createViews()){status(L"增强初始化失败,请核对本地运行时",true);break;}@@ -106,13 +106,17 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options){while(!stop_){const float gain=muted_?0.0f:volume_.load();audio.setGain(gain);if(isCapture){const bool available=captureSource.setAudioGain(gain);std::lock_guard lock(mutex_);snapshot_.audioAvailable=available;}- EnhancementSettings requested;{std::lock_guard lock(mutex_);requested=desired_;}+ // Save the currently displayed result before a settings transaction+ // invalidates it. Keep a request queued until a frame exists.+ std::wstring save;EnhancementSettings requested;{std::lock_guard lock(mutex_);requested=desired_;if(hasOutput)save.swap(savePath_);}+ if(!save.empty()){sink::RgbaImage result;const auto e=std::filesystem::path(save).extension().wstring();+ if(!sink::readRgba8(ctx,ring,graph.videoFrameResource(out.videoSlot),result)||!sink::saveImage(save,result,e==L".jpg"||e==L".jpeg"))status(L"保存失败(目标文件可能已存在)",true);else{status(L"图片已保存:"+save);veyra::log::info("image-save",std::format("saved extent={}x{} revision={}",gd.workWidth,gd.workHeight,options.settings.revision));}}const auto previous=options.snapshot();const auto previousDesc=gd;bool transaction=false;if(requested.revision!=previous.revision){auto next=PlayerOptions::from(requested);auto nextDesc=gd;const auto plan=pipeline::ResolutionPlan::make({width,height},next.sr,requested.nrPolicy,isImage,requested.revision);nextDesc.workWidth=plan.base.width;nextDesc.workHeight=plan.base.height;nextDesc.nrWidth=plan.nr.width;nextDesc.nrHeight=plan.nr.height;- nextDesc.enableSr=next.sr&&(width!=3840||height!=2160);nextDesc.enableNr=next.nr;nextDesc.enableFg=next.fg;nextDesc.fgMultiplier=next.fgMultiplier;nextDesc.enableNvofStandalone=next.nr;+ nextDesc.enableSr=plan.srApplied;nextDesc.enableNr=next.nr;nextDesc.enableFg=next.fg;nextDesc.fgMultiplier=next.fgMultiplier;nextDesc.enableNvofStandalone=next.nr;nextDesc.model=requested.model;nextDesc.residual=requested.residual;nextDesc.settingsRevision=requested.revision;nextDesc.flowQuality=requested.flow;nextDesc.contentRate=requested.content;const bool rebuild=gd.flowQuality!=nextDesc.flowQuality||gd.workWidth!=nextDesc.workWidth||gd.workHeight!=nextDesc.workHeight||gd.nrWidth!=nextDesc.nrWidth||gd.nrHeight!=nextDesc.nrHeight;bool accepted=ring.drainQueue();out={};hasOutput=false;@@ -122,9 +126,6 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options){if(accepted){options=next;gd=nextDesc;transaction=true;reset=true;}else {std::lock_guard lock(mutex_);if(desired_.revision==requested.revision)desired_=previous;snapshot_.desired=desired_;snapshot_.rejectedRevision=requested.revision;snapshot_.applying=desired_.revision!=previous.revision;snapshot_.status=L"设置应用失败,已恢复上一套参数";}}- std::wstring save;{std::lock_guard lock(mutex_);save.swap(savePath_);}- if(!save.empty()&&hasOutput){sink::RgbaImage result;const auto e=std::filesystem::path(save).extension().wstring();- if(!sink::readRgba8(ctx,ring,graph.videoFrameResource(out.videoSlot),result)||!sink::saveImage(save,result,e==L".jpg"||e==L".jpeg"))status(L"保存失败(目标文件可能已存在)",true);else status(L"图片已保存:"+save);}const double seek=seekSeconds_.exchange(-1);if(seek>=0&&!isImage&&!isCapture){if(!ring.drainQueue()||!activeSource->seek({static_cast<int64_t>(seek*1000000),1000000})){status(L"跳转失败",true);break;}diff --git a/src/engine/VideoExportJob.cpp b/src/engine/VideoExportJob.cppindex 0b029c91..96ee49ae 100644--- a/src/engine/VideoExportJob.cpp+++ b/src/engine/VideoExportJob.cpp@@ -2,6 +2,7 @@#include "veyra/engine/CfrTimeline.h"#include "veyra/source/MediaFileSource.h"#include "veyra/pipeline/EnhanceGraph.h"+#include "veyra/pipeline/ResolutionPlan.h"#include "veyra/sink/NvencD3D12Encoder.h"#include "veyra/gfx/D3D12DeviceContext.h"#include "veyra/gfx/CommandSlotRing.h"@@ -39,7 +40,8 @@ bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOptisource.close();if(!source.open(od))break; // reopen from the true beginning, including negative PTSconst AVRational rate=av_mul_q({rateNum,rateDen},{int(options.fg?options.fgMultiplier:1),1});veyra::log::info("export-timeline",std::format("CFR declared={}/{} candidate={}/{} timestampQuantum={} sampled={} output={}/{} (timestamp-consistent candidate, quantized short clips may be ambiguous; every PTS validated)",info.nominalRateNum,info.nominalRateDen,rateNum,rateDen,info.timestampQuantum,samples.size(),rate.num,rate.den));- pipeline::EnhanceGraphDesc gd;gd.sourceWidth=info.width;gd.sourceHeight=info.height;gd.workWidth=options.sr?3840:info.width;gd.workHeight=options.sr?2160:info.height;gd.enableSr=options.sr&&(info.width!=3840||info.height!=2160);gd.enableNr=options.nr;gd.enableFg=options.fg;gd.fgMultiplier=options.fgMultiplier;gd.enableNvofStandalone=options.nr;gd.model=options.settings.model;gd.residual=options.settings.residual;gd.settingsRevision=options.settings.revision;gd.flowQuality=options.settings.flow;gd.contentRate=options.settings.content;gd.runtimeAbsPath=(std::filesystem::path(VEYRA_PROJECT_ROOT)/"runtime_local/nvidia").wstring();+ const auto resolution=pipeline::ResolutionPlan::make({info.width,info.height},options.sr,pipeline::NrSizePolicy::Native,true,options.settings.revision);+ pipeline::EnhanceGraphDesc gd;gd.sourceWidth=info.width;gd.sourceHeight=info.height;gd.workWidth=resolution.base.width;gd.workHeight=resolution.base.height;gd.enableSr=resolution.srApplied;gd.enableNr=options.nr;gd.enableFg=options.fg;gd.fgMultiplier=options.fgMultiplier;gd.enableNvofStandalone=options.nr;gd.model=options.settings.model;gd.residual=options.settings.residual;gd.settingsRevision=options.settings.revision;gd.flowQuality=options.settings.flow;gd.contentRate=options.settings.content;gd.runtimeAbsPath=(std::filesystem::path(VEYRA_PROJECT_ROOT)/"runtime_local/nvidia").wstring();if(!graph.initialize(gd)||!graph.createViews())break;if(avformat_alloc_output_context2(&mux,nullptr,"mp4",utf8(partial).c_str())<0||!mux)break;videoStream=avformat_new_stream(mux,nullptr);if(!videoStream)break;videoStream->time_base={rate.den,rate.num};videoStream->avg_frame_rate=rate;diff --git a/src/engine/VideoPresenter.cpp b/src/engine/VideoPresenter.cppindex bdf4a9ac..3623ab08 100644--- a/src/engine/VideoPresenter.cpp+++ b/src/engine/VideoPresenter.cpp@@ -20,7 +20,8 @@ void VideoPresenter::refresh(ID3D12Device* device){for(unsigned i=0;i<3;++i){Micbool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing& ring,pipeline::EnhanceGraph& graph,unsigned slot,bool generated,int comparison,bool baseReference,float split,pipeline::FrameIdentity identity) {RECT rc{};GetClientRect(window_,&rc);if(rc.right<1||rc.bottom<1)return true;const auto now=std::chrono::steady_clock::now();- if((unsigned(rc.right)!=sink_.width()||unsigned(rc.bottom)!=sink_.height())&&now-lastResize_>=std::chrono::milliseconds(100)) {+ const auto deferUntil=uint64_t(uintptr_t(GetPropW(window_,L"Veyra.ResizeDeferUntil")));+ if((unsigned(rc.right)!=sink_.width()||unsigned(rc.bottom)!=sink_.height())&&GetTickCount64()>=deferUntil&&now-lastResize_>=std::chrono::milliseconds(100)) {if(!ring.drainQueue())return false;sink_.resize(rc.right,rc.bottom);if(sink_.bufferWidth()!=unsigned(rc.right)||sink_.bufferHeight()!=unsigned(rc.bottom))return false;refresh(ctx.device());lastResize_=now;@@ -34,8 +35,11 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&barriers[1].Transition.pResource=bb;barriers[1].Transition.StateAfter=D3D12_RESOURCE_STATE_RENDER_TARGET;list->ResourceBarrier(2,barriers);D3D12_CPU_DESCRIPTOR_HANDLE rtv{rtvs_->GetCPUDescriptorHandleForHeapStart().ptr+size_t(sink_.swapChain()->GetCurrentBackBufferIndex())*inc_};const float black[4]={0,0,0,1};list->ClearRenderTargetView(rtv,black,0,nullptr);list->OMSetRenderTargets(1,&rtv,FALSE,nullptr);- const float scale=std::min(float(sink_.bufferWidth())/graph.workWidth(),float(sink_.bufferHeight())/graph.workHeight());- const float w=graph.workWidth()*scale,h=graph.workHeight()*scale;+ // DXGI stretches the retained buffer while the native workspace unfolds.+ // Compute contain in CURRENT client coordinates, then map back to buffer+ // coordinates so that the onscreen image keeps its aspect throughout.+ const float scale=std::min(float(rc.right)/graph.workWidth(),float(rc.bottom)/graph.workHeight());+ const float w=graph.workWidth()*scale*sink_.bufferWidth()/rc.right,h=graph.workHeight()*scale*sink_.bufferHeight()/rc.bottom;D3D12_VIEWPORT viewport{(sink_.bufferWidth()-w)*0.5f,(sink_.bufferHeight()-h)*0.5f,w,h,0,1};D3D12_RECT rect{0,0,LONG(sink_.bufferWidth()),LONG(sink_.bufferHeight())};list->RSSetViewports(1,&viewport);list->RSSetScissorRects(1,&rect);ID3D12DescriptorHeap* heaps[]={pass_.heap.Get()};list->SetDescriptorHeaps(1,heaps);list->SetGraphicsRootSignature(pass_.rootSig.Get());list->SetPipelineState(pass_.pso.Get());diff --git a/tests/integration/DesktopBackdropFixture.cpp b/tests/integration/DesktopBackdropFixture.cppnew file mode 100644index 00000000..c121b129--- /dev/null+++ b/tests/integration/DesktopBackdropFixture.cpp@@ -0,0 +1,26 @@+// Manual DWM visual test: an independent window beneath Veyra. It supplies+// real desktop colors; the player never reads or captures these pixels.+// Closes itself after 180 seconds. Press Space to change the background.+#include <windows.h>+namespace {+bool blue=false;+LRESULT CALLBACK fixture(HWND h,UINT m,WPARAM w,LPARAM l){+ switch(m){+ case WM_CREATE:SetTimer(h,1,30000,nullptr);SetTimer(h,2,180000,nullptr);return 0;+ case WM_TIMER:if(w==2){DestroyWindow(h);return 0;}[[fallthrough]];+ case WM_KEYDOWN:if(m==WM_KEYDOWN&&w!=VK_SPACE)break;blue=!blue;SetWindowTextW(h,blue?L"Veyra backdrop fixture - BLUE":L"Veyra backdrop fixture - RED");InvalidateRect(h,nullptr,FALSE);return 0;+ case WM_ERASEBKGND:return 1;+ case WM_PAINT:{PAINTSTRUCT ps{};auto dc=BeginPaint(h,&ps);RECT r{};GetClientRect(h,&r);auto color=CreateSolidBrush(blue?RGB(16,76,242):RGB(242,34,22));FillRect(dc,&r,color);DeleteObject(color);+ auto checker=CreateSolidBrush(blue?RGB(32,170,255):RGB(255,120,32));for(int y=0;y<r.bottom;y+=80)for(int x=0;x<r.right;x+=80)if((x/80+y/80)%2){RECT tile{x,y,x+80,y+80};FillRect(dc,&tile,checker);}DeleteObject(checker);+ SetBkMode(dc,TRANSPARENT);SetTextColor(dc,RGB(255,255,255));DrawTextW(dc,blue?L"BLUE - independent desktop window":L"RED - independent desktop window",-1,&r,DT_CENTER|DT_SINGLELINE);EndPaint(h,&ps);return 0;}+ case WM_DESTROY:PostQuitMessage(0);return 0;+ }+ return DefWindowProcW(h,m,w,l);+}+}+int WINAPI wWinMain(HINSTANCE instance,HINSTANCE,PWSTR,int){+ SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);+ WNDCLASSW c{};c.hInstance=instance;c.lpfnWndProc=fixture;c.lpszClassName=L"VeyraDesktopBackdropFixture";c.hCursor=LoadCursorW(nullptr,IDC_ARROW);RegisterClassW(&c);+ RECT work{};SystemParametersInfoW(SPI_GETWORKAREA,0,&work,0);auto h=CreateWindowExW(0,c.lpszClassName,L"Veyra backdrop fixture - RED",WS_OVERLAPPEDWINDOW,work.left,work.top,work.right-work.left,work.bottom-work.top,nullptr,nullptr,instance,nullptr);ShowWindow(h,SW_SHOWMAXIMIZED);+ MSG m{};while(GetMessageW(&m,nullptr,0,0)>0){TranslateMessage(&m);DispatchMessageW(&m);}return 0;+}diff --git a/tests/unit/UiContractTests.cpp b/tests/unit/UiContractTests.cppindex f08817e4..cb195b83 100644--- a/tests/unit/UiContractTests.cpp+++ b/tests/unit/UiContractTests.cpp@@ -1,5 +1,6 @@#include "../../apps/veyra/ui/UiSessionState.h"#include "../../apps/veyra/ui/WorkspaceChrome.h"+#include "../../apps/veyra/ui/WorkspaceTransition.h"#include "../../apps/veyra/ui/UiPreferenceStore.h"#include "veyra/sink/AudioGain.h"#include <iostream>@@ -10,6 +11,13 @@ int wmain(int argc,wchar_t** argv){try{using namespace veyra;ui::UiSessionState state;state.configured.multiplier=4;state.configured.sr=true;state.configured.model.intensity=.37f;state.configured.residual.color=1.4f;auto before=state.effective();require(state.mode==ui::Mode::Daily,"startup Daily");state.mode=ui::Mode::Professional;require(state.effective()==before,"mode cannot alter settings");state.enhanced=false;auto bypass=state.effective();require(!bypass.nr&&!bypass.sr&&bypass.multiplier==1,"true full bypass");state.enhanced=true;require(state.effective()==before,"restore all settings");+ ui::ChromeLayout daily(1440,900,false,false);require(daily.left==0&&daily.top==0&&daily.viewWidth==1440&&daily.viewHeight==812&&daily.bottom==812,"daily video owns all space above transport");+ ui::WorkspaceTransition animation;animation.start(true,1000);animation.sample(1120);const auto halfway=animation.value;require(halfway>.49&&halfway<.51,"visible intermediate expansion");animation.start(false,1120);require(animation.value==halfway,"reverse without jump");animation.sample(1240);require(animation.value>0&&animation.value<halfway,"panel collapses progressively");animation.sample(1360);require(!animation.running&&animation.value==0,"collapse ends exactly");+ using pipeline::ResolutionPlan;using pipeline::NrSizePolicy;using pipeline::Extent;+ require(ResolutionPlan::make({1448,1086},true,NrSizePolicy::Native,true).output==Extent{2880,2160},"4:3 SR preserves aspect");+ require(ResolutionPlan::make({1080,1920},true,NrSizePolicy::Native,true).output==Extent{1214,2160},"portrait SR even dimensions");+ require(!ResolutionPlan::make({2880,2160},true,NrSizePolicy::Native,true).srApplied,"already maximum edge skips SR");+ require(ResolutionPlan::make({1920,1080},true,NrSizePolicy::Realtime,false).output==Extent{3840,2160},"16:9 SR unchanged");for(int dpi:{96,120,144,192})for(int width:{720,900,960,1180,1280,1920})for(int height:{540,720,800,1080})for(bool pro:{false,true})for(bool drawer:{false,true}){ui::ChromeLayout l(width,height,pro,drawer);require(l.left>=0&&l.top>=0&&l.viewWidth>0&&l.viewHeight>0,"nonnegative viewport");require(l.left+l.viewWidth<=width&&l.top+l.viewHeight<=height,"viewport contained");if(pro&&(width>=960||drawer))require(l.left+l.viewWidth<l.right&&l.right+l.panelWidth<=width,"disjoint inspector");require(MulDiv(l.viewWidth,dpi,96)>0,"DPI physical extent");