@@ -8,6 +8,7 @@ use crate::preferences::GlobalPreferences;
8
8
use anyhow:: anyhow;
9
9
use egui:: { Context , ViewportId } ;
10
10
use fontdb:: { Database , Family , Query , Source } ;
11
+ use ruffle_core:: events:: { ImeCursorArea , ImePurpose } ;
11
12
use ruffle_core:: { Player , PlayerEvent } ;
12
13
use ruffle_render_wgpu:: backend:: { request_adapter_and_device, WgpuRenderBackend } ;
13
14
use ruffle_render_wgpu:: descriptors:: Descriptors ;
@@ -21,7 +22,7 @@ use winit::dpi::{PhysicalPosition, PhysicalSize};
21
22
use winit:: event:: WindowEvent ;
22
23
use winit:: event_loop:: EventLoopProxy ;
23
24
use winit:: keyboard:: { Key , NamedKey } ;
24
- use winit:: window:: { Theme , Window } ;
25
+ use winit:: window:: { ImePurpose as WinitImePurpose , Theme , Window } ;
25
26
26
27
use super :: { DialogDescriptor , FilePicker } ;
27
28
@@ -269,6 +270,11 @@ impl GuiController {
269
270
( x, y)
270
271
}
271
272
273
+ pub fn movie_to_window_position ( & self , x : f64 , y : f64 ) -> PhysicalPosition < f64 > {
274
+ let y = y + self . height_offset ( ) ;
275
+ PhysicalPosition :: new ( x, y)
276
+ }
277
+
272
278
pub fn render ( & mut self , mut player : Option < MutexGuard < Player > > ) {
273
279
let surface_texture = match self . surface . get_current_texture ( ) {
274
280
Ok ( surface_texture) => surface_texture,
@@ -439,6 +445,24 @@ impl GuiController {
439
445
pub fn open_dialog ( & mut self , dialog_event : DialogDescriptor ) {
440
446
self . gui . dialogs . open_dialog ( dialog_event) ;
441
447
}
448
+
449
+ pub fn set_ime_allowed ( & self , allowed : bool ) {
450
+ self . window . set_ime_allowed ( allowed) ;
451
+ }
452
+
453
+ pub fn set_ime_purpose ( & self , purpose : ImePurpose ) {
454
+ self . window . set_ime_purpose ( match purpose {
455
+ ImePurpose :: Standard => WinitImePurpose :: Normal ,
456
+ ImePurpose :: Password => WinitImePurpose :: Password ,
457
+ } ) ;
458
+ }
459
+
460
+ pub fn set_ime_cursor_area ( & self , cursor_area : ImeCursorArea ) {
461
+ self . window . set_ime_cursor_area (
462
+ self . movie_to_window_position ( cursor_area. x , cursor_area. y ) ,
463
+ PhysicalSize :: new ( cursor_area. width , cursor_area. height ) ,
464
+ ) ;
465
+ }
442
466
}
443
467
444
468
fn create_wgpu_instance (
0 commit comments