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:
@@ -1,4 +1,4 @@
|
|||||||
use super::{MacDisplay, NSRange, NSStringExt, ns_string, renderer};
|
use super::{BoolExt, MacDisplay, NSRange, NSStringExt, ns_string, renderer};
|
||||||
use crate::{
|
use crate::{
|
||||||
AnyWindowHandle, Bounds, DisplayLink, ExternalPaths, FileDropEvent, ForegroundExecutor,
|
AnyWindowHandle, Bounds, DisplayLink, ExternalPaths, FileDropEvent, ForegroundExecutor,
|
||||||
KeyDownEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent,
|
KeyDownEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent,
|
||||||
@@ -1021,11 +1021,8 @@ impl PlatformWindow for MacWindow {
|
|||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
let opaque = if background_appearance == WindowBackgroundAppearance::Opaque {
|
let opaque = (background_appearance == WindowBackgroundAppearance::Opaque).to_objc();
|
||||||
YES
|
|
||||||
} else {
|
|
||||||
NO
|
|
||||||
};
|
|
||||||
unsafe {
|
unsafe {
|
||||||
this.native_window.setOpaque_(opaque);
|
this.native_window.setOpaque_(opaque);
|
||||||
// Shadows for transparent windows cause artifacts and performance issues
|
// 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 {
|
extern "C" fn perform_drag_operation(this: &Object, _: Sel, dragging_info: id) -> BOOL {
|
||||||
let window_state = unsafe { get_window_state(this) };
|
let window_state = unsafe { get_window_state(this) };
|
||||||
let position = drag_event_position(&window_state, dragging_info);
|
let position = drag_event_position(&window_state, dragging_info);
|
||||||
if send_new_event(
|
send_new_event(
|
||||||
&window_state,
|
&window_state,
|
||||||
PlatformInput::FileDrop(FileDropEvent::Submit { position }),
|
PlatformInput::FileDrop(FileDropEvent::Submit { position }),
|
||||||
) {
|
)
|
||||||
YES
|
.to_objc()
|
||||||
} else {
|
|
||||||
NO
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn external_paths_from_event(dragging_info: *mut Object) -> Option<ExternalPaths> {
|
fn external_paths_from_event(dragging_info: *mut Object) -> Option<ExternalPaths> {
|
||||||
|
|||||||
Reference in New Issue
Block a user