@@ -23,42 +23,9 @@ use cef::CefHandler;
2323use cli:: Cli ;
2424use event:: CreateAppEventSchedulerEventLoopExt ;
2525
26- mod mac_app_impl {
27- use objc2:: { ClassType , define_class, msg_send} ;
28- use objc2_app_kit:: { NSApplication , NSEvent , NSEventType , NSResponder } ;
29- use objc2_foundation:: NSObject ;
30-
31- define_class ! (
32- #[ unsafe ( super ( NSApplication , NSResponder , NSObject ) ) ]
33- #[ name = "GraphiteApplication" ]
34- pub ( super ) struct GraphiteApplication ;
35-
36- impl GraphiteApplication {
37- #[ unsafe ( method( sendEvent: ) ) ]
38- fn send_event( & self , event: & NSEvent ) {
39- if event. r#type( ) == NSEventType :: KeyDown && let Some ( key_window) = self . keyWindow( ) {
40- unsafe { msg_send![ & key_window, sendEvent: event] }
41- } else {
42- unsafe { msg_send![ super ( self ) , sendEvent: event] }
43- }
44- }
45- }
46- ) ;
47-
48- impl GraphiteApplication {
49- pub ( super ) fn init ( ) {
50- unsafe {
51- let _: & NSApplication = msg_send ! [ GraphiteApplication :: class( ) , sharedApplication] ;
52- }
53- }
54- }
55- }
56-
5726pub fn start ( ) {
5827 tracing_subscriber:: fmt ( ) . with_env_filter ( EnvFilter :: from_default_env ( ) ) . init ( ) ;
5928
60- mac_app_impl:: GraphiteApplication :: init ( ) ;
61-
6229 let cef_context_builder = cef:: CefContextBuilder :: < CefHandler > :: new ( ) ;
6330
6431 if cef_context_builder. is_sub_process ( ) {
@@ -69,6 +36,8 @@ pub fn start() {
6936 return ;
7037 }
7138
39+ App :: init ( ) ;
40+
7241 let cli = Cli :: parse ( ) ;
7342
7443 let wgpu_context = futures:: executor:: block_on ( gpu_context:: create_wgpu_context ( ) ) ;
0 commit comments