In X11, it is possible to have multiple _NET_WM_WINDOW_TYPE properties, so that you can have a combination of window types. winit, however, only allows a single XWindowType.
let window = WindowBuilder::new()
.with_title("A fantastic window!")
.with_x11_window_type(XWindowType::Notification) // this property is overridden
.with_x11_window_type(XWindowType::Utility) // by this one
.build(&event_loop)
.unwrap();
In Xlib, if you wanted to have a window which had types NOTIFICATION and UTILITY you'd do something like this:
property[2] = XInternAtom(dsp, "_NET_WM_WINDOW_TYPE", false);
property[0] = XInternAtom(dsp, "_NET_WM_WINDOW_TYPE_NOTIFICATION", false);
property[1] = XInternAtom(dsp, "_NET_WM_WINDOW_TYPE_UTILITY", false);
XChangeProperty(dsp, win, property[2], XA_ATOM, 32, PropModeReplace, (unsigned char *) property, 2L);
From a user perspective, I think the most obvious behaviour would be for WindowBuilder.with_x11_window_type() to combine window types rather than replace them, but it seems to just overwrite the property:
https://github.com/rust-windowing/winit/blob/cf0b8babbdb39abc443c94c8a94281201e6e9b0c/src/platform/unix.rs#L367-L370
I would be happy to contribute to fix this issue if a preferred method is described. I locally did a quick and dirty fix by pushing window types to a Vec, which works but allows doubling up on properties. Perhaps a HashSet or bitwise OR would work better.
winit = "0.20.0-alpha2"
Thanks for the issue!
I see no reason not to do this. If you'd like to submit a PR, could you expose this by converting XWindowType to a bitflags type? Also, I'd like to keep with_x11_window_type's current behavior for the sake of consistency with the rest of the API. Moving to a bitflags type would allow us to do that while still making it easy to set multiple window types.
Closed by #1147
Most helpful comment
Thanks for the issue!
I see no reason not to do this. If you'd like to submit a PR, could you expose this by converting
XWindowTypeto abitflagstype? Also, I'd like to keepwith_x11_window_type's current behavior for the sake of consistency with the rest of the API. Moving to abitflagstype would allow us to do that while still making it easy to set multiple window types.