gdk4/auto/
vulkan_context.rs1use crate::{ffi, DrawContext};
6use glib::{
7 object::ObjectType as _,
8 prelude::*,
9 signal::{connect_raw, SignalHandlerId},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 #[doc(alias = "GdkVulkanContext")]
16 pub struct VulkanContext(Object<ffi::GdkVulkanContext>) @extends DrawContext;
17
18 match fn {
19 type_ => || ffi::gdk_vulkan_context_get_type(),
20 }
21}
22
23impl VulkanContext {
24 #[doc(alias = "images-updated")]
25 pub fn connect_images_updated<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
26 unsafe extern "C" fn images_updated_trampoline<F: Fn(&VulkanContext) + 'static>(
27 this: *mut ffi::GdkVulkanContext,
28 f: glib::ffi::gpointer,
29 ) {
30 let f: &F = &*(f as *const F);
31 f(&from_glib_borrow(this))
32 }
33 unsafe {
34 let f: Box_<F> = Box_::new(f);
35 connect_raw(
36 self.as_ptr() as *mut _,
37 c"images-updated".as_ptr() as *const _,
38 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
39 images_updated_trampoline::<F> as *const (),
40 )),
41 Box_::into_raw(f),
42 )
43 }
44 }
45}