Apply 'with_active' option to winit (#2813)
* feat: apply 'with_active' option to winit * fix: remove platform specification - winit accept this option for all platforms * build fix --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
parent
af4d737c92
commit
8a2cfbd131
|
|
@ -284,6 +284,9 @@ pub struct NativeOptions {
|
|||
/// Generally you would use this in conjunction with always_on_top
|
||||
pub mouse_passthrough: bool,
|
||||
|
||||
/// Whether grant focus when window initially opened. True by default.
|
||||
pub active: bool,
|
||||
|
||||
/// Turn on vertical syncing, limiting the FPS to the display refresh rate.
|
||||
///
|
||||
/// The default is `true`.
|
||||
|
|
@ -421,6 +424,9 @@ impl Default for NativeOptions {
|
|||
resizable: true,
|
||||
transparent: false,
|
||||
mouse_passthrough: false,
|
||||
|
||||
active: true,
|
||||
|
||||
vsync: true,
|
||||
multisampling: 0,
|
||||
depth_buffer: 0,
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ pub fn window_builder<E>(
|
|||
resizable,
|
||||
transparent,
|
||||
centered,
|
||||
active,
|
||||
..
|
||||
} = native_options;
|
||||
|
||||
|
|
@ -104,6 +105,7 @@ pub fn window_builder<E>(
|
|||
.with_resizable(*resizable)
|
||||
.with_transparent(*transparent)
|
||||
.with_window_icon(window_icon)
|
||||
.with_active(*active)
|
||||
// Keep hidden until we've painted something. See https://github.com/emilk/egui/pull/2279
|
||||
// We must also keep the window hidden until AccessKit is initialized.
|
||||
.with_visible(false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue