@@ -592,18 +592,34 @@ void RequestRender() {
592592#ifdef FLOATNOTE_GLASS_LAB
593593void SyncAdaptiveInk () {
594594 static bool timer=false ;
595+ static bool fadeTimer=false ;
596+ static GlassAutoInk::Fade fade;
597+ static double lastInkPaint=0 ;
595598 const bool motion=ExperienceAbsorbing ();
596599 const bool active=g_window && g_settings.autoTextColor && !g_highContrast && g_nativeGlass && g_glassActive &&
597600 g_backdrop.mode ==2 && EffectiveOpacityPercent ()<100 && g_isVisible && !IsIconic (g_window) && !ExperienceCompact ();
598601 if (active && !motion && !timer){SetTimer (g_window,82 ,100 ,nullptr );timer=true ;}
599602 else if ((!active || motion) && timer){KillTimer (g_window,82 );timer=false ;}
600- if (motion)return ; // Freeze the chosen ink through the cached-surface animation.
603+ if (motion) {
604+ if (fadeTimer){KillTimer (g_window,83 );fadeTimer=false ;}
605+ fade.Reset (kNoteText );return ; // Freeze ink through the cached-surface animation.
606+ }
601607 const int alpha=std::max (g_settings.passThrough ?0 :1 ,MulDiv (EffectiveOpacityPercent (),255 ,100 ));
602608 const int choice=g_backdrop.UpdateAutoInk (active,kBackground ,alpha,kText ==GlassAutoInk::Light);
603609 const COLORREF next=g_highContrast?kText :!g_settings.autoTextColor ?g_settings.textColor :
604610 choice<0 ?kText :choice?GlassAutoInk::Light:GlassAutoInk::Dark;
605- if (next!=kNoteText ) {
606- kNoteText =next;
611+ const double now=GlassClockMs ();
612+ if (active && choice>=0 )fade.Aim (next,kNoteText ,now);
613+ else fade.Reset (next); // Explicit colours and accessibility changes apply immediately.
614+ const bool animating=active && fade.Running (now);
615+ if (animating && !fadeTimer){SetTimer (g_window,83 ,16 ,nullptr );fadeTimer=true ;}
616+ else if (!animating && fadeTimer){KillTimer (g_window,83 );fadeTimer=false ;}
617+ // Capture and render-completion events also enter here. Cap fade updates
618+ // so they cannot turn a short animation into a self-posting repaint loop.
619+ const COLORREF presented=animating && now-lastInkPaint<16 ?kNoteText :fade.Sample (now);
620+ if (presented!=kNoteText ) {
621+ lastInkPaint=now;
622+ kNoteText =presented;
607623 if (g_edit)InvalidateRect (g_edit,nullptr ,FALSE );
608624 RequestRender ();
609625 }
@@ -2434,6 +2450,7 @@ LRESULT CALLBACK WindowProcedure(HWND window, UINT message, WPARAM wParam, LPARA
24342450 if (message == WM_TIMER && wParam == 71 ) { g_backdrop.Tick (); SyncAdaptiveInk (); return 0 ; }
24352451 if (message == kGlassFrameReady ) { g_backdrop.FrameReady (); SyncAdaptiveInk (); ApplyWindowStacking (); return 0 ; }
24362452 if (message == WM_TIMER && wParam == 82 ) { SyncAdaptiveInk (); return 0 ; }
2453+ if (message == WM_TIMER && wParam == 83 ) { SyncAdaptiveInk (); return 0 ; }
24372454 if (message == WM_WINDOWPOSCHANGED ) {g_backdrop.RequestDraw ();SyncExperienceUI ();}
24382455 if (message == WM_ACTIVATE && LOWORD (wParam)!=WA_INACTIVE )SyncExperienceUI ();
24392456 if (message == WM_TIMER && wParam==73 ){ApplyWindowStacking ();SyncExperienceUI ();return 0 ;}
0 commit comments