基于WebView2实现的Win11桌面框架,利用插件自定义
chunhualin1
2026-08-14 b84db8983d63a9a981083ebce1a139860c6bdf25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
namespace Moli.Desktop.Runtime;
 
/// <summary>In-memory per-widget overlay that never writes <c>layout.json</c>.</summary>
public sealed record WidgetSessionOverlay
{
    public static WidgetSessionOverlay Empty { get; } = new();
 
    public bool? Interactable { get; init; }
    public bool? Visible { get; init; }
 
    public bool HasInteractableOverride => Interactable is not null;
    public bool HasVisibleOverride => Visible is not null;
}
 
/// <summary>Effective click-through / visibility rules used by runtime, surfaces and tests.</summary>
public static class WidgetSurfaceRules
{
    public static bool ComputeClickThrough(
        bool isEditMode,
        bool isSafeInputMode,
        WidgetSessionOverlay overlay,
        bool layoutClickThrough)
    {
        if (isEditMode || isSafeInputMode)
        {
            return false;
        }
 
        if (overlay.Interactable is { } interactable)
        {
            return !interactable;
        }
 
        return layoutClickThrough;
    }
 
    public static bool ComputeVisible(WidgetSessionOverlay overlay, bool layoutVisible)
        => overlay.Visible ?? layoutVisible;
}