bevy_winit: Create the window initially invisible as required by AccessKit (#18346)
The initial `with_visible` call was intended to do this, but that was undone by a later `with_visible` call.
This commit is contained in:
parent
79655269f5
commit
35526743b3
@ -110,14 +110,16 @@ impl WinitWindows {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// It's crucial to avoid setting the window's final visibility here;
|
||||||
|
// as explained above, the window must be invisible until the AccessKit
|
||||||
|
// adapter is created.
|
||||||
winit_window_attributes = winit_window_attributes
|
winit_window_attributes = winit_window_attributes
|
||||||
.with_window_level(convert_window_level(window.window_level))
|
.with_window_level(convert_window_level(window.window_level))
|
||||||
.with_theme(window.window_theme.map(convert_window_theme))
|
.with_theme(window.window_theme.map(convert_window_theme))
|
||||||
.with_resizable(window.resizable)
|
.with_resizable(window.resizable)
|
||||||
.with_enabled_buttons(convert_enabled_buttons(window.enabled_buttons))
|
.with_enabled_buttons(convert_enabled_buttons(window.enabled_buttons))
|
||||||
.with_decorations(window.decorations)
|
.with_decorations(window.decorations)
|
||||||
.with_transparent(window.transparent)
|
.with_transparent(window.transparent);
|
||||||
.with_visible(window.visible);
|
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
{
|
{
|
||||||
@ -284,6 +286,10 @@ impl WinitWindows {
|
|||||||
handlers,
|
handlers,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Now that the AccessKit adapter is created, it's safe to show
|
||||||
|
// the window.
|
||||||
|
winit_window.set_visible(window.visible);
|
||||||
|
|
||||||
// Do not set the grab mode on window creation if it's none. It can fail on mobile.
|
// Do not set the grab mode on window creation if it's none. It can fail on mobile.
|
||||||
if window.cursor_options.grab_mode != CursorGrabMode::None {
|
if window.cursor_options.grab_mode != CursorGrabMode::None {
|
||||||
let _ = attempt_grab(&winit_window, window.cursor_options.grab_mode);
|
let _ = attempt_grab(&winit_window, window.cursor_options.grab_mode);
|
||||||
|
Loading…
Reference in New Issue
Block a user