diff --git a/gdk4-macos/src/auto/versions.txt b/gdk4-macos/src/auto/versions.txt index 72da81c41e33..6192019b777d 100644 --- a/gdk4-macos/src/auto/versions.txt +++ b/gdk4-macos/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 19e8a2f15e0e) +Generated by gir (https://github.com/gtk-rs/gir @ 8a55e4fc8412) from gir-files (https://github.com/gtk-rs/gir-files @ 770dd7bbdcd1) diff --git a/gdk4-macos/sys/versions.txt b/gdk4-macos/sys/versions.txt index 72da81c41e33..6192019b777d 100644 --- a/gdk4-macos/sys/versions.txt +++ b/gdk4-macos/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 19e8a2f15e0e) +Generated by gir (https://github.com/gtk-rs/gir @ 8a55e4fc8412) from gir-files (https://github.com/gtk-rs/gir-files @ 770dd7bbdcd1) diff --git a/gdk4-wayland/src/auto/versions.txt b/gdk4-wayland/src/auto/versions.txt index 72da81c41e33..6192019b777d 100644 --- a/gdk4-wayland/src/auto/versions.txt +++ b/gdk4-wayland/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 19e8a2f15e0e) +Generated by gir (https://github.com/gtk-rs/gir @ 8a55e4fc8412) from gir-files (https://github.com/gtk-rs/gir-files @ 770dd7bbdcd1) diff --git a/gdk4-wayland/sys/versions.txt b/gdk4-wayland/sys/versions.txt index 72da81c41e33..6192019b777d 100644 --- a/gdk4-wayland/sys/versions.txt +++ b/gdk4-wayland/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 19e8a2f15e0e) +Generated by gir (https://github.com/gtk-rs/gir @ 8a55e4fc8412) from gir-files (https://github.com/gtk-rs/gir-files @ 770dd7bbdcd1) diff --git a/gdk4-win32/src/auto/versions.txt b/gdk4-win32/src/auto/versions.txt index 72da81c41e33..6192019b777d 100644 --- a/gdk4-win32/src/auto/versions.txt +++ b/gdk4-win32/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 19e8a2f15e0e) +Generated by gir (https://github.com/gtk-rs/gir @ 8a55e4fc8412) from gir-files (https://github.com/gtk-rs/gir-files @ 770dd7bbdcd1) diff --git a/gdk4-win32/sys/versions.txt b/gdk4-win32/sys/versions.txt index 72da81c41e33..6192019b777d 100644 --- a/gdk4-win32/sys/versions.txt +++ b/gdk4-win32/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 19e8a2f15e0e) +Generated by gir (https://github.com/gtk-rs/gir @ 8a55e4fc8412) from gir-files (https://github.com/gtk-rs/gir-files @ 770dd7bbdcd1) diff --git a/gdk4-x11/src/auto/versions.txt b/gdk4-x11/src/auto/versions.txt index 72da81c41e33..6192019b777d 100644 --- a/gdk4-x11/src/auto/versions.txt +++ b/gdk4-x11/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 19e8a2f15e0e) +Generated by gir (https://github.com/gtk-rs/gir @ 8a55e4fc8412) from gir-files (https://github.com/gtk-rs/gir-files @ 770dd7bbdcd1) diff --git a/gdk4-x11/sys/versions.txt b/gdk4-x11/sys/versions.txt index 72da81c41e33..6192019b777d 100644 --- a/gdk4-x11/sys/versions.txt +++ b/gdk4-x11/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 19e8a2f15e0e) +Generated by gir (https://github.com/gtk-rs/gir @ 8a55e4fc8412) from gir-files (https://github.com/gtk-rs/gir-files @ 770dd7bbdcd1) diff --git a/gdk4/Gir.toml b/gdk4/Gir.toml index 0ee93ab2b299..c57ce5975b01 100644 --- a/gdk4/Gir.toml +++ b/gdk4/Gir.toml @@ -28,8 +28,6 @@ generate = [ "Gdk.DevicePad", "Gdk.DevicePadFeature", "Gdk.DeviceToolType", - "Gdk.DmabufError", - "Gdk.DmabufTexture", "Gdk.DNDEvent", "Gdk.DragAction", "Gdk.DragCancelReason", @@ -422,35 +420,64 @@ manual_traits = ["DisplayExtManual"] [[object.function]] pattern = "map_key(code|val)" manual = true # make use of Key + [[object.function]] + name = "get_dmabuf_formats" + cfg_condition = "target_os = \"linux\"" [[object.property]] name = "shadow-width" generate = ["notify"] + [[object.property]] + name = "dmabuf-formats" + cfg_condition = "target_os = \"linux\"" [[object]] name = "Gdk.DisplayManager" status = "generate" generate_builder = false +[[object]] +name = "Gdk.DmabufError" +status = "generate" +cfg_condition = "target_os = \"linux\"" + [[object]] name = "Gdk.DmabufFormats" status = "generate" +cfg_condition = "target_os = \"linux\"" [[object.function]] name = "equal" [[object.function.parameter]] name = "formats2" nullable = false +[[object]] +name = "Gdk.DmabufTexture" +status = "generate" +cfg_condition = "target_os = \"linux\"" + [[object]] name = "Gdk.DmabufTextureBuilder" status = "generate" +cfg_condition = "target_os = \"linux\"" [[object.function]] name = "set_update_region" [[object.function.parameter]] name = "region" const = true [[object.function]] + pattern = "set_(color_state|display|fd|fourcc|height|modifier|n_planes|offset|premultiplied|stride|update_region|update_texture|width)" + # Take by value and return self + manual = true + [[object.function]] + pattern = "get_fd" + # Use BorrowedFd + manual = true + [[object.function]] name = "build" manual = true # Can't be auto-generated + [[object.property]] + pattern = "(color-state|display|fourcc|height|modifier|n-planes|premultiplied|update-region|update-texture|width)" + generate = [] # ignore get/set/notify [[object]] name = "Gdk.Drag" @@ -530,7 +557,8 @@ generate_builder = false name = "region" const = true [[object.function]] - pattern = "set_(context|format|has_mipmap|height|id|update_region|update_texture|width)" + pattern = "set_(color_state|context|format|has_mipmap|height|id|update_region|update_texture|width)" + # Take by value and return self manual = true [[object.function]] pattern = "(set|get)_sync" @@ -539,7 +567,7 @@ generate_builder = false name = "build" manual = true [[object.property]] - pattern = "(context|format|has-mipmap|height|id|sync|update-region|update-texture|width)" + pattern = "(color-state|context|format|has-mipmap|height|id|sync|update-region|update-texture|width)" generate = [] # ignore get/set/notify [[object]] @@ -579,6 +607,13 @@ concurrency = "send+sync" [[object.function.parameter]] name = "region" const = true + [[object.function]] + pattern = "set_(bytes|color_state|format|height|offset|stride|stride_for_plane|update_region|update_texture|width)" + # Take by value and return self + manual = true + [[object.property]] + pattern = "(bytes|color-state|format|height|stride|update-region|update-texture|width)" + generate = [] # ignore get/set/notify [[object]] name = "Gdk.Monitor" diff --git a/gdk4/src/auto/display.rs b/gdk4/src/auto/display.rs index e320c8285c17..aa67ccb770dd 100644 --- a/gdk4/src/auto/display.rs +++ b/gdk4/src/auto/display.rs @@ -3,6 +3,8 @@ // DO NOT EDIT #![allow(deprecated)] +#[cfg(target_os = "linux")] +#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))] #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] use crate::DmabufFormats; @@ -130,6 +132,8 @@ pub trait DisplayExt: IsA + 'static { } } + #[cfg(target_os = "linux")] + #[cfg_attr(docsrs, doc(cfg(target_os = "linux")))] #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] #[doc(alias = "gdk_display_get_dmabuf_formats")] diff --git a/gdk4/src/auto/dmabuf_texture_builder.rs b/gdk4/src/auto/dmabuf_texture_builder.rs index b8b92c518c3a..6c04b1b1aec8 100644 --- a/gdk4/src/auto/dmabuf_texture_builder.rs +++ b/gdk4/src/auto/dmabuf_texture_builder.rs @@ -6,12 +6,7 @@ #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] use crate::ColorState; use crate::{ffi, Display, Texture}; -use glib::{ - prelude::*, - signal::{connect_raw, SignalHandlerId}, - translate::*, -}; -use std::boxed::Box as Box_; +use glib::translate::*; glib::wrapper! { #[doc(alias = "GdkDmabufTextureBuilder")] @@ -52,12 +47,6 @@ impl DmabufTextureBuilder { } } - #[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) } - } - #[doc(alias = "gdk_dmabuf_texture_builder_get_fourcc")] #[doc(alias = "get_fourcc")] pub fn fourcc(&self) -> u32 { @@ -133,382 +122,6 @@ impl DmabufTextureBuilder { pub fn width(&self) -> u32 { unsafe { ffi::gdk_dmabuf_texture_builder_get_width(self.to_glib_none().0) } } - - #[cfg(feature = "v4_16")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] - #[doc(alias = "gdk_dmabuf_texture_builder_set_color_state")] - #[doc(alias = "color-state")] - pub fn set_color_state(&self, color_state: Option<&ColorState>) { - unsafe { - ffi::gdk_dmabuf_texture_builder_set_color_state( - self.to_glib_none().0, - color_state.to_glib_none().0, - ); - } - } - - #[doc(alias = "gdk_dmabuf_texture_builder_set_display")] - #[doc(alias = "display")] - pub fn set_display(&self, display: &impl IsA) { - unsafe { - ffi::gdk_dmabuf_texture_builder_set_display( - self.to_glib_none().0, - display.as_ref().to_glib_none().0, - ); - } - } - - #[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); - } - } - - #[doc(alias = "gdk_dmabuf_texture_builder_set_fourcc")] - #[doc(alias = "fourcc")] - pub fn set_fourcc(&self, fourcc: u32) { - unsafe { - ffi::gdk_dmabuf_texture_builder_set_fourcc(self.to_glib_none().0, fourcc); - } - } - - #[doc(alias = "gdk_dmabuf_texture_builder_set_height")] - #[doc(alias = "height")] - pub fn set_height(&self, height: u32) { - unsafe { - ffi::gdk_dmabuf_texture_builder_set_height(self.to_glib_none().0, height); - } - } - - #[doc(alias = "gdk_dmabuf_texture_builder_set_modifier")] - #[doc(alias = "modifier")] - pub fn set_modifier(&self, modifier: u64) { - unsafe { - ffi::gdk_dmabuf_texture_builder_set_modifier(self.to_glib_none().0, modifier); - } - } - - #[doc(alias = "gdk_dmabuf_texture_builder_set_n_planes")] - #[doc(alias = "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); - } - } - - #[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); - } - } - - #[doc(alias = "gdk_dmabuf_texture_builder_set_premultiplied")] - #[doc(alias = "premultiplied")] - pub fn set_premultiplied(&self, premultiplied: bool) { - unsafe { - ffi::gdk_dmabuf_texture_builder_set_premultiplied( - self.to_glib_none().0, - premultiplied.into_glib(), - ); - } - } - - #[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); - } - } - - #[doc(alias = "gdk_dmabuf_texture_builder_set_update_region")] - #[doc(alias = "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), - ); - } - } - - #[doc(alias = "gdk_dmabuf_texture_builder_set_update_texture")] - #[doc(alias = "update-texture")] - pub fn set_update_texture(&self, texture: Option<&impl IsA>) { - unsafe { - ffi::gdk_dmabuf_texture_builder_set_update_texture( - self.to_glib_none().0, - texture.map(|p| p.as_ref()).to_glib_none().0, - ); - } - } - - #[doc(alias = "gdk_dmabuf_texture_builder_set_width")] - #[doc(alias = "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_16")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] - #[doc(alias = "color-state")] - pub fn connect_color_state_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_color_state_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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::color-state".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_color_state_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } - - #[cfg(feature = "v4_14")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] - #[doc(alias = "display")] - pub fn connect_display_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_display_trampoline( - 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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::display".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_display_trampoline:: 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(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_fourcc_trampoline( - 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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::fourcc".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_fourcc_trampoline:: 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(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_height_trampoline( - 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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::height".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_height_trampoline:: 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(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_modifier_trampoline( - 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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::modifier".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_modifier_trampoline:: 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(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_n_planes_trampoline( - 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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::n-planes".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_n_planes_trampoline:: 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(&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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::premultiplied".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_premultiplied_trampoline:: 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(&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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::update-region".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_update_region_trampoline:: 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(&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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::update-texture".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_update_texture_trampoline:: 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(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_width_trampoline( - 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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::width".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_width_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } } #[cfg(feature = "v4_14")] diff --git a/gdk4/src/auto/enums.rs b/gdk4/src/auto/enums.rs index 8460d77d6f99..dde7ed038d88 100644 --- a/gdk4/src/auto/enums.rs +++ b/gdk4/src/auto/enums.rs @@ -601,6 +601,8 @@ impl From for glib::Value { #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] +#[cfg(target_os = "linux")] +#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GdkDmabufError")] @@ -617,6 +619,7 @@ pub enum DmabufError { #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] +#[cfg(target_os = "linux")] #[doc(hidden)] impl IntoGlib for DmabufError { type GlibType = ffi::GdkDmabufError; @@ -634,6 +637,7 @@ impl IntoGlib for DmabufError { #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] +#[cfg(target_os = "linux")] #[doc(hidden)] impl FromGlib for DmabufError { #[inline] @@ -651,6 +655,7 @@ impl FromGlib for DmabufError { #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] +#[cfg(target_os = "linux")] impl glib::error::ErrorDomain for DmabufError { #[inline] fn domain() -> glib::Quark { @@ -676,6 +681,7 @@ impl glib::error::ErrorDomain for DmabufError { #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] +#[cfg(target_os = "linux")] impl StaticType for DmabufError { #[inline] #[doc(alias = "gdk_dmabuf_error_get_type")] @@ -686,6 +692,7 @@ impl StaticType for DmabufError { #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] +#[cfg(target_os = "linux")] impl glib::HasParamSpec for DmabufError { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; @@ -698,12 +705,14 @@ impl glib::HasParamSpec for DmabufError { #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] +#[cfg(target_os = "linux")] impl glib::value::ValueType for DmabufError { type Type = Self; } #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] +#[cfg(target_os = "linux")] unsafe impl<'a> glib::value::FromValue<'a> for DmabufError { type Checker = glib::value::GenericValueTypeChecker; @@ -716,6 +725,7 @@ unsafe impl<'a> glib::value::FromValue<'a> for DmabufError { #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] +#[cfg(target_os = "linux")] impl ToValue for DmabufError { #[inline] fn to_value(&self) -> glib::Value { @@ -734,6 +744,7 @@ impl ToValue for DmabufError { #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] +#[cfg(target_os = "linux")] impl From for glib::Value { #[inline] fn from(v: DmabufError) -> Self { diff --git a/gdk4/src/auto/gl_texture_builder.rs b/gdk4/src/auto/gl_texture_builder.rs index 160fa999e68f..aeb8483d7e4d 100644 --- a/gdk4/src/auto/gl_texture_builder.rs +++ b/gdk4/src/auto/gl_texture_builder.rs @@ -7,15 +7,6 @@ use crate::ColorState; use crate::{ffi, GLContext, MemoryFormat, Texture}; use glib::translate::*; -#[cfg(feature = "v4_16")] -#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] -use glib::{ - prelude::*, - signal::{connect_raw, SignalHandlerId}, -}; -#[cfg(feature = "v4_16")] -#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] -use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GdkGLTextureBuilder")] @@ -116,49 +107,6 @@ impl GLTextureBuilder { pub fn width(&self) -> i32 { unsafe { ffi::gdk_gl_texture_builder_get_width(self.to_glib_none().0) } } - - #[cfg(feature = "v4_16")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] - #[doc(alias = "gdk_gl_texture_builder_set_color_state")] - #[doc(alias = "color-state")] - pub fn set_color_state(&self, color_state: &ColorState) { - unsafe { - ffi::gdk_gl_texture_builder_set_color_state( - self.to_glib_none().0, - color_state.to_glib_none().0, - ); - } - } - - #[cfg(feature = "v4_16")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] - #[doc(alias = "color-state")] - pub fn connect_color_state_notify( - &self, - f: F, - ) -> SignalHandlerId { - unsafe extern "C" fn notify_color_state_trampoline< - F: Fn(&GLTextureBuilder) + Send + Sync + 'static, - >( - this: *mut ffi::GdkGLTextureBuilder, - _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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::color-state".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_color_state_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } } #[cfg(feature = "v4_12")] diff --git a/gdk4/src/auto/memory_texture_builder.rs b/gdk4/src/auto/memory_texture_builder.rs index 4f48641428ce..dc80b97be922 100644 --- a/gdk4/src/auto/memory_texture_builder.rs +++ b/gdk4/src/auto/memory_texture_builder.rs @@ -3,12 +3,7 @@ // DO NOT EDIT use crate::{ffi, ColorState, MemoryFormat, Texture}; -use glib::{ - prelude::*, - signal::{connect_raw, SignalHandlerId}, - translate::*, -}; -use std::boxed::Box as Box_; +use glib::translate::*; glib::wrapper! { #[doc(alias = "GdkMemoryTextureBuilder")] @@ -119,344 +114,6 @@ impl MemoryTextureBuilder { pub fn width(&self) -> i32 { unsafe { ffi::gdk_memory_texture_builder_get_width(self.to_glib_none().0) } } - - #[doc(alias = "gdk_memory_texture_builder_set_bytes")] - #[doc(alias = "bytes")] - pub fn set_bytes(&self, bytes: Option<&glib::Bytes>) { - unsafe { - ffi::gdk_memory_texture_builder_set_bytes( - self.to_glib_none().0, - bytes.to_glib_none().0, - ); - } - } - - #[doc(alias = "gdk_memory_texture_builder_set_color_state")] - #[doc(alias = "color-state")] - pub fn set_color_state(&self, color_state: Option<&ColorState>) { - unsafe { - ffi::gdk_memory_texture_builder_set_color_state( - self.to_glib_none().0, - color_state.to_glib_none().0, - ); - } - } - - #[doc(alias = "gdk_memory_texture_builder_set_format")] - #[doc(alias = "format")] - pub fn set_format(&self, format: MemoryFormat) { - unsafe { - ffi::gdk_memory_texture_builder_set_format(self.to_glib_none().0, format.into_glib()); - } - } - - #[doc(alias = "gdk_memory_texture_builder_set_height")] - #[doc(alias = "height")] - pub fn set_height(&self, height: i32) { - unsafe { - ffi::gdk_memory_texture_builder_set_height(self.to_glib_none().0, height); - } - } - - #[cfg(feature = "v4_20")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))] - #[doc(alias = "gdk_memory_texture_builder_set_offset")] - pub fn set_offset(&self, plane: u32, offset: usize) { - unsafe { - ffi::gdk_memory_texture_builder_set_offset(self.to_glib_none().0, plane, offset); - } - } - - #[doc(alias = "gdk_memory_texture_builder_set_stride")] - #[doc(alias = "stride")] - pub fn set_stride(&self, stride: usize) { - unsafe { - ffi::gdk_memory_texture_builder_set_stride(self.to_glib_none().0, stride); - } - } - - #[cfg(feature = "v4_20")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))] - #[doc(alias = "gdk_memory_texture_builder_set_stride_for_plane")] - pub fn set_stride_for_plane(&self, plane: u32, stride: usize) { - unsafe { - ffi::gdk_memory_texture_builder_set_stride_for_plane( - self.to_glib_none().0, - plane, - stride, - ); - } - } - - #[doc(alias = "gdk_memory_texture_builder_set_update_region")] - #[doc(alias = "update-region")] - pub fn set_update_region(&self, region: Option<&cairo::Region>) { - unsafe { - ffi::gdk_memory_texture_builder_set_update_region( - self.to_glib_none().0, - mut_override(region.to_glib_none().0), - ); - } - } - - #[doc(alias = "gdk_memory_texture_builder_set_update_texture")] - #[doc(alias = "update-texture")] - pub fn set_update_texture(&self, texture: Option<&impl IsA>) { - unsafe { - ffi::gdk_memory_texture_builder_set_update_texture( - self.to_glib_none().0, - texture.map(|p| p.as_ref()).to_glib_none().0, - ); - } - } - - #[doc(alias = "gdk_memory_texture_builder_set_width")] - #[doc(alias = "width")] - pub fn set_width(&self, width: i32) { - unsafe { - ffi::gdk_memory_texture_builder_set_width(self.to_glib_none().0, width); - } - } - - #[cfg(feature = "v4_16")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] - #[doc(alias = "bytes")] - pub fn connect_bytes_notify( - &self, - f: F, - ) -> SignalHandlerId { - unsafe extern "C" fn notify_bytes_trampoline< - F: Fn(&MemoryTextureBuilder) + Send + Sync + 'static, - >( - this: *mut ffi::GdkMemoryTextureBuilder, - _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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::bytes".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_bytes_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } - - #[cfg(feature = "v4_16")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] - #[doc(alias = "color-state")] - pub fn connect_color_state_notify( - &self, - f: F, - ) -> SignalHandlerId { - unsafe extern "C" fn notify_color_state_trampoline< - F: Fn(&MemoryTextureBuilder) + Send + Sync + 'static, - >( - this: *mut ffi::GdkMemoryTextureBuilder, - _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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::color-state".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_color_state_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } - - #[cfg(feature = "v4_16")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] - #[doc(alias = "format")] - pub fn connect_format_notify( - &self, - f: F, - ) -> SignalHandlerId { - unsafe extern "C" fn notify_format_trampoline< - F: Fn(&MemoryTextureBuilder) + Send + Sync + 'static, - >( - this: *mut ffi::GdkMemoryTextureBuilder, - _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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::format".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_format_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } - - #[cfg(feature = "v4_16")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] - #[doc(alias = "height")] - pub fn connect_height_notify( - &self, - f: F, - ) -> SignalHandlerId { - unsafe extern "C" fn notify_height_trampoline< - F: Fn(&MemoryTextureBuilder) + Send + Sync + 'static, - >( - this: *mut ffi::GdkMemoryTextureBuilder, - _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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::height".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_height_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } - - #[cfg(feature = "v4_16")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] - #[doc(alias = "stride")] - pub fn connect_stride_notify( - &self, - f: F, - ) -> SignalHandlerId { - unsafe extern "C" fn notify_stride_trampoline< - F: Fn(&MemoryTextureBuilder) + Send + Sync + 'static, - >( - this: *mut ffi::GdkMemoryTextureBuilder, - _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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::stride".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_stride_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } - - #[cfg(feature = "v4_16")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] - #[doc(alias = "update-region")] - pub fn connect_update_region_notify( - &self, - f: F, - ) -> SignalHandlerId { - unsafe extern "C" fn notify_update_region_trampoline< - F: Fn(&MemoryTextureBuilder) + Send + Sync + 'static, - >( - this: *mut ffi::GdkMemoryTextureBuilder, - _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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::update-region".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_update_region_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } - - #[cfg(feature = "v4_16")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] - #[doc(alias = "update-texture")] - pub fn connect_update_texture_notify( - &self, - f: F, - ) -> SignalHandlerId { - unsafe extern "C" fn notify_update_texture_trampoline< - F: Fn(&MemoryTextureBuilder) + Send + Sync + 'static, - >( - this: *mut ffi::GdkMemoryTextureBuilder, - _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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::update-texture".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_update_texture_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } - - #[cfg(feature = "v4_16")] - #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] - #[doc(alias = "width")] - pub fn connect_width_notify( - &self, - f: F, - ) -> SignalHandlerId { - unsafe extern "C" fn notify_width_trampoline< - F: Fn(&MemoryTextureBuilder) + Send + Sync + 'static, - >( - this: *mut ffi::GdkMemoryTextureBuilder, - _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_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - c"notify::width".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_width_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } } #[cfg(feature = "v4_16")] diff --git a/gdk4/src/auto/mod.rs b/gdk4/src/auto/mod.rs index 44e0fbdeb4b4..8efb2ceb1b6a 100644 --- a/gdk4/src/auto/mod.rs +++ b/gdk4/src/auto/mod.rs @@ -57,16 +57,24 @@ pub use self::display::Display; mod display_manager; pub use self::display_manager::DisplayManager; +#[cfg(target_os = "linux")] +#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))] #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] mod dmabuf_texture; +#[cfg(target_os = "linux")] +#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))] #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] pub use self::dmabuf_texture::DmabufTexture; +#[cfg(target_os = "linux")] +#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))] #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] mod dmabuf_texture_builder; +#[cfg(target_os = "linux")] +#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))] #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] pub use self::dmabuf_texture_builder::DmabufTextureBuilder; @@ -181,9 +189,13 @@ pub use self::content_formats::ContentFormats; mod content_formats_builder; pub use self::content_formats_builder::ContentFormatsBuilder; +#[cfg(target_os = "linux")] +#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))] #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] mod dmabuf_formats; +#[cfg(target_os = "linux")] +#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))] #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] pub use self::dmabuf_formats::DmabufFormats; @@ -230,6 +242,8 @@ pub use self::enums::DevicePadFeature; pub use self::enums::DeviceToolType; #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] +#[cfg(target_os = "linux")] +#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))] pub use self::enums::DmabufError; pub use self::enums::DragCancelReason; pub use self::enums::EventType; diff --git a/gdk4/src/auto/versions.txt b/gdk4/src/auto/versions.txt index 72da81c41e33..6192019b777d 100644 --- a/gdk4/src/auto/versions.txt +++ b/gdk4/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 19e8a2f15e0e) +Generated by gir (https://github.com/gtk-rs/gir @ 8a55e4fc8412) from gir-files (https://github.com/gtk-rs/gir-files @ 770dd7bbdcd1) diff --git a/gdk4/src/dmabuf_texture_builder.rs b/gdk4/src/dmabuf_texture_builder.rs index afa5cfc558a3..2546ede3d44c 100644 --- a/gdk4/src/dmabuf_texture_builder.rs +++ b/gdk4/src/dmabuf_texture_builder.rs @@ -1,10 +1,175 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; +use glib::{prelude::*, translate::*}; -use crate::{ffi, DmabufTextureBuilder, Texture}; +#[cfg(feature = "v4_16")] +use crate::ColorState; +use crate::{ffi, Display, DmabufTextureBuilder, Texture}; impl DmabufTextureBuilder { + #[cfg(feature = "v4_16")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] + #[doc(alias = "gdk_dmabuf_texture_builder_set_color_state")] + #[doc(alias = "color-state")] + pub fn set_color_state(self, color_state: Option<&ColorState>) -> Self { + unsafe { + ffi::gdk_dmabuf_texture_builder_set_color_state( + self.to_glib_none().0, + color_state.to_glib_none().0, + ); + } + + self + } + + #[doc(alias = "gdk_dmabuf_texture_builder_set_display")] + #[doc(alias = "display")] + pub fn set_display(self, display: &impl IsA) -> Self { + unsafe { + ffi::gdk_dmabuf_texture_builder_set_display( + self.to_glib_none().0, + display.as_ref().to_glib_none().0, + ); + } + + self + } + + // rustdoc-stripper-ignore-next + /// # Safety + /// + /// The caller must ensure that `fd` says valid for at least as long as the texture, e.g. by + /// using `build_with_release_func()` to get notified when `fd` is not used anymore. + #[doc(alias = "gdk_dmabuf_texture_builder_set_fd")] + pub unsafe fn set_fd(self, plane: u32, fd: std::os::fd::RawFd) -> Self { + unsafe { + ffi::gdk_dmabuf_texture_builder_set_fd(self.to_glib_none().0, plane, fd); + } + + self + } + + #[doc(alias = "gdk_dmabuf_texture_builder_get_fd")] + #[doc(alias = "get_fd")] + pub fn fd(&self, plane: u32) -> Option> { + unsafe { + let fd = ffi::gdk_dmabuf_texture_builder_get_fd(self.to_glib_none().0, plane); + + if fd == -1 { + None + } else { + Some(std::os::fd::BorrowedFd::borrow_raw(fd)) + } + } + } + + #[doc(alias = "gdk_dmabuf_texture_builder_set_fourcc")] + #[doc(alias = "fourcc")] + pub fn set_fourcc(self, fourcc: u32) -> Self { + unsafe { + ffi::gdk_dmabuf_texture_builder_set_fourcc(self.to_glib_none().0, fourcc); + } + + self + } + + #[doc(alias = "gdk_dmabuf_texture_builder_set_height")] + #[doc(alias = "height")] + pub fn set_height(self, height: u32) -> Self { + unsafe { + ffi::gdk_dmabuf_texture_builder_set_height(self.to_glib_none().0, height); + } + + self + } + + #[doc(alias = "gdk_dmabuf_texture_builder_set_modifier")] + #[doc(alias = "modifier")] + pub fn set_modifier(self, modifier: u64) -> Self { + unsafe { + ffi::gdk_dmabuf_texture_builder_set_modifier(self.to_glib_none().0, modifier); + } + + self + } + + #[doc(alias = "gdk_dmabuf_texture_builder_set_n_planes")] + #[doc(alias = "n-planes")] + pub fn set_n_planes(self, n_planes: u32) -> Self { + unsafe { + ffi::gdk_dmabuf_texture_builder_set_n_planes(self.to_glib_none().0, n_planes); + } + + self + } + + #[doc(alias = "gdk_dmabuf_texture_builder_set_offset")] + pub fn set_offset(self, plane: u32, offset: u32) -> Self { + unsafe { + ffi::gdk_dmabuf_texture_builder_set_offset(self.to_glib_none().0, plane, offset); + } + + self + } + + #[doc(alias = "gdk_dmabuf_texture_builder_set_premultiplied")] + #[doc(alias = "premultiplied")] + pub fn set_premultiplied(self, premultiplied: bool) -> Self { + unsafe { + ffi::gdk_dmabuf_texture_builder_set_premultiplied( + self.to_glib_none().0, + premultiplied.into_glib(), + ); + } + + self + } + + #[doc(alias = "gdk_dmabuf_texture_builder_set_stride")] + pub fn set_stride(self, plane: u32, stride: u32) -> Self { + unsafe { + ffi::gdk_dmabuf_texture_builder_set_stride(self.to_glib_none().0, plane, stride); + } + + self + } + + #[doc(alias = "gdk_dmabuf_texture_builder_set_update_region")] + #[doc(alias = "update-region")] + pub fn set_update_region(self, region: Option<&cairo::Region>) -> Self { + unsafe { + ffi::gdk_dmabuf_texture_builder_set_update_region( + self.to_glib_none().0, + mut_override(region.to_glib_none().0), + ); + } + + self + } + + #[doc(alias = "gdk_dmabuf_texture_builder_set_update_texture")] + #[doc(alias = "update-texture")] + pub fn set_update_texture(self, texture: Option<&impl IsA>) -> Self { + unsafe { + ffi::gdk_dmabuf_texture_builder_set_update_texture( + self.to_glib_none().0, + texture.map(|p| p.as_ref()).to_glib_none().0, + ); + } + + self + } + + #[doc(alias = "gdk_dmabuf_texture_builder_set_width")] + #[doc(alias = "width")] + pub fn set_width(self, width: u32) -> Self { + unsafe { + ffi::gdk_dmabuf_texture_builder_set_width(self.to_glib_none().0, width); + } + + self + } + #[doc(alias = "gdk_dmabuf_texture_builder_build")] #[must_use = "The builder must be built to be used"] #[allow(clippy::missing_safety_doc)] diff --git a/gdk4/src/gl_texture_builder.rs b/gdk4/src/gl_texture_builder.rs index 4e27386c75ff..18377a71e914 100644 --- a/gdk4/src/gl_texture_builder.rs +++ b/gdk4/src/gl_texture_builder.rs @@ -2,6 +2,8 @@ use glib::{prelude::*, translate::*}; +#[cfg(feature = "v4_16")] +use crate::ColorState; use crate::{ffi, GLContext, GLTextureBuilder, MemoryFormat, Texture}; #[cfg(not(feature = "gl"))] @@ -43,6 +45,21 @@ impl GLTextureBuilder { )) } + #[cfg(feature = "v4_16")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] + #[doc(alias = "gdk_gl_texture_builder_set_color_state")] + #[doc(alias = "color-state")] + pub fn set_color_state(self, color_state: &ColorState) -> Self { + unsafe { + ffi::gdk_gl_texture_builder_set_color_state( + self.to_glib_none().0, + color_state.to_glib_none().0, + ); + } + + self + } + #[doc(alias = "gdk_gl_texture_builder_set_context")] pub fn set_context(self, context: Option<&impl IsA>) -> Self { unsafe { diff --git a/gdk4/src/lib.rs b/gdk4/src/lib.rs index 4ce8a188e219..7dfd4bc2deb0 100644 --- a/gdk4/src/lib.rs +++ b/gdk4/src/lib.rs @@ -78,6 +78,8 @@ mod crossing_event; mod cursor; mod delete_event; mod display; +#[cfg(target_os = "linux")] +#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))] #[cfg(feature = "v4_14")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))] mod dmabuf_texture_builder; @@ -100,6 +102,9 @@ mod grab_broken_event; mod key_event; mod keymap_key; mod keys; +#[cfg(feature = "v4_16")] +#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] +mod memory_texture_builder; mod motion_event; mod pad_event; mod popup_layout; diff --git a/gdk4/src/memory_texture_builder.rs b/gdk4/src/memory_texture_builder.rs new file mode 100644 index 000000000000..85398611dc2f --- /dev/null +++ b/gdk4/src/memory_texture_builder.rs @@ -0,0 +1,124 @@ +// Take a look at the license at the top of the repository in the LICENSE file. + +use crate::{ffi, ColorState, MemoryFormat, MemoryTextureBuilder, Texture}; +use glib::{prelude::*, translate::*}; + +impl MemoryTextureBuilder { + #[doc(alias = "gdk_memory_texture_builder_set_bytes")] + #[doc(alias = "bytes")] + pub fn set_bytes(self, bytes: Option<&glib::Bytes>) -> Self { + unsafe { + ffi::gdk_memory_texture_builder_set_bytes( + self.to_glib_none().0, + bytes.to_glib_none().0, + ); + } + + self + } + + #[doc(alias = "gdk_memory_texture_builder_set_color_state")] + #[doc(alias = "color-state")] + pub fn set_color_state(self, color_state: Option<&ColorState>) -> Self { + unsafe { + ffi::gdk_memory_texture_builder_set_color_state( + self.to_glib_none().0, + color_state.to_glib_none().0, + ); + } + + self + } + + #[doc(alias = "gdk_memory_texture_builder_set_format")] + #[doc(alias = "format")] + pub fn set_format(self, format: MemoryFormat) -> Self { + unsafe { + ffi::gdk_memory_texture_builder_set_format(self.to_glib_none().0, format.into_glib()); + } + + self + } + + #[doc(alias = "gdk_memory_texture_builder_set_height")] + #[doc(alias = "height")] + pub fn set_height(self, height: i32) -> Self { + unsafe { + ffi::gdk_memory_texture_builder_set_height(self.to_glib_none().0, height); + } + + self + } + + #[cfg(feature = "v4_20")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))] + #[doc(alias = "gdk_memory_texture_builder_set_offset")] + pub fn set_offset(self, plane: u32, offset: usize) -> Self { + unsafe { + ffi::gdk_memory_texture_builder_set_offset(self.to_glib_none().0, plane, offset); + } + + self + } + + #[doc(alias = "gdk_memory_texture_builder_set_stride")] + #[doc(alias = "stride")] + pub fn set_stride(self, stride: usize) -> Self { + unsafe { + ffi::gdk_memory_texture_builder_set_stride(self.to_glib_none().0, stride); + } + + self + } + + #[cfg(feature = "v4_20")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))] + #[doc(alias = "gdk_memory_texture_builder_set_stride_for_plane")] + pub fn set_stride_for_plane(self, plane: u32, stride: usize) -> Self { + unsafe { + ffi::gdk_memory_texture_builder_set_stride_for_plane( + self.to_glib_none().0, + plane, + stride, + ); + } + + self + } + + #[doc(alias = "gdk_memory_texture_builder_set_update_region")] + #[doc(alias = "update-region")] + pub fn set_update_region(self, region: Option<&cairo::Region>) -> Self { + unsafe { + ffi::gdk_memory_texture_builder_set_update_region( + self.to_glib_none().0, + mut_override(region.to_glib_none().0), + ); + } + + self + } + + #[doc(alias = "gdk_memory_texture_builder_set_update_texture")] + #[doc(alias = "update-texture")] + pub fn set_update_texture(self, texture: Option<&impl IsA>) -> Self { + unsafe { + ffi::gdk_memory_texture_builder_set_update_texture( + self.to_glib_none().0, + texture.map(|p| p.as_ref()).to_glib_none().0, + ); + } + + self + } + + #[doc(alias = "gdk_memory_texture_builder_set_width")] + #[doc(alias = "width")] + pub fn set_width(self, width: i32) -> Self { + unsafe { + ffi::gdk_memory_texture_builder_set_width(self.to_glib_none().0, width); + } + + self + } +} diff --git a/gdk4/sys/versions.txt b/gdk4/sys/versions.txt index 72da81c41e33..6192019b777d 100644 --- a/gdk4/sys/versions.txt +++ b/gdk4/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 19e8a2f15e0e) +Generated by gir (https://github.com/gtk-rs/gir @ 8a55e4fc8412) from gir-files (https://github.com/gtk-rs/gir-files @ 770dd7bbdcd1) diff --git a/gir b/gir index 19e8a2f15e0e..8a55e4fc8412 160000 --- a/gir +++ b/gir @@ -1 +1 @@ -Subproject commit 19e8a2f15e0eb97563cbee857846b2d57506ec7d +Subproject commit 8a55e4fc8412223937da58eac17ce58b44f60fc8 diff --git a/gsk4/src/auto/versions.txt b/gsk4/src/auto/versions.txt index 72da81c41e33..6192019b777d 100644 --- a/gsk4/src/auto/versions.txt +++ b/gsk4/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 19e8a2f15e0e) +Generated by gir (https://github.com/gtk-rs/gir @ 8a55e4fc8412) from gir-files (https://github.com/gtk-rs/gir-files @ 770dd7bbdcd1) diff --git a/gsk4/sys/versions.txt b/gsk4/sys/versions.txt index 72da81c41e33..6192019b777d 100644 --- a/gsk4/sys/versions.txt +++ b/gsk4/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 19e8a2f15e0e) +Generated by gir (https://github.com/gtk-rs/gir @ 8a55e4fc8412) from gir-files (https://github.com/gtk-rs/gir-files @ 770dd7bbdcd1) diff --git a/gtk4/src/auto/versions.txt b/gtk4/src/auto/versions.txt index 72da81c41e33..6192019b777d 100644 --- a/gtk4/src/auto/versions.txt +++ b/gtk4/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 19e8a2f15e0e) +Generated by gir (https://github.com/gtk-rs/gir @ 8a55e4fc8412) from gir-files (https://github.com/gtk-rs/gir-files @ 770dd7bbdcd1) diff --git a/gtk4/sys/versions.txt b/gtk4/sys/versions.txt index 72da81c41e33..6192019b777d 100644 --- a/gtk4/sys/versions.txt +++ b/gtk4/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 19e8a2f15e0e) +Generated by gir (https://github.com/gtk-rs/gir @ 8a55e4fc8412) from gir-files (https://github.com/gtk-rs/gir-files @ 770dd7bbdcd1)