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:
@@ -85,6 +85,7 @@ impl DataSourceHandler for WinitState {
|
||||
},
|
||||
},
|
||||
SendData::Bytes(binary) => Cursor::new(binary),
|
||||
_ => return,
|
||||
};
|
||||
|
||||
let _ = self.loop_handle.insert_source(fd, move |_, file, _| {
|
||||
|
||||
@@ -694,7 +694,7 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
||||
) -> Result<CoreCustomCursor, RequestError> {
|
||||
let cursor_image = match cursor {
|
||||
CustomCursorSource::Image(cursor_image) => cursor_image,
|
||||
CustomCursorSource::Animation { .. } | CustomCursorSource::Url { .. } => {
|
||||
_ => {
|
||||
return Err(NotSupportedError::new("unsupported cursor kind").into());
|
||||
},
|
||||
};
|
||||
|
||||
@@ -453,9 +453,6 @@ impl CoreWindow for Window {
|
||||
|
||||
fn set_fullscreen(&self, fullscreen: Option<Fullscreen>) {
|
||||
match fullscreen {
|
||||
Some(Fullscreen::Exclusive(..)) => {
|
||||
warn!("`Fullscreen::Exclusive` is ignored on Wayland");
|
||||
},
|
||||
Some(Fullscreen::Borderless(monitor)) => {
|
||||
let output = monitor.as_ref().and_then(|monitor| {
|
||||
monitor.cast_ref::<output::MonitorHandle>().map(|handle| &handle.proxy)
|
||||
@@ -463,6 +460,9 @@ impl CoreWindow for Window {
|
||||
|
||||
self.window.set_fullscreen(output)
|
||||
},
|
||||
Some(_) => {
|
||||
warn!("this fullscreen mode is ignored on Wayland");
|
||||
},
|
||||
None => self.window.unset_fullscreen(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1269,6 +1269,7 @@ impl WindowState {
|
||||
self.text_input_state = None;
|
||||
true
|
||||
},
|
||||
_ => return Err(ImeRequestError::NotSupported),
|
||||
};
|
||||
|
||||
// Only one input method may be active per (seat, surface),
|
||||
|
||||
Reference in New Issue
Block a user