mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-29 04:40:04 -04:00
Mark extensible enums in winit-core as #[non_exhaustive]
Event, input source, error, data transfer, native key, IME request, scroll delta and fullscreen enums can now gain variants without a breaking change. Backends and examples get wildcard arms where they matched exhaustively; unknown IME requests are reported as ImeRequestError::NotSupported and unknown fullscreen modes behave like Fullscreen::Borderless(None).
This commit is contained in:
@@ -34,7 +34,7 @@ impl CustomCursor {
|
||||
pub(crate) fn new(cursor: CustomCursorSource) -> Result<CustomCursor, RequestError> {
|
||||
let cursor = match cursor {
|
||||
CustomCursorSource::Image(cursor_image) => cursor_image,
|
||||
CustomCursorSource::Animation { .. } | CustomCursorSource::Url { .. } => {
|
||||
_ => {
|
||||
return Err(NotSupportedError::new("unsupported cursor kind").into());
|
||||
},
|
||||
};
|
||||
|
||||
@@ -453,6 +453,7 @@ impl PasteboardWriterState {
|
||||
SendData::Uris(_) => None,
|
||||
SendData::String(string) => Some(NSString::from_str(&string).into()),
|
||||
SendData::Bytes(binary) => Some(NSData::from_vec(binary).into()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,6 +248,7 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
||||
.chain(Vec::new().into_iter().map(ns_url_from_str)),
|
||||
),
|
||||
SendData::Bytes(_) => None,
|
||||
_ => None,
|
||||
}
|
||||
})
|
||||
.into_iter()
|
||||
|
||||
@@ -227,6 +227,7 @@ define_class!(
|
||||
// in fullscreen, so we must've reached here by `set_fullscreen`
|
||||
// as it updates the state
|
||||
Some(Fullscreen::Borderless(_)) => (),
|
||||
Some(_) => (),
|
||||
// Otherwise, we must've reached fullscreen by the user clicking
|
||||
// on the green fullscreen button. Update state!
|
||||
None => {
|
||||
@@ -667,6 +668,7 @@ fn new_window(
|
||||
monitor.ns_screen(mtm).or_else(|| NSScreen::mainScreen(mtm))
|
||||
},
|
||||
Some(Fullscreen::Borderless(None)) => NSScreen::mainScreen(mtm),
|
||||
Some(_) => NSScreen::mainScreen(mtm),
|
||||
None => None,
|
||||
};
|
||||
let frame = match &screen {
|
||||
@@ -1683,7 +1685,7 @@ impl WindowDelegate {
|
||||
let monitor = monitor.cast_ref::<MonitorHandle>().unwrap();
|
||||
monitor.ns_screen(mtm)
|
||||
},
|
||||
Fullscreen::Borderless(None) => {
|
||||
_ => {
|
||||
if let Some(monitor) = self.current_monitor_inner() {
|
||||
monitor.ns_screen(mtm)
|
||||
} else {
|
||||
@@ -1928,6 +1930,7 @@ impl WindowDelegate {
|
||||
self.view().disable_ime();
|
||||
return Ok(());
|
||||
},
|
||||
_ => return Err(ImeRequestError::NotSupported),
|
||||
};
|
||||
|
||||
if let Some((spot, size)) = request_data.cursor_area {
|
||||
|
||||
Reference in New Issue
Block a user