Rust-SDL2 / rust-sdl2

SDL2 bindings for Rust
MIT License
2.72k stars 467 forks source link

[Question] Make window type dock? #1197

Open alexmozaidze opened 2 years ago

alexmozaidze commented 2 years ago

I was searching a way to make sdl window of type dock in X11 and found this issue, then I tried doing something like this:

const WM_WINDOW_TYPE_DOCK: &str = "_NET_WM_WINDOW_TYPE_DOCK";
const SDL_HINT: &str = "SDL_HINT_X11_WINDOW_TYPE";

println!("Setting dock hint...");
assert!(hint::set(SDL_HINT, WM_WINDOW_TYPE_DOCK));

println!("hint: {:?}", hint::get(SDL_HINT)); // Prints `Some("_NET_WM_WINDOW_TYPE_DOCK")`

but it didn't work. How can I tell WM that my sdl window is a dock?

Cobrand commented 2 years ago

Do you have a C example where it works as expected? This repo is explicitly for the rust bindings, if this isn't rust-related then I can't help you that much.

alexmozaidze commented 2 years ago

I don't, but the guy in the issue I linked said it worked. I'll try to get an example working with C and report back.

alexmozaidze commented 2 years ago

Getting latest SDL working is harder than I imagined, it might take me a while. I'm sure it's this commit that added the hint that specifies to X11 that it should treat SDL window as a dock. Could you update the SDL and the bindings so that feature is available? Now, I shall continue my journey of learning C and C compilers.

Cobrand commented 2 years ago

That explains it, the commit is only 4 days old. Unfortunately we only use the stable release in bundled and in the bindings, but you could always fork the project, update the submodule to your commit, and use the bundled feature then.

You also can use your own compiled SDL2 version with the proper cargo link parameters

ThibaultLemaire commented 2 years ago

@alexmozaidze The answer is in the commit you linked:

You should use "SDL_X11_WINDOW_TYPE", not "SDL_HINT_X11_WINDOW_TYPE"