diff --git a/PrivacyGlass/BlurOverlay.cs b/PrivacyGlass/BlurOverlay.cs index 527be96..7fb7189 100644 --- a/PrivacyGlass/BlurOverlay.cs +++ b/PrivacyGlass/BlurOverlay.cs @@ -7,9 +7,10 @@ namespace PrivacyGlass { public class BlurOverlay : Form { - public int TintOpacity = 128; // 0–255 + public int TintOpacity = 32; // 0–255 public Color TintColor = Color.Black; // tint over the blur private bool _enabled = false; + private bool enableClickThrough = false; public BlurOverlay(Rectangle bounds) { @@ -22,7 +23,7 @@ namespace PrivacyGlass // Important: background color = transparency key // so GDI background is not drawn, blur shows through. BackColor = Color.Black; - TransparencyKey = Color.Black; + //TransparencyKey = Color.Black; } protected override CreateParams CreateParams @@ -39,14 +40,17 @@ namespace PrivacyGlass protected override void WndProc(ref Message m) { - const int WM_NCHITTEST = 0x84; - const int HTTRANSPARENT = -1; - - if (m.Msg == WM_NCHITTEST) + if (enableClickThrough) { - // Click-through - m.Result = (IntPtr)HTTRANSPARENT; - return; + const int WM_NCHITTEST = 0x84; + const int HTTRANSPARENT = -1; + + if (m.Msg == WM_NCHITTEST) + { + // Click-through + m.Result = (IntPtr)HTTRANSPARENT; + return; + } } base.WndProc(ref m); @@ -72,9 +76,9 @@ namespace PrivacyGlass // ACCENT_ENABLE_BLURBEHIND on Win10/11 AccentPolicy accent = new AccentPolicy(); accent.AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND; + //accent.AccentState = AccentState.ACCENT_ENABLE_ACRYLICBLURBEHIND; - // Optional tint over blur (ARGB, but note it's BGR in low 24 bits) - int a = TintOpacity & 0xFF; + int a = TintOpacity & 0xFF; int color = (a << 24) | (TintColor.B << 16) | @@ -82,7 +86,6 @@ namespace PrivacyGlass TintColor.R; accent.GradientColor = color; - int size = Marshal.SizeOf(accent); IntPtr ptr = Marshal.AllocHGlobal(size); try @@ -101,6 +104,12 @@ namespace PrivacyGlass Marshal.FreeHGlobal(ptr); } } + protected override void OnShown(EventArgs e) + { + base.OnShown(e); + this.Focus(); + } + // -------- interop stuff below -------- diff --git a/PrivacyGlass/PrivacyGlass.csproj b/PrivacyGlass/PrivacyGlass.csproj index 01903c9..d254391 100644 --- a/PrivacyGlass/PrivacyGlass.csproj +++ b/PrivacyGlass/PrivacyGlass.csproj @@ -17,12 +17,12 @@ x64 true full - true + false bin\Debug\ DEBUG;TRACE prompt 4 - true + false AnyCPU diff --git a/PrivacyGlass/TrayApp.cs b/PrivacyGlass/TrayApp.cs index adcbdc2..a34fefc 100644 --- a/PrivacyGlass/TrayApp.cs +++ b/PrivacyGlass/TrayApp.cs @@ -68,7 +68,6 @@ namespace PrivacyGlass var menu = new ContextMenuStrip(); menu.Items.Add("Toggle Now", null, (_, __) => Toggle()); - menu.Items.Add("Settings...", null, ShowSettings); menu.Items.Add("Exit", null, Exit); return menu; @@ -80,7 +79,7 @@ namespace PrivacyGlass { BlurOverlay ov = new BlurOverlay(screen.Bounds); ov.TintColor = Color.Black; - ov.TintOpacity = 12; // 0–255, higher = darker + ov.TintOpacity = 0; // 0–255, higher = darker overlays.Add(ov); } @@ -96,10 +95,6 @@ namespace PrivacyGlass Application.Exit(); } - private void ShowSettings(object sender, EventArgs e) - { - MessageBox.Show("Settings window goes here"); - } } }