@@ -72,6 +72,11 @@ pub trait IMContextImpl: ObjectImpl + ObjectSubclass<Type: IsA<IMContext>> {
72
72
fn activate_osk_with_event ( & self , event : Option < & gdk:: Event > ) -> bool {
73
73
self . parent_activate_osk_with_event ( event)
74
74
}
75
+ #[ cfg( feature = "v4_22" ) ]
76
+ #[ cfg_attr( docsrs, doc( cfg( feature = "v4_22" ) ) ) ]
77
+ fn invalid_composition ( & self , string : & str ) -> bool {
78
+ self . parent_invalid_composition ( string)
79
+ }
75
80
}
76
81
77
82
#[ allow( clippy:: upper_case_acronyms) ]
@@ -327,6 +332,23 @@ pub trait IMContextImplExt: IMContextImpl {
327
332
}
328
333
}
329
334
}
335
+
336
+ #[ cfg( feature = "v4_22" ) ]
337
+ #[ cfg_attr( docsrs, doc( cfg( feature = "v4_22" ) ) ) ]
338
+ fn parent_invalid_composition ( & self , string : & str ) -> bool {
339
+ unsafe {
340
+ let data = Self :: type_data ( ) ;
341
+ let parent_class = data. as_ref ( ) . parent_class ( ) as * mut ffi:: GtkIMContextClass ;
342
+ if let Some ( f) = ( * parent_class) . invalid_composition {
343
+ from_glib ( f (
344
+ self . obj ( ) . unsafe_cast_ref :: < IMContext > ( ) . to_glib_none ( ) . 0 ,
345
+ string. to_glib_none ( ) . 0 ,
346
+ ) )
347
+ } else {
348
+ false
349
+ }
350
+ }
351
+ }
330
352
}
331
353
332
354
impl < T : IMContextImpl > IMContextImplExt for T { }
@@ -364,6 +386,11 @@ unsafe impl<T: IMContextImpl> IsSubclassable<T> for IMContext {
364
386
{
365
387
klass. activate_osk_with_event = Some ( im_context_activate_osk_with_event :: < T > ) ;
366
388
} ;
389
+ #[ cfg( feature = "v4_22" ) ]
390
+ #[ cfg_attr( docsrs, doc( cfg( feature = "v4_22" ) ) ) ]
391
+ {
392
+ klass. invalid_composition = Some ( im_context_invalid_composition :: < T > ) ;
393
+ } ;
367
394
}
368
395
}
369
396
@@ -538,7 +565,6 @@ unsafe extern "C" fn im_context_set_use_preedit<T: IMContextImpl>(
538
565
}
539
566
540
567
#[ cfg( feature = "v4_10" ) ]
541
- #[ cfg_attr( docsrs, doc( cfg( feature = "v4_10" ) ) ) ]
542
568
unsafe extern "C" fn im_context_activate_osk < T : IMContextImpl > ( ptr : * mut ffi:: GtkIMContext ) {
543
569
let instance = & * ( ptr as * mut T :: Instance ) ;
544
570
let imp = instance. imp ( ) ;
@@ -547,7 +573,6 @@ unsafe extern "C" fn im_context_activate_osk<T: IMContextImpl>(ptr: *mut ffi::Gt
547
573
}
548
574
549
575
#[ cfg( feature = "v4_14" ) ]
550
- #[ cfg_attr( docsrs, doc( cfg( feature = "v4_14" ) ) ) ]
551
576
unsafe extern "C" fn im_context_activate_osk_with_event < T : IMContextImpl > (
552
577
ptr : * mut ffi:: GtkIMContext ,
553
578
eventptr : * mut gdk:: ffi:: GdkEvent ,
@@ -560,3 +585,15 @@ unsafe extern "C" fn im_context_activate_osk_with_event<T: IMContextImpl>(
560
585
imp. activate_osk_with_event ( event. as_ref ( ) . as_ref ( ) )
561
586
. into_glib ( )
562
587
}
588
+
589
+ #[ cfg( feature = "v4_22" ) ]
590
+ unsafe extern "C" fn im_context_invalid_composition < T : IMContextImpl > (
591
+ ptr : * mut ffi:: GtkIMContext ,
592
+ stringptr : * const libc:: c_char ,
593
+ ) -> glib:: ffi:: gboolean {
594
+ let instance = & * ( ptr as * mut T :: Instance ) ;
595
+ let imp = instance. imp ( ) ;
596
+ let text: Borrowed < GString > = from_glib_borrow ( stringptr) ;
597
+
598
+ imp. invalid_composition ( & text) . into_glib ( )
599
+ }
0 commit comments