Skip to content

Commit

Permalink
Make the winit adapter docs explicit about needing to make the window…
Browse files Browse the repository at this point in the history
… initially invisible, as I did for the subclassing adapters
  • Loading branch information
mwcampbell committed Aug 24, 2023
1 parent cfe1558 commit 2107b39
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions platforms/winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ pub struct Adapter {
}

impl Adapter {
/// Creates a new AccessKit adapter for a winit window. This must be done
/// before the window is shown for the first time. This means that you must
/// use [`winit::window::WindowBuilder::with_visible`] to make the window
/// initially invisible, then create the adapter, then show the window.
pub fn new<T: From<ActionRequestEvent> + Send + 'static>(
window: &Window,
source: impl 'static + FnOnce() -> TreeUpdate + Send,
Expand All @@ -158,6 +162,11 @@ impl Adapter {
Self::with_action_handler(window, source, Box::new(action_handler))
}

/// Creates a new AccessKit adapter for a winit window. This must be done
/// before the window is shown for the first time. This means that you must
/// use [`winit::window::WindowBuilder::with_visible`] to make the window
/// initially invisible, then create the adapter, then show the window.
///
/// Use this if you need to provide your own AccessKit action handler
/// rather than dispatching action requests through the winit event loop.
/// Remember that an AccessKit action handler can be called on any thread,
Expand Down

0 comments on commit 2107b39

Please sign in to comment.