-
Notifications
You must be signed in to change notification settings - Fork 941
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
Allow using multiple XWindowType
s on X11 (#1140)
#1147
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
This largely looks good to me (except for the build target things below), but keep in mind that I'm not familiar with the Linux code. I've requested a review from @zegentzy who's more familiar with that backend, mainly because I'm not comfortable merging code that I can't properly review, but I'd be surprised if they find an issue.
&Normal => b"_NET_WM_WINDOW_TYPE_NORMAL\0", | ||
}; | ||
unsafe { xconn.get_atom_unchecked(atom_name) } | ||
pub(crate) fn get_atoms(&self, xconn: &Arc<XConnection>) -> Vec<ffi::Atom> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not liking this solution, the specs say:
The Client SHOULD specify window types in order of preference (the first being most preferable) but MUST include at least one of the basic window type atoms from the list below.
This bit flags thing stops users from specifying their order. I'd rather we keep the old enum WindowType
and instead accept a T: AsRef<[utils::WindowType]>
in set_window_type
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would this change face the user? -- with_x11_window_type()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed my mind on the AsRef
, but we should still be accepting an slice of them.
So:
fn with_x11_window_type(self, x11_window_type: &[utils::WindowType]) -> WindowBuilder
fn set_window_type(&self, window_type: &[util::WindowType]) -> util::Flusher<'_>
and so forth.
I've pushed the slice variant. A static lifetime seems like the neatest way to do this, but stops users adding window types dynamically -- which is fine, IMO. I admit I'm not too confident with lifetimes so maybe this has worse consequences. Something I noticed is that the window type is not set at all if the window type is the default: winit/src/platform_impl/linux/x11/window.rs Lines 299 to 301 in b03e589
Either this behaviour or the documentation should be changed, since the documentation states: Is it ok to just hack this into the winit/src/platform_impl/linux/x11/window.rs Lines 301 to 303 in 1e83d9d
|
I'd rather not have it
I don't really know. cc @murarth |
Not in principal, but I don't think forcing it via platform-specific extension traits is a good place to do it - it'll force us to hack in lifetimes for |
According to the WM spec (at the bottom of this section), if no The replacement |
I think this is a bit obtuse. If the documentation says the window type defaults to Pretty much every application I can Also note, from the specification:
The more I think about it the more I want to
So just to confirm, |
(Edit: Accidentally submitted too soon.) The "MUST" language in the spec is pretty clear, but if you want to pass |
I edited my post a while after submitting to include a relevant section from the specification, probably after you started typing. Sorry! |
I think you may be misreading that portion of the spec. I don't think it's saying that the client MUST supply This is how the section begins:
A |
Ahhh it seems like I am. It's almost like I'm reading some legislation with this spec -- thanks for understanding anyway. Hopefully we've arrived at an implementation with this latest commit. Funnily enough we've almost gone right back to what I originally had to fix the issue locally. Thanks for your patience. |
Good to merge, @murarth ? |
@Toqozz This needs an entry in Otherwise, it looks great. |
cargo fmt
has been run on this branchCHANGELOG.md
if knowledge of this change could be valuable to usersI'm not familiar with rustdoc. Does documentation need to be updated manually for this change? Note that the change is breaking due to the case change of
XWindowType
.get_atoms()
is quite ugly, but seems necessary.Please let me know of any changes/improvements necessary and I'll update as soon as I can.