1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// pub fn rfb_get_screen(
// width: i32,
// height: i32,
// bits_per_sample: i32,
// samples_per_pixel: i32,
// bytes_per_pixel: i32,
// ) -> bindings::rfbScreenInfoPtr {
// let mut arg_len = 0 as i32;
// let mut arg_ptr: *mut i8 = core::ptr::null_mut();
// unsafe {
// bindings::rfbGetScreen(
// &mut arg_len,
// &mut arg_ptr,
// width,
// height,
// bits_per_sample,
// samples_per_pixel,
// bytes_per_pixel,
// )
// }
// }
// pub fn rfb_screen_cleanup(ptr: bindings::rfbScreenInfoPtr) {
// unsafe {
// bindings::rfbScreenCleanup(ptr);
// }
// }
// pub fn rfb_framebuffer_malloc(ptr: bindings::rfbScreenInfoPtr, fb_size: u64) {
// unsafe {
// (*ptr).frameBuffer = bindings::malloc(fb_size as ::std::os::raw::c_ulong) as *mut i8;
// }
// }
// pub fn rfb_framebuffer_free(ptr: bindings::rfbScreenInfoPtr) {
// unsafe {
// bindings::free((*ptr).frameBuffer as *mut ::std::os::raw::c_void);
// }
// }
// pub fn rfb_framebuffer_set_rgb16(ptr: bindings::rfbScreenInfoPtr, x: i32, y: i32, rgb16: u16) {
// unsafe {
// let addr = (*ptr).frameBuffer as *mut u16;
// let fb_size = (*ptr).height * (*ptr).width * (*ptr).bitsPerPixel / 2;
// let slice: &mut [u16] = core::slice::from_raw_parts_mut(addr, fb_size as usize);
// let pos = (*ptr).width * y + x;
// if pos < fb_size {
// slice[pos as usize] = rgb16;
// }
// }
// }
// pub fn rfb_process_events(ptr: bindings::rfbScreenInfoPtr, usec: i64) -> bindings::rfbBool {
// unsafe { bindings::rfbProcessEvents(ptr, usec as ::std::os::raw::c_long) }
// }
// pub fn rfb_kbd_add_event(ptr: bindings::rfbScreenInfoPtr, cb: bindings::rfbKbdAddEventProcPtr) {
// unsafe {
// (*ptr).kbdAddEvent = cb;
// }
// }
// pub fn rfb_mark_rect_as_modified(
// ptr: bindings::rfbScreenInfoPtr,
// x1: i32,
// y1: i32,
// x2: i32,
// y2: i32,
// ) {
// unsafe {
// bindings::rfbMarkRectAsModified(
// ptr,
// x1 as ::std::os::raw::c_int,
// y1 as ::std::os::raw::c_int,
// x2 as ::std::os::raw::c_int,
// y2 as ::std::os::raw::c_int,
// );
// }
// }
// pub fn rfb_is_active(ptr: bindings::rfbScreenInfoPtr) -> bindings::rfbBool {
// unsafe { bindings::rfbIsActive(ptr) }
// }
// pub fn rfb_init_server(ptr: bindings::rfbScreenInfoPtr) {
// unsafe {
// bindings::rfbInitServerWithPthreadsAndZRLE(ptr);
// }
// }
// pub fn rfb_run_event_loop(
// ptr: bindings::rfbScreenInfoPtr,
// usec: i64,
// run_in_background: bindings::rfbBool,
// ) {
// unsafe {
// bindings::rfbRunEventLoop(ptr, usec as ::std::os::raw::c_long, run_in_background);
// };
// }
// pub fn rfb_get_client(
// bits_per_sample: i32,
// samples_per_pixel: i32,
// bytes_per_pixel: i32,
// ) -> *mut bindings::_rfbClient {
// unsafe { bindings::rfbGetClient(bits_per_sample, samples_per_pixel, bytes_per_pixel) }
// }