Desktop 'lock' fix: the window no longer steals focus when a full-screen game owns the foreground at launch. Opening after an exclusive-fullscreen game (creator's THE DIVISION 2 gameplay-stream start) the window ACTIVATED by default, Windows dropped the game to the taskbar and the 1920x1040 window covered the whole work area - 'the desktop is locked and I can't reach the game with the mouse'. MainWindow ctor now sets ShowActivated = !MainViewModel.FullscreenGameRunningNow (GetForegroundFullScreenMonitorIndex() != null), so an in-game launch keeps the game focused and live; a normal launch is unchanged. New FullScreenDetectorOverride test seam (mirrors WindowEnumeratorOverride - deterministic, no real Win32 foreground state) + DesktopLockTests: game at launch -> ShowActivated=false, normal launch -> true, FullscreenGameRunningNow reflects the detector. 422 pass / 1 known env flake, 0 build warnings. (Unit: launch focus)
This commit is contained in:
@@ -24,6 +24,12 @@ public partial class MainViewModel
|
||||
/// swaps in a fake enumerator to drive the "window dies -> re-heal" flow.</summary>
|
||||
internal static IWindowEnumerator? WindowEnumeratorOverride { get; set; }
|
||||
|
||||
/// <summary>Test seam for the launch focus decision: a fake detector simulates
|
||||
/// a full-screen game owning the foreground without touching any real window,
|
||||
/// so the <c>ShowActivated = !FullscreenGameRunningNow</c> rule (desktop-"lock"
|
||||
/// fix 2026-10-10) is pinned without Win32 state.</summary>
|
||||
internal static IFullScreenDetector? FullScreenDetectorOverride { get; set; }
|
||||
|
||||
private ImageSource? _activeBackgroundImage;
|
||||
private ImageSource? _backgroundImage;
|
||||
private bool _backgroundSizeMismatch;
|
||||
@@ -168,6 +174,15 @@ public partial class MainViewModel
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>True when a full-screen game/app owns the foreground right now.
|
||||
/// MainWindow reads this at launch to decide whether to steal focus: opening
|
||||
/// LlamaCasty while the creator is playing an exclusive-fullscreen game would
|
||||
/// minimize that game out of fullscreen — the "desktop is locked and I can't
|
||||
/// get back into the game" bug (2026-10-10) — so the window opens without
|
||||
/// activating instead.</summary>
|
||||
public bool FullscreenGameRunningNow
|
||||
=> _fullScreenDetector.GetForegroundFullScreenMonitorIndex() != null;
|
||||
|
||||
// After a layout load / file open: make sure every background-enabled scene
|
||||
// has a background, give any background without a persisted key the auto-detected
|
||||
// one, then acquire one capture per unique background key. ScreenCaptureManager
|
||||
|
||||
Reference in New Issue
Block a user