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:
@@ -54,6 +54,7 @@ impl CustomCursor {
|
||||
true,
|
||||
)
|
||||
},
|
||||
_ => unimplemented!("unknown `CustomCursorSource` variant"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ pub fn pointer_source(event: &PointerEvent, kind: PointerKind) -> PointerSource
|
||||
|
||||
PointerSource::TabletTool { kind: tool, data }
|
||||
},
|
||||
PointerKind::Unknown => PointerSource::Unknown,
|
||||
_ => PointerSource::Unknown,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ pub(crate) fn request_fullscreen(
|
||||
canvas.webkit_request_fullscreen();
|
||||
}
|
||||
},
|
||||
_ => error!("This full screen mode is not supported"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ impl PointerHandler {
|
||||
PointerSource::TabletTool { kind, data } => {
|
||||
ButtonSource::TabletTool { kind, button: event::tool_button(button), data }
|
||||
},
|
||||
PointerSource::Unknown => ButtonSource::Unknown(button),
|
||||
_ => ButtonSource::Unknown(button),
|
||||
};
|
||||
|
||||
handler(
|
||||
@@ -152,7 +152,7 @@ impl PointerHandler {
|
||||
|
||||
ButtonSource::TabletTool { kind, button: event::tool_button(button), data }
|
||||
},
|
||||
PointerSource::Unknown => ButtonSource::Unknown(button),
|
||||
_ => ButtonSource::Unknown(button),
|
||||
};
|
||||
|
||||
handler(
|
||||
@@ -229,7 +229,7 @@ impl PointerHandler {
|
||||
button: event::tool_button(button),
|
||||
data,
|
||||
},
|
||||
PointerSource::Unknown => ButtonSource::Unknown(button),
|
||||
_ => ButtonSource::Unknown(button),
|
||||
};
|
||||
|
||||
button_handler(
|
||||
|
||||
Reference in New Issue
Block a user