chore(rustfmt): use nightly (#2325)

Stable rustfmt lacks a lot of features resulting in worse formatted
code, thus use nightly formatter.
This commit is contained in:
Kirill Chibisov 2024-04-26 19:11:44 +04:00 committed by GitHub
parent 7006c7ceca
commit 7b0c7b6cb2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
154 changed files with 3439 additions and 5891 deletions

View file

@ -1,12 +1,10 @@
//! The [`Window`] struct and associated types.
use std::fmt;
use crate::{
dpi::{PhysicalPosition, PhysicalSize, Position, Size},
error::{ExternalError, NotSupportedError},
monitor::{MonitorHandle, VideoModeHandle},
platform_impl::{self, PlatformSpecificWindowAttributes},
};
use crate::dpi::{PhysicalPosition, PhysicalSize, Position, Size};
use crate::error::{ExternalError, NotSupportedError};
use crate::monitor::{MonitorHandle, VideoModeHandle};
use crate::platform_impl::{self, PlatformSpecificWindowAttributes};
pub use crate::cursor::{BadImage, Cursor, CustomCursor, CustomCursorSource, MAX_CURSOR_SIZE};
pub use crate::icon::{BadIcon, Icon};
@ -239,19 +237,15 @@ impl WindowAttributes {
///
/// ## Platform-specific
///
/// - **macOS:** The top left corner position of the window content, the
/// window's "inner" position. The window title bar will be placed above
/// it. The window will be positioned such that it fits on screen,
/// maintaining set `inner_size` if any.
/// If you need to precisely position the top left corner of the whole
/// window you have to use [`Window::set_outer_position`] after creating
/// the window.
/// - **Windows:** The top left corner position of the window title bar,
/// the window's "outer" position.
/// There may be a small gap between this position and the window due to
/// the specifics of the Window Manager.
/// - **X11:** The top left corner of the window, the window's "outer"
/// position.
/// - **macOS:** The top left corner position of the window content, the window's "inner"
/// position. The window title bar will be placed above it. The window will be positioned such
/// that it fits on screen, maintaining set `inner_size` if any. If you need to precisely
/// position the top left corner of the whole window you have to use
/// [`Window::set_outer_position`] after creating the window.
/// - **Windows:** The top left corner position of the window title bar, the window's "outer"
/// position. There may be a small gap between this position and the window due to the
/// specifics of the Window Manager.
/// - **X11:** The top left corner of the window, the window's "outer" position.
/// - **Others:** Ignored.
#[inline]
pub fn with_position<P: Into<Position>>(mut self, position: P) -> Self {
@ -523,26 +517,29 @@ impl Window {
///
/// The scale factor is calculated differently on different platforms:
///
/// - **Windows:** On Windows 8 and 10, per-monitor scaling is readily configured by users from the
/// display settings. While users are free to select any option they want, they're only given a
/// selection of "nice" scale factors, i.e. 1.0, 1.25, 1.5... on Windows 7. The scale factor is
/// global and changing it requires logging out. See [this article][windows_1] for technical
/// details.
/// - **Windows:** On Windows 8 and 10, per-monitor scaling is readily configured by users from
/// the display settings. While users are free to select any option they want, they're only
/// given a selection of "nice" scale factors, i.e. 1.0, 1.25, 1.5... on Windows 7. The scale
/// factor is global and changing it requires logging out. See [this article][windows_1] for
/// technical details.
/// - **macOS:** Recent macOS versions allow the user to change the scaling factor for specific
/// displays. When available, the user may pick a per-monitor scaling factor from a set of
/// pre-defined settings. All "retina displays" have a scaling factor above 1.0 by default,
/// but the specific value varies across devices.
/// - **X11:** Many man-hours have been spent trying to figure out how to handle DPI in X11. Winit
/// currently uses a three-pronged approach:
/// - **X11:** Many man-hours have been spent trying to figure out how to handle DPI in X11.
/// Winit currently uses a three-pronged approach:
/// + Use the value in the `WINIT_X11_SCALE_FACTOR` environment variable if present.
/// + If not present, use the value set in `Xft.dpi` in Xresources.
/// + Otherwise, calculate the scale factor based on the millimeter monitor dimensions provided by XRandR.
/// + Otherwise, calculate the scale factor based on the millimeter monitor dimensions
/// provided by XRandR.
///
/// If `WINIT_X11_SCALE_FACTOR` is set to `randr`, it'll ignore the `Xft.dpi` field and use the
/// XRandR scaling method. Generally speaking, you should try to configure the standard system
/// variables to do what you want before resorting to `WINIT_X11_SCALE_FACTOR`.
/// - **Wayland:** The scale factor is suggested by the compositor for each window individually by
/// using the wp-fractional-scale protocol if available. Falls back to integer-scale factors otherwise.
/// If `WINIT_X11_SCALE_FACTOR` is set to `randr`, it'll ignore the `Xft.dpi` field and use
/// the XRandR scaling method. Generally speaking, you should try to configure the
/// standard system variables to do what you want before resorting to
/// `WINIT_X11_SCALE_FACTOR`.
/// - **Wayland:** The scale factor is suggested by the compositor for each window individually
/// by using the wp-fractional-scale protocol if available. Falls back to integer-scale
/// factors otherwise.
///
/// The monitor scale factor may differ from the window scale factor.
/// - **iOS:** Scale factors are set by Apple to the value that best suits the device, and range
@ -591,12 +588,13 @@ impl Window {
///
/// ## Platform-specific
///
/// - **Windows** This API uses `RedrawWindow` to request a `WM_PAINT` message and `RedrawRequested`
/// is emitted in sync with any `WM_PAINT` messages.
/// - **Windows** This API uses `RedrawWindow` to request a `WM_PAINT` message and
/// `RedrawRequested` is emitted in sync with any `WM_PAINT` messages.
/// - **iOS:** Can only be called on the main thread.
/// - **Wayland:** The events are aligned with the frame callbacks when [`Window::pre_present_notify`]
/// is used.
/// - **Web:** [`WindowEvent::RedrawRequested`] will be aligned with the `requestAnimationFrame`.
/// - **Wayland:** The events are aligned with the frame callbacks when
/// [`Window::pre_present_notify`] is used.
/// - **Web:** [`WindowEvent::RedrawRequested`] will be aligned with the
/// `requestAnimationFrame`.
///
/// [`WindowEvent::RedrawRequested`]: crate::event::WindowEvent::RedrawRequested
#[inline]
@ -674,8 +672,8 @@ impl Window {
///
/// - **iOS:** Can only be called on the main thread. Returns the top left coordinates of the
/// window's [safe area] in the screen space coordinate system.
/// - **Web:** Returns the top-left coordinates relative to the viewport. _Note: this returns the
/// same value as [`Window::outer_position`]._
/// - **Web:** Returns the top-left coordinates relative to the viewport. _Note: this returns
/// the same value as [`Window::outer_position`]._
/// - **Android / Wayland:** Always returns [`NotSupportedError`].
///
/// [safe area]: https://developer.apple.com/documentation/uikit/uiview/2891103-safeareainsets?language=objc
@ -744,8 +742,7 @@ impl Window {
)
.entered();
self.window
.maybe_queue_on_main(move |w| w.set_outer_position(position))
self.window.maybe_queue_on_main(move |w| w.set_outer_position(position))
}
/// Returns the physical size of the window's client area.
@ -810,19 +807,18 @@ impl Window {
size = ?size
)
.entered();
self.window
.maybe_wait_on_main(|w| w.request_inner_size(size))
self.window.maybe_wait_on_main(|w| w.request_inner_size(size))
}
/// Returns the physical size of the entire window.
///
/// These dimensions include the title bar and borders. If you don't want that (and you usually don't),
/// use [`Window::inner_size`] instead.
/// These dimensions include the title bar and borders. If you don't want that (and you usually
/// don't), use [`Window::inner_size`] instead.
///
/// ## Platform-specific
///
/// - **iOS:** Can only be called on the main thread. Returns the [`PhysicalSize`] of the window in
/// screen space coordinates.
/// - **iOS:** Can only be called on the main thread. Returns the [`PhysicalSize`] of the window
/// in screen space coordinates.
/// - **Web:** Returns the size of the canvas element. _Note: this returns the same value as
/// [`Window::inner_size`]._
#[inline]
@ -856,8 +852,7 @@ impl Window {
min_size = ?min_size
)
.entered();
self.window
.maybe_queue_on_main(move |w| w.set_min_inner_size(min_size))
self.window.maybe_queue_on_main(move |w| w.set_min_inner_size(min_size))
}
/// Sets a maximum dimension size for the window.
@ -885,8 +880,7 @@ impl Window {
max_size = ?max_size
)
.entered();
self.window
.maybe_queue_on_main(move |w| w.set_max_inner_size(max_size))
self.window.maybe_queue_on_main(move |w| w.set_max_inner_size(max_size))
}
/// Returns window resize increments if any were set.
@ -907,7 +901,8 @@ impl Window {
///
/// ## Platform-specific
///
/// - **macOS:** Increments are converted to logical size and then macOS rounds them to whole numbers.
/// - **macOS:** Increments are converted to logical size and then macOS rounds them to whole
/// numbers.
/// - **Wayland:** Not implemented.
/// - **iOS / Android / Web / Orbital:** Unsupported.
#[inline]
@ -918,8 +913,7 @@ impl Window {
increments = ?increments
)
.entered();
self.window
.maybe_queue_on_main(move |w| w.set_resize_increments(increments))
self.window.maybe_queue_on_main(move |w| w.set_resize_increments(increments))
}
}
@ -948,12 +942,12 @@ impl Window {
/// ## Platform-specific
///
/// - **Web / iOS / Android:** Unsupported.
/// - **X11:** Can only be set while building the window, with [`WindowAttributes::with_transparent`].
/// - **X11:** Can only be set while building the window, with
/// [`WindowAttributes::with_transparent`].
#[inline]
pub fn set_transparent(&self, transparent: bool) {
let _span = tracing::debug_span!("winit::Window::set_transparent", transparent).entered();
self.window
.maybe_queue_on_main(move |w| w.set_transparent(transparent))
self.window.maybe_queue_on_main(move |w| w.set_transparent(transparent))
}
/// Change the window blur state.
@ -981,13 +975,13 @@ impl Window {
#[inline]
pub fn set_visible(&self, visible: bool) {
let _span = tracing::debug_span!("winit::Window::set_visible", visible).entered();
self.window
.maybe_queue_on_main(move |w| w.set_visible(visible))
self.window.maybe_queue_on_main(move |w| w.set_visible(visible))
}
/// Gets the window's current visibility state.
///
/// `None` means it couldn't be determined, so it is not recommended to use this to drive your rendering backend.
/// `None` means it couldn't be determined, so it is not recommended to use this to drive your
/// rendering backend.
///
/// ## Platform-specific
///
@ -1001,9 +995,10 @@ impl Window {
/// Sets whether the window is resizable or not.
///
/// Note that making the window unresizable doesn't exempt you from handling [`WindowEvent::Resized`], as that
/// event can still be triggered by DPI scaling, entering fullscreen mode, etc. Also, the
/// window could still be resized by calling [`Window::request_inner_size`].
/// Note that making the window unresizable doesn't exempt you from handling
/// [`WindowEvent::Resized`], as that event can still be triggered by DPI scaling, entering
/// fullscreen mode, etc. Also, the window could still be resized by calling
/// [`Window::request_inner_size`].
///
/// ## Platform-specific
///
@ -1016,8 +1011,7 @@ impl Window {
#[inline]
pub fn set_resizable(&self, resizable: bool) {
let _span = tracing::debug_span!("winit::Window::set_resizable", resizable).entered();
self.window
.maybe_queue_on_main(move |w| w.set_resizable(resizable))
self.window.maybe_queue_on_main(move |w| w.set_resizable(resizable))
}
/// Gets the window's current resizable state.
@ -1044,8 +1038,7 @@ impl Window {
buttons = ?buttons
)
.entered();
self.window
.maybe_queue_on_main(move |w| w.set_enabled_buttons(buttons))
self.window.maybe_queue_on_main(move |w| w.set_enabled_buttons(buttons))
}
/// Gets the enabled window buttons.
@ -1068,8 +1061,7 @@ impl Window {
#[inline]
pub fn set_minimized(&self, minimized: bool) {
let _span = tracing::debug_span!("winit::Window::set_minimized", minimized).entered();
self.window
.maybe_queue_on_main(move |w| w.set_minimized(minimized))
self.window.maybe_queue_on_main(move |w| w.set_minimized(minimized))
}
/// Gets the window's current minimized state.
@ -1098,8 +1090,7 @@ impl Window {
#[inline]
pub fn set_maximized(&self, maximized: bool) {
let _span = tracing::debug_span!("winit::Window::set_maximized", maximized).entered();
self.window
.maybe_queue_on_main(move |w| w.set_maximized(maximized))
self.window.maybe_queue_on_main(move |w| w.set_maximized(maximized))
}
/// Gets the window's current maximized state.
@ -1117,11 +1108,10 @@ impl Window {
///
/// ## Platform-specific
///
/// - **macOS:** [`Fullscreen::Exclusive`] provides true exclusive mode with a
/// video mode change. *Caveat!* macOS doesn't provide task switching (or
/// spaces!) while in exclusive fullscreen mode. This mode should be used
/// when a video mode change is desired, but for a better user experience,
/// borderless fullscreen might be preferred.
/// - **macOS:** [`Fullscreen::Exclusive`] provides true exclusive mode with a video mode
/// change. *Caveat!* macOS doesn't provide task switching (or spaces!) while in exclusive
/// fullscreen mode. This mode should be used when a video mode change is desired, but for a
/// better user experience, borderless fullscreen might be preferred.
///
/// [`Fullscreen::Borderless`] provides a borderless fullscreen window on a
/// separate space. This is the idiomatic way for fullscreen games to work
@ -1143,8 +1133,7 @@ impl Window {
fullscreen = ?fullscreen
)
.entered();
self.window
.maybe_queue_on_main(move |w| w.set_fullscreen(fullscreen.map(|f| f.into())))
self.window.maybe_queue_on_main(move |w| w.set_fullscreen(fullscreen.map(|f| f.into())))
}
/// Gets the window's current fullscreen state.
@ -1158,8 +1147,7 @@ impl Window {
#[inline]
pub fn fullscreen(&self) -> Option<Fullscreen> {
let _span = tracing::debug_span!("winit::Window::fullscreen",).entered();
self.window
.maybe_wait_on_main(|w| w.fullscreen().map(|f| f.into()))
self.window.maybe_wait_on_main(|w| w.fullscreen().map(|f| f.into()))
}
/// Turn window decorations on or off.
@ -1174,8 +1162,7 @@ impl Window {
#[inline]
pub fn set_decorations(&self, decorations: bool) {
let _span = tracing::debug_span!("winit::Window::set_decorations", decorations).entered();
self.window
.maybe_queue_on_main(move |w| w.set_decorations(decorations))
self.window.maybe_queue_on_main(move |w| w.set_decorations(decorations))
}
/// Gets the window's current decorations state.
@ -1203,8 +1190,7 @@ impl Window {
level = ?level
)
.entered();
self.window
.maybe_queue_on_main(move |w| w.set_window_level(level))
self.window.maybe_queue_on_main(move |w| w.set_window_level(level))
}
/// Sets the window icon.
@ -1219,13 +1205,12 @@ impl Window {
/// - **Windows:** Sets `ICON_SMALL`. The base size for a window icon is 16x16, but it's
/// recommended to account for screen scaling and pick a multiple of that, i.e. 32x32.
///
/// - **X11:** Has no universal guidelines for icon sizes, so you're at the whims of the WM. That
/// said, it's usually in the same ballpark as on Windows.
/// - **X11:** Has no universal guidelines for icon sizes, so you're at the whims of the WM.
/// That said, it's usually in the same ballpark as on Windows.
#[inline]
pub fn set_window_icon(&self, window_icon: Option<Icon>) {
let _span = tracing::debug_span!("winit::Window::set_window_icon",).entered();
self.window
.maybe_queue_on_main(move |w| w.set_window_icon(window_icon))
self.window.maybe_queue_on_main(move |w| w.set_window_icon(window_icon))
}
/// Set the IME cursor editing area, where the `position` is the top left corner of that area
@ -1272,8 +1257,7 @@ impl Window {
size = ?size,
)
.entered();
self.window
.maybe_queue_on_main(move |w| w.set_ime_cursor_area(position, size))
self.window.maybe_queue_on_main(move |w| w.set_ime_cursor_area(position, size))
}
/// Sets whether the window should get IME events
@ -1290,7 +1274,8 @@ impl Window {
///
/// ## Platform-specific
///
/// - **macOS:** IME must be enabled to receive text-input where dead-key sequences are combined.
/// - **macOS:** IME must be enabled to receive text-input where dead-key sequences are
/// combined.
/// - **iOS / Android / Web / Orbital:** Unsupported.
/// - **X11**: Enabling IME will disable dead keys reporting during compose.
///
@ -1299,8 +1284,7 @@ impl Window {
#[inline]
pub fn set_ime_allowed(&self, allowed: bool) {
let _span = tracing::debug_span!("winit::Window::set_ime_allowed", allowed).entered();
self.window
.maybe_queue_on_main(move |w| w.set_ime_allowed(allowed))
self.window.maybe_queue_on_main(move |w| w.set_ime_allowed(allowed))
}
/// Sets the IME purpose for the window using [`ImePurpose`].
@ -1315,8 +1299,7 @@ impl Window {
purpose = ?purpose
)
.entered();
self.window
.maybe_queue_on_main(move |w| w.set_ime_purpose(purpose))
self.window.maybe_queue_on_main(move |w| w.set_ime_purpose(purpose))
}
/// Brings the window to the front and sets input focus. Has no effect if the window is
@ -1366,8 +1349,7 @@ impl Window {
request_type = ?request_type
)
.entered();
self.window
.maybe_queue_on_main(move |w| w.request_user_attention(request_type))
self.window.maybe_queue_on_main(move |w| w.request_user_attention(request_type))
}
/// Sets the current window theme. Use `None` to fallback to system default.
@ -1375,9 +1357,10 @@ impl Window {
/// ## Platform-specific
///
/// - **macOS:** This is an app-wide setting.
/// - **Wayland:** Sets the theme for the client side decorations. Using `None` will use dbus
/// to get the system preference.
/// - **X11:** Sets `_GTK_THEME_VARIANT` hint to `dark` or `light` and if `None` is used, it will default to [`Theme::Dark`].
/// - **Wayland:** Sets the theme for the client side decorations. Using `None` will use dbus to
/// get the system preference.
/// - **X11:** Sets `_GTK_THEME_VARIANT` hint to `dark` or `light` and if `None` is used, it
/// will default to [`Theme::Dark`].
/// - **iOS / Android / Web / Orbital:** Unsupported.
#[inline]
pub fn set_theme(&self, theme: Option<Theme>) {
@ -1413,8 +1396,7 @@ impl Window {
pub fn set_content_protected(&self, protected: bool) {
let _span =
tracing::debug_span!("winit::Window::set_content_protected", protected).entered();
self.window
.maybe_queue_on_main(move |w| w.set_content_protected(protected))
self.window.maybe_queue_on_main(move |w| w.set_content_protected(protected))
}
/// Gets the current title of the window.
@ -1436,14 +1418,13 @@ impl Window {
/// ## Platform-specific
///
/// - **iOS / Android / Orbital:** Unsupported.
/// - **Web:** Custom cursors have to be loaded and decoded first, until
/// then the previous cursor is shown.
/// - **Web:** Custom cursors have to be loaded and decoded first, until then the previous
/// cursor is shown.
#[inline]
pub fn set_cursor(&self, cursor: impl Into<Cursor>) {
let cursor = cursor.into();
let _span = tracing::debug_span!("winit::Window::set_cursor",).entered();
self.window
.maybe_queue_on_main(move |w| w.set_cursor(cursor))
self.window.maybe_queue_on_main(move |w| w.set_cursor(cursor))
}
/// Deprecated! Use [`Window::set_cursor()`] instead.
@ -1479,8 +1460,7 @@ impl Window {
position = ?position
)
.entered();
self.window
.maybe_wait_on_main(|w| w.set_cursor_position(position))
self.window.maybe_wait_on_main(|w| w.set_cursor_position(position))
}
/// Set grabbing [mode][CursorGrabMode] on the cursor preventing it from leaving the window.
@ -1492,9 +1472,10 @@ impl Window {
/// ```no_run
/// # use winit::window::{CursorGrabMode, Window};
/// # fn scope(window: &Window) {
/// window.set_cursor_grab(CursorGrabMode::Confined)
/// .or_else(|_e| window.set_cursor_grab(CursorGrabMode::Locked))
/// .unwrap();
/// window
/// .set_cursor_grab(CursorGrabMode::Confined)
/// .or_else(|_e| window.set_cursor_grab(CursorGrabMode::Locked))
/// .unwrap();
/// # }
/// ```
#[inline]
@ -1516,14 +1497,13 @@ impl Window {
/// - **Windows:** The cursor is only hidden within the confines of the window.
/// - **X11:** The cursor is only hidden within the confines of the window.
/// - **Wayland:** The cursor is only hidden within the confines of the window.
/// - **macOS:** The cursor is hidden as long as the window has input focus, even if the cursor is
/// outside of the window.
/// - **macOS:** The cursor is hidden as long as the window has input focus, even if the cursor
/// is outside of the window.
/// - **iOS / Android:** Unsupported.
#[inline]
pub fn set_cursor_visible(&self, visible: bool) {
let _span = tracing::debug_span!("winit::Window::set_cursor_visible", visible).entered();
self.window
.maybe_queue_on_main(move |w| w.set_cursor_visible(visible))
self.window.maybe_queue_on_main(move |w| w.set_cursor_visible(visible))
}
/// Moves the window with the left mouse button until the button is released.
@ -1559,8 +1539,7 @@ impl Window {
direction = ?direction
)
.entered();
self.window
.maybe_wait_on_main(|w| w.drag_resize_window(direction))
self.window.maybe_wait_on_main(|w| w.drag_resize_window(direction))
}
/// Show [window menu] at a specified position .
@ -1579,14 +1558,14 @@ impl Window {
position = ?position
)
.entered();
self.window
.maybe_queue_on_main(move |w| w.show_window_menu(position))
self.window.maybe_queue_on_main(move |w| w.show_window_menu(position))
}
/// Modifies whether the window catches cursor events.
///
/// If `true`, the window will catch the cursor events. If `false`, events are passed through
/// the window such that any other window behind it receives them. By default hittest is enabled.
/// the window such that any other window behind it receives them. By default hittest is
/// enabled.
///
/// ## Platform-specific
///
@ -1594,8 +1573,7 @@ impl Window {
#[inline]
pub fn set_cursor_hittest(&self, hittest: bool) -> Result<(), ExternalError> {
let _span = tracing::debug_span!("winit::Window::set_cursor_hittest", hittest).entered();
self.window
.maybe_wait_on_main(|w| w.set_cursor_hittest(hittest))
self.window.maybe_wait_on_main(|w| w.set_cursor_hittest(hittest))
}
}
@ -1607,22 +1585,20 @@ impl Window {
#[inline]
pub fn current_monitor(&self) -> Option<MonitorHandle> {
let _span = tracing::debug_span!("winit::Window::current_monitor",).entered();
self.window
.maybe_wait_on_main(|w| w.current_monitor().map(|inner| MonitorHandle { inner }))
self.window.maybe_wait_on_main(|w| w.current_monitor().map(|inner| MonitorHandle { inner }))
}
/// Returns the list of all the monitors available on the system.
///
/// This is the same as [`ActiveEventLoop::available_monitors`], and is provided for convenience.
/// This is the same as [`ActiveEventLoop::available_monitors`], and is provided for
/// convenience.
///
/// [`ActiveEventLoop::available_monitors`]: crate::event_loop::ActiveEventLoop::available_monitors
#[inline]
pub fn available_monitors(&self) -> impl Iterator<Item = MonitorHandle> {
let _span = tracing::debug_span!("winit::Window::available_monitors",).entered();
self.window.maybe_wait_on_main(|w| {
w.available_monitors()
.into_iter()
.map(|inner| MonitorHandle { inner })
w.available_monitors().into_iter().map(|inner| MonitorHandle { inner })
})
}
@ -1640,8 +1616,7 @@ impl Window {
#[inline]
pub fn primary_monitor(&self) -> Option<MonitorHandle> {
let _span = tracing::debug_span!("winit::Window::primary_monitor",).entered();
self.window
.maybe_wait_on_main(|w| w.primary_monitor().map(|inner| MonitorHandle { inner }))
self.window.maybe_wait_on_main(|w| w.primary_monitor().map(|inner| MonitorHandle { inner }))
}
}
@ -1681,9 +1656,7 @@ unsafe impl<T> Send for UnsafeSendWrapper<T> {}
#[cfg(feature = "rwh_05")]
unsafe impl rwh_05::HasRawWindowHandle for Window {
fn raw_window_handle(&self) -> rwh_05::RawWindowHandle {
self.window
.maybe_wait_on_main(|w| UnsafeSendWrapper(w.raw_window_handle_rwh_05()))
.0
self.window.maybe_wait_on_main(|w| UnsafeSendWrapper(w.raw_window_handle_rwh_05())).0
}
}
@ -1694,18 +1667,14 @@ unsafe impl rwh_05::HasRawDisplayHandle for Window {
///
/// [`EventLoop`]: crate::event_loop::EventLoop
fn raw_display_handle(&self) -> rwh_05::RawDisplayHandle {
self.window
.maybe_wait_on_main(|w| UnsafeSendWrapper(w.raw_display_handle_rwh_05()))
.0
self.window.maybe_wait_on_main(|w| UnsafeSendWrapper(w.raw_display_handle_rwh_05())).0
}
}
#[cfg(feature = "rwh_04")]
unsafe impl rwh_04::HasRawWindowHandle for Window {
fn raw_window_handle(&self) -> rwh_04::RawWindowHandle {
self.window
.maybe_wait_on_main(|w| UnsafeSendWrapper(w.raw_window_handle_rwh_04()))
.0
self.window.maybe_wait_on_main(|w| UnsafeSendWrapper(w.raw_window_handle_rwh_04())).0
}
}
@ -1736,7 +1705,8 @@ pub enum CursorGrabMode {
///
/// ## Platform-specific
///
/// - **X11 / Windows:** Not implemented. Always returns [`ExternalError::NotSupported`] for now.
/// - **X11 / Windows:** Not implemented. Always returns [`ExternalError::NotSupported`] for
/// now.
/// - **iOS / Android:** Always returns an [`ExternalError::NotSupported`].
Locked,
}
@ -1792,7 +1762,8 @@ pub enum Theme {
/// ## Platform-specific
///
/// - **X11:** Sets the WM's `XUrgencyHint`. No distinction between [`Critical`] and [`Informational`].
/// - **X11:** Sets the WM's `XUrgencyHint`. No distinction between [`Critical`] and
/// [`Informational`].
///
/// [`Critical`]: Self::Critical
/// [`Informational`]: Self::Informational
@ -1801,7 +1772,8 @@ pub enum UserAttentionType {
/// ## Platform-specific
///
/// - **macOS:** Bounces the dock icon until the application is in focus.
/// - **Windows:** Flashes both the window and the taskbar button until the application is in focus.
/// - **Windows:** Flashes both the window and the taskbar button until the application is in
/// focus.
Critical,
/// ## Platform-specific