4
4
5
5
use crate :: Texture ;
6
6
use glib:: { prelude:: * , translate:: * } ;
7
- #[ cfg( feature = "v4_16" ) ]
8
- #[ cfg_attr( docsrs, doc( cfg( feature = "v4_16" ) ) ) ]
9
- use std:: boxed:: Box as Box_ ;
10
7
11
8
glib:: wrapper! {
12
9
#[ doc( alias = "GdkCursor" ) ]
@@ -18,63 +15,6 @@ glib::wrapper! {
18
15
}
19
16
20
17
impl Cursor {
21
- #[ cfg( feature = "v4_16" ) ]
22
- #[ cfg_attr( docsrs, doc( cfg( feature = "v4_16" ) ) ) ]
23
- #[ doc( alias = "gdk_cursor_new_from_callback" ) ]
24
- #[ doc( alias = "new_from_callback" ) ]
25
- pub fn from_callback < P : Fn ( & Cursor , i32 , f64 , i32 , i32 , i32 , i32 ) -> Texture + ' static > (
26
- callback : P ,
27
- fallback : Option < & Cursor > ,
28
- ) -> Option < Cursor > {
29
- assert_initialized_main_thread ! ( ) ;
30
- let callback_data: Box_ < P > = Box_ :: new ( callback) ;
31
- unsafe extern "C" fn callback_func <
32
- P : Fn ( & Cursor , i32 , f64 , i32 , i32 , i32 , i32 ) -> Texture + ' static ,
33
- > (
34
- cursor : * mut ffi:: GdkCursor ,
35
- cursor_size : libc:: c_int ,
36
- scale : libc:: c_double ,
37
- width : * mut libc:: c_int ,
38
- height : * mut libc:: c_int ,
39
- hotspot_x : * mut libc:: c_int ,
40
- hotspot_y : * mut libc:: c_int ,
41
- data : glib:: ffi:: gpointer ,
42
- ) -> * mut ffi:: GdkTexture {
43
- let cursor = from_glib_borrow ( cursor) ;
44
- let callback = & * ( data as * mut P ) ;
45
- ( * callback) (
46
- & cursor,
47
- cursor_size,
48
- scale,
49
- width,
50
- height,
51
- hotspot_x,
52
- hotspot_y,
53
- )
54
- /*Not checked*/
55
- . to_glib_none ( )
56
- . 0
57
- }
58
- let callback = Some ( callback_func :: < P > as _ ) ;
59
- unsafe extern "C" fn destroy_func <
60
- P : Fn ( & Cursor , i32 , f64 , i32 , i32 , i32 , i32 ) -> Texture + ' static ,
61
- > (
62
- data : glib:: ffi:: gpointer ,
63
- ) {
64
- let _callback = Box_ :: from_raw ( data as * mut P ) ;
65
- }
66
- let destroy_call2 = Some ( destroy_func :: < P > as _ ) ;
67
- let super_callback0: Box_ < P > = callback_data;
68
- unsafe {
69
- from_glib_full ( ffi:: gdk_cursor_new_from_callback (
70
- callback,
71
- Box_ :: into_raw ( super_callback0) as * mut _ ,
72
- destroy_call2,
73
- fallback. to_glib_none ( ) . 0 ,
74
- ) )
75
- }
76
- }
77
-
78
18
#[ doc( alias = "gdk_cursor_new_from_name" ) ]
79
19
#[ doc( alias = "new_from_name" ) ]
80
20
pub fn from_name ( name : & str , fallback : Option < & Cursor > ) -> Option < Cursor > {
0 commit comments