From 2107b39c4a490ca92e3fe00a187397c08d1685b5 Mon Sep 17 00:00:00 2001 From: Matt Campbell Date: Thu, 24 Aug 2023 09:45:18 -0500 Subject: [PATCH] Make the winit adapter docs explicit about needing to make the window initially invisible, as I did for the subclassing adapters --- platforms/winit/src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/platforms/winit/src/lib.rs b/platforms/winit/src/lib.rs index 99b865486..c6f4c95f0 100644 --- a/platforms/winit/src/lib.rs +++ b/platforms/winit/src/lib.rs @@ -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 + Send + 'static>( window: &Window, source: impl 'static + FnOnce() -> TreeUpdate + Send, @@ -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,