fix(slint): vendor femtovg-wgpu renderer for transparent window surface
Slint 1.16's femtovg-wgpu renderer configures the wgpu surface via get_default_config() and leaves the composite alpha mode at Auto, which resolves to an opaque surface on KWin/Wayland — a borderless transparent window then shows a black rectangular backing behind the rounded card. WGPUConfiguration exposes no surface/alpha hook, so the only fix is a renderer patch. Vendor i-slint-renderer-femtovg-1.16.1 with a preferred_alpha_mode() that picks a supported non-opaque mode (PreMultiplied / PostMultiplied / Inherit, guarded by the surface's advertised alpha_modes, else Auto) and wire it into set_surface(). Pulled in via [patch.crates-io]; Slint stays pinned =1.16.1. The main window is unaffected (it paints opaque). cx
This commit is contained in:
17 files changed
+6533
-2
No files matched your search
@@ -0,0 +1,36 @@
|
||||
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
||||
|
||||
// cspell:ignore Noto fontconfig
|
||||
|
||||
use femtovg::TextContext;
|
||||
use i_slint_common::sharedfontique::HashedBlob;
|
||||
use i_slint_core::textlayout::sharedparley::parley;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub struct FontCache {
|
||||
pub(crate) text_context: femtovg::TextContext,
|
||||
fonts: HashMap<(HashedBlob, u32), femtovg::FontId>,
|
||||
}
|
||||
|
||||
impl Default for FontCache {
|
||||
fn default() -> Self {
|
||||
let text_context = TextContext::default();
|
||||
Self { text_context, fonts: Default::default() }
|
||||
}
|
||||
}
|
||||
|
||||
impl FontCache {
|
||||
pub fn font(&mut self, font: &parley::FontData) -> femtovg::FontId {
|
||||
let text_context = self.text_context.clone();
|
||||
|
||||
*self.fonts.entry((font.data.clone().into(), font.index)).or_insert_with(move || {
|
||||
text_context.add_shared_font_with_index(font.data.clone(), font.index).unwrap()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
thread_local! {
|
||||
pub static FONT_CACHE: RefCell<FontCache> = RefCell::new(Default::default())
|
||||
}
|
||||
Reference in new issue
Block a user