This commit is contained in:
Mayank Verma 2026-05-31 15:10:42 +05:30 committed by GitHub
commit eb353cdd70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 0 deletions

View file

@ -670,6 +670,7 @@ pub trait PlatformWindow: HasWindowHandle + HasDisplayHandle {
}
fn set_edited(&mut self, _edited: bool) {}
fn set_document_path(&self, _path: Option<&std::path::Path>) {}
fn set_traffic_light_position(&self, _position: Point<Pixels>) {}
fn show_character_palette(&self) {}
fn titlebar_double_click(&self) {}
fn on_move_tab_to_new_window(&self, _callback: Box<dyn FnMut()>) {}

View file

@ -2311,6 +2311,11 @@ impl Window {
self.platform_window.set_title(title);
}
/// Sets the position of the macOS traffic light buttons
pub fn set_traffic_light_position(&self, position: Point<Pixels>) {
self.platform_window.set_traffic_light_position(position);
}
/// Sets the application identifier.
pub fn set_app_id(&mut self, app_id: &str) {
self.platform_window.set_app_id(app_id);

View file

@ -1188,6 +1188,12 @@ impl PlatformWindow for MacWindow {
}
}
fn set_traffic_light_position(&self, position: Point<Pixels>) {
let mut state = self.0.lock();
state.traffic_light_position = Some(position);
state.move_traffic_light();
}
fn scale_factor(&self) -> f32 {
self.0.as_ref().lock().scale_factor()
}