Closing Windows Store apps

I am inspired by Raymond Chen’s blog entry regarding the close gestures. He has always been my idol and an expert in Win32. But this time he was mistaken.

The close gesture has been evolving from Windows 8 to Windows 10. Between each pair of consecutive versions of Windows, closing Windows Store apps is different.

汉语读者可以查看 我在知乎上写的类似内容,它不如这一篇全面,但是对不能阅读英语的人来说更友好一些(我不信赖翻译器)。

Terms

  • Each independent window (i.e., not counting sharing view, file picker view, etc.) of a Windows Store app (or Universal Windows app nowadays) is called a CoreWindow.
  • Drag gesture: dragging the window from the top of the screen down to the bottom.
  • Hold gesture: hold the window at the bottom of the screen for a while.
  • Release gesture: release the window.
  • Recover gesture: dragging the window back to the middle of the screen.
  • Stage gesture: dragging the window to the left (or right for RTL cultures) of the screen so that it is placed in the task switcher of Windows 8 or Windows 8.1.
  • Close hotkey: Alt+F4.
  • Close button: the ‘×’ at the upper right (or upper left for RTL cultures) corner of a window, also the ‘Close’ menu item on the context menu of the title bar.
  • Minimise button: the ‘−’ at the upper right (or upper left for RTL cultures) corner of a window, also the ‘Minimise’ menu item on the context menu of the title bar.

Note

  • Each Windows Store app has at most one process at a time.
  • Windows can always suspend an app if it has no visible CoreWindow.

Windows 8

  • Each Windows Store app have at most one CoreWindow.
  • Performing drag-release will suspend the app and terminate it.
  • Making the app off-screen by any other means (e.g., pressing Windows to return to Start, using the switcher to switch to another app) will allow Windows to suspend it and to further terminate it. But those are done opportunistically.
  • Pressing close hotkey will suspend the app and terminate it.
  • No close button, hold gesture or minimise button is available.

Windows 8.1

  • Each Windows Store app can have unlimited number of CoreWindows. Well, actually limited by perhaps handle count etc.
  • Performing drag-release will remove the CoreWindow. The Consolidated event for that CoreWindow will be raised. It is recommended that the app clean up the resources for that CoreWindow. The Consolidated event also happens if a CoreWindow falls off the task switcher (the number of CoreWindows in the task switcher is limited by screen height). If the CoreWindow is the last CoreWindow of that app, it must also be the main window, and the Consolidated event will not fire, instead the app is suspended. Note that now Windows is allowed to terminate it opportunistically. Later the user might try to launch the app again, e.g. from Start, which is the most complicated part of the story. If the user launches the app after it is terminated, the app launches as normal (from Terminated). If the user launches the app after it is suspended but not terminated, the app is resumed (from Suspended state). If the user launches the app before it finishes suspending, it will launch from NotRunning state, as if it has been terminated, has crashed, or has not been launched since logging on.
  • Performing drag-hold-release will suspend the app and terminate it. Note that means any other CoreWindows of that app will be closed, too.
  • Performing drag-hold-recover-release will suspend the app, terminate it and finally launches it as if it is launched from the main tile.
  • Performing drag-hold-recover-stage-release will put the current CoreWindow to the task switcher. This is the regret medicine if you accidentally hold the window until the logo has turned to you.
  • Pressing close hotkey will close the current CoreWindow. If that is the last CoreWindow of the app, the app is suspended and terminated.
  • Pressing close button is equivalent to performing drag-release.
  • Pressing minimise button will minimise the CoreWindow and put it to the task switcher. It is not Consolidated!

Note that Windows 8.1 is rather aggressive in suspending off-screen apps. Windows 8 might take a long time before it tries to suspend an app after it is moved to the task switcher, but Windows 8.1 will almost surely suspend the app if its last window is minimised.

Windows 10

  • Each Windows Store app can have unlimited number of CoreWindows.
  • Performing drag-release will remove the current CoreWindow (Consolidated fired). If the window is the last CoreWindow of the app, the app is suspended and terminated. This gesture is only available in Tablet Mode.
  • Pressing close hotkey or pressing close button is equivalent to performing drag-release in Tablet Mode.
  • No hold or stage gesture is available.
  • Pressing minimise button will minimise the CoreWindow.

Note that Windows 10 will almost surely suspend a usual app if all CoreWindows of it have been minimised. Also, switching among virtual desktops will almost surely suspend apps that do not have windows open on the current desktop. (An app can have CoreWindows across different virtual desktops.)

Summary

To summarise, Windows 10 resembles Windows 8 a lot, except it has multiple-CoreWindow mechanism. The behaviour of Windows 8.1 might be hard to understand for a newbie but is richful in controlling app states.

Some key points:

  • The main CoreWindow will not be Consolidated, instead whenever that should happen, the app is suspended.
  • Other CoreWindows will be Consolidated once they fall off the task switcher, or is closed.
  • The drag-hold-release gesture will close all windows of an app, see this with Internet Explorer.
  • The drag-hold is reversible by staging the app into the task switcher.
  • Mouse and keyboard closing operations differ in Windows 8.1.
  • The drag-release actually tries to suspend the app. However, if the user changes his mind too soon, the app can be miserable. I frequently made myself patient to recover an app from suspended state. This can also be done by opening Task Manager, opening the context menu of that app and clicking Switch to and this method does not require waiting the process to be suspended.

Please enable JavaScript to view the comments powered by Disqus.