-
Notifications
You must be signed in to change notification settings - Fork 945
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
wayland: Add WindowExtWayland::xdg_toplevel
#4076
base: master
Are you sure you want to change the base?
Conversation
We can not expose objects from SCTK like that. We can expose a pointer, but that's about it. |
Thanks for the review. I have changed the method to return |
You should open your changes against master. |
Ops sorry for triggering additional review requests. I have cherry-pick my commits to |
src/platform/wayland.rs
Outdated
pub trait WindowExtWayland {} | ||
pub trait WindowExtWayland { | ||
/// Returns `xdg_toplevel` of the window or null if the window is X11 window. | ||
fn xdg_toplevel(&self) -> *mut c_void; |
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.
Could you return an Option<NonNull>
instead?
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.
Okay. Will do after next week since I don't have access to my computer.
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.
Done.
116c68e
to
0c671f2
Compare
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.
Needs a changelog entry.
src/platform/wayland.rs
Outdated
let id = w.xdg_toplevel().id(); | ||
let ptr = NonNull::new(id.as_ptr().cast()).expect("xdg_toplevel should not be null"); |
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.
could you move this logic to wayland/window/mod.rs
and return pointer from there instead, so we don't have an export here. We could also not fail when we can not cast
.
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.
Done.
We could also not fail when we can not
cast
.
Sorry I don't understand what you mean. Do you mean we should use NonNull::new_unchecked
instead of NonNull::new
?
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 mean, that you just forward option up and not panic.
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.
Done.
changelog
module if knowledge of this change could be valuable to usersI did not update changelog yet because I don't know if this change is okay or not.
Resolves #4068.