@@ -25,9 +25,10 @@ use bevy_utils::{
2525 Instant ,
2626} ;
2727use bevy_window:: {
28- CursorEntered , CursorLeft , CursorMoved , FileDragAndDrop , ModifiesWindows , ReceivedCharacter ,
29- RequestRedraw , Window , WindowBackendScaleFactorChanged , WindowCloseRequested , WindowCreated ,
30- WindowFocused , WindowMoved , WindowResized , WindowScaleFactorChanged ,
28+ CursorEntered , CursorLeft , CursorMoved , FileDragAndDrop , Ime , ModifiesWindows ,
29+ ReceivedCharacter , RequestRedraw , Window , WindowBackendScaleFactorChanged ,
30+ WindowCloseRequested , WindowCreated , WindowFocused , WindowMoved , WindowResized ,
31+ WindowScaleFactorChanged ,
3132} ;
3233
3334use winit:: {
@@ -170,6 +171,7 @@ struct InputEvents<'w> {
170171 mouse_button_input : EventWriter < ' w , MouseButtonInput > ,
171172 mouse_wheel_input : EventWriter < ' w , MouseWheel > ,
172173 touch_input : EventWriter < ' w , TouchInput > ,
174+ ime_input : EventWriter < ' w , Ime > ,
173175}
174176
175177#[ derive( SystemParam ) ]
@@ -555,6 +557,25 @@ pub fn winit_runner(mut app: App) {
555557 position,
556558 } ) ;
557559 }
560+ WindowEvent :: Ime ( event) => match event {
561+ event:: Ime :: Preedit ( value, cursor) => {
562+ input_events. ime_input . send ( Ime :: Preedit {
563+ window : window_entity,
564+ value,
565+ cursor,
566+ } ) ;
567+ }
568+ event:: Ime :: Commit ( value) => input_events. ime_input . send ( Ime :: Commit {
569+ window : window_entity,
570+ value,
571+ } ) ,
572+ event:: Ime :: Enabled => input_events. ime_input . send ( Ime :: Enabled {
573+ window : window_entity,
574+ } ) ,
575+ event:: Ime :: Disabled => input_events. ime_input . send ( Ime :: Disabled {
576+ window : window_entity,
577+ } ) ,
578+ } ,
558579 _ => { }
559580 }
560581 }
0 commit comments