@@ -27,7 +27,7 @@ use super::window::WinitWindow;
27
27
use crate :: dpi:: { LogicalPosition , LogicalSize } ;
28
28
use crate :: event:: {
29
29
DeviceEvent , ElementState , Ime , Modifiers , MouseButton , MouseScrollDelta , PointerKind ,
30
- PointerSource , TouchPhase , WindowEvent ,
30
+ PointerSource , TouchPhase , SurfaceEvent ,
31
31
} ;
32
32
use crate :: keyboard:: { Key , KeyCode , KeyLocation , ModifiersState , NamedKey } ;
33
33
use crate :: platform:: macos:: OptionAsAlt ;
@@ -196,7 +196,7 @@ declare_class!(
196
196
// 2. Even when a window resize does occur on a new tabbed window, it contains the wrong size (includes tab height).
197
197
let logical_size = LogicalSize :: new( rect. size. width as f64 , rect. size. height as f64 ) ;
198
198
let size = logical_size. to_physical:: <u32 >( self . scale_factor( ) ) ;
199
- self . queue_event( WindowEvent :: SurfaceResized ( size) ) ;
199
+ self . queue_event( SurfaceEvent :: SurfaceResized ( size) ) ;
200
200
}
201
201
202
202
#[ method( drawRect: ) ]
@@ -301,7 +301,7 @@ declare_class!(
301
301
// Notify IME is active if application still doesn't know it.
302
302
if self . ivars( ) . ime_state. get( ) == ImeState :: Disabled {
303
303
* 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 ) ) ;
305
305
}
306
306
307
307
if unsafe { self . hasMarkedText( ) } {
@@ -324,8 +324,8 @@ declare_class!(
324
324
Some ( ( lowerbound_utf8, upperbound_utf8) )
325
325
} ;
326
326
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) ) ) ;
329
329
}
330
330
331
331
#[ method( unmarkText) ]
@@ -336,7 +336,7 @@ declare_class!(
336
336
let input_context = self . inputContext( ) . expect( "input context" ) ;
337
337
input_context. discardMarkedText( ) ;
338
338
339
- self . queue_event( WindowEvent :: Ime ( Ime :: Preedit ( String :: new( ) , None ) ) ) ;
339
+ self . queue_event( SurfaceEvent :: Ime ( Ime :: Preedit ( String :: new( ) , None ) ) ) ;
340
340
if self . is_ime_enabled( ) {
341
341
// Leave the Preedit self.ivars()
342
342
self . ivars( ) . ime_state. set( ImeState :: Ground ) ;
@@ -403,8 +403,8 @@ declare_class!(
403
403
404
404
// Commit only if we have marked text.
405
405
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) ) ) ;
408
408
self . ivars( ) . ime_state. set( ImeState :: Committed ) ;
409
409
}
410
410
}
@@ -442,7 +442,7 @@ declare_class!(
442
442
* prev_input_source = current_input_source;
443
443
drop( prev_input_source) ;
444
444
self . ivars( ) . ime_state. set( ImeState :: Disabled ) ;
445
- self . queue_event( WindowEvent :: Ime ( Ime :: Disabled ) ) ;
445
+ self . queue_event( SurfaceEvent :: Ime ( Ime :: Disabled ) ) ;
446
446
}
447
447
}
448
448
@@ -483,7 +483,7 @@ declare_class!(
483
483
484
484
if !had_ime_input || self . ivars( ) . forward_key_to_app. get( ) {
485
485
let key_event = create_key_event( & event, true , unsafe { event. isARepeat( ) } , None ) ;
486
- self . queue_event( WindowEvent :: KeyboardInput {
486
+ self . queue_event( SurfaceEvent :: KeyboardInput {
487
487
device_id: None ,
488
488
event: key_event,
489
489
is_synthetic: false ,
@@ -503,7 +503,7 @@ declare_class!(
503
503
self . ivars( ) . ime_state. get( ) ,
504
504
ImeState :: Ground | ImeState :: Disabled
505
505
) {
506
- self . queue_event( WindowEvent :: KeyboardInput {
506
+ self . queue_event( SurfaceEvent :: KeyboardInput {
507
507
device_id: None ,
508
508
event: create_key_event( & event, false , false , None ) ,
509
509
is_synthetic: false ,
@@ -554,7 +554,7 @@ declare_class!(
554
554
self . update_modifiers( & event, false ) ;
555
555
let event = create_key_event( & event, true , unsafe { event. isARepeat( ) } , None ) ;
556
556
557
- self . queue_event( WindowEvent :: KeyboardInput {
557
+ self . queue_event( SurfaceEvent :: KeyboardInput {
558
558
device_id: None ,
559
559
event,
560
560
is_synthetic: false ,
@@ -642,7 +642,7 @@ declare_class!(
642
642
643
643
let position = self . mouse_view_point( event) . to_physical( self . scale_factor( ) ) ;
644
644
645
- self . queue_event( WindowEvent :: PointerEntered {
645
+ self . queue_event( SurfaceEvent :: PointerEntered {
646
646
device_id: None ,
647
647
position,
648
648
kind: PointerKind :: Mouse ,
@@ -655,7 +655,7 @@ declare_class!(
655
655
656
656
let position = self . mouse_view_point( event) . to_physical( self . scale_factor( ) ) ;
657
657
658
- self . queue_event( WindowEvent :: PointerLeft {
658
+ self . queue_event( SurfaceEvent :: PointerLeft {
659
659
device_id: None ,
660
660
position: Some ( position) ,
661
661
kind: PointerKind :: Mouse ,
@@ -698,7 +698,7 @@ declare_class!(
698
698
self . ivars( ) . app_state. maybe_queue_with_handler( move |app, event_loop|
699
699
app. device_event( event_loop, None , DeviceEvent :: MouseWheel { delta } )
700
700
) ;
701
- self . queue_event( WindowEvent :: MouseWheel {
701
+ self . queue_event( SurfaceEvent :: MouseWheel {
702
702
device_id: None ,
703
703
delta,
704
704
phase,
@@ -720,7 +720,7 @@ declare_class!(
720
720
_ => return ,
721
721
} ;
722
722
723
- self . queue_event( WindowEvent :: PinchGesture {
723
+ self . queue_event( SurfaceEvent :: PinchGesture {
724
724
device_id: None ,
725
725
delta: unsafe { event. magnification( ) } ,
726
726
phase,
@@ -733,7 +733,7 @@ declare_class!(
733
733
734
734
self . mouse_motion( event) ;
735
735
736
- self . queue_event( WindowEvent :: DoubleTapGesture {
736
+ self . queue_event( SurfaceEvent :: DoubleTapGesture {
737
737
device_id: None ,
738
738
} ) ;
739
739
}
@@ -753,7 +753,7 @@ declare_class!(
753
753
_ => return ,
754
754
} ;
755
755
756
- self . queue_event( WindowEvent :: RotationGesture {
756
+ self . queue_event( SurfaceEvent :: RotationGesture {
757
757
device_id: None ,
758
758
delta: unsafe { event. rotation( ) } ,
759
759
phase,
@@ -764,7 +764,7 @@ declare_class!(
764
764
fn pressure_change_with_event( & self , event: & NSEvent ) {
765
765
trace_scope!( "pressureChangeWithEvent:" ) ;
766
766
767
- self . queue_event( WindowEvent :: TouchpadPressure {
767
+ self . queue_event( SurfaceEvent :: TouchpadPressure {
768
768
device_id: None ,
769
769
pressure: unsafe { event. pressure( ) } ,
770
770
stage: unsafe { event. stage( ) } as i64 ,
@@ -840,7 +840,7 @@ impl WinitView {
840
840
self . ivars ( ) . _ns_window . load ( ) . expect ( "view to have a window" )
841
841
}
842
842
843
- fn queue_event ( & self , event : WindowEvent ) {
843
+ fn queue_event ( & self , event : SurfaceEvent ) {
844
844
let window_id = self . window ( ) . id ( ) ;
845
845
self . ivars ( ) . app_state . maybe_queue_with_handler ( move |app, event_loop| {
846
846
app. window_event ( event_loop, window_id, event) ;
@@ -899,7 +899,7 @@ impl WinitView {
899
899
900
900
if self . ivars ( ) . ime_state . get ( ) != ImeState :: Disabled {
901
901
self . ivars ( ) . ime_state . set ( ImeState :: Disabled ) ;
902
- self . queue_event ( WindowEvent :: Ime ( Ime :: Disabled ) ) ;
902
+ self . queue_event ( SurfaceEvent :: Ime ( Ime :: Disabled ) ) ;
903
903
}
904
904
}
905
905
@@ -914,7 +914,7 @@ impl WinitView {
914
914
pub ( super ) fn reset_modifiers ( & self ) {
915
915
if !self . ivars ( ) . modifiers . get ( ) . state ( ) . is_empty ( ) {
916
916
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 ( ) ) ) ;
918
918
}
919
919
}
920
920
@@ -978,7 +978,7 @@ impl WinitView {
978
978
let mut event = event. clone ( ) ;
979
979
event. location = KeyLocation :: Left ;
980
980
event. physical_key = get_left_modifier_code ( & event. logical_key ) . into ( ) ;
981
- events. push_back ( WindowEvent :: KeyboardInput {
981
+ events. push_back ( SurfaceEvent :: KeyboardInput {
982
982
device_id : None ,
983
983
event,
984
984
is_synthetic : false ,
@@ -987,7 +987,7 @@ impl WinitView {
987
987
if phys_mod. contains ( ModLocationMask :: RIGHT ) {
988
988
event. location = KeyLocation :: Right ;
989
989
event. physical_key = get_right_modifier_code ( & event. logical_key ) . into ( ) ;
990
- events. push_back ( WindowEvent :: KeyboardInput {
990
+ events. push_back ( SurfaceEvent :: KeyboardInput {
991
991
device_id : None ,
992
992
event,
993
993
is_synthetic : false ,
@@ -1018,7 +1018,7 @@ impl WinitView {
1018
1018
event. state = if is_pressed { Pressed } else { Released } ;
1019
1019
}
1020
1020
1021
- events. push_back ( WindowEvent :: KeyboardInput {
1021
+ events. push_back ( SurfaceEvent :: KeyboardInput {
1022
1022
device_id : None ,
1023
1023
event,
1024
1024
is_synthetic : false ,
@@ -1037,7 +1037,7 @@ impl WinitView {
1037
1037
return ;
1038
1038
}
1039
1039
1040
- self . queue_event ( WindowEvent :: ModifiersChanged ( self . ivars ( ) . modifiers . get ( ) ) ) ;
1040
+ self . queue_event ( SurfaceEvent :: ModifiersChanged ( self . ivars ( ) . modifiers . get ( ) ) ) ;
1041
1041
}
1042
1042
1043
1043
fn mouse_click ( & self , event : & NSEvent , button_state : ElementState ) {
@@ -1046,7 +1046,7 @@ impl WinitView {
1046
1046
1047
1047
self . update_modifiers ( event, false ) ;
1048
1048
1049
- self . queue_event ( WindowEvent :: PointerButton {
1049
+ self . queue_event ( SurfaceEvent :: PointerButton {
1050
1050
device_id : None ,
1051
1051
state : button_state,
1052
1052
position,
@@ -1072,7 +1072,7 @@ impl WinitView {
1072
1072
1073
1073
self . update_modifiers ( event, false ) ;
1074
1074
1075
- self . queue_event ( WindowEvent :: PointerMoved {
1075
+ self . queue_event ( SurfaceEvent :: PointerMoved {
1076
1076
device_id : None ,
1077
1077
position : view_point. to_physical ( self . scale_factor ( ) ) ,
1078
1078
source : PointerSource :: Mouse ,
0 commit comments