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:
Olivier Goffart
2026-07-28 14:29:36 +00:00
parent 6a8a334426
commit 37d8a503e4
30 changed files with 57 additions and 21 deletions

View File

@@ -85,6 +85,7 @@ impl DataSourceHandler for WinitState {
},
},
SendData::Bytes(binary) => Cursor::new(binary),
_ => return,
};
let _ = self.loop_handle.insert_source(fd, move |_, file, _| {

View 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());
},
};

View File

@@ -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(),
}
}

View File

@@ -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),