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

Use the `BoolExt` trait which converts rust booleans to their objc
equivalent when applicable.


Release Notes:

- N/A
This commit is contained in:
tidely 2025-04-09 23:28:15 +03:00 committed by GitHub
parent 915a1cb116
commit 9ae4f4b158
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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> {