-
Notifications
You must be signed in to change notification settings - Fork 175
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
Transparent frame doesn't work anymore on latest webview-sys's commit #38
Comments
This seems like https://github.com/zserge/webview issue. Have you reported it there? This is just binding library, meaning we wrap webview and cannot fix regressions directly here. |
Thanks, I'll do it and link the issue to that one to keep track of it. |
I can still reproduce this behavior. Is there a workaround to create transparent windows? |
Bump. Issue seems to have come back. No transparency when running example code in this issue. |
After pouring over the documentation across multiple apps and platforms using gtk and webkit2 I built a hack using the crates already used within web-view that provides transparency (at least for linux): /// Update Gtk's Screen w/ Custom CSS to make Transparent
fn transparency_hack() {
use gdk_sys::gdk_screen_get_default;
use gtk_sys::*;
use std::ffi::CString;
// generate css-provider
let provider = unsafe { gtk_css_provider_new() };
// apply css to css-provider
let css = CString::new("* { background: transparent }").unwrap();
let clen = css.as_bytes().len();
let mut error = std::ptr::null_mut();
unsafe { gtk_css_provider_load_from_data(provider, css.as_ptr() as _, clen as _, &mut error) };
// retrieve screen and apply css- provider to screen
let prio = GTK_STYLE_PROVIDER_PRIORITY_APPLICATION;
let screen = unsafe { gdk_screen_get_default() };
unsafe { gtk_style_context_add_provider_for_screen(screen, provider as _, prio as _) };
} Make sure to run this after building the web-view instance since gtk has to be initialized first before this can work. Might be the wrong way to go about it but it works lol. Edit: had to tweak the code a gazillion times to fix a few glib errors that were logging to stderr when they could be avoided. fixed how hopefully. |
Hey there,
The full window transparency doesn't work anymore on https://github.com/zserge/webview 's latest commit.
It used to work with an old revision:
cd webview-sys/webview git checkout 02aa1dcf62a15f2c1e2197a07642e9c474ac32fa
Code to reproduce:
FYI with the latest commit, only the titlebar is transparent, but the frame remains white:
But should be (the frame is over my terminal):
Which is useful to make beautiful HTML widgets.
The text was updated successfully, but these errors were encountered: