Skip to main content

spice_client_glib/auto/
display_channel.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5#![allow(deprecated)]
6
7use crate::{ffi, Channel, DisplayPrimary, GlScanout};
8use glib::{
9    object::ObjectType as _,
10    prelude::*,
11    signal::{connect_raw, SignalHandlerId},
12    translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17    #[doc(alias = "SpiceDisplayChannel")]
18    pub struct DisplayChannel(Object<ffi::SpiceDisplayChannel, ffi::SpiceDisplayChannelClass>) @extends Channel;
19
20    match fn {
21        type_ => || ffi::spice_display_channel_get_type(),
22    }
23}
24
25impl DisplayChannel {
26    #[doc(alias = "spice_display_channel_change_preferred_compression")]
27    #[doc(alias = "display_channel_change_preferred_compression")]
28    pub fn change_preferred_compression(&self, compression: i32) {
29        unsafe {
30            ffi::spice_display_channel_change_preferred_compression(
31                self.to_glib_none().0,
32                compression,
33            );
34        }
35    }
36
37    #[doc(alias = "spice_display_channel_change_preferred_video_codec_types")]
38    #[doc(alias = "display_channel_change_preferred_video_codec_types")]
39    pub fn change_preferred_video_codec_types(&self, codecs: &[i32]) -> Result<(), glib::Error> {
40        let ncodecs = codecs.len() as _;
41        unsafe {
42            let mut error = std::ptr::null_mut();
43            let is_ok = ffi::spice_display_channel_change_preferred_video_codec_types(
44                self.to_glib_none().0,
45                codecs.to_glib_none().0,
46                ncodecs,
47                &mut error,
48            );
49            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
50            if error.is_null() {
51                Ok(())
52            } else {
53                Err(from_glib_full(error))
54            }
55        }
56    }
57
58    #[doc(alias = "spice_display_channel_get_primary")]
59    #[doc(alias = "display_channel_get_primary")]
60    pub fn get_primary(
61        &self,
62        surface_id: u32,
63        primary: &mut DisplayPrimary,
64    ) -> Result<(), glib::error::BoolError> {
65        unsafe {
66            glib::result_from_gboolean!(
67                ffi::spice_display_channel_get_primary(
68                    self.to_glib_none().0,
69                    surface_id,
70                    primary.to_glib_none_mut().0
71                ),
72                "No primary surface"
73            )
74        }
75    }
76
77    #[cfg_attr(feature = "v0_43", deprecated = "Since 0.43")]
78    #[allow(deprecated)]
79    #[doc(alias = "spice_display_channel_get_gl_scanout")]
80    #[doc(alias = "get_gl_scanout")]
81    #[doc(alias = "gl-scanout")]
82    pub fn gl_scanout(&self) -> Option<GlScanout> {
83        unsafe {
84            from_glib_none(ffi::spice_display_channel_get_gl_scanout(
85                self.to_glib_none().0,
86            ))
87        }
88    }
89
90    #[doc(alias = "spice_display_channel_gl_draw_done")]
91    pub fn gl_draw_done(&self) {
92        unsafe {
93            ffi::spice_display_channel_gl_draw_done(self.to_glib_none().0);
94        }
95    }
96
97    pub fn height(&self) -> u32 {
98        ObjectExt::property(self, "height")
99    }
100
101    #[doc(alias = "monitors-max")]
102    pub fn monitors_max(&self) -> u32 {
103        ObjectExt::property(self, "monitors-max")
104    }
105
106    pub fn width(&self) -> u32 {
107        ObjectExt::property(self, "width")
108    }
109
110    #[doc(alias = "display-invalidate")]
111    pub fn connect_display_invalidate<F: Fn(&Self, i32, i32, i32, i32) + 'static>(
112        &self,
113        f: F,
114    ) -> SignalHandlerId {
115        unsafe extern "C" fn display_invalidate_trampoline<
116            F: Fn(&DisplayChannel, i32, i32, i32, i32) + 'static,
117        >(
118            this: *mut ffi::SpiceDisplayChannel,
119            x: std::ffi::c_int,
120            y: std::ffi::c_int,
121            width: std::ffi::c_int,
122            height: std::ffi::c_int,
123            f: glib::ffi::gpointer,
124        ) {
125            unsafe {
126                let f: &F = &*(f as *const F);
127                f(&from_glib_borrow(this), x, y, width, height)
128            }
129        }
130        unsafe {
131            let f: Box_<F> = Box_::new(f);
132            connect_raw(
133                self.as_ptr() as *mut _,
134                c"display-invalidate".as_ptr(),
135                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
136                    display_invalidate_trampoline::<F> as *const (),
137                )),
138                Box_::into_raw(f),
139            )
140        }
141    }
142
143    #[doc(alias = "display-mark")]
144    pub fn connect_display_mark<F: Fn(&Self, i32) + 'static>(&self, f: F) -> SignalHandlerId {
145        unsafe extern "C" fn display_mark_trampoline<F: Fn(&DisplayChannel, i32) + 'static>(
146            this: *mut ffi::SpiceDisplayChannel,
147            mark: std::ffi::c_int,
148            f: glib::ffi::gpointer,
149        ) {
150            unsafe {
151                let f: &F = &*(f as *const F);
152                f(&from_glib_borrow(this), mark)
153            }
154        }
155        unsafe {
156            let f: Box_<F> = Box_::new(f);
157            connect_raw(
158                self.as_ptr() as *mut _,
159                c"display-mark".as_ptr(),
160                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
161                    display_mark_trampoline::<F> as *const (),
162                )),
163                Box_::into_raw(f),
164            )
165        }
166    }
167
168    #[doc(alias = "display-primary-destroy")]
169    pub fn connect_display_primary_destroy<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
170        unsafe extern "C" fn display_primary_destroy_trampoline<
171            F: Fn(&DisplayChannel) + 'static,
172        >(
173            this: *mut ffi::SpiceDisplayChannel,
174            f: glib::ffi::gpointer,
175        ) {
176            unsafe {
177                let f: &F = &*(f as *const F);
178                f(&from_glib_borrow(this))
179            }
180        }
181        unsafe {
182            let f: Box_<F> = Box_::new(f);
183            connect_raw(
184                self.as_ptr() as *mut _,
185                c"display-primary-destroy".as_ptr(),
186                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
187                    display_primary_destroy_trampoline::<F> as *const (),
188                )),
189                Box_::into_raw(f),
190            )
191        }
192    }
193
194    #[doc(alias = "gl-draw")]
195    pub fn connect_gl_draw<F: Fn(&Self, u32, u32, u32, u32) + 'static>(
196        &self,
197        f: F,
198    ) -> SignalHandlerId {
199        unsafe extern "C" fn gl_draw_trampoline<
200            F: Fn(&DisplayChannel, u32, u32, u32, u32) + 'static,
201        >(
202            this: *mut ffi::SpiceDisplayChannel,
203            x: std::ffi::c_uint,
204            y: std::ffi::c_uint,
205            width: std::ffi::c_uint,
206            height: std::ffi::c_uint,
207            f: glib::ffi::gpointer,
208        ) {
209            unsafe {
210                let f: &F = &*(f as *const F);
211                f(&from_glib_borrow(this), x, y, width, height)
212            }
213        }
214        unsafe {
215            let f: Box_<F> = Box_::new(f);
216            connect_raw(
217                self.as_ptr() as *mut _,
218                c"gl-draw".as_ptr(),
219                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
220                    gl_draw_trampoline::<F> as *const (),
221                )),
222                Box_::into_raw(f),
223            )
224        }
225    }
226
227    //#[doc(alias = "gst-video-overlay")]
228    //pub fn connect_gst_video_overlay<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
229    //    Ignored pipeline: Gst.Pipeline
230    //}
231
232    #[doc(alias = "gl-scanout")]
233    pub fn connect_gl_scanout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
234        unsafe extern "C" fn notify_gl_scanout_trampoline<F: Fn(&DisplayChannel) + 'static>(
235            this: *mut ffi::SpiceDisplayChannel,
236            _param_spec: glib::ffi::gpointer,
237            f: glib::ffi::gpointer,
238        ) {
239            unsafe {
240                let f: &F = &*(f as *const F);
241                f(&from_glib_borrow(this))
242            }
243        }
244        unsafe {
245            let f: Box_<F> = Box_::new(f);
246            connect_raw(
247                self.as_ptr() as *mut _,
248                c"notify::gl-scanout".as_ptr(),
249                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
250                    notify_gl_scanout_trampoline::<F> as *const (),
251                )),
252                Box_::into_raw(f),
253            )
254        }
255    }
256
257    #[doc(alias = "height")]
258    pub fn connect_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
259        unsafe extern "C" fn notify_height_trampoline<F: Fn(&DisplayChannel) + 'static>(
260            this: *mut ffi::SpiceDisplayChannel,
261            _param_spec: glib::ffi::gpointer,
262            f: glib::ffi::gpointer,
263        ) {
264            unsafe {
265                let f: &F = &*(f as *const F);
266                f(&from_glib_borrow(this))
267            }
268        }
269        unsafe {
270            let f: Box_<F> = Box_::new(f);
271            connect_raw(
272                self.as_ptr() as *mut _,
273                c"notify::height".as_ptr(),
274                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
275                    notify_height_trampoline::<F> as *const (),
276                )),
277                Box_::into_raw(f),
278            )
279        }
280    }
281
282    #[doc(alias = "monitors")]
283    pub fn connect_monitors_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
284        unsafe extern "C" fn notify_monitors_trampoline<F: Fn(&DisplayChannel) + 'static>(
285            this: *mut ffi::SpiceDisplayChannel,
286            _param_spec: glib::ffi::gpointer,
287            f: glib::ffi::gpointer,
288        ) {
289            unsafe {
290                let f: &F = &*(f as *const F);
291                f(&from_glib_borrow(this))
292            }
293        }
294        unsafe {
295            let f: Box_<F> = Box_::new(f);
296            connect_raw(
297                self.as_ptr() as *mut _,
298                c"notify::monitors".as_ptr(),
299                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
300                    notify_monitors_trampoline::<F> as *const (),
301                )),
302                Box_::into_raw(f),
303            )
304        }
305    }
306
307    #[doc(alias = "monitors-max")]
308    pub fn connect_monitors_max_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
309        unsafe extern "C" fn notify_monitors_max_trampoline<F: Fn(&DisplayChannel) + 'static>(
310            this: *mut ffi::SpiceDisplayChannel,
311            _param_spec: glib::ffi::gpointer,
312            f: glib::ffi::gpointer,
313        ) {
314            unsafe {
315                let f: &F = &*(f as *const F);
316                f(&from_glib_borrow(this))
317            }
318        }
319        unsafe {
320            let f: Box_<F> = Box_::new(f);
321            connect_raw(
322                self.as_ptr() as *mut _,
323                c"notify::monitors-max".as_ptr(),
324                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
325                    notify_monitors_max_trampoline::<F> as *const (),
326                )),
327                Box_::into_raw(f),
328            )
329        }
330    }
331
332    #[doc(alias = "width")]
333    pub fn connect_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
334        unsafe extern "C" fn notify_width_trampoline<F: Fn(&DisplayChannel) + 'static>(
335            this: *mut ffi::SpiceDisplayChannel,
336            _param_spec: glib::ffi::gpointer,
337            f: glib::ffi::gpointer,
338        ) {
339            unsafe {
340                let f: &F = &*(f as *const F);
341                f(&from_glib_borrow(this))
342            }
343        }
344        unsafe {
345            let f: Box_<F> = Box_::new(f);
346            connect_raw(
347                self.as_ptr() as *mut _,
348                c"notify::width".as_ptr(),
349                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
350                    notify_width_trampoline::<F> as *const (),
351                )),
352                Box_::into_raw(f),
353            )
354        }
355    }
356}