-
-
Notifications
You must be signed in to change notification settings - Fork 284
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
Windows: Support setting ICoreWebView2EnvironmentOptions8::ScrollBarStyle
#1339
Comments
An enum sounds fine Do you plan to work on this in a PR? I can assign the issue to you in that case. |
I'm fine with adding this myself. |
Ah. I think I've encountered a bit of a problem: I can't figure out how I am going to expose this in Tauri, given that this is Windows-specific functionality with an enum that only exists in Wry when compiling for Windows. |
one step at a time, you only need to worry about exposing it as a method on |
I have it exposed on |
you can see this commit for inspiration tauri-apps/tauri@3dc38b1 |
...I just realised I don't need to expose it in Tauri to test it just yet. I can just do something dirty - force it inside a local patch of |
... Well that's... very annoying. Turns out that despite them being exposed, and despite the Microsoft documentation for I'm going to submit a request for the missing COM interfaces to be added. |
gonna start working on that today |
It has the interface defined. So does the version we are using here. It does not appear to have an implementation of that interface reflected on |
I've opened a request in |
@amrbashir Good news: The missing COM interface implementations were added to Also, it turned out that the raw |
webview2-com is updated in #1341 |
Alright. I'll rebase onto that commit once it lands, then open a PR for both this and moving to using the |
Use the CoreWebView2EnvironmentOptions API wrapper when creating a WebView2 environment on Windows, as opposed to using the ICoreWebView2EnvironmentOptions* COM interfaces. The wrapper exposes the interface methods with a more Rust-like API. It may be possible to do this with ICoreWebView2Controller as well, but I don't feel like experimenting with that right now. This is just an improvement I realised I could make while implementing tauri-apps#1339.
Use the CoreWebView2EnvironmentOptions API wrapper when creating a WebView2 environment on Windows, as opposed to using the ICoreWebView2EnvironmentOptions* COM interfaces. The wrapper exposes the interface methods with a more Rust-like API. It may be possible to do this with ICoreWebView2Controller as well, but I don't feel like experimenting with that right now. This is just an improvement I realised I could make while implementing tauri-apps#1339. Signed-off-by: Jamie Ridding <[email protected]>
Use the CoreWebView2EnvironmentOptions API wrapper when creating a WebView2 environment on Windows, as opposed to using the ICoreWebView2EnvironmentOptions* COM interfaces. The wrapper exposes the interface methods with a more Rust-like API. It may be possible to do this with ICoreWebView2Controller as well, but I don't feel like experimenting with that right now. This is just an improvement I realised I could make while implementing tauri-apps#1339. Signed-off-by: Jamie Ridding <[email protected]>
…1344) * Windows: Use `CoreWebView2EnvironmentOptions` API. Use the CoreWebView2EnvironmentOptions API wrapper when creating a WebView2 environment on Windows, as opposed to using the ICoreWebView2EnvironmentOptions* COM interfaces. The wrapper exposes the interface methods with a more Rust-like API. It may be possible to do this with ICoreWebView2Controller as well, but I don't feel like experimenting with that right now. This is just an improvement I realised I could make while implementing #1339. Signed-off-by: Jamie Ridding <[email protected]> * Add with_scroll_bar_style to WebViewBuilderExtWindows Signed-off-by: Jamie Ridding <[email protected]> * Add change file. Signed-off-by: Jamie Ridding <[email protected]> * Adjust change type in change file. I used the wrong change type for wry in 1344-with_scroll_bar_style. This commit upgrades the change type from a patch to a minor change. Signed-off-by: Jamie Ridding <[email protected]> * I forgot to run cargo fmt -_- Signed-off-by: Jamie Ridding <[email protected]> --------- Signed-off-by: Jamie Ridding <[email protected]>
Is your feature request related to a problem? Please describe.
I need a way to set the WebView2 instance on Windows to use Fluent-style overlay scrollbars in Tauri. A member of the project has informed me on Discord that Wry exposes a way to set some platform-specific attributes by use of
PlatformSpecificWebViewAttributes
that are then used to configure settings in the WebView2 options and environment options.Describe the solution you'd like
I propose adding a new field to
PlatformSpecificWebViewAttributes
on Windows, and a setter method toWebViewBuilderExtWindows
to update this field. I'm unsure whether to use a boolean wheretrue
= fluent overlay scrollbars andfalse
= default scrollbars, or an enum that exposes bothDefault
andFluentOverlay
. I feel the latter would be better for extensibility if Microsoft extend the list of scrollbar styles in the future.I expect the API would look something like this (documentation omitted for brevity):
Describe alternatives you've considered
I cannot use a browser flag for this, as per the Microsoft Documentation on WebView2 browser flags where it says that browser feature flags are subject to being removed or altered at any time.
Also, it was either this or adding and exposing a Windows-specific wrapper around all of
ICoreWebView2EnvironmentOptions*
. I feel that for now, this will do.The text was updated successfully, but these errors were encountered: