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

Transparent window on wayland and glutin #1217

Open
SiebenCorgie opened this issue Apr 1, 2017 · 7 comments
Open

Transparent window on wayland and glutin #1217

SiebenCorgie opened this issue Apr 1, 2017 · 7 comments

Comments

@SiebenCorgie
Copy link

Hi,
I tried to follow this tutorial. However, every time I try to create a window with glutin I get a dark rectangle (probably the window frame) but the inside should be filled I guess.
gh_1

And this is how the cube example looks like:
screenshot from 2017-04-01 15-17-27

I am on Wayland 1.13.0 with and intel/nvidia hybrid. I tried to run everything with "primusrun". But it didn't change anything.

This is the code I am using:

#[macro_use]
extern crate gfx;
extern crate gfx_window_glutin;
extern crate glutin;

use gfx::Device;

pub type ColorFormat = gfx::format::Rgba8;
pub type DepthFormat = gfx::format::DepthStencil;

pub fn main() {
    let builder = glutin::WindowBuilder::new()
        .with_title("Triangle example".to_string())
        .with_dimensions(1024, 768)
        .with_vsync();
    let (window, mut device, mut factory, main_color, mut main_depth) =
        gfx_window_glutin::init::<ColorFormat, DepthFormat>(builder);
    'main: loop {
        for event in window.poll_events() {
            match event {
                glutin::Event::KeyboardInput(_, _, Some(glutin::VirtualKeyCode::Escape)) |
                glutin::Event::Closed => break 'main,
                _ => {}
            }
        }
        window.swap_buffers().unwrap();
        device.cleanup();
    }
}

And this is the Cargo.toml:

name = "gfx_sdl_test"
version = "0.1.0"
authors = ["Siebencorgie"]

[dependencies]
gfx = "0.14"
glutin = "0.7"
gfx_window_glutin = "0.14"

Any idea what the problem could be? If you need more information about hard- or software, let me know.

@msiglreith
Copy link
Contributor

Interesting! Seems like the compositor takes the alpha values of our framebuffers into account.
In our cube example, the alpha values are incorrect (0.0f), resulting into a blending with the background.

Not sure if it should be transparent by default, this might be a glutin issue.
I can reproduce it on windows by enabling transparency in the WindowBuilder.

@SiebenCorgie
Copy link
Author

Interesting indeed. I tested the shadow example. Its working as it should. However, the window is still incomplete. It got missing close/minimize/maximize buttons, and not the correct, themed window frame.

@Binero
Copy link
Contributor

Binero commented Jul 12, 2017

I have this issue too on Wayland, but not Xorg. (Both Mutter)

@mitchmindtree
Copy link
Contributor

I've also run into this on wayland+mutter, but via glium instead. This is probably either a glutin, winit, wayland-window or mutter issue. @vberger any ideas what might be going on?

@elinorbgr
Copy link

elinorbgr commented Jul 12, 2017

Not sure if it should be transparent by default, this might be a glutin issue.

I'm pretty sure it is a perfectly normal wayland behavior, given there doesn't exist any way to specify to the compositor that your window should not be transparent.

It got missing close/minimize/maximize buttons, and not the correct, themed window frame.

Wayland (or at least mutter) require client-side decorations to be drawn. Currently, winit draws them using wayland-window which is a very basic decorations implementation and is still WIP. Hence the missing buttons and ugly borders.

However, matching the compositor style would basically require either creating the window using GTK or parsing the GTK theme configuration and mimicking the rendering of it in wayland-window, which is way out of scope for this small crate.

@OvermindDL1
Copy link

However, matching the compositor style would basically require either creating the window using GTK or parsing the GTK theme configuration and mimicking the rendering of it in wayland-window, which is way out of scope for this small crate.

As well as many of us prefer Qt as well.

@torkleyy
Copy link
Contributor

torkleyy commented Oct 1, 2018

What I get on Wayland looks a lot worse:

screenshot from 2018-10-01 17-20-58

(cube example of pre-ll)

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

No branches or pull requests

7 participants