Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Reapply traffic light position after appearance changes (#59712)

Vitaly Kravchenkof18e91efc6de
diff --git a/crates/gpui_macos/src/window.rs b/crates/gpui_macos/src/window.rs
index 507e51c26f8..938633d4749 100644
--- a/crates/gpui_macos/src/window.rs
+++ b/crates/gpui_macos/src/window.rs
@@ -2827,12 +2827,20 @@ extern "C" fn do_command_by_selector(this: &Object, _: Sel, _: Sel) {
extern "C" fn view_did_change_effective_appearance(this: &Object, _: Sel) {
unsafe {
let state = get_window_state(this);
- let mut lock = state.as_ref().lock();
- if let Some(mut callback) = lock.appearance_changed_callback.take() {
- drop(lock);
+ let appearance_changed_callback = {
+ let mut lock = state.as_ref().lock();
+ lock.appearance_changed_callback.take()
+ };
+
+ if let Some(mut callback) = appearance_changed_callback {
callback();
state.lock().appearance_changed_callback = Some(callback);
}
+
+ // AppKit can relayout the standard traffic light buttons as part of
+ // applying a new appearance. Reapply GPUI's custom position after
+ // notifying appearance observers.
+ state.lock().move_traffic_light();
}
}