diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs index 696421714b..bd519a098d 100644 --- a/crates/gpui/src/platform/linux/platform.rs +++ b/crates/gpui/src/platform/linux/platform.rs @@ -35,9 +35,9 @@ use crate::platform::linux::wayland::WaylandClient; use crate::{ px, Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CosmicTextSystem, CursorStyle, DisplayId, ForegroundExecutor, Keymap, Keystroke, LinuxDispatcher, Menu, Modifiers, - PathPromptOptions, Pixels, Platform, PlatformDisplay, PlatformInput, PlatformInputHandler, - PlatformTextSystem, PlatformWindow, Point, PromptLevel, Result, SemanticVersion, Size, Task, - WindowAppearance, WindowOptions, WindowParams, + PathPromptOptions, Pixels, Platform, PlatformDisplay, PlatformInputHandler, PlatformTextSystem, + PlatformWindow, Point, PromptLevel, Result, SemanticVersion, Size, Task, WindowAppearance, + WindowOptions, WindowParams, }; use super::x11::X11Client; @@ -72,11 +72,8 @@ pub trait LinuxClient { #[derive(Default)] pub(crate) struct PlatformHandlers { pub(crate) open_urls: Option)>>, - pub(crate) become_active: Option>, - pub(crate) resign_active: Option>, pub(crate) quit: Option>, pub(crate) reopen: Option>, - pub(crate) event: Option bool>>, pub(crate) app_menu_action: Option>, pub(crate) will_open_app_menu: Option>, pub(crate) validate_app_menu_command: Option bool>>, diff --git a/crates/gpui/src/platform/linux/wayland/window.rs b/crates/gpui/src/platform/linux/wayland/window.rs index adecc089b4..7848a9b284 100644 --- a/crates/gpui/src/platform/linux/wayland/window.rs +++ b/crates/gpui/src/platform/linux/wayland/window.rs @@ -37,7 +37,6 @@ pub(crate) struct Callbacks { input: Option crate::DispatchEventResult>>, active_status_change: Option>, resize: Option, f32)>>, - fullscreen: Option>, moved: Option>, should_close: Option bool>>, close: Option>, @@ -480,11 +479,6 @@ impl WaylandWindowStatePtr { pub fn set_fullscreen(&self, fullscreen: bool) { let mut state = self.state.borrow_mut(); state.fullscreen = fullscreen; - - let mut callbacks = self.callbacks.borrow_mut(); - if let Some(ref mut fun) = callbacks.fullscreen { - fun(fullscreen) - } } /// Notifies the window of the state of the decorations. diff --git a/crates/gpui/src/platform/linux/x11/window.rs b/crates/gpui/src/platform/linux/x11/window.rs index d5adb5fe91..1f23dcd959 100644 --- a/crates/gpui/src/platform/linux/x11/window.rs +++ b/crates/gpui/src/platform/linux/x11/window.rs @@ -147,7 +147,6 @@ pub struct Callbacks { input: Option crate::DispatchEventResult>>, active_status_change: Option>, resize: Option, f32)>>, - fullscreen: Option>, moved: Option>, should_close: Option bool>>, close: Option>, diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rs index d541d78e81..32d49cccbd 100644 --- a/crates/gpui/src/platform/mac/platform.rs +++ b/crates/gpui/src/platform/mac/platform.rs @@ -2,8 +2,8 @@ use super::{events::key_to_native, BoolExt}; use crate::{ Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, ForegroundExecutor, Keymap, MacDispatcher, MacDisplay, MacTextSystem, MacWindow, Menu, MenuItem, PathPromptOptions, - Platform, PlatformDisplay, PlatformInput, PlatformTextSystem, PlatformWindow, Result, - SemanticVersion, Task, WindowAppearance, WindowParams, + Platform, PlatformDisplay, PlatformTextSystem, PlatformWindow, Result, SemanticVersion, Task, + WindowAppearance, WindowParams, }; use anyhow::{anyhow, bail}; use block::ConcreteBlock; @@ -65,10 +65,6 @@ unsafe fn build_classes() { APP_CLASS = { let mut decl = ClassDecl::new("GPUIApplication", class!(NSApplication)).unwrap(); decl.add_ivar::<*mut c_void>(MAC_PLATFORM_IVAR); - decl.add_method( - sel!(sendEvent:), - send_event as extern "C" fn(&mut Object, Sel, id), - ); decl.register() }; @@ -83,14 +79,6 @@ unsafe fn build_classes() { sel!(applicationShouldHandleReopen:hasVisibleWindows:), should_handle_reopen as extern "C" fn(&mut Object, Sel, id, bool), ); - decl.add_method( - sel!(applicationDidBecomeActive:), - did_become_active as extern "C" fn(&mut Object, Sel, id), - ); - decl.add_method( - sel!(applicationDidResignActive:), - did_resign_active as extern "C" fn(&mut Object, Sel, id), - ); decl.add_method( sel!(applicationWillTerminate:), will_terminate as extern "C" fn(&mut Object, Sel, id), @@ -151,11 +139,8 @@ pub(crate) struct MacPlatformState { pasteboard: id, text_hash_pasteboard_type: id, metadata_pasteboard_type: id, - become_active: Option>, - resign_active: Option>, reopen: Option>, quit: Option>, - event: Option bool>>, menu_command: Option>, validate_menu_command: Option bool>>, will_open_menu: Option>, @@ -181,11 +166,8 @@ impl MacPlatform { pasteboard: unsafe { NSPasteboard::generalPasteboard(nil) }, text_hash_pasteboard_type: unsafe { ns_string("zed-text-hash") }, metadata_pasteboard_type: unsafe { ns_string("zed-metadata") }, - become_active: None, - resign_active: None, reopen: None, quit: None, - event: None, menu_command: None, validate_menu_command: None, will_open_menu: None, @@ -1040,24 +1022,6 @@ unsafe fn get_mac_platform(object: &mut Object) -> &MacPlatform { &*(platform_ptr as *const MacPlatform) } -extern "C" fn send_event(this: &mut Object, _sel: Sel, native_event: id) { - unsafe { - if let Some(event) = PlatformInput::from_native(native_event, None) { - let platform = get_mac_platform(this); - let mut lock = platform.0.lock(); - if let Some(mut callback) = lock.event.take() { - drop(lock); - let result = callback(event); - platform.0.lock().event.get_or_insert(callback); - if !result { - return; - } - } - } - msg_send![super(this, class!(NSApplication)), sendEvent: native_event] - } -} - extern "C" fn did_finish_launching(this: &mut Object, _: Sel, _: id) { unsafe { let app: id = msg_send![APP_CLASS, sharedApplication]; @@ -1082,26 +1046,6 @@ extern "C" fn should_handle_reopen(this: &mut Object, _: Sel, _: id, has_open_wi } } -extern "C" fn did_become_active(this: &mut Object, _: Sel, _: id) { - let platform = unsafe { get_mac_platform(this) }; - let mut lock = platform.0.lock(); - if let Some(mut callback) = lock.become_active.take() { - drop(lock); - callback(); - platform.0.lock().become_active.get_or_insert(callback); - } -} - -extern "C" fn did_resign_active(this: &mut Object, _: Sel, _: id) { - let platform = unsafe { get_mac_platform(this) }; - let mut lock = platform.0.lock(); - if let Some(mut callback) = lock.resign_active.take() { - drop(lock); - callback(); - platform.0.lock().resign_active.get_or_insert(callback); - } -} - extern "C" fn will_terminate(this: &mut Object, _: Sel, _: id) { let platform = unsafe { get_mac_platform(this) }; let mut lock = platform.0.lock(); diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs index c1d6e4afc3..570eb9024a 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -259,14 +259,6 @@ unsafe fn build_window_class(name: &'static str, superclass: &Class) -> *const C sel!(windowDidChangeOcclusionState:), window_did_change_occlusion_state as extern "C" fn(&Object, Sel, id), ); - decl.add_method( - sel!(windowWillEnterFullScreen:), - window_will_enter_fullscreen as extern "C" fn(&Object, Sel, id), - ); - decl.add_method( - sel!(windowWillExitFullScreen:), - window_will_exit_fullscreen as extern "C" fn(&Object, Sel, id), - ); decl.add_method( sel!(windowDidMove:), window_did_move as extern "C" fn(&Object, Sel, id), @@ -340,7 +332,6 @@ struct MacWindowState { event_callback: Option crate::DispatchEventResult>>, activate_callback: Option>, resize_callback: Option, f32)>>, - fullscreen_callback: Option>, moved_callback: Option>, should_close_callback: Option bool>>, close_callback: Option>, @@ -632,7 +623,6 @@ impl MacWindow { event_callback: None, activate_callback: None, resize_callback: None, - fullscreen_callback: None, moved_callback: None, should_close_callback: None, close_callback: None, @@ -1476,24 +1466,6 @@ extern "C" fn window_did_resize(this: &Object, _: Sel, _: id) { window_state.as_ref().lock().move_traffic_light(); } -extern "C" fn window_will_enter_fullscreen(this: &Object, _: Sel, _: id) { - window_fullscreen_changed(this, true); -} - -extern "C" fn window_will_exit_fullscreen(this: &Object, _: Sel, _: id) { - window_fullscreen_changed(this, false); -} - -fn window_fullscreen_changed(this: &Object, is_fullscreen: bool) { - let window_state = unsafe { get_window_state(this) }; - let mut lock = window_state.as_ref().lock(); - if let Some(mut callback) = lock.fullscreen_callback.take() { - drop(lock); - callback(is_fullscreen); - window_state.lock().fullscreen_callback = Some(callback); - } -} - extern "C" fn window_did_move(this: &Object, _: Sel, _: id) { let window_state = unsafe { get_window_state(this) }; let mut lock = window_state.as_ref().lock(); diff --git a/crates/gpui/src/platform/windows/platform.rs b/crates/gpui/src/platform/windows/platform.rs index 5e363614b9..7f8ec438a3 100644 --- a/crates/gpui/src/platform/windows/platform.rs +++ b/crates/gpui/src/platform/windows/platform.rs @@ -90,11 +90,8 @@ impl WindowsPlatformInner { #[derive(Default)] struct Callbacks { open_urls: Option)>>, - become_active: Option>, - resign_active: Option>, quit: Option>, reopen: Option>, - event: Option bool>>, app_menu_action: Option>, will_open_app_menu: Option>, validate_app_menu_command: Option bool>>, diff --git a/crates/gpui/src/platform/windows/window.rs b/crates/gpui/src/platform/windows/window.rs index cdf8c6cb1b..9aa44989a9 100644 --- a/crates/gpui/src/platform/windows/window.rs +++ b/crates/gpui/src/platform/windows/window.rs @@ -1223,7 +1223,6 @@ struct Callbacks { input: Option DispatchEventResult>>, active_status_change: Option>, resize: Option, f32)>>, - fullscreen: Option>, moved: Option>, should_close: Option bool>>, close: Option>,