@@ -27,7 +27,7 @@ use super::window::WinitWindow;
2727use crate :: dpi:: { LogicalPosition , LogicalSize } ;
2828use crate :: event:: {
2929 DeviceEvent , ElementState , Ime , Modifiers , MouseButton , MouseScrollDelta , PointerKind ,
30- PointerSource , TouchPhase , WindowEvent ,
30+ PointerSource , TouchPhase , SurfaceEvent ,
3131} ;
3232use crate :: keyboard:: { Key , KeyCode , KeyLocation , ModifiersState , NamedKey } ;
3333use crate :: platform:: macos:: OptionAsAlt ;
@@ -196,7 +196,7 @@ declare_class!(
196196 // 2. Even when a window resize does occur on a new tabbed window, it contains the wrong size (includes tab height).
197197 let logical_size = LogicalSize :: new( rect. size. width as f64 , rect. size. height as f64 ) ;
198198 let size = logical_size. to_physical:: <u32 >( self . scale_factor( ) ) ;
199- self . queue_event( WindowEvent :: SurfaceResized ( size) ) ;
199+ self . queue_event( SurfaceEvent :: SurfaceResized ( size) ) ;
200200 }
201201
202202 #[ method( drawRect: ) ]
@@ -301,7 +301,7 @@ declare_class!(
301301 // Notify IME is active if application still doesn't know it.
302302 if self . ivars( ) . ime_state. get( ) == ImeState :: Disabled {
303303 * self . ivars( ) . input_source. borrow_mut( ) = self . current_input_source( ) ;
304- self . queue_event( WindowEvent :: Ime ( Ime :: Enabled ) ) ;
304+ self . queue_event( SurfaceEvent :: Ime ( Ime :: Enabled ) ) ;
305305 }
306306
307307 if unsafe { self . hasMarkedText( ) } {
@@ -324,8 +324,8 @@ declare_class!(
324324 Some ( ( lowerbound_utf8, upperbound_utf8) )
325325 } ;
326326
327- // Send WindowEvent for updating marked text
328- self . queue_event( WindowEvent :: Ime ( Ime :: Preedit ( string. to_string( ) , cursor_range) ) ) ;
327+ // Send SurfaceEvent for updating marked text
328+ self . queue_event( SurfaceEvent :: Ime ( Ime :: Preedit ( string. to_string( ) , cursor_range) ) ) ;
329329 }
330330
331331 #[ method( unmarkText) ]
@@ -336,7 +336,7 @@ declare_class!(
336336 let input_context = self . inputContext( ) . expect( "input context" ) ;
337337 input_context. discardMarkedText( ) ;
338338
339- self . queue_event( WindowEvent :: Ime ( Ime :: Preedit ( String :: new( ) , None ) ) ) ;
339+ self . queue_event( SurfaceEvent :: Ime ( Ime :: Preedit ( String :: new( ) , None ) ) ) ;
340340 if self . is_ime_enabled( ) {
341341 // Leave the Preedit self.ivars()
342342 self . ivars( ) . ime_state. set( ImeState :: Ground ) ;
@@ -403,8 +403,8 @@ declare_class!(
403403
404404 // Commit only if we have marked text.
405405 if unsafe { self . hasMarkedText( ) } && self . is_ime_enabled( ) && !is_control {
406- self . queue_event( WindowEvent :: Ime ( Ime :: Preedit ( String :: new( ) , None ) ) ) ;
407- self . queue_event( WindowEvent :: Ime ( Ime :: Commit ( string) ) ) ;
406+ self . queue_event( SurfaceEvent :: Ime ( Ime :: Preedit ( String :: new( ) , None ) ) ) ;
407+ self . queue_event( SurfaceEvent :: Ime ( Ime :: Commit ( string) ) ) ;
408408 self . ivars( ) . ime_state. set( ImeState :: Committed ) ;
409409 }
410410 }
@@ -442,7 +442,7 @@ declare_class!(
442442 * prev_input_source = current_input_source;
443443 drop( prev_input_source) ;
444444 self . ivars( ) . ime_state. set( ImeState :: Disabled ) ;
445- self . queue_event( WindowEvent :: Ime ( Ime :: Disabled ) ) ;
445+ self . queue_event( SurfaceEvent :: Ime ( Ime :: Disabled ) ) ;
446446 }
447447 }
448448
@@ -483,7 +483,7 @@ declare_class!(
483483
484484 if !had_ime_input || self . ivars( ) . forward_key_to_app. get( ) {
485485 let key_event = create_key_event( & event, true , unsafe { event. isARepeat( ) } , None ) ;
486- self . queue_event( WindowEvent :: KeyboardInput {
486+ self . queue_event( SurfaceEvent :: KeyboardInput {
487487 device_id: None ,
488488 event: key_event,
489489 is_synthetic: false ,
@@ -503,7 +503,7 @@ declare_class!(
503503 self . ivars( ) . ime_state. get( ) ,
504504 ImeState :: Ground | ImeState :: Disabled
505505 ) {
506- self . queue_event( WindowEvent :: KeyboardInput {
506+ self . queue_event( SurfaceEvent :: KeyboardInput {
507507 device_id: None ,
508508 event: create_key_event( & event, false , false , None ) ,
509509 is_synthetic: false ,
@@ -554,7 +554,7 @@ declare_class!(
554554 self . update_modifiers( & event, false ) ;
555555 let event = create_key_event( & event, true , unsafe { event. isARepeat( ) } , None ) ;
556556
557- self . queue_event( WindowEvent :: KeyboardInput {
557+ self . queue_event( SurfaceEvent :: KeyboardInput {
558558 device_id: None ,
559559 event,
560560 is_synthetic: false ,
@@ -642,7 +642,7 @@ declare_class!(
642642
643643 let position = self . mouse_view_point( event) . to_physical( self . scale_factor( ) ) ;
644644
645- self . queue_event( WindowEvent :: PointerEntered {
645+ self . queue_event( SurfaceEvent :: PointerEntered {
646646 device_id: None ,
647647 position,
648648 kind: PointerKind :: Mouse ,
@@ -655,7 +655,7 @@ declare_class!(
655655
656656 let position = self . mouse_view_point( event) . to_physical( self . scale_factor( ) ) ;
657657
658- self . queue_event( WindowEvent :: PointerLeft {
658+ self . queue_event( SurfaceEvent :: PointerLeft {
659659 device_id: None ,
660660 position: Some ( position) ,
661661 kind: PointerKind :: Mouse ,
@@ -698,7 +698,7 @@ declare_class!(
698698 self . ivars( ) . app_state. maybe_queue_with_handler( move |app, event_loop|
699699 app. device_event( event_loop, None , DeviceEvent :: MouseWheel { delta } )
700700 ) ;
701- self . queue_event( WindowEvent :: MouseWheel {
701+ self . queue_event( SurfaceEvent :: MouseWheel {
702702 device_id: None ,
703703 delta,
704704 phase,
@@ -720,7 +720,7 @@ declare_class!(
720720 _ => return ,
721721 } ;
722722
723- self . queue_event( WindowEvent :: PinchGesture {
723+ self . queue_event( SurfaceEvent :: PinchGesture {
724724 device_id: None ,
725725 delta: unsafe { event. magnification( ) } ,
726726 phase,
@@ -733,7 +733,7 @@ declare_class!(
733733
734734 self . mouse_motion( event) ;
735735
736- self . queue_event( WindowEvent :: DoubleTapGesture {
736+ self . queue_event( SurfaceEvent :: DoubleTapGesture {
737737 device_id: None ,
738738 } ) ;
739739 }
@@ -753,7 +753,7 @@ declare_class!(
753753 _ => return ,
754754 } ;
755755
756- self . queue_event( WindowEvent :: RotationGesture {
756+ self . queue_event( SurfaceEvent :: RotationGesture {
757757 device_id: None ,
758758 delta: unsafe { event. rotation( ) } ,
759759 phase,
@@ -764,7 +764,7 @@ declare_class!(
764764 fn pressure_change_with_event( & self , event: & NSEvent ) {
765765 trace_scope!( "pressureChangeWithEvent:" ) ;
766766
767- self . queue_event( WindowEvent :: TouchpadPressure {
767+ self . queue_event( SurfaceEvent :: TouchpadPressure {
768768 device_id: None ,
769769 pressure: unsafe { event. pressure( ) } ,
770770 stage: unsafe { event. stage( ) } as i64 ,
@@ -840,7 +840,7 @@ impl WinitView {
840840 self . ivars ( ) . _ns_window . load ( ) . expect ( "view to have a window" )
841841 }
842842
843- fn queue_event ( & self , event : WindowEvent ) {
843+ fn queue_event ( & self , event : SurfaceEvent ) {
844844 let window_id = self . window ( ) . id ( ) ;
845845 self . ivars ( ) . app_state . maybe_queue_with_handler ( move |app, event_loop| {
846846 app. window_event ( event_loop, window_id, event) ;
@@ -899,7 +899,7 @@ impl WinitView {
899899
900900 if self . ivars ( ) . ime_state . get ( ) != ImeState :: Disabled {
901901 self . ivars ( ) . ime_state . set ( ImeState :: Disabled ) ;
902- self . queue_event ( WindowEvent :: Ime ( Ime :: Disabled ) ) ;
902+ self . queue_event ( SurfaceEvent :: Ime ( Ime :: Disabled ) ) ;
903903 }
904904 }
905905
@@ -914,7 +914,7 @@ impl WinitView {
914914 pub ( super ) fn reset_modifiers ( & self ) {
915915 if !self . ivars ( ) . modifiers . get ( ) . state ( ) . is_empty ( ) {
916916 self . ivars ( ) . modifiers . set ( Modifiers :: default ( ) ) ;
917- self . queue_event ( WindowEvent :: ModifiersChanged ( self . ivars ( ) . modifiers . get ( ) ) ) ;
917+ self . queue_event ( SurfaceEvent :: ModifiersChanged ( self . ivars ( ) . modifiers . get ( ) ) ) ;
918918 }
919919 }
920920
@@ -978,7 +978,7 @@ impl WinitView {
978978 let mut event = event. clone ( ) ;
979979 event. location = KeyLocation :: Left ;
980980 event. physical_key = get_left_modifier_code ( & event. logical_key ) . into ( ) ;
981- events. push_back ( WindowEvent :: KeyboardInput {
981+ events. push_back ( SurfaceEvent :: KeyboardInput {
982982 device_id : None ,
983983 event,
984984 is_synthetic : false ,
@@ -987,7 +987,7 @@ impl WinitView {
987987 if phys_mod. contains ( ModLocationMask :: RIGHT ) {
988988 event. location = KeyLocation :: Right ;
989989 event. physical_key = get_right_modifier_code ( & event. logical_key ) . into ( ) ;
990- events. push_back ( WindowEvent :: KeyboardInput {
990+ events. push_back ( SurfaceEvent :: KeyboardInput {
991991 device_id : None ,
992992 event,
993993 is_synthetic : false ,
@@ -1018,7 +1018,7 @@ impl WinitView {
10181018 event. state = if is_pressed { Pressed } else { Released } ;
10191019 }
10201020
1021- events. push_back ( WindowEvent :: KeyboardInput {
1021+ events. push_back ( SurfaceEvent :: KeyboardInput {
10221022 device_id : None ,
10231023 event,
10241024 is_synthetic : false ,
@@ -1037,7 +1037,7 @@ impl WinitView {
10371037 return ;
10381038 }
10391039
1040- self . queue_event ( WindowEvent :: ModifiersChanged ( self . ivars ( ) . modifiers . get ( ) ) ) ;
1040+ self . queue_event ( SurfaceEvent :: ModifiersChanged ( self . ivars ( ) . modifiers . get ( ) ) ) ;
10411041 }
10421042
10431043 fn mouse_click ( & self , event : & NSEvent , button_state : ElementState ) {
@@ -1046,7 +1046,7 @@ impl WinitView {
10461046
10471047 self . update_modifiers ( event, false ) ;
10481048
1049- self . queue_event ( WindowEvent :: PointerButton {
1049+ self . queue_event ( SurfaceEvent :: PointerButton {
10501050 device_id : None ,
10511051 state : button_state,
10521052 position,
@@ -1072,7 +1072,7 @@ impl WinitView {
10721072
10731073 self . update_modifiers ( event, false ) ;
10741074
1075- self . queue_event ( WindowEvent :: PointerMoved {
1075+ self . queue_event ( SurfaceEvent :: PointerMoved {
10761076 device_id : None ,
10771077 position : view_point. to_physical ( self . scale_factor ( ) ) ,
10781078 source : PointerSource :: Mouse ,
0 commit comments