Detailed changes
@@ -41,6 +41,7 @@ pub fn init(cx: &mut MutableAppContext) {
)),
titlebar: None,
center: false,
+ focus: false,
kind: WindowKind::PopUp,
is_movable: false,
screen: Some(screen),
@@ -40,6 +40,7 @@ pub fn init(cx: &mut MutableAppContext) {
)),
titlebar: None,
center: false,
+ focus: false,
kind: WindowKind::PopUp,
is_movable: false,
screen: Some(screen),
@@ -152,6 +152,7 @@ pub struct WindowOptions<'a> {
pub bounds: WindowBounds,
pub titlebar: Option<TitlebarOptions<'a>>,
pub center: bool,
+ pub focus: bool,
pub kind: WindowKind,
pub is_movable: bool,
pub screen: Option<Rc<dyn Screen>>,
@@ -296,6 +297,7 @@ impl<'a> Default for WindowOptions<'a> {
traffic_light_position: Default::default(),
}),
center: false,
+ focus: true,
kind: WindowKind::Normal,
is_movable: true,
screen: None,
@@ -514,7 +514,11 @@ impl Window {
);
}
}
- native_window.makeKeyAndOrderFront_(nil);
+ if options.focus {
+ native_window.makeKeyAndOrderFront_(nil);
+ } else {
+ native_window.orderFront_(nil);
+ }
window.0.borrow().move_traffic_light();
pool.drain();
@@ -354,6 +354,7 @@ pub fn build_window_options() -> WindowOptions<'static> {
traffic_light_position: Some(vec2f(8., 8.)),
}),
center: false,
+ focus: true,
kind: WindowKind::Normal,
is_movable: true,
screen: None,