Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal - CoreApp and app lifecycle helpers #9

Closed
jonwis opened this issue May 18, 2020 · 5 comments
Closed

Proposal - CoreApp and app lifecycle helpers #9

jonwis opened this issue May 18, 2020 · 5 comments

Comments

@jonwis
Copy link
Member

jonwis commented May 18, 2020

Proposal: CoreApp Everywhere

Summary

Provide a variant of CoreApplication that gives Win32 apps the same common events as UWPs. Expose a set of common app/user/session lifecycle events for all kinds of apps to use under a single API surface.

Rationale

While UWP has a rich app-lifecycle model for applications under system control, Win32 has historically made it hard to detect and react to app/user/system/session power and lifecycle events. There should be a single type that collects & generates events for the lifecycle of an app. As Windows' power management functionality improves having a single type collecting these events is critical.

  • Setting up Win32 notifications for user lock & unlock is challenging
  • Notifications for query-end-session and end-session are hard to implement
  • Power state transitions let apps reduce their footprint on the system when the user goes on battery
  • Detecting whether a session is locked right now is complex
  • UWP provides platform support for app single-instancing, Win32 does not (easily)
  • Integration with restart manager means apps restore after both app & OS update

Scope

Capability Priority
A single API surface usable by Win32 and UWP apps Must
Apps get a set of events they can listen to and react in their own way Must
Connect apps to Restart Manager to support OS servicing Should
Provide APIs for user state transitions for apps to use Should
Expose more of the power state management directly to apps Could
Provide a "default main thread message pump" for Win32 apps Could
Prevent user sign-out (by blocking end-session) Won't
Let the system control and manage resource usage with the UWP model on Win32 apps Won't
Require Win32 app use CoreApplication/CoreWindow for windowing Won't

Important Notes

The existing CoreApplication type mixes together basic app functionality like lifecycle and window generation. Reunion's CoreApp should expose only app lifecycle events. UWP activation paths like OnActivated should be moved to another object that's clearly about UWP activation and windowing behavior.

@kennykerr
Copy link
Contributor

Yes please! Using CoreApp is so much simpler. 👍

@jonwis
Copy link
Member Author

jonwis commented May 18, 2020

See also https://docs.microsoft.com/en-us/windows/win32/power/wm-powerbroadcast which provides more powers.

@AzAgarampur
Copy link

Yes! I've always wanted to use CoreApp with my C++/WinRT programs. 👍👍

@eklipse2k8
Copy link

Would love to see suspension support for all apps.

@luisvargascr
Copy link

Yes, I would like to have the option to apply lifecycle support to desktop apps (not just UWP). This would be great!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants