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

Support visuals with depth 32 on X11 #226

Merged
merged 1 commit into from
Jun 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/backends/x11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -882,13 +882,15 @@ fn is_shm_available(c: &impl Connection) -> bool {
/// Collect all visuals that use softbuffer's pixel format
fn supported_visuals(c: &impl Connection) -> HashSet<Visualid> {
// Check that depth 24 uses 32 bits per pixels
// HACK(notgull): Also support depth 32 for transparent visuals.
// Otherwise winit users get weird errors.
if !c
.setup()
.pixmap_formats
.iter()
.any(|f| f.depth == 24 && f.bits_per_pixel == 32)
.any(|f| (f.depth == 24 || f.depth == 32) && f.bits_per_pixel == 32)
{
log::warn!("X11 server does not have a depth 24 format with 32 bits per pixel");
log::warn!("X11 server does not have a depth 24/32 format with 32 bits per pixel");
return HashSet::new();
}

Expand All @@ -911,7 +913,7 @@ fn supported_visuals(c: &impl Connection) -> HashSet<Visualid> {
screen
.allowed_depths
.iter()
.filter(|depth| depth.depth == 24)
.filter(|depth| depth.depth == 24 || depth.depth == 32)
.flat_map(|depth| {
depth
.visuals
Expand Down