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.

gpui: Use BoolExt trait in more places (#28052)

tidely9ae4f4b158ff
diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs
index 5c04c9505da..532856d8900 100644
--- a/crates/gpui/src/platform/mac/window.rs
+++ b/crates/gpui/src/platform/mac/window.rs
@@ -1,4 +1,4 @@
-use super::{MacDisplay, NSRange, NSStringExt, ns_string, renderer};
+use super::{BoolExt, MacDisplay, NSRange, NSStringExt, ns_string, renderer};
use crate::{
AnyWindowHandle, Bounds, DisplayLink, ExternalPaths, FileDropEvent, ForegroundExecutor,
KeyDownEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent,
@@ -1021,11 +1021,8 @@ impl PlatformWindow for MacWindow {
} else {
0
};
- let opaque = if background_appearance == WindowBackgroundAppearance::Opaque {
- YES
- } else {
- NO
- };
+ let opaque = (background_appearance == WindowBackgroundAppearance::Opaque).to_objc();
+
unsafe {
this.native_window.setOpaque_(opaque);
// Shadows for transparent windows cause artifacts and performance issues
@@ -1981,14 +1978,11 @@ extern "C" fn dragging_exited(this: &Object, _: Sel, _: id) {
extern "C" fn perform_drag_operation(this: &Object, _: Sel, dragging_info: id) -> BOOL {
let window_state = unsafe { get_window_state(this) };
let position = drag_event_position(&window_state, dragging_info);
- if send_new_event(
+ send_new_event(
&window_state,
PlatformInput::FileDrop(FileDropEvent::Submit { position }),
- ) {
- YES
- } else {
- NO
- }
+ )
+ .to_objc()
}
fn external_paths_from_event(dragging_info: *mut Object) -> Option<ExternalPaths> {