@@ -892,24 +892,33 @@ impl WinitView {
892892 false
893893 }
894894 }
895+ pub ( super ) fn enable_ime ( & self , capabilities : ImeCapabilities ) {
896+ // This seems reasonable but the prior behavior of `set_ime_allowed` doesn't do this
897+ // (it was also broken but let's not break things worse)
895898
896- pub ( super ) fn set_ime_allowed ( & self , capabilities : Option < ImeCapabilities > ) {
897- if self . ivars ( ) . ime_capabilities . get ( ) . is_some ( ) {
898- return ;
899- }
900- self . ivars ( ) . ime_capabilities . set ( capabilities) ;
899+ // if self.ivars().ime_capabilities.get().is_none() {
900+ // self.ivars().ime_state.set(ImeState::Ground);
901+ // }
901902
902- if capabilities. is_some ( ) {
903- return ;
903+ // why are we disabling things in an enable fn? who knows. it's what the previous one did
904+ // though
905+ if self . ivars ( ) . ime_state . get ( ) != ImeState :: Disabled {
906+ self . ivars ( ) . ime_state . set ( ImeState :: Disabled ) ;
907+ self . queue_event ( WindowEvent :: Ime ( Ime :: Disabled ) ) ;
904908 }
905-
906- // Clear markedText
909+ self . ivars ( ) . ime_capabilities . set ( Some ( capabilities) ) ;
907910 * self . ivars ( ) . marked_text . borrow_mut ( ) = NSMutableAttributedString :: new ( ) ;
908-
911+ }
912+ pub ( super ) fn disable_ime ( & self ) {
913+ // see above
914+ self . ivars ( ) . ime_capabilities . set ( None ) ;
909915 if self . ivars ( ) . ime_state . get ( ) != ImeState :: Disabled {
910916 self . ivars ( ) . ime_state . set ( ImeState :: Disabled ) ;
911917 self . queue_event ( WindowEvent :: Ime ( Ime :: Disabled ) ) ;
912918 }
919+ // we probably don't need to do this, but again this mirrors the prior behavior of
920+ // `set_ime_allowed`
921+ * self . ivars ( ) . marked_text . borrow_mut ( ) = NSMutableAttributedString :: new ( ) ;
913922 }
914923
915924 pub ( super ) fn ime_capabilities ( & self ) -> Option < ImeCapabilities > {
0 commit comments