Replace log with tracing
Tracing is a modern replacement for the log crate that allows for annotating log messages with the function that they come from. Signed-off-by: John Nunley <dev@notgull.net> Closes: #3482
This commit is contained in:
parent
96172693fe
commit
944347696a
44 changed files with 249 additions and 68 deletions
130
src/window.rs
130
src/window.rs
|
|
@ -528,6 +528,8 @@ impl Window {
|
|||
/// Returns an identifier unique to the window.
|
||||
#[inline]
|
||||
pub fn id(&self) -> WindowId {
|
||||
let _span = tracing::debug_span!("winit::Window::id",).entered();
|
||||
|
||||
self.window.maybe_wait_on_main(|w| WindowId(w.id()))
|
||||
}
|
||||
|
||||
|
|
@ -591,6 +593,8 @@ impl Window {
|
|||
/// [`contentScaleFactor`]: https://developer.apple.com/documentation/uikit/uiview/1622657-contentscalefactor?language=objc
|
||||
#[inline]
|
||||
pub fn scale_factor(&self) -> f64 {
|
||||
let _span = tracing::debug_span!("winit::Window::scale_factor",).entered();
|
||||
|
||||
self.window.maybe_wait_on_main(|w| w.scale_factor())
|
||||
}
|
||||
|
||||
|
|
@ -622,6 +626,8 @@ impl Window {
|
|||
/// [`WindowEvent::RedrawRequested`]: crate::event::WindowEvent::RedrawRequested
|
||||
#[inline]
|
||||
pub fn request_redraw(&self) {
|
||||
let _span = tracing::debug_span!("winit::Window::request_redraw",).entered();
|
||||
|
||||
self.window.maybe_queue_on_main(|w| w.request_redraw())
|
||||
}
|
||||
|
||||
|
|
@ -658,6 +664,8 @@ impl Window {
|
|||
/// [`WindowEvent::RedrawRequested`]: crate::event::WindowEvent::RedrawRequested
|
||||
#[inline]
|
||||
pub fn pre_present_notify(&self) {
|
||||
let _span = tracing::debug_span!("winit::Window::pre_present_notify",).entered();
|
||||
|
||||
self.window.maybe_queue_on_main(|w| w.pre_present_notify());
|
||||
}
|
||||
|
||||
|
|
@ -674,6 +682,8 @@ impl Window {
|
|||
// at least, then this function should be provided through a platform specific
|
||||
// extension trait
|
||||
pub fn reset_dead_keys(&self) {
|
||||
let _span = tracing::debug_span!("winit::Window::reset_dead_keys",).entered();
|
||||
|
||||
self.window.maybe_queue_on_main(|w| w.reset_dead_keys())
|
||||
}
|
||||
}
|
||||
|
|
@ -696,6 +706,8 @@ impl Window {
|
|||
/// [safe area]: https://developer.apple.com/documentation/uikit/uiview/2891103-safeareainsets?language=objc
|
||||
#[inline]
|
||||
pub fn inner_position(&self) -> Result<PhysicalPosition<i32>, NotSupportedError> {
|
||||
let _span = tracing::debug_span!("winit::Window::inner_position",).entered();
|
||||
|
||||
self.window.maybe_wait_on_main(|w| w.inner_position())
|
||||
}
|
||||
|
||||
|
|
@ -717,6 +729,8 @@ impl Window {
|
|||
/// - **Android / Wayland:** Always returns [`NotSupportedError`].
|
||||
#[inline]
|
||||
pub fn outer_position(&self) -> Result<PhysicalPosition<i32>, NotSupportedError> {
|
||||
let _span = tracing::debug_span!("winit::Window::outer_position",).entered();
|
||||
|
||||
self.window.maybe_wait_on_main(|w| w.outer_position())
|
||||
}
|
||||
|
||||
|
|
@ -749,6 +763,12 @@ impl Window {
|
|||
#[inline]
|
||||
pub fn set_outer_position<P: Into<Position>>(&self, position: P) {
|
||||
let position = position.into();
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::set_outer_position",
|
||||
position = ?position
|
||||
)
|
||||
.entered();
|
||||
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.set_outer_position(position))
|
||||
}
|
||||
|
|
@ -767,6 +787,8 @@ impl Window {
|
|||
/// [`transform`]: https://developer.mozilla.org/en-US/docs/Web/CSS/transform
|
||||
#[inline]
|
||||
pub fn inner_size(&self) -> PhysicalSize<u32> {
|
||||
let _span = tracing::debug_span!("winit::Window::inner_size",).entered();
|
||||
|
||||
self.window.maybe_wait_on_main(|w| w.inner_size())
|
||||
}
|
||||
|
||||
|
|
@ -808,6 +830,11 @@ impl Window {
|
|||
#[must_use]
|
||||
pub fn request_inner_size<S: Into<Size>>(&self, size: S) -> Option<PhysicalSize<u32>> {
|
||||
let size = size.into();
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::request_inner_size",
|
||||
size = ?size
|
||||
)
|
||||
.entered();
|
||||
self.window
|
||||
.maybe_wait_on_main(|w| w.request_inner_size(size))
|
||||
}
|
||||
|
|
@ -825,6 +852,7 @@ impl Window {
|
|||
/// [`Window::inner_size`]._
|
||||
#[inline]
|
||||
pub fn outer_size(&self) -> PhysicalSize<u32> {
|
||||
let _span = tracing::debug_span!("winit::Window::outer_size",).entered();
|
||||
self.window.maybe_wait_on_main(|w| w.outer_size())
|
||||
}
|
||||
|
||||
|
|
@ -848,6 +876,11 @@ impl Window {
|
|||
#[inline]
|
||||
pub fn set_min_inner_size<S: Into<Size>>(&self, min_size: Option<S>) {
|
||||
let min_size = min_size.map(|s| s.into());
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::set_min_inner_size",
|
||||
min_size = ?min_size
|
||||
)
|
||||
.entered();
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.set_min_inner_size(min_size))
|
||||
}
|
||||
|
|
@ -872,6 +905,11 @@ impl Window {
|
|||
#[inline]
|
||||
pub fn set_max_inner_size<S: Into<Size>>(&self, max_size: Option<S>) {
|
||||
let max_size = max_size.map(|s| s.into());
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::max_size",
|
||||
max_size = ?max_size
|
||||
)
|
||||
.entered();
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.set_max_inner_size(max_size))
|
||||
}
|
||||
|
|
@ -883,6 +921,7 @@ impl Window {
|
|||
/// - **iOS / Android / Web / Wayland / Windows / Orbital:** Always returns [`None`].
|
||||
#[inline]
|
||||
pub fn resize_increments(&self) -> Option<PhysicalSize<u32>> {
|
||||
let _span = tracing::debug_span!("winit::Window::resize_increments",).entered();
|
||||
self.window.maybe_wait_on_main(|w| w.resize_increments())
|
||||
}
|
||||
|
||||
|
|
@ -899,6 +938,11 @@ impl Window {
|
|||
#[inline]
|
||||
pub fn set_resize_increments<S: Into<Size>>(&self, increments: Option<S>) {
|
||||
let increments = increments.map(Into::into);
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::set_resize_increments",
|
||||
increments = ?increments
|
||||
)
|
||||
.entered();
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.set_resize_increments(increments))
|
||||
}
|
||||
|
|
@ -913,6 +957,7 @@ impl Window {
|
|||
/// - **iOS / Android:** Unsupported.
|
||||
#[inline]
|
||||
pub fn set_title(&self, title: &str) {
|
||||
let _span = tracing::debug_span!("winit::Window::set_title", title).entered();
|
||||
self.window.maybe_wait_on_main(|w| w.set_title(title))
|
||||
}
|
||||
|
||||
|
|
@ -931,6 +976,7 @@ impl Window {
|
|||
/// - **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))
|
||||
}
|
||||
|
|
@ -945,6 +991,7 @@ impl Window {
|
|||
/// - **Wayland:** Only works with org_kde_kwin_blur_manager protocol.
|
||||
#[inline]
|
||||
pub fn set_blur(&self, blur: bool) {
|
||||
let _span = tracing::debug_span!("winit::Window::set_blur", blur).entered();
|
||||
self.window.maybe_queue_on_main(move |w| w.set_blur(blur))
|
||||
}
|
||||
|
||||
|
|
@ -958,6 +1005,7 @@ impl Window {
|
|||
/// - **iOS:** Can only be called on the main thread.
|
||||
#[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))
|
||||
}
|
||||
|
|
@ -972,6 +1020,7 @@ impl Window {
|
|||
/// - **Wayland / iOS / Android / Web:** Unsupported.
|
||||
#[inline]
|
||||
pub fn is_visible(&self) -> Option<bool> {
|
||||
let _span = tracing::debug_span!("winit::Window::is_visible",).entered();
|
||||
self.window.maybe_wait_on_main(|w| w.is_visible())
|
||||
}
|
||||
|
||||
|
|
@ -991,6 +1040,7 @@ impl Window {
|
|||
/// [`WindowEvent::Resized`]: crate::event::WindowEvent::Resized
|
||||
#[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))
|
||||
}
|
||||
|
|
@ -1003,6 +1053,7 @@ impl Window {
|
|||
/// - **iOS / Android / Web:** Unsupported.
|
||||
#[inline]
|
||||
pub fn is_resizable(&self) -> bool {
|
||||
let _span = tracing::debug_span!("winit::Window::is_resizable",).entered();
|
||||
self.window.maybe_wait_on_main(|w| w.is_resizable())
|
||||
}
|
||||
|
||||
|
|
@ -1013,6 +1064,11 @@ impl Window {
|
|||
/// - **Wayland / X11 / Orbital:** Not implemented.
|
||||
/// - **Web / iOS / Android:** Unsupported.
|
||||
pub fn set_enabled_buttons(&self, buttons: WindowButtons) {
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::set_enabled_buttons",
|
||||
buttons = ?buttons
|
||||
)
|
||||
.entered();
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.set_enabled_buttons(buttons))
|
||||
}
|
||||
|
|
@ -1024,6 +1080,7 @@ impl Window {
|
|||
/// - **Wayland / X11 / Orbital:** Not implemented. Always returns [`WindowButtons::all`].
|
||||
/// - **Web / iOS / Android:** Unsupported. Always returns [`WindowButtons::all`].
|
||||
pub fn enabled_buttons(&self) -> WindowButtons {
|
||||
let _span = tracing::debug_span!("winit::Window::enabled_buttons",).entered();
|
||||
self.window.maybe_wait_on_main(|w| w.enabled_buttons())
|
||||
}
|
||||
|
||||
|
|
@ -1035,6 +1092,7 @@ impl Window {
|
|||
/// - **Wayland:** Un-minimize is unsupported.
|
||||
#[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))
|
||||
}
|
||||
|
|
@ -1053,6 +1111,7 @@ impl Window {
|
|||
/// - **iOS / Android / Web / Orbital:** Unsupported.
|
||||
#[inline]
|
||||
pub fn is_minimized(&self) -> Option<bool> {
|
||||
let _span = tracing::debug_span!("winit::Window::is_minimized",).entered();
|
||||
self.window.maybe_wait_on_main(|w| w.is_minimized())
|
||||
}
|
||||
|
||||
|
|
@ -1063,6 +1122,7 @@ impl Window {
|
|||
/// - **iOS / Android / Web:** Unsupported.
|
||||
#[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))
|
||||
}
|
||||
|
|
@ -1074,6 +1134,7 @@ impl Window {
|
|||
/// - **iOS / Android / Web:** Unsupported.
|
||||
#[inline]
|
||||
pub fn is_maximized(&self) -> bool {
|
||||
let _span = tracing::debug_span!("winit::Window::is_maximized",).entered();
|
||||
self.window.maybe_wait_on_main(|w| w.is_maximized())
|
||||
}
|
||||
|
||||
|
|
@ -1102,6 +1163,11 @@ impl Window {
|
|||
/// [transient activation]: https://developer.mozilla.org/en-US/docs/Glossary/Transient_activation
|
||||
#[inline]
|
||||
pub fn set_fullscreen(&self, fullscreen: Option<Fullscreen>) {
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::set_fullscreen",
|
||||
fullscreen = ?fullscreen
|
||||
)
|
||||
.entered();
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.set_fullscreen(fullscreen.map(|f| f.into())))
|
||||
}
|
||||
|
|
@ -1116,6 +1182,7 @@ impl Window {
|
|||
/// - **Web:** Can only return `None` or `Borderless(None)`.
|
||||
#[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()))
|
||||
}
|
||||
|
|
@ -1131,6 +1198,7 @@ impl Window {
|
|||
/// - **iOS / Android / Web:** No effect.
|
||||
#[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))
|
||||
}
|
||||
|
|
@ -1145,6 +1213,7 @@ impl Window {
|
|||
/// - **iOS / Android / Web:** Always returns `true`.
|
||||
#[inline]
|
||||
pub fn is_decorated(&self) -> bool {
|
||||
let _span = tracing::debug_span!("winit::Window::is_decorated",).entered();
|
||||
self.window.maybe_wait_on_main(|w| w.is_decorated())
|
||||
}
|
||||
|
||||
|
|
@ -1154,6 +1223,11 @@ impl Window {
|
|||
///
|
||||
/// See [`WindowLevel`] for details.
|
||||
pub fn set_window_level(&self, level: WindowLevel) {
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::set_window_level",
|
||||
level = ?level
|
||||
)
|
||||
.entered();
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.set_window_level(level))
|
||||
}
|
||||
|
|
@ -1174,6 +1248,7 @@ impl Window {
|
|||
/// 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))
|
||||
}
|
||||
|
|
@ -1216,6 +1291,12 @@ impl Window {
|
|||
pub fn set_ime_cursor_area<P: Into<Position>, S: Into<Size>>(&self, position: P, size: S) {
|
||||
let position = position.into();
|
||||
let size = size.into();
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::set_ime_cursor_area",
|
||||
position = ?position,
|
||||
size = ?size,
|
||||
)
|
||||
.entered();
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.set_ime_cursor_area(position, size))
|
||||
}
|
||||
|
|
@ -1242,6 +1323,7 @@ impl Window {
|
|||
/// [`KeyboardInput`]: crate::event::WindowEvent::KeyboardInput
|
||||
#[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))
|
||||
}
|
||||
|
|
@ -1253,6 +1335,11 @@ impl Window {
|
|||
/// - **iOS / Android / Web / Windows / X11 / macOS / Orbital:** Unsupported.
|
||||
#[inline]
|
||||
pub fn set_ime_purpose(&self, purpose: ImePurpose) {
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::set_ime_purpose",
|
||||
purpose = ?purpose
|
||||
)
|
||||
.entered();
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.set_ime_purpose(purpose))
|
||||
}
|
||||
|
|
@ -1269,6 +1356,7 @@ impl Window {
|
|||
/// - **iOS / Android / Wayland / Orbital:** Unsupported.
|
||||
#[inline]
|
||||
pub fn focus_window(&self) {
|
||||
let _span = tracing::debug_span!("winit::Window::focus_window",).entered();
|
||||
self.window.maybe_queue_on_main(|w| w.focus_window())
|
||||
}
|
||||
|
||||
|
|
@ -1279,6 +1367,7 @@ impl Window {
|
|||
/// [`WindowEvent::Focused`]: crate::event::WindowEvent::Focused
|
||||
#[inline]
|
||||
pub fn has_focus(&self) -> bool {
|
||||
let _span = tracing::debug_span!("winit::Window::has_focus",).entered();
|
||||
self.window.maybe_wait_on_main(|w| w.has_focus())
|
||||
}
|
||||
|
||||
|
|
@ -1297,6 +1386,11 @@ impl Window {
|
|||
/// - **Wayland:** Requires `xdg_activation_v1` protocol, `None` has no effect.
|
||||
#[inline]
|
||||
pub fn request_user_attention(&self, request_type: Option<UserAttentionType>) {
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::request_user_attention",
|
||||
request_type = ?request_type
|
||||
)
|
||||
.entered();
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.request_user_attention(request_type))
|
||||
}
|
||||
|
|
@ -1312,6 +1406,11 @@ impl Window {
|
|||
/// - **iOS / Android / Web / Orbital:** Unsupported.
|
||||
#[inline]
|
||||
pub fn set_theme(&self, theme: Option<Theme>) {
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::set_theme",
|
||||
theme = ?theme
|
||||
)
|
||||
.entered();
|
||||
self.window.maybe_queue_on_main(move |w| w.set_theme(theme))
|
||||
}
|
||||
|
||||
|
|
@ -1323,6 +1422,7 @@ impl Window {
|
|||
/// - **iOS / Android / Wayland / x11 / Orbital:** Unsupported.
|
||||
#[inline]
|
||||
pub fn theme(&self) -> Option<Theme> {
|
||||
let _span = tracing::debug_span!("winit::Window::theme",).entered();
|
||||
self.window.maybe_wait_on_main(|w| w.theme())
|
||||
}
|
||||
|
||||
|
|
@ -1336,6 +1436,8 @@ impl Window {
|
|||
///
|
||||
/// [`NSWindowSharingNone`]: https://developer.apple.com/documentation/appkit/nswindowsharingtype/nswindowsharingnone
|
||||
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))
|
||||
}
|
||||
|
|
@ -1347,6 +1449,7 @@ impl Window {
|
|||
/// - **iOS / Android / x11 / Wayland / Web:** Unsupported. Always returns an empty string.
|
||||
#[inline]
|
||||
pub fn title(&self) -> String {
|
||||
let _span = tracing::debug_span!("winit::Window::title",).entered();
|
||||
self.window.maybe_wait_on_main(|w| w.title())
|
||||
}
|
||||
}
|
||||
|
|
@ -1363,6 +1466,7 @@ impl Window {
|
|||
#[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))
|
||||
}
|
||||
|
|
@ -1395,6 +1499,11 @@ impl Window {
|
|||
#[inline]
|
||||
pub fn set_cursor_position<P: Into<Position>>(&self, position: P) -> Result<(), ExternalError> {
|
||||
let position = position.into();
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::set_cursor_position",
|
||||
position = ?position
|
||||
)
|
||||
.entered();
|
||||
self.window
|
||||
.maybe_wait_on_main(|w| w.set_cursor_position(position))
|
||||
}
|
||||
|
|
@ -1415,6 +1524,11 @@ impl Window {
|
|||
/// ```
|
||||
#[inline]
|
||||
pub fn set_cursor_grab(&self, mode: CursorGrabMode) -> Result<(), ExternalError> {
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::set_cursor_grab",
|
||||
mode = ?mode
|
||||
)
|
||||
.entered();
|
||||
self.window.maybe_wait_on_main(|w| w.set_cursor_grab(mode))
|
||||
}
|
||||
|
||||
|
|
@ -1432,6 +1546,7 @@ impl 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))
|
||||
}
|
||||
|
|
@ -1449,6 +1564,7 @@ impl Window {
|
|||
/// - **iOS / Android / Web:** Always returns an [`ExternalError::NotSupported`].
|
||||
#[inline]
|
||||
pub fn drag_window(&self) -> Result<(), ExternalError> {
|
||||
let _span = tracing::debug_span!("winit::Window::drag_window",).entered();
|
||||
self.window.maybe_wait_on_main(|w| w.drag_window())
|
||||
}
|
||||
|
||||
|
|
@ -1463,6 +1579,11 @@ impl Window {
|
|||
/// - **iOS / Android / Web:** Always returns an [`ExternalError::NotSupported`].
|
||||
#[inline]
|
||||
pub fn drag_resize_window(&self, direction: ResizeDirection) -> Result<(), ExternalError> {
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::drag_resize_window",
|
||||
direction = ?direction
|
||||
)
|
||||
.entered();
|
||||
self.window
|
||||
.maybe_wait_on_main(|w| w.drag_resize_window(direction))
|
||||
}
|
||||
|
|
@ -1478,6 +1599,11 @@ impl Window {
|
|||
/// [window menu]: https://en.wikipedia.org/wiki/Common_menus_in_Microsoft_Windows#System_menu
|
||||
pub fn show_window_menu(&self, position: impl Into<Position>) {
|
||||
let position = position.into();
|
||||
let _span = tracing::debug_span!(
|
||||
"winit::Window::show_window_menu",
|
||||
position = ?position
|
||||
)
|
||||
.entered();
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.show_window_menu(position))
|
||||
}
|
||||
|
|
@ -1492,6 +1618,7 @@ impl Window {
|
|||
/// - **iOS / Android / Web / Orbital:** Always returns an [`ExternalError::NotSupported`].
|
||||
#[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))
|
||||
}
|
||||
|
|
@ -1504,6 +1631,7 @@ impl Window {
|
|||
/// Returns `None` if current monitor can't be detected.
|
||||
#[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 }))
|
||||
}
|
||||
|
|
@ -1515,6 +1643,7 @@ impl Window {
|
|||
/// [`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()
|
||||
|
|
@ -1535,6 +1664,7 @@ impl Window {
|
|||
/// [`ActiveEventLoop::primary_monitor`]: crate::event_loop::ActiveEventLoop::primary_monitor
|
||||
#[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 }))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue