-
-
Notifications
You must be signed in to change notification settings - Fork 476
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
Update raw-window-handle
to v0.6
#1670
Update raw-window-handle
to v0.6
#1670
Conversation
5e513c2
to
92a5ab0
Compare
We already have #1582 for that, though we have an option for |
I'd just post a review, since there's nothing wrong with just using |
A lot of changes here may snoop the implementation from ash-rs/ash#799 which - to my knowledge - treats (non)-nullable parameters accordingly. |
ca6d970
to
6c16bb3
Compare
0fefa0b
to
b209d27
Compare
Is there a plan to merge this PR? @declantsien |
In general, re-request the review with github UI when it's ready or explicitly indicate the state if you're not interested anymore. |
b209d27
to
6f67a0c
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.
Overall seeing a bit too many semantical changes that I'm not immediately content with. raw-window-handle 0.6
gives us the ability to know that values are intentionally 0
/null()
by setting an Option
to None
, but we're not taking this opportunity to validate whether the underlying API can and should handle that value, or that we should bail. In some cases there are unwraps, or None
propagation, or ?
propagation making things harder to follow and validate.
glutin/src/api/wgl/display.rs
Outdated
let (wgl_extra, client_extensions) = | ||
super::load_extra_functions(window.hinstance as _, window.hwnd as _)?; | ||
let (wgl_extra, client_extensions) = super::load_extra_functions( | ||
window.hinstance.map(|i| i.get()).unwrap_or(0) as _, |
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.
unwrap_or_else
?
I'm unfamiliar with this code to say if it's okay to pass 0
for HINSTANCE
. There are multiple getters but don't know if any should be used.
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.
it's the same as before, because it could be 0, which is default for rwh 0.5 and lower.
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.
@kchibisov yes that is the point: it could have been passed before, but now that we know the raw-window-handle
API allows zero, we should take a second to realize whether that is actually valid inside super::load_extra_functions()
.
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.
Our own safety docs already say that this must be "valid":
glutin/glutin/src/api/wgl/display.rs
Lines 40 to 44 in 052399d
/// # Safety | |
/// | |
/// The `native_window` must point to the valid platform window and have | |
/// valid `hinstance`. | |
pub unsafe fn new( |
So I think this should be a panic!()
/.unwrap()
/ok_or...()?
.
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.
Looking further than that, load_extra_functions()
calls GetClassInfoExW()
and CreateWindowExW()
, both of which allow NULL, so the safety docs are likely too strict and should be removed if we keep this unwrap_or(0)
.
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.
So I think this should be a
panic!()
/.unwrap()
/ok_or...()?
.
I go with .unwrap()
.
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.
Yes that is a good idea. If people were previously implicitly passing 0
(mismatching the # Safety
docs), we'll catch that and can always amend the code with a new patch release.
6f67a0c
to
f77078c
Compare
@kchibisov Can you help with the CI error. Wired cfg errors. |
f77078c
to
a86a9ad
Compare
The error is from the rust nightly. Tried with an old build |
The old default behavior for rust was to not include |
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.
Should be good after rebase.
a86a9ad
to
ddc85b4
Compare
Nice |
Right. Good to know. Thanks. |
A reproducible build (for libraries) is "useless" when a published crate is on crates.io. Only semver version (range) dependencies from |
CHANGELOG.md
Outdated
@@ -1,6 +1,7 @@ | |||
# Unreleased | |||
|
|||
- Bump MSRV from `1.65` to `1.70`. | |||
- **Breaking:** updated `raw-window-handle` dependency to `0.6.1`. |
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.
Question for @kchibisov: the changelog seems to have a mix of past- and present-tense. What should we pick?
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.
One more cleanup request for an unreachable if display.is_null()
, but seems like we're getting somewhere otherwise.
ade655b
to
d941c1c
Compare
Not happy with how valid open comments get marked as resolved.
725b03e
to
3fbda28
Compare
3fbda28
to
ee70c03
Compare
One item remaining, the rest looks good: |
5f90db4
to
e20c41d
Compare
e20c41d
to
2de3d8c
Compare
@MarijnS95 I think I am done with your requests. |
@@ -22,11 +22,11 @@ wayland = ["glutin-winit/wayland", "winit/wayland-dlopen", "winit/wayland-csd-ad | |||
glutin = { path = "../glutin", default-features = false } | |||
glutin-winit = { path = "../glutin-winit", default-features = false } | |||
png = { version = "0.17.6", optional = true } | |||
raw-window-handle = "0.5" | |||
raw-window-handle = "0.6" | |||
winit = { version = "0.29.2", default-features = false, features = ["rwh_05"] } |
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.
Any reason this winit
was left unchanged with rwh_05
instead of rwh_06
?
I just noticed it when resolving conflicts in #1675
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.
it's example, doesn't really matter. Could use 06.
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.
Yeah, seems to work just fine, I simply found it odd 😄
Only tested on devices using Linux
CHANGELOG.md
if knowledge of this change could be valuable to usersNone