@@ -826,7 +826,14 @@ private void SetFullScreen(bool fullscreen)
826
826
if ( fullscreen )
827
827
{
828
828
GetWindowRect ( _hwnd , out var windowRect ) ;
829
- _savedWindowInfo . WindowRect = windowRect ;
829
+ GetClientRect ( _hwnd , out var clientRect ) ;
830
+
831
+ clientRect . left += windowRect . left ;
832
+ clientRect . right += windowRect . left ;
833
+ clientRect . top += windowRect . top ;
834
+ clientRect . bottom += windowRect . top ;
835
+
836
+ _savedWindowInfo . WindowRect = clientRect ;
830
837
831
838
var current = GetStyle ( ) ;
832
839
var currentEx = GetExtendedStyle ( ) ;
@@ -863,10 +870,10 @@ private void SetFullScreen(bool fullscreen)
863
870
SetExtendedStyle ( _savedWindowInfo . ExStyle , false ) ;
864
871
865
872
// On restore, resize to the previous saved rect size.
866
- var new_rect = _savedWindowInfo . WindowRect . ToPixelRect ( ) ;
873
+ var newClientRect = _savedWindowInfo . WindowRect . ToPixelRect ( ) ;
867
874
868
- SetWindowPos ( _hwnd , IntPtr . Zero , new_rect . X , new_rect . Y , new_rect . Width ,
869
- new_rect . Height ,
875
+ SetWindowPos ( _hwnd , IntPtr . Zero , newClientRect . X , newClientRect . Y , newClientRect . Width ,
876
+ newClientRect . Height ,
870
877
SetWindowPosFlags . SWP_NOZORDER | SetWindowPosFlags . SWP_NOACTIVATE | SetWindowPosFlags . SWP_FRAMECHANGED ) ;
871
878
872
879
UpdateWindowProperties ( _windowProperties , true ) ;
0 commit comments