@@ -49,6 +49,12 @@ private void TasksService_Event(object sender, EventArgs e)
4949
5050 private void TasksService_FullScreenChanged ( object sender , FullScreenEventArgs e )
5151 {
52+ if ( InactiveFullScreenApps . Count > 0 && InactiveFullScreenApps . Any ( app => app . hWnd == e . Handle ) )
53+ {
54+ // If this window is in the inactive list, remove it--the message that triggered this event takes precedence
55+ InactiveFullScreenApps . Remove ( InactiveFullScreenApps . First ( app => app . hWnd == e . Handle ) ) ;
56+ }
57+
5258 if ( FullScreenApps . Any ( app => app . hWnd == e . Handle ) == e . IsEntering )
5359 {
5460 if ( e . IsEntering )
@@ -63,12 +69,6 @@ private void TasksService_FullScreenChanged(object sender, FullScreenEventArgs e
6369 return ;
6470 }
6571
66- if ( InactiveFullScreenApps . Count > 0 && InactiveFullScreenApps . Any ( app => app . hWnd == e . Handle ) )
67- {
68- // If this window is in the inactive list, remove it because it is no longer needed
69- InactiveFullScreenApps . Remove ( InactiveFullScreenApps . First ( app => app . hWnd == e . Handle ) ) ;
70- }
71-
7272 if ( e . IsEntering )
7373 {
7474 // When TasksService gives us a full-screen window handle, trust that it is full-screen in terms of bounds
@@ -224,10 +224,10 @@ private void updateFullScreenWindows()
224224 private FullScreenApp getFullScreenApp ( IntPtr hWnd , bool fromTasksService = false )
225225 {
226226 ScreenInfo screenInfo = null ;
227+ Rect rect = GetEffectiveWindowRect ( hWnd ) ;
227228
228229 if ( ! fromTasksService )
229230 {
230- Rect rect = GetEffectiveWindowRect ( hWnd ) ;
231231 var allScreens = Screen . AllScreens . Select ( ScreenInfo . Create ) . ToList ( ) ;
232232 if ( allScreens . Count > 1 ) allScreens . Add ( ScreenInfo . CreateVirtualScreen ( ) ) ;
233233
@@ -260,7 +260,7 @@ private FullScreenApp getFullScreenApp(IntPtr hWnd, bool fromTasksService = fals
260260 }
261261
262262 // this is a full screen app
263- return new FullScreenApp { hWnd = hWnd , screen = screenInfo , title = win . Title , fromTasksService = fromTasksService } ;
263+ return new FullScreenApp { hWnd = hWnd , screen = screenInfo , rect = rect , title = win . Title , fromTasksService = fromTasksService } ;
264264 }
265265
266266 private Rect GetEffectiveWindowRect ( IntPtr hWnd )
0 commit comments