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

@@ -977,6 +977,7 @@ impl CoreWindow for Window {
*current_caps = None; *current_caps = None;
self.app.hide_soft_input(true); self.app.hide_soft_input(true);
}, },
_ => return Err(ImeRequestError::NotSupported),
} }
Ok(()) Ok(())

View File

@@ -34,7 +34,7 @@ impl CustomCursor {
pub(crate) fn new(cursor: CustomCursorSource) -> Result<CustomCursor, RequestError> { pub(crate) fn new(cursor: CustomCursorSource) -> Result<CustomCursor, RequestError> {
let cursor = match cursor { let cursor = match cursor {
CustomCursorSource::Image(cursor_image) => cursor_image, CustomCursorSource::Image(cursor_image) => cursor_image,
CustomCursorSource::Animation { .. } | CustomCursorSource::Url { .. } => { _ => {
return Err(NotSupportedError::new("unsupported cursor kind").into()); return Err(NotSupportedError::new("unsupported cursor kind").into());
}, },
}; };

View File

@@ -453,6 +453,7 @@ impl PasteboardWriterState {
SendData::Uris(_) => None, SendData::Uris(_) => None,
SendData::String(string) => Some(NSString::from_str(&string).into()), SendData::String(string) => Some(NSString::from_str(&string).into()),
SendData::Bytes(binary) => Some(NSData::from_vec(binary).into()), SendData::Bytes(binary) => Some(NSData::from_vec(binary).into()),
_ => None,
} }
} }
} }

View File

@@ -248,6 +248,7 @@ impl RootActiveEventLoop for ActiveEventLoop {
.chain(Vec::new().into_iter().map(ns_url_from_str)), .chain(Vec::new().into_iter().map(ns_url_from_str)),
), ),
SendData::Bytes(_) => None, SendData::Bytes(_) => None,
_ => None,
} }
}) })
.into_iter() .into_iter()

View File

@@ -227,6 +227,7 @@ define_class!(
// in fullscreen, so we must've reached here by `set_fullscreen` // in fullscreen, so we must've reached here by `set_fullscreen`
// as it updates the state // as it updates the state
Some(Fullscreen::Borderless(_)) => (), Some(Fullscreen::Borderless(_)) => (),
Some(_) => (),
// Otherwise, we must've reached fullscreen by the user clicking // Otherwise, we must've reached fullscreen by the user clicking
// on the green fullscreen button. Update state! // on the green fullscreen button. Update state!
None => { None => {
@@ -667,6 +668,7 @@ fn new_window(
monitor.ns_screen(mtm).or_else(|| NSScreen::mainScreen(mtm)) monitor.ns_screen(mtm).or_else(|| NSScreen::mainScreen(mtm))
}, },
Some(Fullscreen::Borderless(None)) => NSScreen::mainScreen(mtm), Some(Fullscreen::Borderless(None)) => NSScreen::mainScreen(mtm),
Some(_) => NSScreen::mainScreen(mtm),
None => None, None => None,
}; };
let frame = match &screen { let frame = match &screen {
@@ -1683,7 +1685,7 @@ impl WindowDelegate {
let monitor = monitor.cast_ref::<MonitorHandle>().unwrap(); let monitor = monitor.cast_ref::<MonitorHandle>().unwrap();
monitor.ns_screen(mtm) monitor.ns_screen(mtm)
}, },
Fullscreen::Borderless(None) => { _ => {
if let Some(monitor) = self.current_monitor_inner() { if let Some(monitor) = self.current_monitor_inner() {
monitor.ns_screen(mtm) monitor.ns_screen(mtm)
} else { } else {
@@ -1928,6 +1930,7 @@ impl WindowDelegate {
self.view().disable_ime(); self.view().disable_ime();
return Ok(()); return Ok(());
}, },
_ => return Err(ImeRequestError::NotSupported),
}; };
if let Some((spot, size)) = request_data.cursor_area { if let Some((spot, size)) = request_data.cursor_area {

View File

@@ -111,6 +111,7 @@ impl_dyn_casting!(CustomCursorProvider);
/// ///
/// See [`CustomCursor`] for more details. /// See [`CustomCursor`] for more details.
#[derive(Debug, Clone, Eq, Hash, PartialEq)] #[derive(Debug, Clone, Eq, Hash, PartialEq)]
#[non_exhaustive]
pub enum CustomCursorSource { pub enum CustomCursorSource {
/// Cursor that is backed by RGBA image. /// Cursor that is backed by RGBA image.
/// ///
@@ -167,6 +168,7 @@ impl CustomCursorSource {
/// An error produced when using [`CustomCursorSource::from_rgba`] with invalid arguments. /// An error produced when using [`CustomCursorSource::from_rgba`] with invalid arguments.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[non_exhaustive]
pub enum BadImage { pub enum BadImage {
/// Produced when the image dimensions are larger than [`MAX_CURSOR_SIZE`]. This doesn't /// Produced when the image dimensions are larger than [`MAX_CURSOR_SIZE`]. This doesn't
/// guarantee that the cursor will work, but should avoid many platform and device specific /// guarantee that the cursor will work, but should avoid many platform and device specific
@@ -217,6 +219,7 @@ impl Error for BadImage {}
/// An error produced when using [`CustomCursorSource::from_animation`] with invalid arguments. /// An error produced when using [`CustomCursorSource::from_animation`] with invalid arguments.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[non_exhaustive]
pub enum BadAnimation { pub enum BadAnimation {
/// Produced when no cursors were supplied. /// Produced when no cursors were supplied.
Empty, Empty,

View File

@@ -127,6 +127,7 @@ impl DataTransferId {
/// The set of types supported cross-platform. /// The set of types supported cross-platform.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum TypeHint { pub enum TypeHint {
/// Plain UTF-8 text (see [`TypedData::try_as_string`]). /// Plain UTF-8 text (see [`TypedData::try_as_string`]).
/// ///
@@ -381,6 +382,7 @@ impl_dyn_casting!(DataTransfer);
/// different encoding on different platforms. To allow this to be represented, we allow /// different encoding on different platforms. To allow this to be represented, we allow
/// supplying strings and URIs separately from binary blobs. /// supplying strings and URIs separately from binary blobs.
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum SendData { pub enum SendData {
/// List of URIs. /// List of URIs.
/// ///

View File

@@ -20,6 +20,7 @@ use crate::window::{ActivationToken, Theme};
/// Describes the reason the event loop is resuming. /// Describes the reason the event loop is resuming.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum StartCause { pub enum StartCause {
/// Sent if the time specified by [`ControlFlow::WaitUntil`] has been reached. Contains the /// Sent if the time specified by [`ControlFlow::WaitUntil`] has been reached. Contains the
/// moment the timeout was requested and the requested resume time. The actual resume time is /// moment the timeout was requested and the requested resume time. The actual resume time is
@@ -44,6 +45,7 @@ pub enum StartCause {
/// Describes an event from a [`Window`]. /// Describes an event from a [`Window`].
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum WindowEvent { pub enum WindowEvent {
/// The activation token was delivered back and now could be used. /// The activation token was delivered back and now could be used.
ActivationTokenDone { serial: AsyncRequestSerial, token: ActivationToken }, ActivationTokenDone { serial: AsyncRequestSerial, token: ActivationToken },
@@ -531,6 +533,7 @@ pub enum WindowEvent {
/// **Wayland/X11:** [`Unknown`](Self::Unknown) device types are converted to known variants by the /// **Wayland/X11:** [`Unknown`](Self::Unknown) device types are converted to known variants by the
/// system. /// system.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum PointerKind { pub enum PointerKind {
Mouse, Mouse,
/// See [`PointerSource::Touch`] for more details. /// See [`PointerSource::Touch`] for more details.
@@ -548,6 +551,7 @@ pub enum PointerKind {
/// **Wayland/X11:** [`Unknown`](Self::Unknown) device types are converted to known variants by the /// **Wayland/X11:** [`Unknown`](Self::Unknown) device types are converted to known variants by the
/// system. /// system.
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum PointerSource { pub enum PointerSource {
Mouse, Mouse,
/// Represents a touch event. /// Represents a touch event.
@@ -616,6 +620,7 @@ impl From<PointerSource> for PointerKind {
/// **Wayland/X11:** [`Unknown`](Self::Unknown) device types are converted to known variants by the /// **Wayland/X11:** [`Unknown`](Self::Unknown) device types are converted to known variants by the
/// system. /// system.
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ButtonSource { pub enum ButtonSource {
/// ## Platform-specific /// ## Platform-specific
/// ///
@@ -730,6 +735,7 @@ impl FingerId {
/// ///
/// [window events]: WindowEvent /// [window events]: WindowEvent
#[derive(Clone, Copy, Debug, PartialEq)] #[derive(Clone, Copy, Debug, PartialEq)]
#[non_exhaustive]
pub enum DeviceEvent { pub enum DeviceEvent {
/// Change in physical position of a pointing device. /// Change in physical position of a pointing device.
/// ///
@@ -1052,6 +1058,7 @@ impl From<ModifiersState> for Modifiers {
/// ``` /// ```
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[non_exhaustive]
pub enum Ime { pub enum Ime {
/// Notifies when the IME was enabled. /// Notifies when the IME was enabled.
/// ///
@@ -1576,6 +1583,7 @@ impl From<TabletToolButton> for Option<MouseButton> {
/// Describes a difference in the mouse scroll wheel state. /// Describes a difference in the mouse scroll wheel state.
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[non_exhaustive]
pub enum MouseScrollDelta { pub enum MouseScrollDelta {
/// Amount in lines or rows to scroll in the horizontal /// Amount in lines or rows to scroll in the horizontal
/// and vertical directions. /// and vertical directions.

View File

@@ -282,6 +282,7 @@ impl From<Icon> for DragIcon {
/// are expected to provide some kind of order of preference. /// are expected to provide some kind of order of preference.
#[repr(u8)] #[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
#[non_exhaustive]
pub enum DndAction { pub enum DndAction {
/// Move the dragged item from the source to the destination. /// Move the dragged item from the source to the destination.
/// ///

View File

@@ -26,6 +26,7 @@ impl_dyn_casting!(IconProvider);
#[derive(Debug)] #[derive(Debug)]
/// An error produced when using [`RgbaIcon::new`] with invalid arguments. /// An error produced when using [`RgbaIcon::new`] with invalid arguments.
#[non_exhaustive]
pub enum BadIcon { pub enum BadIcon {
/// Produced when the length of the `rgba` argument isn't divisible by 4, thus `rgba` can't be /// Produced when the length of the `rgba` argument isn't divisible by 4, thus `rgba` can't be
/// safely interpreted as 32bpp RGBA pixels. /// safely interpreted as 32bpp RGBA pixels.

View File

@@ -19,6 +19,7 @@ pub use smol_str::SmolStr;
/// - On non-Web platforms, support assigning keybinds to virtually any key through a UI. /// - On non-Web platforms, support assigning keybinds to virtually any key through a UI.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[non_exhaustive]
pub enum NativeKeyCode { pub enum NativeKeyCode {
Unidentified, Unidentified,
/// An Android "scancode". /// An Android "scancode".
@@ -78,6 +79,7 @@ impl std::fmt::Debug for NativeKeyCode {
/// define keybinds which work in the presence of identifiers we haven't mapped for you yet. /// define keybinds which work in the presence of identifiers we haven't mapped for you yet.
#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] #[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[non_exhaustive]
pub enum NativeKey { pub enum NativeKey {
Unidentified, Unidentified,
/// An Android "keycode", which is similar to a "virtual-key code" on Windows. /// An Android "keycode", which is similar to a "virtual-key code" on Windows.

View File

@@ -183,6 +183,7 @@ impl fmt::Display for VideoMode {
/// Fullscreen modes. /// Fullscreen modes.
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum Fullscreen { pub enum Fullscreen {
Exclusive(MonitorHandle, VideoMode), Exclusive(MonitorHandle, VideoMode),

View File

@@ -1756,6 +1756,7 @@ bitflags! {
} }
#[derive(Debug, PartialEq, Eq, Clone, Hash)] #[derive(Debug, PartialEq, Eq, Clone, Hash)]
#[non_exhaustive]
pub enum ImeSurroundingTextError { pub enum ImeSurroundingTextError {
/// Text exceeds 4000 bytes /// Text exceeds 4000 bytes
TextTooLong, TextTooLong,
@@ -1868,6 +1869,7 @@ impl ImeSurroundingText {
/// Request to send to IME. /// Request to send to IME.
#[derive(Debug, PartialEq, Clone)] #[derive(Debug, PartialEq, Clone)]
#[non_exhaustive]
pub enum ImeRequest { pub enum ImeRequest {
/// Enable the IME with the [`ImeCapabilities`] and [`ImeRequestData`] as initial state. When /// Enable the IME with the [`ImeCapabilities`] and [`ImeRequestData`] as initial state. When
/// the [`ImeRequestData`] is **not** matching capabilities fully, the default values will be /// the [`ImeRequestData`] is **not** matching capabilities fully, the default values will be

View File

@@ -342,6 +342,7 @@ impl CoreWindow for Window {
None => { None => {
let _ = self.set_flag(ORBITAL_FLAG_FULLSCREEN, false); let _ = self.set_flag(ORBITAL_FLAG_FULLSCREEN, false);
}, },
Some(_) => (),
} }
} }

View File

@@ -323,9 +323,7 @@ impl Inner {
Some(Fullscreen::Borderless(Some(monitor))) => { Some(Fullscreen::Borderless(Some(monitor))) => {
monitor.cast_ref::<MonitorHandle>().unwrap().ui_screen(mtm).clone() monitor.cast_ref::<MonitorHandle>().unwrap().ui_screen(mtm).clone()
}, },
Some(Fullscreen::Borderless(None)) => { Some(_) => self.current_monitor_inner().ui_screen(mtm).clone(),
self.current_monitor_inner().ui_screen(mtm).clone()
},
None => { None => {
warn!("`Window::set_fullscreen(None)` ignored on iOS"); warn!("`Window::set_fullscreen(None)` ignored on iOS");
return; return;
@@ -405,6 +403,7 @@ impl Inner {
*current_caps = None; *current_caps = None;
self.view.resignFirstResponder(); self.view.resignFirstResponder();
}, },
_ => return Err(ImeRequestError::NotSupported),
} }
Ok(()) Ok(())
@@ -522,7 +521,7 @@ impl Window {
let monitor = monitor.cast_ref::<MonitorHandle>().unwrap(); let monitor = monitor.cast_ref::<MonitorHandle>().unwrap();
monitor.ui_screen(mtm) monitor.ui_screen(mtm)
}, },
Some(Fullscreen::Borderless(None)) | None => &main_screen, _ => &main_screen,
}; };
let screen_bounds = screen.bounds(); let screen_bounds = screen.bounds();

View File

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

View File

@@ -694,7 +694,7 @@ impl RootActiveEventLoop for ActiveEventLoop {
) -> Result<CoreCustomCursor, RequestError> { ) -> Result<CoreCustomCursor, RequestError> {
let cursor_image = match cursor { let cursor_image = match cursor {
CustomCursorSource::Image(cursor_image) => cursor_image, CustomCursorSource::Image(cursor_image) => cursor_image,
CustomCursorSource::Animation { .. } | CustomCursorSource::Url { .. } => { _ => {
return Err(NotSupportedError::new("unsupported cursor kind").into()); 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>) { fn set_fullscreen(&self, fullscreen: Option<Fullscreen>) {
match fullscreen { match fullscreen {
Some(Fullscreen::Exclusive(..)) => {
warn!("`Fullscreen::Exclusive` is ignored on Wayland");
},
Some(Fullscreen::Borderless(monitor)) => { Some(Fullscreen::Borderless(monitor)) => {
let output = monitor.as_ref().and_then(|monitor| { let output = monitor.as_ref().and_then(|monitor| {
monitor.cast_ref::<output::MonitorHandle>().map(|handle| &handle.proxy) monitor.cast_ref::<output::MonitorHandle>().map(|handle| &handle.proxy)
@@ -463,6 +460,9 @@ impl CoreWindow for Window {
self.window.set_fullscreen(output) self.window.set_fullscreen(output)
}, },
Some(_) => {
warn!("this fullscreen mode is ignored on Wayland");
},
None => self.window.unset_fullscreen(), None => self.window.unset_fullscreen(),
} }
} }

View File

@@ -1269,6 +1269,7 @@ impl WindowState {
self.text_input_state = None; self.text_input_state = None;
true true
}, },
_ => return Err(ImeRequestError::NotSupported),
}; };
// Only one input method may be active per (seat, surface), // Only one input method may be active per (seat, surface),

View File

@@ -54,6 +54,7 @@ impl CustomCursor {
true, true,
) )
}, },
_ => unimplemented!("unknown `CustomCursorSource` variant"),
} }
} }

View File

@@ -153,7 +153,7 @@ pub fn pointer_source(event: &PointerEvent, kind: PointerKind) -> PointerSource
PointerSource::TabletTool { kind: tool, data } PointerSource::TabletTool { kind: tool, data }
}, },
PointerKind::Unknown => PointerSource::Unknown, _ => PointerSource::Unknown,
} }
} }

View File

@@ -88,6 +88,7 @@ pub(crate) fn request_fullscreen(
canvas.webkit_request_fullscreen(); canvas.webkit_request_fullscreen();
} }
}, },
_ => error!("This full screen mode is not supported"),
} }
} }

View File

@@ -90,7 +90,7 @@ impl PointerHandler {
PointerSource::TabletTool { kind, data } => { PointerSource::TabletTool { kind, data } => {
ButtonSource::TabletTool { kind, button: event::tool_button(button), data } ButtonSource::TabletTool { kind, button: event::tool_button(button), data }
}, },
PointerSource::Unknown => ButtonSource::Unknown(button), _ => ButtonSource::Unknown(button),
}; };
handler( handler(
@@ -152,7 +152,7 @@ impl PointerHandler {
ButtonSource::TabletTool { kind, button: event::tool_button(button), data } ButtonSource::TabletTool { kind, button: event::tool_button(button), data }
}, },
PointerSource::Unknown => ButtonSource::Unknown(button), _ => ButtonSource::Unknown(button),
}; };
handler( handler(
@@ -229,7 +229,7 @@ impl PointerHandler {
button: event::tool_button(button), button: event::tool_button(button),
data, data,
}, },
PointerSource::Unknown => ButtonSource::Unknown(button), _ => ButtonSource::Unknown(button),
}; };
button_handler( button_handler(

View File

@@ -247,6 +247,7 @@ impl TypedData for WinTypedData {
}, },
// Windows URI drag-and-drop can't be neatly expressed as a binary blob. // Windows URI drag-and-drop can't be neatly expressed as a binary blob.
SendData::Uris(_) => None, SendData::Uris(_) => None,
_ => None,
} }
} }
@@ -924,6 +925,7 @@ unsafe fn send_data_to_stgmedium(data: SendData, hint: TypeHint) -> Option<STGME
hglobal hglobal
}, },
SendData::Bytes(b) => alloc_hglobal_from(&b)?, SendData::Bytes(b) => alloc_hglobal_from(&b)?,
_ => return None,
}; };
let mut medium = unsafe { std::mem::zeroed::<STGMEDIUM>() }; let mut medium = unsafe { std::mem::zeroed::<STGMEDIUM>() };

View File

@@ -431,7 +431,7 @@ impl RootActiveEventLoop for ActiveEventLoop {
) -> Result<CustomCursor, RequestError> { ) -> Result<CustomCursor, RequestError> {
let cursor = match source { let cursor = match source {
CustomCursorSource::Image(cursor) => cursor, CustomCursorSource::Image(cursor) => cursor,
CustomCursorSource::Animation { .. } | CustomCursorSource::Url { .. } => { _ => {
return Err(NotSupportedError::new("unsupported cursor kind").into()); return Err(NotSupportedError::new("unsupported cursor kind").into());
}, },
}; };
@@ -1397,6 +1397,7 @@ unsafe fn public_window_callback_inner(
window_pos.cy = old_monitor_rect.bottom - old_monitor_rect.top; window_pos.cy = old_monitor_rect.bottom - old_monitor_rect.top;
} }
}, },
_ => (),
} }
} }
} }

View File

@@ -967,7 +967,7 @@ impl CoreWindow for Window {
| Fullscreen::Borderless(Some(monitor)) => { | Fullscreen::Borderless(Some(monitor)) => {
Some(Cow::Borrowed(monitor.cast_ref::<MonitorHandle>().unwrap())) Some(Cow::Borrowed(monitor.cast_ref::<MonitorHandle>().unwrap()))
}, },
Fullscreen::Borderless(None) => None, _ => None,
}; };
let monitor = monitor let monitor = monitor
@@ -1068,7 +1068,8 @@ impl CoreWindow for Window {
match &request { match &request {
ImeRequest::Enable(..) if cap.is_some() => return Err(ImeRequestError::AlreadyEnabled), ImeRequest::Enable(..) if cap.is_some() => return Err(ImeRequestError::AlreadyEnabled),
ImeRequest::Update(_) if cap.is_none() => return Err(ImeRequestError::NotEnabled), ImeRequest::Update(_) if cap.is_none() => return Err(ImeRequestError::NotEnabled),
_ => (), ImeRequest::Enable(..) | ImeRequest::Update(_) | ImeRequest::Disable => (),
_ => return Err(ImeRequestError::NotSupported),
} }
let window = self.window; let window = self.window;
@@ -1096,6 +1097,7 @@ impl CoreWindow for Window {
ImeContext::set_ime_allowed(window.hwnd(), false); ImeContext::set_ime_allowed(window.hwnd(), false);
return; return;
}, },
_ => return,
}; };
if let Some((spot, size)) = request_data.cursor_area { if let Some((spot, size)) = request_data.cursor_area {

View File

@@ -199,7 +199,7 @@ impl CustomCursor {
) -> Result<CustomCursor, RequestError> { ) -> Result<CustomCursor, RequestError> {
let mut cursor = match cursor { let mut cursor = match cursor {
CustomCursorSource::Image(cursor_image) => cursor_image, CustomCursorSource::Image(cursor_image) => cursor_image,
CustomCursorSource::Animation { .. } | CustomCursorSource::Url { .. } => { _ => {
return Err(NotSupportedError::new("unsupported cursor kind").into()); return Err(NotSupportedError::new("unsupported cursor kind").into());
}, },
}; };

View File

@@ -1105,9 +1105,7 @@ impl UnownedWindow {
let monitor = monitor.cast_ref::<X11MonitorHandle>().unwrap(); let monitor = monitor.cast_ref::<X11MonitorHandle>().unwrap();
(Cow::Borrowed(monitor), None) (Cow::Borrowed(monitor), None)
}, },
Fullscreen::Borderless(None) => { _ => (Cow::Owned(self.shared_state_lock().last_monitor.clone()), None),
(Cow::Owned(self.shared_state_lock().last_monitor.clone()), None)
},
}; };
// Don't set fullscreen on an invalid dummy monitor handle // Don't set fullscreen on an invalid dummy monitor handle
@@ -2144,6 +2142,7 @@ impl UnownedWindow {
self.set_ime_allowed(false); self.set_ime_allowed(false);
return Ok(()); return Ok(());
}, },
_ => return Err(ImeRequestError::NotSupported),
}; };
if let Some((position, size)) = state.cursor_area { if let Some((position, size)) = state.cursor_area {

View File

@@ -457,6 +457,7 @@ impl ApplicationHandler for Application {
MouseScrollDelta::PixelDelta(px) => { MouseScrollDelta::PixelDelta(px) => {
info!("Mouse wheel Pixel Delta: ({},{})", px.x, px.y); info!("Mouse wheel Pixel Delta: ({},{})", px.x, px.y);
}, },
_ => (),
}, },
WindowEvent::KeyboardInput { event, is_synthetic: false, .. } => { WindowEvent::KeyboardInput { event, is_synthetic: false, .. } => {
let mods = window.modifiers; let mods = window.modifiers;

View File

@@ -248,6 +248,7 @@ impl App {
} }
}, },
Ime::Disabled => info!("IME disabled for Window={:?}", surface.window().id()), Ime::Disabled => info!("IME disabled for Window={:?}", surface.window().id()),
_ => (),
} }
} }