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

Add Spec for IsWindowControlsOverlayEnabled.md #4613

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tochukwuIbeEkeocha
Copy link
Contributor

@tochukwuIbeEkeocha tochukwuIbeEkeocha commented Jun 4, 2024

What

These new APIs introduce support for a Webview2 Window Controls Overlay. The Window Controls Overlay will allow developers to build apps in webview2 with 100% of the UI controlled by the browser process. Devs will be able to create their apps as borderless & caption-less windows, and have the Webview draw its own window control buttons (minimize,maximize, close, restore).

image image

@tochukwuIbeEkeocha tochukwuIbeEkeocha force-pushed the api-isWindowControlsOverlayEnabled-draft branch from 657def7 to d395730 Compare June 7, 2024 22:18


# Appendix
To provide your app users with the best experience, it is important to handle webview
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this relevant to this API? If so it should be in the ref docs for the property or method. But it sort of sounds like its for something else?

/// top right corner of the window.
///
[propput] HRESULT IsWindowControlsOverlayEnabled([in] BOOL value);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing COM IDL for the controller method

unsealed runtimeclass CoreWebView2Controller {
[interface_name("Microsoft.Web.WebView2.Core.ICoreWebView2Controller5")]
{
Windows.Foundation.Rect QueryWindowControlsOverlayBounds();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a getter-only property instead of a method?

{
InitializeComponent();
this.webView2Control.CoreWebView2InitializationCompleted
+= WebView2InitializationCompleted;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indenting is off here and elsewhere

object sender,
CoreWebView2NavigationCompletedEventArgs e)
{
Windows.Foundation.Rect bounds = CoreWebView2Controller.QueryWindowControlsOverlayBounds();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You aren't doing anything with the bounds.

private void SetWindowControlsOverlaySupport(bool enabled)
{
var coreWebView2Settings = this.webView2Control.CoreWebView2.Settings;
coreWebView2Settings.IsWindowControlsOverlayEnabled = enabled;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sample code should show code that an end dev would write for a real app. We don't really need code that shows setting a property - but if you show setting the property in the correct context or correct way that would be helpful.

In this case it would probably be helpful to show when to set the overlayEnabled property (during startup? - would an end dev ever want to change the value after startup?) and also show how to use the QueryWindowControlsOverlayBounds to adjust web content so the web content isn't under the window overlay bounds.

be rendered and controlled by the browser process. This API allows devs to tell
WebView2 that it should render its own window control buttons.

# Description
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to repeat what you have in the ref docs here. The current template doesn't have a Description section.

the entire Window UI is rendered by WebView2. Till now, it hasn't been possible
for the window/caption control buttons (minimize, maximize, restore, close) to
be rendered and controlled by the browser process. This API allows devs to tell
WebView2 that it should render its own window control buttons.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to add in the background section the notes about how this relates to previous APIs (that css property for a titlebar html element - related feature but they don't really interact) and how it relates to future APIs (you said future APIs will let them control the styling or something?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Proposal Review WebView2 API Proposal for review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants