gdk4/auto/
dmabuf_texture_builder.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5#[cfg(feature = "v4_16")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
7use crate::ColorState;
8use crate::{ffi, Display, Texture};
9use glib::{
10    prelude::*,
11    signal::{connect_raw, SignalHandlerId},
12    translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17    /// [`DmabufTextureBuilder`][crate::DmabufTextureBuilder] is a builder used to construct [`Texture`][crate::Texture]
18    /// objects from DMA buffers.
19    ///
20    /// DMA buffers are commonly called **_dma-bufs_**.
21    ///
22    /// DMA buffers are a feature of the Linux kernel to enable efficient buffer and
23    /// memory sharing between hardware such as codecs, GPUs, displays, cameras and the
24    /// kernel drivers controlling them. For example, a decoder may want its output to
25    /// be directly shared with the display server for rendering without a copy.
26    ///
27    /// Any device driver which participates in DMA buffer sharing, can do so as either
28    /// the exporter or importer of buffers (or both).
29    ///
30    /// The memory that is shared via DMA buffers is usually stored in non-system memory
31    /// (maybe in device's local memory or something else not directly accessible by the
32    /// CPU), and accessing this memory from the CPU may have higher-than-usual overhead.
33    ///
34    /// In particular for graphics data, it is not uncommon that data consists of multiple
35    /// separate blocks of memory, for example one block for each of the red, green and
36    /// blue channels. These blocks are called **_planes_**. DMA buffers can have up to
37    /// four planes. Even if the memory is a single block, the data can be organized in
38    /// multiple planes, by specifying offsets from the beginning of the data.
39    ///
40    /// DMA buffers are exposed to user-space as file descriptors allowing to pass them
41    /// between processes. If a DMA buffer has multiple planes, there is one file
42    /// descriptor per plane.
43    ///
44    /// The format of the data (for graphics data, essentially its colorspace) is described
45    /// by a 32-bit integer. These format identifiers are defined in the header file `drm_fourcc.h`
46    /// and commonly referred to as **_fourcc_** values, since they are identified by 4 ASCII
47    /// characters. Additionally, each DMA buffer has a **_modifier_**, which is a 64-bit integer
48    /// that describes driver-specific details of the memory layout, such as tiling or compression.
49    ///
50    /// For historical reasons, some producers of dma-bufs don't provide an explicit modifier, but
51    /// instead return `DMA_FORMAT_MOD_INVALID` to indicate that their modifier is **_implicit_**.
52    /// GTK tries to accommodate this situation by accepting `DMA_FORMAT_MOD_INVALID` as modifier.
53    ///
54    /// The operation of [`DmabufTextureBuilder`][crate::DmabufTextureBuilder] is quite simple: Create a texture builder,
55    /// set all the necessary properties, and then call [`build()`][Self::build()]
56    /// to create the new texture.
57    ///
58    /// The required properties for a dma-buf texture are
59    ///
60    ///  * The width and height in pixels
61    ///
62    ///  * The `fourcc` code and `modifier` which identify the format and memory layout of the dma-buf
63    ///
64    ///  * The file descriptor, offset and stride for each of the planes
65    ///
66    /// [`DmabufTextureBuilder`][crate::DmabufTextureBuilder] can be used for quick one-shot construction of
67    /// textures as well as kept around and reused to construct multiple textures.
68    ///
69    /// For further information, see
70    ///
71    /// * The Linux kernel [documentation](https://docs.kernel.org/driver-api/dma-buf.html)
72    ///
73    /// * The header file [drm_fourcc.h](https://gitlab.freedesktop.org/mesa/drm/-/blob/main/include/drm/drm_fourcc.h)
74    ///
75    /// ## Properties
76    ///
77    ///
78    /// #### `color-state`
79    ///  The color state of the texture.
80    ///
81    /// Readable | Writeable
82    ///
83    ///
84    /// #### `display`
85    ///  The display that this texture will be used on.
86    ///
87    /// Readable | Writeable
88    ///
89    ///
90    /// #### `fourcc`
91    ///  The format of the texture, as a fourcc value.
92    ///
93    /// Readable | Writeable
94    ///
95    ///
96    /// #### `height`
97    ///  The height of the texture.
98    ///
99    /// Readable | Writeable
100    ///
101    ///
102    /// #### `modifier`
103    ///  The modifier.
104    ///
105    /// Readable | Writeable
106    ///
107    ///
108    /// #### `n-planes`
109    ///  The number of planes of the texture.
110    ///
111    /// Note that you can set properties for other planes,
112    /// but they will be ignored when constructing the texture.
113    ///
114    /// Readable | Writeable
115    ///
116    ///
117    /// #### `premultiplied`
118    ///  Whether the alpha channel is premultiplied into the others.
119    ///
120    /// Only relevant if the format has alpha.
121    ///
122    /// Readable | Writeable
123    ///
124    ///
125    /// #### `update-region`
126    ///  The update region for [`update-texture`][struct@crate::DmabufTextureBuilder#update-texture].
127    ///
128    /// Readable | Writeable
129    ///
130    ///
131    /// #### `update-texture`
132    ///  The texture [`update-region`][struct@crate::DmabufTextureBuilder#update-region] is an update for.
133    ///
134    /// Readable | Writeable
135    ///
136    ///
137    /// #### `width`
138    ///  The width of the texture.
139    ///
140    /// Readable | Writeable
141    #[doc(alias = "GdkDmabufTextureBuilder")]
142    pub struct DmabufTextureBuilder(Object<ffi::GdkDmabufTextureBuilder, ffi::GdkDmabufTextureBuilderClass>);
143
144    match fn {
145        type_ => || ffi::gdk_dmabuf_texture_builder_get_type(),
146    }
147}
148
149impl DmabufTextureBuilder {
150    /// Creates a new texture builder.
151    ///
152    /// # Returns
153    ///
154    /// the new `GdkTextureBuilder`
155    #[doc(alias = "gdk_dmabuf_texture_builder_new")]
156    pub fn new() -> DmabufTextureBuilder {
157        assert_initialized_main_thread!();
158        unsafe { from_glib_full(ffi::gdk_dmabuf_texture_builder_new()) }
159    }
160
161    /// Gets the color state previously set via gdk_dmabuf_texture_builder_set_color_state().
162    ///
163    /// # Returns
164    ///
165    /// the color state
166    #[cfg(feature = "v4_16")]
167    #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
168    #[doc(alias = "gdk_dmabuf_texture_builder_get_color_state")]
169    #[doc(alias = "get_color_state")]
170    #[doc(alias = "color-state")]
171    pub fn color_state(&self) -> Option<ColorState> {
172        unsafe {
173            from_glib_none(ffi::gdk_dmabuf_texture_builder_get_color_state(
174                self.to_glib_none().0,
175            ))
176        }
177    }
178
179    /// Returns the display that this texture builder is
180    /// associated with.
181    ///
182    /// # Returns
183    ///
184    /// the display
185    #[doc(alias = "gdk_dmabuf_texture_builder_get_display")]
186    #[doc(alias = "get_display")]
187    pub fn display(&self) -> Display {
188        unsafe {
189            from_glib_none(ffi::gdk_dmabuf_texture_builder_get_display(
190                self.to_glib_none().0,
191            ))
192        }
193    }
194
195    /// Gets the file descriptor for a plane.
196    /// ## `plane`
197    /// the plane to get the fd for
198    ///
199    /// # Returns
200    ///
201    /// the file descriptor
202    #[doc(alias = "gdk_dmabuf_texture_builder_get_fd")]
203    #[doc(alias = "get_fd")]
204    pub fn fd(&self, plane: u32) -> i32 {
205        unsafe { ffi::gdk_dmabuf_texture_builder_get_fd(self.to_glib_none().0, plane) }
206    }
207
208    /// Gets the format previously set via gdk_dmabuf_texture_builder_set_fourcc()
209    /// or 0 if the format wasn't set.
210    ///
211    /// The format is specified as a fourcc code.
212    ///
213    /// # Returns
214    ///
215    /// The format
216    #[doc(alias = "gdk_dmabuf_texture_builder_get_fourcc")]
217    #[doc(alias = "get_fourcc")]
218    pub fn fourcc(&self) -> u32 {
219        unsafe { ffi::gdk_dmabuf_texture_builder_get_fourcc(self.to_glib_none().0) }
220    }
221
222    /// Gets the height previously set via gdk_dmabuf_texture_builder_set_height() or
223    /// 0 if the height wasn't set.
224    ///
225    /// # Returns
226    ///
227    /// The height
228    #[doc(alias = "gdk_dmabuf_texture_builder_get_height")]
229    #[doc(alias = "get_height")]
230    pub fn height(&self) -> u32 {
231        unsafe { ffi::gdk_dmabuf_texture_builder_get_height(self.to_glib_none().0) }
232    }
233
234    /// Gets the modifier value.
235    ///
236    /// # Returns
237    ///
238    /// the modifier
239    #[doc(alias = "gdk_dmabuf_texture_builder_get_modifier")]
240    #[doc(alias = "get_modifier")]
241    pub fn modifier(&self) -> u64 {
242        unsafe { ffi::gdk_dmabuf_texture_builder_get_modifier(self.to_glib_none().0) }
243    }
244
245    /// Gets the number of planes.
246    ///
247    /// # Returns
248    ///
249    /// The number of planes
250    #[doc(alias = "gdk_dmabuf_texture_builder_get_n_planes")]
251    #[doc(alias = "get_n_planes")]
252    #[doc(alias = "n-planes")]
253    pub fn n_planes(&self) -> u32 {
254        unsafe { ffi::gdk_dmabuf_texture_builder_get_n_planes(self.to_glib_none().0) }
255    }
256
257    /// Gets the offset value for a plane.
258    /// ## `plane`
259    /// the plane to get the offset for
260    ///
261    /// # Returns
262    ///
263    /// the offset
264    #[doc(alias = "gdk_dmabuf_texture_builder_get_offset")]
265    #[doc(alias = "get_offset")]
266    pub fn offset(&self, plane: u32) -> u32 {
267        unsafe { ffi::gdk_dmabuf_texture_builder_get_offset(self.to_glib_none().0, plane) }
268    }
269
270    /// Whether the data is premultiplied.
271    ///
272    /// # Returns
273    ///
274    /// whether the data is premultiplied
275    #[doc(alias = "gdk_dmabuf_texture_builder_get_premultiplied")]
276    #[doc(alias = "get_premultiplied")]
277    #[doc(alias = "premultiplied")]
278    pub fn is_premultiplied(&self) -> bool {
279        unsafe {
280            from_glib(ffi::gdk_dmabuf_texture_builder_get_premultiplied(
281                self.to_glib_none().0,
282            ))
283        }
284    }
285
286    /// Gets the stride value for a plane.
287    /// ## `plane`
288    /// the plane to get the stride for
289    ///
290    /// # Returns
291    ///
292    /// the stride
293    #[doc(alias = "gdk_dmabuf_texture_builder_get_stride")]
294    #[doc(alias = "get_stride")]
295    pub fn stride(&self, plane: u32) -> u32 {
296        unsafe { ffi::gdk_dmabuf_texture_builder_get_stride(self.to_glib_none().0, plane) }
297    }
298
299    /// Gets the region previously set via gdk_dmabuf_texture_builder_set_update_region() or
300    /// [`None`] if none was set.
301    ///
302    /// # Returns
303    ///
304    /// The region
305    #[doc(alias = "gdk_dmabuf_texture_builder_get_update_region")]
306    #[doc(alias = "get_update_region")]
307    #[doc(alias = "update-region")]
308    pub fn update_region(&self) -> Option<cairo::Region> {
309        unsafe {
310            from_glib_none(ffi::gdk_dmabuf_texture_builder_get_update_region(
311                self.to_glib_none().0,
312            ))
313        }
314    }
315
316    /// Gets the texture previously set via gdk_dmabuf_texture_builder_set_update_texture() or
317    /// [`None`] if none was set.
318    ///
319    /// # Returns
320    ///
321    /// The texture
322    #[doc(alias = "gdk_dmabuf_texture_builder_get_update_texture")]
323    #[doc(alias = "get_update_texture")]
324    #[doc(alias = "update-texture")]
325    pub fn update_texture(&self) -> Option<Texture> {
326        unsafe {
327            from_glib_none(ffi::gdk_dmabuf_texture_builder_get_update_texture(
328                self.to_glib_none().0,
329            ))
330        }
331    }
332
333    /// Gets the width previously set via gdk_dmabuf_texture_builder_set_width() or
334    /// 0 if the width wasn't set.
335    ///
336    /// # Returns
337    ///
338    /// The width
339    #[doc(alias = "gdk_dmabuf_texture_builder_get_width")]
340    #[doc(alias = "get_width")]
341    pub fn width(&self) -> u32 {
342        unsafe { ffi::gdk_dmabuf_texture_builder_get_width(self.to_glib_none().0) }
343    }
344
345    /// Sets the color state for the texture.
346    ///
347    /// By default, the colorstate is `NULL`. In that case, GTK will choose the
348    /// correct colorstate based on the format.
349    /// If you don't know what colorstates are, this is probably the right thing.
350    /// ## `color_state`
351    /// a [`ColorState`][crate::ColorState] or `NULL` to unset the colorstate.
352    #[cfg(feature = "v4_16")]
353    #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
354    #[doc(alias = "gdk_dmabuf_texture_builder_set_color_state")]
355    #[doc(alias = "color-state")]
356    pub fn set_color_state(&self, color_state: Option<&ColorState>) {
357        unsafe {
358            ffi::gdk_dmabuf_texture_builder_set_color_state(
359                self.to_glib_none().0,
360                color_state.to_glib_none().0,
361            );
362        }
363    }
364
365    /// Sets the display that this texture builder is
366    /// associated with.
367    ///
368    /// The display is used to determine the supported
369    /// dma-buf formats.
370    /// ## `display`
371    /// the display
372    #[doc(alias = "gdk_dmabuf_texture_builder_set_display")]
373    #[doc(alias = "display")]
374    pub fn set_display(&self, display: &impl IsA<Display>) {
375        unsafe {
376            ffi::gdk_dmabuf_texture_builder_set_display(
377                self.to_glib_none().0,
378                display.as_ref().to_glib_none().0,
379            );
380        }
381    }
382
383    /// Sets the file descriptor for a plane.
384    /// ## `plane`
385    /// the plane to set the fd for
386    /// ## `fd`
387    /// the file descriptor
388    #[doc(alias = "gdk_dmabuf_texture_builder_set_fd")]
389    pub fn set_fd(&self, plane: u32, fd: i32) {
390        unsafe {
391            ffi::gdk_dmabuf_texture_builder_set_fd(self.to_glib_none().0, plane, fd);
392        }
393    }
394
395    /// Sets the format of the texture.
396    ///
397    /// The format is specified as a fourcc code.
398    ///
399    /// The format must be set before calling [`build()`][Self::build()].
400    /// ## `fourcc`
401    /// the texture's format or 0 to unset
402    #[doc(alias = "gdk_dmabuf_texture_builder_set_fourcc")]
403    #[doc(alias = "fourcc")]
404    pub fn set_fourcc(&self, fourcc: u32) {
405        unsafe {
406            ffi::gdk_dmabuf_texture_builder_set_fourcc(self.to_glib_none().0, fourcc);
407        }
408    }
409
410    /// Sets the height of the texture.
411    ///
412    /// The height must be set before calling [`build()`][Self::build()].
413    /// ## `height`
414    /// the texture's height or 0 to unset
415    #[doc(alias = "gdk_dmabuf_texture_builder_set_height")]
416    #[doc(alias = "height")]
417    pub fn set_height(&self, height: u32) {
418        unsafe {
419            ffi::gdk_dmabuf_texture_builder_set_height(self.to_glib_none().0, height);
420        }
421    }
422
423    /// Sets the modifier.
424    /// ## `modifier`
425    /// the modifier value
426    #[doc(alias = "gdk_dmabuf_texture_builder_set_modifier")]
427    #[doc(alias = "modifier")]
428    pub fn set_modifier(&self, modifier: u64) {
429        unsafe {
430            ffi::gdk_dmabuf_texture_builder_set_modifier(self.to_glib_none().0, modifier);
431        }
432    }
433
434    /// Sets the number of planes of the texture.
435    /// ## `n_planes`
436    /// the number of planes
437    #[doc(alias = "gdk_dmabuf_texture_builder_set_n_planes")]
438    #[doc(alias = "n-planes")]
439    pub fn set_n_planes(&self, n_planes: u32) {
440        unsafe {
441            ffi::gdk_dmabuf_texture_builder_set_n_planes(self.to_glib_none().0, n_planes);
442        }
443    }
444
445    /// Sets the offset for a plane.
446    /// ## `plane`
447    /// the plane to set the offset for
448    /// ## `offset`
449    /// the offset value
450    #[doc(alias = "gdk_dmabuf_texture_builder_set_offset")]
451    pub fn set_offset(&self, plane: u32, offset: u32) {
452        unsafe {
453            ffi::gdk_dmabuf_texture_builder_set_offset(self.to_glib_none().0, plane, offset);
454        }
455    }
456
457    /// Sets whether the data is premultiplied.
458    ///
459    /// Unless otherwise specified, all formats including alpha channels are assumed
460    /// to be premultiplied.
461    /// ## `premultiplied`
462    /// whether the data is premultiplied
463    #[doc(alias = "gdk_dmabuf_texture_builder_set_premultiplied")]
464    #[doc(alias = "premultiplied")]
465    pub fn set_premultiplied(&self, premultiplied: bool) {
466        unsafe {
467            ffi::gdk_dmabuf_texture_builder_set_premultiplied(
468                self.to_glib_none().0,
469                premultiplied.into_glib(),
470            );
471        }
472    }
473
474    /// Sets the stride for a plane.
475    ///
476    /// The stride must be set for all planes before calling [`build()`][Self::build()].
477    /// ## `plane`
478    /// the plane to set the stride for
479    /// ## `stride`
480    /// the stride value
481    #[doc(alias = "gdk_dmabuf_texture_builder_set_stride")]
482    pub fn set_stride(&self, plane: u32, stride: u32) {
483        unsafe {
484            ffi::gdk_dmabuf_texture_builder_set_stride(self.to_glib_none().0, plane, stride);
485        }
486    }
487
488    /// Sets the region to be updated by this texture. Together with
489    /// [`update-texture`][struct@crate::DmabufTextureBuilder#update-texture] this describes an
490    /// update of a previous texture.
491    ///
492    /// When rendering animations of large textures, it is possible that
493    /// consecutive textures are only updating contents in parts of the texture.
494    /// It is then possible to describe this update via these two properties,
495    /// so that GTK can avoid rerendering parts that did not change.
496    ///
497    /// An example would be a screen recording where only the mouse pointer moves.
498    /// ## `region`
499    /// the region to update
500    #[doc(alias = "gdk_dmabuf_texture_builder_set_update_region")]
501    #[doc(alias = "update-region")]
502    pub fn set_update_region(&self, region: Option<&cairo::Region>) {
503        unsafe {
504            ffi::gdk_dmabuf_texture_builder_set_update_region(
505                self.to_glib_none().0,
506                mut_override(region.to_glib_none().0),
507            );
508        }
509    }
510
511    /// Sets the texture to be updated by this texture. See
512    /// [`set_update_region()`][Self::set_update_region()] for an explanation.
513    /// ## `texture`
514    /// the texture to update
515    #[doc(alias = "gdk_dmabuf_texture_builder_set_update_texture")]
516    #[doc(alias = "update-texture")]
517    pub fn set_update_texture(&self, texture: Option<&impl IsA<Texture>>) {
518        unsafe {
519            ffi::gdk_dmabuf_texture_builder_set_update_texture(
520                self.to_glib_none().0,
521                texture.map(|p| p.as_ref()).to_glib_none().0,
522            );
523        }
524    }
525
526    /// Sets the width of the texture.
527    ///
528    /// The width must be set before calling [`build()`][Self::build()].
529    /// ## `width`
530    /// The texture's width or 0 to unset
531    #[doc(alias = "gdk_dmabuf_texture_builder_set_width")]
532    #[doc(alias = "width")]
533    pub fn set_width(&self, width: u32) {
534        unsafe {
535            ffi::gdk_dmabuf_texture_builder_set_width(self.to_glib_none().0, width);
536        }
537    }
538
539    #[cfg(feature = "v4_16")]
540    #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
541    #[doc(alias = "color-state")]
542    pub fn connect_color_state_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
543        unsafe extern "C" fn notify_color_state_trampoline<
544            F: Fn(&DmabufTextureBuilder) + 'static,
545        >(
546            this: *mut ffi::GdkDmabufTextureBuilder,
547            _param_spec: glib::ffi::gpointer,
548            f: glib::ffi::gpointer,
549        ) {
550            let f: &F = &*(f as *const F);
551            f(&from_glib_borrow(this))
552        }
553        unsafe {
554            let f: Box_<F> = Box_::new(f);
555            connect_raw(
556                self.as_ptr() as *mut _,
557                b"notify::color-state\0".as_ptr() as *const _,
558                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
559                    notify_color_state_trampoline::<F> as *const (),
560                )),
561                Box_::into_raw(f),
562            )
563        }
564    }
565
566    #[cfg(feature = "v4_14")]
567    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
568    #[doc(alias = "display")]
569    pub fn connect_display_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
570        unsafe extern "C" fn notify_display_trampoline<F: Fn(&DmabufTextureBuilder) + 'static>(
571            this: *mut ffi::GdkDmabufTextureBuilder,
572            _param_spec: glib::ffi::gpointer,
573            f: glib::ffi::gpointer,
574        ) {
575            let f: &F = &*(f as *const F);
576            f(&from_glib_borrow(this))
577        }
578        unsafe {
579            let f: Box_<F> = Box_::new(f);
580            connect_raw(
581                self.as_ptr() as *mut _,
582                b"notify::display\0".as_ptr() as *const _,
583                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
584                    notify_display_trampoline::<F> as *const (),
585                )),
586                Box_::into_raw(f),
587            )
588        }
589    }
590
591    #[cfg(feature = "v4_14")]
592    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
593    #[doc(alias = "fourcc")]
594    pub fn connect_fourcc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
595        unsafe extern "C" fn notify_fourcc_trampoline<F: Fn(&DmabufTextureBuilder) + 'static>(
596            this: *mut ffi::GdkDmabufTextureBuilder,
597            _param_spec: glib::ffi::gpointer,
598            f: glib::ffi::gpointer,
599        ) {
600            let f: &F = &*(f as *const F);
601            f(&from_glib_borrow(this))
602        }
603        unsafe {
604            let f: Box_<F> = Box_::new(f);
605            connect_raw(
606                self.as_ptr() as *mut _,
607                b"notify::fourcc\0".as_ptr() as *const _,
608                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
609                    notify_fourcc_trampoline::<F> as *const (),
610                )),
611                Box_::into_raw(f),
612            )
613        }
614    }
615
616    #[cfg(feature = "v4_14")]
617    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
618    #[doc(alias = "height")]
619    pub fn connect_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
620        unsafe extern "C" fn notify_height_trampoline<F: Fn(&DmabufTextureBuilder) + 'static>(
621            this: *mut ffi::GdkDmabufTextureBuilder,
622            _param_spec: glib::ffi::gpointer,
623            f: glib::ffi::gpointer,
624        ) {
625            let f: &F = &*(f as *const F);
626            f(&from_glib_borrow(this))
627        }
628        unsafe {
629            let f: Box_<F> = Box_::new(f);
630            connect_raw(
631                self.as_ptr() as *mut _,
632                b"notify::height\0".as_ptr() as *const _,
633                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
634                    notify_height_trampoline::<F> as *const (),
635                )),
636                Box_::into_raw(f),
637            )
638        }
639    }
640
641    #[cfg(feature = "v4_14")]
642    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
643    #[doc(alias = "modifier")]
644    pub fn connect_modifier_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
645        unsafe extern "C" fn notify_modifier_trampoline<F: Fn(&DmabufTextureBuilder) + 'static>(
646            this: *mut ffi::GdkDmabufTextureBuilder,
647            _param_spec: glib::ffi::gpointer,
648            f: glib::ffi::gpointer,
649        ) {
650            let f: &F = &*(f as *const F);
651            f(&from_glib_borrow(this))
652        }
653        unsafe {
654            let f: Box_<F> = Box_::new(f);
655            connect_raw(
656                self.as_ptr() as *mut _,
657                b"notify::modifier\0".as_ptr() as *const _,
658                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
659                    notify_modifier_trampoline::<F> as *const (),
660                )),
661                Box_::into_raw(f),
662            )
663        }
664    }
665
666    #[cfg(feature = "v4_14")]
667    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
668    #[doc(alias = "n-planes")]
669    pub fn connect_n_planes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
670        unsafe extern "C" fn notify_n_planes_trampoline<F: Fn(&DmabufTextureBuilder) + 'static>(
671            this: *mut ffi::GdkDmabufTextureBuilder,
672            _param_spec: glib::ffi::gpointer,
673            f: glib::ffi::gpointer,
674        ) {
675            let f: &F = &*(f as *const F);
676            f(&from_glib_borrow(this))
677        }
678        unsafe {
679            let f: Box_<F> = Box_::new(f);
680            connect_raw(
681                self.as_ptr() as *mut _,
682                b"notify::n-planes\0".as_ptr() as *const _,
683                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
684                    notify_n_planes_trampoline::<F> as *const (),
685                )),
686                Box_::into_raw(f),
687            )
688        }
689    }
690
691    #[cfg(feature = "v4_14")]
692    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
693    #[doc(alias = "premultiplied")]
694    pub fn connect_premultiplied_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
695        unsafe extern "C" fn notify_premultiplied_trampoline<
696            F: Fn(&DmabufTextureBuilder) + 'static,
697        >(
698            this: *mut ffi::GdkDmabufTextureBuilder,
699            _param_spec: glib::ffi::gpointer,
700            f: glib::ffi::gpointer,
701        ) {
702            let f: &F = &*(f as *const F);
703            f(&from_glib_borrow(this))
704        }
705        unsafe {
706            let f: Box_<F> = Box_::new(f);
707            connect_raw(
708                self.as_ptr() as *mut _,
709                b"notify::premultiplied\0".as_ptr() as *const _,
710                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
711                    notify_premultiplied_trampoline::<F> as *const (),
712                )),
713                Box_::into_raw(f),
714            )
715        }
716    }
717
718    #[cfg(feature = "v4_14")]
719    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
720    #[doc(alias = "update-region")]
721    pub fn connect_update_region_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
722        unsafe extern "C" fn notify_update_region_trampoline<
723            F: Fn(&DmabufTextureBuilder) + 'static,
724        >(
725            this: *mut ffi::GdkDmabufTextureBuilder,
726            _param_spec: glib::ffi::gpointer,
727            f: glib::ffi::gpointer,
728        ) {
729            let f: &F = &*(f as *const F);
730            f(&from_glib_borrow(this))
731        }
732        unsafe {
733            let f: Box_<F> = Box_::new(f);
734            connect_raw(
735                self.as_ptr() as *mut _,
736                b"notify::update-region\0".as_ptr() as *const _,
737                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
738                    notify_update_region_trampoline::<F> as *const (),
739                )),
740                Box_::into_raw(f),
741            )
742        }
743    }
744
745    #[cfg(feature = "v4_14")]
746    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
747    #[doc(alias = "update-texture")]
748    pub fn connect_update_texture_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
749        unsafe extern "C" fn notify_update_texture_trampoline<
750            F: Fn(&DmabufTextureBuilder) + 'static,
751        >(
752            this: *mut ffi::GdkDmabufTextureBuilder,
753            _param_spec: glib::ffi::gpointer,
754            f: glib::ffi::gpointer,
755        ) {
756            let f: &F = &*(f as *const F);
757            f(&from_glib_borrow(this))
758        }
759        unsafe {
760            let f: Box_<F> = Box_::new(f);
761            connect_raw(
762                self.as_ptr() as *mut _,
763                b"notify::update-texture\0".as_ptr() as *const _,
764                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
765                    notify_update_texture_trampoline::<F> as *const (),
766                )),
767                Box_::into_raw(f),
768            )
769        }
770    }
771
772    #[cfg(feature = "v4_14")]
773    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
774    #[doc(alias = "width")]
775    pub fn connect_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
776        unsafe extern "C" fn notify_width_trampoline<F: Fn(&DmabufTextureBuilder) + 'static>(
777            this: *mut ffi::GdkDmabufTextureBuilder,
778            _param_spec: glib::ffi::gpointer,
779            f: glib::ffi::gpointer,
780        ) {
781            let f: &F = &*(f as *const F);
782            f(&from_glib_borrow(this))
783        }
784        unsafe {
785            let f: Box_<F> = Box_::new(f);
786            connect_raw(
787                self.as_ptr() as *mut _,
788                b"notify::width\0".as_ptr() as *const _,
789                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
790                    notify_width_trampoline::<F> as *const (),
791                )),
792                Box_::into_raw(f),
793            )
794        }
795    }
796}
797
798#[cfg(feature = "v4_14")]
799#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
800impl Default for DmabufTextureBuilder {
801    fn default() -> Self {
802        Self::new()
803    }
804}