1use crate::{ffi, Channel};
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 #[doc(alias = "SpiceMainChannel")]
17 pub struct MainChannel(Object<ffi::SpiceMainChannel, ffi::SpiceMainChannelClass>) @extends Channel;
18
19 match fn {
20 type_ => || ffi::spice_main_channel_get_type(),
21 }
22}
23
24impl MainChannel {
25 #[doc(alias = "spice_main_channel_agent_test_capability")]
26 pub fn agent_test_capability(&self, cap: u32) -> bool {
27 unsafe {
28 from_glib(ffi::spice_main_channel_agent_test_capability(
29 self.to_glib_none().0,
30 cap,
31 ))
32 }
33 }
34
35 #[doc(alias = "spice_main_channel_clipboard_selection_grab")]
36 pub fn clipboard_selection_grab(&self, selection: u32, types: &[u32]) {
37 let ntypes = types.len() as _;
38 unsafe {
39 ffi::spice_main_channel_clipboard_selection_grab(
40 self.to_glib_none().0,
41 selection,
42 types.to_glib_none().0,
43 ntypes,
44 );
45 }
46 }
47
48 #[doc(alias = "spice_main_channel_clipboard_selection_notify")]
49 pub fn clipboard_selection_notify(&self, selection: u32, type_: u32, data: &[u8]) {
50 let size = data.len() as _;
51 unsafe {
52 ffi::spice_main_channel_clipboard_selection_notify(
53 self.to_glib_none().0,
54 selection,
55 type_,
56 data.to_glib_none().0,
57 size,
58 );
59 }
60 }
61
62 #[doc(alias = "spice_main_channel_clipboard_selection_release")]
63 pub fn clipboard_selection_release(&self, selection: u32) {
64 unsafe {
65 ffi::spice_main_channel_clipboard_selection_release(self.to_glib_none().0, selection);
66 }
67 }
68
69 #[doc(alias = "spice_main_channel_clipboard_selection_request")]
70 pub fn clipboard_selection_request(&self, selection: u32, type_: u32) {
71 unsafe {
72 ffi::spice_main_channel_clipboard_selection_request(
73 self.to_glib_none().0,
74 selection,
75 type_,
76 );
77 }
78 }
79
80 #[doc(alias = "spice_main_channel_request_mouse_mode")]
104 pub fn request_mouse_mode(&self, mode: i32) {
105 unsafe {
106 ffi::spice_main_channel_request_mouse_mode(self.to_glib_none().0, mode);
107 }
108 }
109
110 #[doc(alias = "spice_main_channel_send_monitor_config")]
111 pub fn send_monitor_config(&self) -> bool {
112 unsafe {
113 from_glib(ffi::spice_main_channel_send_monitor_config(
114 self.to_glib_none().0,
115 ))
116 }
117 }
118
119 #[doc(alias = "spice_main_channel_update_display")]
120 pub fn update_display(&self, id: i32, x: i32, y: i32, width: i32, height: i32, update: bool) {
121 unsafe {
122 ffi::spice_main_channel_update_display(
123 self.to_glib_none().0,
124 id,
125 x,
126 y,
127 width,
128 height,
129 update.into_glib(),
130 );
131 }
132 }
133
134 #[doc(alias = "spice_main_channel_update_display_enabled")]
135 pub fn update_display_enabled(&self, id: i32, enabled: bool, update: bool) {
136 unsafe {
137 ffi::spice_main_channel_update_display_enabled(
138 self.to_glib_none().0,
139 id,
140 enabled.into_glib(),
141 update.into_glib(),
142 );
143 }
144 }
145
146 #[doc(alias = "spice_main_channel_update_display_mm")]
147 pub fn update_display_mm(&self, id: i32, width_mm: i32, height_mm: i32, update: bool) {
148 unsafe {
149 ffi::spice_main_channel_update_display_mm(
150 self.to_glib_none().0,
151 id,
152 width_mm,
153 height_mm,
154 update.into_glib(),
155 );
156 }
157 }
158
159 #[doc(alias = "agent-caps-0")]
160 pub fn agent_caps_0(&self) -> i32 {
161 ObjectExt::property(self, "agent-caps-0")
162 }
163
164 #[doc(alias = "agent-connected")]
165 pub fn is_agent_connected(&self) -> bool {
166 ObjectExt::property(self, "agent-connected")
167 }
168
169 #[doc(alias = "disable-animation")]
170 pub fn is_disable_animation(&self) -> bool {
171 ObjectExt::property(self, "disable-animation")
172 }
173
174 #[doc(alias = "disable-animation")]
175 pub fn set_disable_animation(&self, disable_animation: bool) {
176 ObjectExt::set_property(self, "disable-animation", disable_animation)
177 }
178
179 #[doc(alias = "disable-display-align")]
180 pub fn is_disable_display_align(&self) -> bool {
181 ObjectExt::property(self, "disable-display-align")
182 }
183
184 #[doc(alias = "disable-display-align")]
185 pub fn set_disable_display_align(&self, disable_display_align: bool) {
186 ObjectExt::set_property(self, "disable-display-align", disable_display_align)
187 }
188
189 #[doc(alias = "disable-display-position")]
190 pub fn is_disable_display_position(&self) -> bool {
191 ObjectExt::property(self, "disable-display-position")
192 }
193
194 #[doc(alias = "disable-display-position")]
195 pub fn set_disable_display_position(&self, disable_display_position: bool) {
196 ObjectExt::set_property(self, "disable-display-position", disable_display_position)
197 }
198
199 #[doc(alias = "disable-font-smooth")]
200 pub fn is_disable_font_smooth(&self) -> bool {
201 ObjectExt::property(self, "disable-font-smooth")
202 }
203
204 #[doc(alias = "disable-font-smooth")]
205 pub fn set_disable_font_smooth(&self, disable_font_smooth: bool) {
206 ObjectExt::set_property(self, "disable-font-smooth", disable_font_smooth)
207 }
208
209 #[doc(alias = "disable-wallpaper")]
210 pub fn is_disable_wallpaper(&self) -> bool {
211 ObjectExt::property(self, "disable-wallpaper")
212 }
213
214 #[doc(alias = "disable-wallpaper")]
215 pub fn set_disable_wallpaper(&self, disable_wallpaper: bool) {
216 ObjectExt::set_property(self, "disable-wallpaper", disable_wallpaper)
217 }
218
219 #[doc(alias = "max-clipboard")]
220 pub fn max_clipboard(&self) -> i32 {
221 ObjectExt::property(self, "max-clipboard")
222 }
223
224 #[doc(alias = "max-clipboard")]
225 pub fn set_max_clipboard(&self, max_clipboard: i32) {
226 ObjectExt::set_property(self, "max-clipboard", max_clipboard)
227 }
228
229 #[doc(alias = "mouse-mode")]
230 pub fn mouse_mode(&self) -> i32 {
231 ObjectExt::property(self, "mouse-mode")
232 }
233
234 #[doc(alias = "main-agent-update")]
235 pub fn connect_main_agent_update<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
236 unsafe extern "C" fn main_agent_update_trampoline<F: Fn(&MainChannel) + 'static>(
237 this: *mut ffi::SpiceMainChannel,
238 f: glib::ffi::gpointer,
239 ) {
240 unsafe {
241 let f: &F = &*(f as *const F);
242 f(&from_glib_borrow(this))
243 }
244 }
245 unsafe {
246 let f: Box_<F> = Box_::new(f);
247 connect_raw(
248 self.as_ptr() as *mut _,
249 c"main-agent-update".as_ptr(),
250 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
251 main_agent_update_trampoline::<F> as *const (),
252 )),
253 Box_::into_raw(f),
254 )
255 }
256 }
257
258 #[doc(alias = "main-clipboard-selection-release")]
259 pub fn connect_main_clipboard_selection_release<F: Fn(&Self, u32) + 'static>(
260 &self,
261 f: F,
262 ) -> SignalHandlerId {
263 unsafe extern "C" fn main_clipboard_selection_release_trampoline<
264 F: Fn(&MainChannel, u32) + 'static,
265 >(
266 this: *mut ffi::SpiceMainChannel,
267 selection: std::ffi::c_uint,
268 f: glib::ffi::gpointer,
269 ) {
270 unsafe {
271 let f: &F = &*(f as *const F);
272 f(&from_glib_borrow(this), selection)
273 }
274 }
275 unsafe {
276 let f: Box_<F> = Box_::new(f);
277 connect_raw(
278 self.as_ptr() as *mut _,
279 c"main-clipboard-selection-release".as_ptr(),
280 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
281 main_clipboard_selection_release_trampoline::<F> as *const (),
282 )),
283 Box_::into_raw(f),
284 )
285 }
286 }
287
288 #[doc(alias = "main-clipboard-selection-request")]
289 pub fn connect_main_clipboard_selection_request<F: Fn(&Self, u32, u32) -> bool + 'static>(
290 &self,
291 f: F,
292 ) -> SignalHandlerId {
293 unsafe extern "C" fn main_clipboard_selection_request_trampoline<
294 F: Fn(&MainChannel, u32, u32) -> bool + 'static,
295 >(
296 this: *mut ffi::SpiceMainChannel,
297 selection: std::ffi::c_uint,
298 types: std::ffi::c_uint,
299 f: glib::ffi::gpointer,
300 ) -> glib::ffi::gboolean {
301 unsafe {
302 let f: &F = &*(f as *const F);
303 f(&from_glib_borrow(this), selection, types).into_glib()
304 }
305 }
306 unsafe {
307 let f: Box_<F> = Box_::new(f);
308 connect_raw(
309 self.as_ptr() as *mut _,
310 c"main-clipboard-selection-request".as_ptr(),
311 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
312 main_clipboard_selection_request_trampoline::<F> as *const (),
313 )),
314 Box_::into_raw(f),
315 )
316 }
317 }
318
319 #[doc(alias = "main-mouse-update")]
320 pub fn connect_main_mouse_update<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
321 unsafe extern "C" fn main_mouse_update_trampoline<F: Fn(&MainChannel) + 'static>(
322 this: *mut ffi::SpiceMainChannel,
323 f: glib::ffi::gpointer,
324 ) {
325 unsafe {
326 let f: &F = &*(f as *const F);
327 f(&from_glib_borrow(this))
328 }
329 }
330 unsafe {
331 let f: Box_<F> = Box_::new(f);
332 connect_raw(
333 self.as_ptr() as *mut _,
334 c"main-mouse-update".as_ptr(),
335 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
336 main_mouse_update_trampoline::<F> as *const (),
337 )),
338 Box_::into_raw(f),
339 )
340 }
341 }
342
343 #[doc(alias = "migration-started")]
344 pub fn connect_migration_started<F: Fn(&Self, &glib::Object) + 'static>(
345 &self,
346 f: F,
347 ) -> SignalHandlerId {
348 unsafe extern "C" fn migration_started_trampoline<
349 F: Fn(&MainChannel, &glib::Object) + 'static,
350 >(
351 this: *mut ffi::SpiceMainChannel,
352 session: *mut glib::gobject_ffi::GObject,
353 f: glib::ffi::gpointer,
354 ) {
355 unsafe {
356 let f: &F = &*(f as *const F);
357 f(&from_glib_borrow(this), &from_glib_borrow(session))
358 }
359 }
360 unsafe {
361 let f: Box_<F> = Box_::new(f);
362 connect_raw(
363 self.as_ptr() as *mut _,
364 c"migration-started".as_ptr(),
365 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
366 migration_started_trampoline::<F> as *const (),
367 )),
368 Box_::into_raw(f),
369 )
370 }
371 }
372
373 #[doc(alias = "new-file-transfer")]
374 pub fn connect_new_file_transfer<F: Fn(&Self, &glib::Object) + 'static>(
375 &self,
376 f: F,
377 ) -> SignalHandlerId {
378 unsafe extern "C" fn new_file_transfer_trampoline<
379 F: Fn(&MainChannel, &glib::Object) + 'static,
380 >(
381 this: *mut ffi::SpiceMainChannel,
382 task: *mut glib::gobject_ffi::GObject,
383 f: glib::ffi::gpointer,
384 ) {
385 unsafe {
386 let f: &F = &*(f as *const F);
387 f(&from_glib_borrow(this), &from_glib_borrow(task))
388 }
389 }
390 unsafe {
391 let f: Box_<F> = Box_::new(f);
392 connect_raw(
393 self.as_ptr() as *mut _,
394 c"new-file-transfer".as_ptr(),
395 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
396 new_file_transfer_trampoline::<F> as *const (),
397 )),
398 Box_::into_raw(f),
399 )
400 }
401 }
402
403 #[doc(alias = "agent-caps-0")]
404 pub fn connect_agent_caps_0_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
405 unsafe extern "C" fn notify_agent_caps_0_trampoline<F: Fn(&MainChannel) + 'static>(
406 this: *mut ffi::SpiceMainChannel,
407 _param_spec: glib::ffi::gpointer,
408 f: glib::ffi::gpointer,
409 ) {
410 unsafe {
411 let f: &F = &*(f as *const F);
412 f(&from_glib_borrow(this))
413 }
414 }
415 unsafe {
416 let f: Box_<F> = Box_::new(f);
417 connect_raw(
418 self.as_ptr() as *mut _,
419 c"notify::agent-caps-0".as_ptr(),
420 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
421 notify_agent_caps_0_trampoline::<F> as *const (),
422 )),
423 Box_::into_raw(f),
424 )
425 }
426 }
427
428 #[doc(alias = "agent-connected")]
429 pub fn connect_agent_connected_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
430 unsafe extern "C" fn notify_agent_connected_trampoline<F: Fn(&MainChannel) + 'static>(
431 this: *mut ffi::SpiceMainChannel,
432 _param_spec: glib::ffi::gpointer,
433 f: glib::ffi::gpointer,
434 ) {
435 unsafe {
436 let f: &F = &*(f as *const F);
437 f(&from_glib_borrow(this))
438 }
439 }
440 unsafe {
441 let f: Box_<F> = Box_::new(f);
442 connect_raw(
443 self.as_ptr() as *mut _,
444 c"notify::agent-connected".as_ptr(),
445 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
446 notify_agent_connected_trampoline::<F> as *const (),
447 )),
448 Box_::into_raw(f),
449 )
450 }
451 }
452
453 #[doc(alias = "disable-animation")]
454 pub fn connect_disable_animation_notify<F: Fn(&Self) + 'static>(
455 &self,
456 f: F,
457 ) -> SignalHandlerId {
458 unsafe extern "C" fn notify_disable_animation_trampoline<F: Fn(&MainChannel) + 'static>(
459 this: *mut ffi::SpiceMainChannel,
460 _param_spec: glib::ffi::gpointer,
461 f: glib::ffi::gpointer,
462 ) {
463 unsafe {
464 let f: &F = &*(f as *const F);
465 f(&from_glib_borrow(this))
466 }
467 }
468 unsafe {
469 let f: Box_<F> = Box_::new(f);
470 connect_raw(
471 self.as_ptr() as *mut _,
472 c"notify::disable-animation".as_ptr(),
473 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
474 notify_disable_animation_trampoline::<F> as *const (),
475 )),
476 Box_::into_raw(f),
477 )
478 }
479 }
480
481 #[doc(alias = "disable-display-align")]
482 pub fn connect_disable_display_align_notify<F: Fn(&Self) + 'static>(
483 &self,
484 f: F,
485 ) -> SignalHandlerId {
486 unsafe extern "C" fn notify_disable_display_align_trampoline<
487 F: Fn(&MainChannel) + 'static,
488 >(
489 this: *mut ffi::SpiceMainChannel,
490 _param_spec: glib::ffi::gpointer,
491 f: glib::ffi::gpointer,
492 ) {
493 unsafe {
494 let f: &F = &*(f as *const F);
495 f(&from_glib_borrow(this))
496 }
497 }
498 unsafe {
499 let f: Box_<F> = Box_::new(f);
500 connect_raw(
501 self.as_ptr() as *mut _,
502 c"notify::disable-display-align".as_ptr(),
503 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
504 notify_disable_display_align_trampoline::<F> as *const (),
505 )),
506 Box_::into_raw(f),
507 )
508 }
509 }
510
511 #[doc(alias = "disable-display-position")]
512 pub fn connect_disable_display_position_notify<F: Fn(&Self) + 'static>(
513 &self,
514 f: F,
515 ) -> SignalHandlerId {
516 unsafe extern "C" fn notify_disable_display_position_trampoline<
517 F: Fn(&MainChannel) + 'static,
518 >(
519 this: *mut ffi::SpiceMainChannel,
520 _param_spec: glib::ffi::gpointer,
521 f: glib::ffi::gpointer,
522 ) {
523 unsafe {
524 let f: &F = &*(f as *const F);
525 f(&from_glib_borrow(this))
526 }
527 }
528 unsafe {
529 let f: Box_<F> = Box_::new(f);
530 connect_raw(
531 self.as_ptr() as *mut _,
532 c"notify::disable-display-position".as_ptr(),
533 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
534 notify_disable_display_position_trampoline::<F> as *const (),
535 )),
536 Box_::into_raw(f),
537 )
538 }
539 }
540
541 #[doc(alias = "disable-font-smooth")]
542 pub fn connect_disable_font_smooth_notify<F: Fn(&Self) + 'static>(
543 &self,
544 f: F,
545 ) -> SignalHandlerId {
546 unsafe extern "C" fn notify_disable_font_smooth_trampoline<
547 F: Fn(&MainChannel) + 'static,
548 >(
549 this: *mut ffi::SpiceMainChannel,
550 _param_spec: glib::ffi::gpointer,
551 f: glib::ffi::gpointer,
552 ) {
553 unsafe {
554 let f: &F = &*(f as *const F);
555 f(&from_glib_borrow(this))
556 }
557 }
558 unsafe {
559 let f: Box_<F> = Box_::new(f);
560 connect_raw(
561 self.as_ptr() as *mut _,
562 c"notify::disable-font-smooth".as_ptr(),
563 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
564 notify_disable_font_smooth_trampoline::<F> as *const (),
565 )),
566 Box_::into_raw(f),
567 )
568 }
569 }
570
571 #[doc(alias = "disable-wallpaper")]
572 pub fn connect_disable_wallpaper_notify<F: Fn(&Self) + 'static>(
573 &self,
574 f: F,
575 ) -> SignalHandlerId {
576 unsafe extern "C" fn notify_disable_wallpaper_trampoline<F: Fn(&MainChannel) + 'static>(
577 this: *mut ffi::SpiceMainChannel,
578 _param_spec: glib::ffi::gpointer,
579 f: glib::ffi::gpointer,
580 ) {
581 unsafe {
582 let f: &F = &*(f as *const F);
583 f(&from_glib_borrow(this))
584 }
585 }
586 unsafe {
587 let f: Box_<F> = Box_::new(f);
588 connect_raw(
589 self.as_ptr() as *mut _,
590 c"notify::disable-wallpaper".as_ptr(),
591 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
592 notify_disable_wallpaper_trampoline::<F> as *const (),
593 )),
594 Box_::into_raw(f),
595 )
596 }
597 }
598
599 #[doc(alias = "max-clipboard")]
600 pub fn connect_max_clipboard_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
601 unsafe extern "C" fn notify_max_clipboard_trampoline<F: Fn(&MainChannel) + 'static>(
602 this: *mut ffi::SpiceMainChannel,
603 _param_spec: glib::ffi::gpointer,
604 f: glib::ffi::gpointer,
605 ) {
606 unsafe {
607 let f: &F = &*(f as *const F);
608 f(&from_glib_borrow(this))
609 }
610 }
611 unsafe {
612 let f: Box_<F> = Box_::new(f);
613 connect_raw(
614 self.as_ptr() as *mut _,
615 c"notify::max-clipboard".as_ptr(),
616 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
617 notify_max_clipboard_trampoline::<F> as *const (),
618 )),
619 Box_::into_raw(f),
620 )
621 }
622 }
623
624 #[doc(alias = "mouse-mode")]
625 pub fn connect_mouse_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
626 unsafe extern "C" fn notify_mouse_mode_trampoline<F: Fn(&MainChannel) + 'static>(
627 this: *mut ffi::SpiceMainChannel,
628 _param_spec: glib::ffi::gpointer,
629 f: glib::ffi::gpointer,
630 ) {
631 unsafe {
632 let f: &F = &*(f as *const F);
633 f(&from_glib_borrow(this))
634 }
635 }
636 unsafe {
637 let f: Box_<F> = Box_::new(f);
638 connect_raw(
639 self.as_ptr() as *mut _,
640 c"notify::mouse-mode".as_ptr(),
641 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
642 notify_mouse_mode_trampoline::<F> as *const (),
643 )),
644 Box_::into_raw(f),
645 )
646 }
647 }
648}