@@ -19,7 +19,9 @@ public partial class LockWindow : Window
1919 private readonly SimpleGlobalHook hook = new SimpleGlobalHook ( ) ;
2020 private readonly Dictionary < KeyCode , DateTime > pressedKeys = [ ] ;
2121 private readonly Settings settings ;
22+ private readonly List < BlurWindow > blurWindows = [ ] ;
2223 private List < IntPtr > windows = [ ] ;
24+ private Point lastMousePosition ;
2325 private bool isOpen = true ;
2426 private bool suppressInput = false ;
2527
@@ -120,11 +122,32 @@ private void ActivateLockScreen()
120122 MinimizeWindows ( ) ;
121123 }
122124
123- isOpen = true ;
124- suppressInput = true ;
125-
126125 Dispatcher . Invoke ( ( ) =>
127126 {
127+ lastMousePosition = WpfScreenHelper . MouseHelper . MousePosition ;
128+
129+ if ( settings . BlurScreen )
130+ {
131+ foreach ( Rect bounds in WpfScreenHelper . Screen . AllScreens . Select ( s => s . WpfBounds ) )
132+ {
133+ BlurWindow blurWindow = new ( )
134+ {
135+ Width = bounds . Width ,
136+ Height = bounds . Height ,
137+ Left = bounds . Left ,
138+ Top = bounds . Top ,
139+ } ;
140+
141+ blurWindows . Add ( blurWindow ) ;
142+ blurWindow . Show ( ) ;
143+ }
144+
145+ _ = WindowsApi . SetCursorPosition ( new Point ( 100000 , 100000 ) ) ;
146+ }
147+
148+ isOpen = true ;
149+ suppressInput = true ;
150+
128151 _ = Activate ( ) ;
129152
130153 textBlock . Text = settings . LockText ;
@@ -155,6 +178,9 @@ private void DeactivateLockScreen()
155178
156179 isOpen = true ;
157180
181+ _ = WindowsApi . SetCursorPosition ( lastMousePosition ) ;
182+ blurWindows . ForEach ( w => w . Close ( ) ) ;
183+
158184 textBlock . Text = settings . UnlockText ;
159185 textBlock . Stroke = ( Brush ) FindResource ( "PaletteGreenBrush" ) ;
160186
@@ -203,6 +229,9 @@ private async void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.Ses
203229
204230 isOpen = true ;
205231
232+ _ = WindowsApi . SetCursorPosition ( lastMousePosition ) ;
233+ blurWindows . ForEach ( w => w . Close ( ) ) ;
234+
206235 _ = Activate ( ) ;
207236
208237 await Task . Delay ( 500 ) ;
0 commit comments