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